http://stackoverflow.com/q/21492712
has comment: http://stackoverflow.com/comment/32707060
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
has title: Why am I running into org.codehaus.mojo:exec-maven-plugin:1.2.1:exec error?
answer count: 2
has body: I have the following simple pom.xml. When I run the application it runs into following error, I read many answers for this problem but they did not work out. ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource resource = client.resource("Query Request Goes Here"); List<Output> allOutputs = resource.get(new GenericType<List<Output>>(){}); System.out.println(allOutputs.size()); Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project eBaytest: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. POM.XML 4.0.0 com.mycompany Test 1.0-SNAPSHOT jar eBaytest http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.sun.jersey jersey-client 1.18 jar
possible better answer: http://stackoverflow.com/a/71064647
tagged with: maven
has answer: http://stackoverflow.com/a/71064647
has comment: http://stackoverflow.com/comment/32707180
has comment: http://stackoverflow.com/comment/32450348
has answer: http://stackoverflow.com/a/21648747
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32444983
downvote count: 1
has comment: http://stackoverflow.com/comment/32973240
accepted answer: http://stackoverflow.com/a/21648747
tagged with: jersey

http://stackoverflow.com/comment/32216174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21365046
score: 4
has text: "read it wrong" doesn't give us *any* information. There are all kinds of things wrong here to be honest, such as using the platform-default encoding, assuming that all the strings will be < 256 bytes, encoding the data twice, assuming that a single call to `read(byte[])` will read all the data etc. Consider using `DataOutputStream` instead...

http://stackoverflow.com/comment/32433512
type: QuestionComment
comment on: http://stackoverflow.com/q/21486915
has text: I was being a bit facetious @DavidHofmann. I suspect you are going to have to be running this on a seriously large bit of hardware to make it scale to 1T rows and still be performant.
score: 0
type: Comment

http://stackoverflow.com/comment/32408484
comment on: http://stackoverflow.com/a/21460152
score: 0
type: Comment
has text: Thanks for the response , the issue here is not about wait , its working fine when i run it through a normal firefox driver , but the same is not happening when i try it from a RemoteWebdriver and run tests parallely , so i doubt if there is any timeout issue , or any limitations on the perfomance when i run my selenium tests parallely
type: AnswerComment

http://stackoverflow.com/a/21441012
answers question: http://stackoverflow.com/q/21440908
downvote count: 0
upvote count: 2
has body: First, this kind of micro-optimization isn't really a detail you should concern yourself with. If anything, there are more copious wins in performance in much more involved pieces of your code. This sort of micro-optimization doesn't net you much, and you may sacrifice readability for a negligible performance boost. Your code has no places in which there's a huge performance bottleneck, so I wouldn't expect any major performance wins if you made any micro-optimizations. To your main question, the idea behind the static final variable would be twofold: You avoid magic numbers, thus making your intent clear. Should your value need to change, you can change it in one place as opposed to several places. I would argue that, if other classes aren't making use of it, then it doesn't need to be public. I would still recommend it be a class variable, so it'd have the style of Sample 1, but with the declaration private static final int onlyUsedByMethodFoo = 1;.
type: Answer
score: 2

http://stackoverflow.com/comment/32342758
type: QuestionComment
has text: I don't think there is a way to detect if a process was killed from within the process.
comment on: http://stackoverflow.com/q/21436212
score: 0
type: Comment

http://stackoverflow.com/comment/32366753
type: QuestionComment
comment on: http://stackoverflow.com/q/21448720
type: Comment
has text: You are mixing up `ArrayList` with `Array`, what you want, `Array` can do that for you...
score: 0

http://stackoverflow.com/comment/32244841
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21380290
has text: This won't scale as the number of book names gets larger. A better solution would let the database handle what it's good at. I think a better query, perhaps an indexer, would be far more scalable.
score: 1

http://stackoverflow.com/a/21438042
downvote count: 0
has body: I would instead create a Pair Object hold String name and Integer count. private static final class Pair&lt;K, V&gt; { private final K key; private final V value; private Pair(final K key, final V value) { this.key = key; this.value = value; } @Override public String toString() { return "P: " + key + ", " + value; } } public static void main(final String[] args) { final Stack&lt;Pair&lt;String, Integer&gt;&gt; stack = new Stack&lt;&gt;(); stack.add(new Pair&lt;String, Integer&gt;("Chair", 2)); stack.add(new Pair&lt;String, Integer&gt;("Table", 2)); stack.add(new Pair&lt;String, Integer&gt;("Bed", 44)); Collections.sort(stack, new Comparator&lt;Pair&lt;String, Integer&gt;&gt;() { @Override public int compare(final Pair&lt;String, Integer&gt; o1, final Pair&lt;String, Integer&gt; o2) { return o2.value.compareTo(o1.value); } }); System.out.println(stack); } Which returns: [P: Bed, 44, P: Chair, 2, P: Table, 2] You could iterate through your Stacks to create a Collections of pairs to sort quite easily to: final Stack&lt;Pair&lt;String, Integer&gt;&gt; stack = new Stack&lt;&gt;(); for (int i = 0; i &lt; stringStack.size(); i++) { stack.push(new Pair&lt;String, Integer&gt;(stringStack.get(0), countStack.get(0)); }
answers question: http://stackoverflow.com/q/21437806
has comment: http://stackoverflow.com/comment/32346247
type: Answer
accepted answer of: http://stackoverflow.com/q/21437806
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/32441325
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21491504
has text: The tester class was provided by my professor, he said we couldn't modify it.

http://stackoverflow.com/comment/32466069
comment on: http://stackoverflow.com/q/21505312
type: Comment
type: QuestionComment
has text: i debug it but i cant understand whats wrong with it
score: 0

http://stackoverflow.com/q/21457469
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21457502
tagged with: guava
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21457502
type: Question
has answer: http://stackoverflow.com/a/21457777
answer count: 2
has body: I have a List&lt;String&gt; I need to find whether the particular string exists inside a List or not. for Eg: String str = "apple"; List&lt;String&gt; listObject = Lists.newArrayList("apple", "orange", "banana"); I need to find whether str exists in listObject or not using Google Guava. So I need a true or false result. How can I achieve this?
has comment: http://stackoverflow.com/comment/32380474
accepted answer: http://stackoverflow.com/a/21457777
favorite count: 0
linked to: http://stackoverflow.com/q/1160081
has comment: http://stackoverflow.com/comment/32380104
has title: How can I find an element whether it exists in a List or not using Google Guava?
upvote count: 2
tagged with: collections
downvote count: 1

http://stackoverflow.com/a/21486457
score: 1
has comment: http://stackoverflow.com/comment/32432040
type: Answer
has comment: http://stackoverflow.com/comment/32433699
has comment: http://stackoverflow.com/comment/32434349
has comment: http://stackoverflow.com/comment/32448101
accepted answer of: http://stackoverflow.com/q/21485929
upvote count: 1
answers question: http://stackoverflow.com/q/21485929
has comment: http://stackoverflow.com/comment/32445806
has comment: http://stackoverflow.com/comment/32444940
has comment: http://stackoverflow.com/comment/32445802
has comment: http://stackoverflow.com/comment/32432157
has comment: http://stackoverflow.com/comment/32433128
has body: You need to make sure to set your target fragment for your dialog. to do this add the line before you show the dialog: newFragment.setTargetFragment(ChatRoomFragment.this, REQUEST_CODE); within your showDialog method. Doing so will tell your dialog which fragment is supposed to receive the activity's result. Also, define three constants: public static final int REQUEST_CODE = 0, RESULT_PHOTO = 1, RESULT_VID = 2; Now, within your Dialog, you should be doing something along the lines of: ...setPositiveButton("Photo", new DialogInterface.OnClickListener() { public void onClick(...) { Intent data = new Intent(); getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_PHOTO, data); }}) .setNegativeButton(... getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_VID, data); ... Then in your onActivityResult method, you need to do a check for the request code and result code pairs: if(requestCode == REQUEST_CODE &amp;&amp; resultCode == RESULT_PHOTO) { doPositiveClick(); } ...
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21476137
has answer: http://stackoverflow.com/a/21476757
has title: .DatabaseObjectNotClosedException
tagged with: java
type: Question
answer count: 2
score: 0
tagged with: android
has body: My logcat shows the above error. Yet in all methods in the Databasehelper class, i call close() method for the db object. Here is some code from db helper class. public MyDatabaseAdapter(Context context,String databaseName){ super(context,databaseName,null,1); this.mycontext=context; try{ Log.v("Path",DB_PATH); DB_NAME=databaseName; Log.v("name",DB_NAME); openDataBase(); }catch(Exception e) { Log.e("gezaaako",e.toString()); } } public SQLiteDatabase openDataBase() throws SQLException { String myPath=DB_PATH+DB_NAME; Log.e("CheckPath",myPath); if (myDataBase==null) { try { createdatabase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } myDataBase=SQLiteDatabase.openDatabase(myPath,null,SQLiteDatabase.OPEN_READWRITE); } return myDataBase; } public synchronized void close() { if(myDataBase!=null){ myDataBase.close(); } super.close(); } public long AddMeter(Meters meter){ SQLiteDatabase db=this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(SERIALNUMBER, meter.getSerialNumber().toString()); values.put(METERNUMBER, meter.getMeterNumber().toString()); values.put(DATEADDED, getDateTime()); long meterid=db.insert(TABLE_METERS, null, values); db.close(); return meterid; } In the method AddMeter, i explicitly call close method. Here is a method that uses a cursor public List&lt;TenantMeterID&gt; GetTenantMeterIds() { List&lt;TenantMeterID&gt; meterlist = new ArrayList&lt;TenantMeterID&gt;(); String selectQuery = " SELECT * FROM " +View_Tenant_Meter_id; Log.e("LOG", selectQuery); SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(selectQuery, null); if(c.moveToFirst()){ do{ TenantMeterID t = new TenantMeterID(); t.set_id(Integer.parseInt(c.getString(c.getColumnIndex(KEY_ID)))); t.setFullName(c.getString(c.getColumnIndex(TENANT))); meterlist.add(t); } while(c.moveToNext()); } c.close(); db.close(); return meterlist; } Again, i think, i explicitly close the cursor and db object. Here logcat …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21476793

http://stackoverflow.com/comment/32326282
score: 0
comment on: http://stackoverflow.com/a/21426984
type: Comment
has text: what do you mean by reference ? could you give me an example of it
type: AnswerComment

http://stackoverflow.com/a/22975868
downvote count: 0
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21432626
has body: It is far from straightforward to get an accesstoken for this API. This blog post helped get me started in the right direction, but I've outlined my own process that does not depend on using any external scripts to work. The steps are: Obtain a client ID and secret (one-time) Obtain a Refresh Token (one-time) Use the Refresh Token to obtain an Access Token (once per hour) 4 Use the access token to access the API Each of these steps are detailed below: Obtaining Client ID and Secret Go to the the Google Developer's console Go to your project page Select "Consent Screen" on the left side and make sure that the email address and Product name fields are set Select "Credentials" from the left menu, and select "create a new client id" Leave Application type set to "Web application" and set "Authorized redirect URI" to https://localhost. You do not need to change the Authorized JavaScript Origins. Click "Create Client ID" and record the Client ID and Client secret that result. Obtaining a Refresh Token In web browser, enter the following URL (substituting correct value for client_id): https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&amp;response_type=code&amp;access_type=offline&amp;redirect_uri=https://localhost&amp;client_id=XXXX Accept any requests for authorization that appear You will then be redirected to a URL like this: https://localhost/?code=4/k0TenvwICIgmBoQOazJy4_EnJr6-.clLqtp_vVAIbEnp6UAPFm0GASPqQigI Copy the code from the latter part of this URL Use wget to convert this code into refresh token; substitute CODE, CLIENT_ID, and CLIENT_SECRET wget --debug --post-data="grant_type=authorization_code&amp;code=CODE&amp;client_id=CLIENT_ID&amp;client_secret=CLIENT_SECRET&amp;redirect_uri=https://localhost" https://accounts.google.com/o/oauth2/token The resulting JSON file will contain an access_token and a refresh_token. Record the refresh_token value Obtaining an Access Token send a POST request to https://accounts.goo…

http://stackoverflow.com/comment/32725573
has text: Treating your answer as a hint though I think the merge method will be the key to getting there
comment on: http://stackoverflow.com/a/21477332
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/21514372
has comment: http://stackoverflow.com/comment/32481969
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/32774470
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32482377
has answer: http://stackoverflow.com/a/21646774
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21734523
favorite count: 0
tagged with: console
has comment: http://stackoverflow.com/comment/32482530
has comment: http://stackoverflow.com/comment/32634009
has title: Dynamic JTextArea which wait for user input like Netbeans Console
type: UnansweredQuestion
has body: I am creating an IDE in swing where user can compile and run their java program. Here, output of the user's program will be shown to a JEditorPane. i am using reflection to do so. I have set the input stream to a JTextArea by using System.setIn() and output stream to JEdotorPane by using System.setOut() method. Now, the Problem is that when user run a program which have console input like System.in.read(); it do't wait for user input, from JEditorPane. It just run the program and read whole data from JTextArea. and further process other line of code. Now, i want that the program output should wait for the user input and when user provide input in JTextArea and hit enter, then further processing of inputted text is done. Another Way: via CMD Actually, its little bit complicated to make an JTextPane as dynamic windows... and i have to do some more research on this particular topic... So for now, i just did some changes in the way of showing Output. i am creating a separate Process by using Runtime class and execute that process in Command Prompt(CMD). So, when the program generates an output. it shown on the command prompt... like many IDEs supports this mechanism... for example... Code Block. for now, Its working fine...
has comment: http://stackoverflow.com/comment/32482628
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/21734291
tagged with: stream

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/21431658
tags question: http://stackoverflow.com/q/21427762
tags question: http://stackoverflow.com/q/21504141
tags question: http://stackoverflow.com/q/21377253
tags question: http://stackoverflow.com/q/21456741
tags question: http://stackoverflow.com/q/21423655
tags question: http://stackoverflow.com/q/21376247
tags question: http://stackoverflow.com/q/21432660
tags question: http://stackoverflow.com/q/21503426
tags question: http://stackoverflow.com/q/21450111
tags question: http://stackoverflow.com/q/21380382
tags question: http://stackoverflow.com/q/21401573
tag name: jfreechart
tags question: http://stackoverflow.com/q/21502979

http://stackoverflow.com/q/21429436
favorite count: 0
tagged with: service
has body: In my androidManifest my mainActivity have few system intent filter. is there any way to detect which intent filter opened my activity? same goes to android service - is there a way to detect? I know a broadcast has a ctor with intent and there I can analyze which intent woke it up.
answer count: 2
has answer: http://stackoverflow.com/a/21429787
downvote count: 1
has answer: http://stackoverflow.com/a/21429616
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21429787
possible better answer: http://stackoverflow.com/a/21429616
score: 2
has title: can an android service or activity know which intent opened it?
type: Question
type: AnsweredQuestion
tagged with: android

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

http://stackoverflow.com/q/21457436
accepted answer: http://stackoverflow.com/a/21458105
has title: progress dialog in for into a thread
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32381045
type: Question
answer count: 1
has body: I have a problem, I have a for loop and a ProgressDialog and would like to see something like (10/5) where 10 is the total items to be processed by and for the 5 elements are currently being developed. I have this code. new Thread(new Runnable() { public void run() { for(int i=0; i&lt;adapter.getTotalItems().size(); i++) { try { index = i; progressDialog = ProgressDialog.show(MyClass.this,adapter.getTotalItems().size()+"/"+index, ); MyClass.this.runOnUiThread(new Runnable() { public void run() { progressDialog.cancel(); } }); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { Thread.sleep(1*2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } MyClass.this.runOnUiThread(new Runnable() { public void run() { progressDialog.dismiss(); } }); } }).start();
has comment: http://stackoverflow.com/comment/32380134
score: 0
has answer: http://stackoverflow.com/a/21458105
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32385044

http://stackoverflow.com/comment/32272223
comment on: http://stackoverflow.com/q/21395596
type: QuestionComment
type: Comment
score: 1
has text: @pcnThird reminds me of the story about the physicist who had to calculate the height of a tower depending on some given values - he simply asked the concierge as the board of professors didn't specify anything in particular and after all the profs where asking what he is doing he came up with >8 other solutions he could have calculated the height. There are multiple ways of achieving your goals - as long as you can explain your intend and fall back to other strategies, why not?

http://stackoverflow.com/q/21410828
tagged with: java-ee-6
downvote count: 0
answer count: 1
has title: Is it safe to inject @Resource UserTransaction to EJB Singleton bean
favorite count: 0
has body: Q1: I am writing an EJB Singleton bean that use BMT so I need to use UserTransaction in my bean. I was wondering that IS IT SAFE to inject @Resource UserTransaction to my EJB singleton bean. I don't know whether container will inject a Proxy of UserTransaction or NOT. Can someone give me some ideas? Thank you! Q2: What are difference between @Resource UserTransaction and sessionContext.getUserTransaction(). Are they equivalent?
type: UnansweredQuestion
score: 5
tagged with: transactions
tagged with: java
tagged with: java-ee-7
type: Question
has answer: http://stackoverflow.com/a/21419081
tagged with: ejb
upvote count: 5

http://stackoverflow.com/comment/32458659
type: QuestionComment
comment on: http://stackoverflow.com/q/21499249
has text: 404 on "/" - do you have a controller(method) mapped to "/"?
score: 1
type: Comment

http://stackoverflow.com/q/21360950
has comment: http://stackoverflow.com/comment/32209066
tagged with: java
type: Question
has title: Read values from an Excel File using Apache POI API
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21361030
accepted answer: http://stackoverflow.com/a/21361030
has body: I am using a program to read values from an excel file and then return the read values. I have tried using an iterator as well as a for loop but the program does not return all the values in the worksheet. Please suggest. import java.io.FileInputStream; import java.util.ArrayList; import java.util.Iterator; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellValue; import java.io.File; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelReading { public static STring ReadExcel(String Path){ String FakeReturn = null; try { FileInputStream file = new FileInputStream(new File(Path)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); for(Row row:sheet) { Cell cell=row.getCell(0); Cell testcell = row.getCell(1); if(cell.getStringCellValue()!=null) return testcell.getStringCellValue(); else break; } file.close(); } catch (Exception e) { System.out.println("The code carries an exception"); e.printStackTrace(); return FakeReturn; } return FakeReturn; } }
tagged with: apache-poi
type: AnsweredQuestion

java
tags question: http://stackoverflow.com/q/21496101
tags question: http://stackoverflow.com/q/21462396
tags question: http://stackoverflow.com/q/21454825
tags question: http://stackoverflow.com/q/21393130
tags question: http://stackoverflow.com/q/21456076
tags question: http://stackoverflow.com/q/21461049
tags question: http://stackoverflow.com/q/21447959
tags question: http://stackoverflow.com/q/21471290
tags question: http://stackoverflow.com/q/21489286
tags question: http://stackoverflow.com/q/21357638
tags question: http://stackoverflow.com/q/21402088
tags question: http://stackoverflow.com/q/21442914
tags question: http://stackoverflow.com/q/21395148
tags question: http://stackoverflow.com/q/21444305
tags question: http://stackoverflow.com/q/21480694
tags question: http://stackoverflow.com/q/21490246
tags question: http://stackoverflow.com/q/21374608
tags question: http://stackoverflow.com/q/21512449
tags question: http://stackoverflow.com/q/21355977
tags question: http://stackoverflow.com/q/21364798
tags question: http://stackoverflow.com/q/21423250
tags question: http://stackoverflow.com/q/21425012
tags question: http://stackoverflow.com/q/21502642
tags question: http://stackoverflow.com/q/21359312
tags question: http://stackoverflow.com/q/21410330
tags question: http://stackoverflow.com/q/21380501
tags question: http://stackoverflow.com/q/21401852
tags question: http://stackoverflow.com/q/21434031
tags question: http://stackoverflow.com/q/21411274
tags question: http://stackoverflow.com/q/21426128
tags question: http://stackoverflow.com/q/21480748
tags question: http://stackoverflow.com/q/21370075
tags question: http://stackoverflow.com/q/21386941
tags question: http://stackoverflow.com/q/21361650
tags question: http://stackoverflow.com/q/21378609
tags question: http://stackoverflow.com/q/21475590
tags question: http://stackoverflow.com/q/21378623
tags question: http://stackoverflow.com/q/21514008
tags question: http://stackoverflow.com/q/21420497
tags question: http://stackoverflow.com/q/21470696
tags question: http://stackoverflow.com/q/21490123
tags question: http://stackoverflow.com/q/21508212
tags question: http://stackoverflow.com/q/21352756
tags question: http://stackoverflow.com/q/21391442
tags question: http://stackoverflow.com/q/21378362
tags question: http://stackoverflow.com/q/21360259
tags question: http://stackoverflow.com/q/21371721
tags question: http://stackoverflow.com/q/21509536
tags question: http://stackoverflow.com/q/21501621
tags question: http://stackoverflow.com/q/21465413
tags question: http://stackoverflow.com/q/21388466
tags question: http://stackoverflow.com/q/21478106
tags question: http://stackoverflow.com/q/21424908
tags question: http://stackoverflow.com/q/21463765
tags question: http://stackoverflow.com/q/21462332
tags question: http://stackoverflow.com/q/21410243
tags question: http://stackoverflow.com/q/21355422
tags question: http://stackoverflow.com/q/21512809
tags question: http://stackoverflow.com/q/21491920
tags question: http://stackoverflow.com/q/21352740
tags question: http://stackoverflow.com/q/21383446
tags question: http://stackoverflow.com/q/21366491
tags question: http://stackoverflow.com/q/21464823
tags question: http://stackoverflow.com/q/21476117
tags question: http://stackoverflow.com/q/21429770
tags question: http://stackoverflow.com/q/21500781
tags question: http://stackoverflow.com/q/21361737
tags question: http://stackoverflow.com/q/21418515
tags question: http://stackoverflow.com/q/21485150
tags question: http://stackoverflow.com/q/21464840
tags question: http://stackoverflow.com/q/21499944
tags question: http://stackoverflow.com/q/21456071
tags question: http://stackoverflow.com/q/21447862
tags question: http://stackoverflow.com/q/21425668
tags question: http://stackoverflow.com/q/21383967
tags question: http://stackoverflow.com/q/21453071
tags question: http://stackoverflow.com/q/21500771
tags question: http://stackoverflow.com/q/21376640
tags question: http://stackoverflow.com/q/21501988
tags question: http://stackoverflow.com/q/21408643

http://stackoverflow.com/comment/32351083
comment on: http://stackoverflow.com/q/21430665
type: QuestionComment
score: 0
has text: Do note that you can have multiple transaction managers to which you refer to in the @Transactional declaration (the value attribute).
type: Comment

http://stackoverflow.com/comment/32449051
type: QuestionComment
has text: check this if it helps http://stackoverflow.com/questions/17079579/aes-algo-decryption-issue and this http://android-developers.blogspot.in/2013/02/security-enhancements-in-jelly-bean.html
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21495944

http://stackoverflow.com/comment/32399404
score: 0
comment on: http://stackoverflow.com/q/21467708
has text: Java != javascript ;) I removed the tag but wanted to make sure you understood that
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21425668
has title: Start Chrome browser in webdriver
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21426277
has answer: http://stackoverflow.com/a/21426277
favorite count: 0
has answer: http://stackoverflow.com/a/21429337
has body: Sorry for stupid question, but how to start Chrome browser in webdriver? I know that I have to specify the path to chromedriver.exe. Problem is I unable to download chromedriver.exe it is depricated. Also files that I found doesn't have .exe extension. I am using eclipse, Java. Please help! I did everything step by step as suggested but its doesn't work. Here is my code: import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public class chrome { @Test public void test(){ System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32(2)\\chromedriver"); ChromeDriver driver = new ChromeDriver(); driver.get("http:\\yahoo.com"); } } And here is the error: FAILED: test java.lang.IllegalStateException: The driver executable does not exist: C:\chromedriver_win32(2)\chromedriver
score: 2
tagged with: selenium-chromedriver
has comment: http://stackoverflow.com/comment/32324073
upvote count: 2
tagged with: selenium
accepted answer: http://stackoverflow.com/a/21429337
type: AnsweredQuestion

http://stackoverflow.com/comment/32205516
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21358838
has text: @Pshemo Why did you delete your comment? It seems like the only way.

http://stackoverflow.com/q/21397090
has comment: http://stackoverflow.com/comment/32276089
tagged with: bufferedwriter
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32276453
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32275033
has comment: http://stackoverflow.com/comment/32275144
tagged with: stringbuffer
tagged with: java-io
has comment: http://stackoverflow.com/comment/32276171
has answer: http://stackoverflow.com/a/21397433
has comment: http://stackoverflow.com/comment/32274832
answer count: 2
has title: CSV file generated from Java adds unwanted question mark (?)
has comment: http://stackoverflow.com/comment/32276638
has comment: http://stackoverflow.com/comment/32276961
has answer: http://stackoverflow.com/a/21398024
downvote count: 0
has comment: http://stackoverflow.com/comment/32274905
favorite count: 0
has body: I am creating a CSV file from Java code. (I also generated HTML and txt files with the same. The problem remains the same.) The code is as below. private String writeToFile(StringBuffer csvData, long randomDigits, String type) { String fileName = ""; String filePath = ""; if ("CSV".equals(type)) { filePath = WebConstants.PATH + randomDigits + "CSV.csv"; fileName = randomDigits + "CSV.csv"; } try { BufferedWriter bw = new BufferedWriter(new FileWriter(filePath)); bw.write(csvData.toString()); bw.flush(); bw.close(); } catch (Exception ex) { ex.printStackTrace(); } return fileName; } Now, when the file is generated, all data looks correct. But at the end of file, there is a question mark (?) which is unwanted. I debugged the code, when the bw.write(csvData.toString()) is called, the value of csvData does not contain the question mark at the end. This is how I am creating the StringBuffer csvData private StringBuffer saveAsCVSFile(Vector&lt;XYZVO&gt; list) { StringBuffer csvData = new StringBuffer(); XYZVO VO = null; if (list != null) { for (int i = 0; i &lt; list.size(); i++) { VO = list.get(i); csvData.append(VO.getABC()+","); csvData.append(VO.getDEF()+","); csvData.append(VO.getGHI()+","); csvData.append(VO.getJKL()+","); csvData.append(VO.getMNO()+"\n"); } } return csvData; } Here, XYZVO contains all String or int variables. I also added a code to read the generated file it is as below. private void checkFileData(String filePath) { try { BufferedReader br = new BufferedReader(new FileReader(filePath)); String line = null; while((line = br.readLine()) != null) { System.out.println("Line X: "+line); } } catch(FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } When I check the output of this read code in console, it simply doesn't show the question mark at the end. If some one has any idea, please inform.
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/32275100
has comment: http://stackoverflow.com/comment/32274782

http://stackoverflow.com/a/21411611
has comment: http://stackoverflow.com/comment/32337152
has body: If there is no other way on doing this, I will do it with this work-around (with different bean-classes than in the first posting). But I don't really like it. public static FeatureValueRepository featureValueRepository; private static final Lock featureValueRepositoryLock = new ReentrantLock(); private static FeatureValueRepository getFeatureValueRepository() { featureValueRepositoryLock.lock(); try { if (featureValueRepository == null) { //ContextProvider is a custom class in our project featureValueRepository = ContextProvider.getContext().getBean( FeatureValueRepository.class); } return featureValueRepository; } finally { featureValueRepositoryLock.unlock(); } } And then call a method that queries by the root-bean's id.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21408565

http://stackoverflow.com/comment/32454036
type: QuestionComment
comment on: http://stackoverflow.com/q/21498756
score: 3
has text: I would consider Observer/Observable as old, bad designed classes, and use PropertyChangeListener instead.
type: Comment

http://stackoverflow.com/q/21445425
accepted answer: http://stackoverflow.com/a/21445640
possible better answer: http://stackoverflow.com/a/21445797
has comment: http://stackoverflow.com/comment/32359826
has comment: http://stackoverflow.com/comment/32360380
answer count: 4
type: AnsweredQuestion
score: 2
has title: Printing out the least occurring elements in an array
upvote count: 2
has answer: http://stackoverflow.com/a/21445640
tagged with: java
has comment: http://stackoverflow.com/comment/32359891
type: Question
has comment: http://stackoverflow.com/comment/32359842
tagged with: arrays
has answer: http://stackoverflow.com/a/21445797
has answer: http://stackoverflow.com/a/21445853
downvote count: 0
has body: OK, so I found this question from a few days ago but it's on hold and it won't let me post anything on it. ***Note: The values or order in the array are completely random. They should also be able to be negative. Someone recommended this code and was thumbed up for it, but I don't see how this can solve the problem. If one of the least occurring elements isn't at the BEGINNING of the array then this does not work. This is because the maxCount will be equal to array.length and the results array will ALWAYS take the first element in the code written below. What ways are there to combat this, using simple java such as below? No hash-maps and whatnot. I've been thinking about it for a while but can't really come up with anything. Maybe using a double array to store the count of a certain number? How would you solve this? Any guidance? public static void main(String[] args) { int[] array = { 1, 2, 3, 3, 2, 2, 4, 4, 5, 4 }; int count = 0; int maxCount = 10; int[] results = new int[array.length]; int k = 0; // To keep index in 'results' // Initializing 'results', so when printing, elements that -1 are not part of the result // If your array also contains negative numbers, change '-1' to another more appropriate for (int i = 0; i &lt; results.length; i++) { results[i] = -1; } for (int i = 0; i &lt; array.length; i++) { for (int j = 0; j &lt; array.length; j++) { if (array[j] == array[i]) { count++; } } if (count &lt;= maxCount) { // &lt;= so it admits number with the SAME number of occurrences maxCount = count; results[k++] = array[i]; // Add to 'results' and increase counter 'k' } count = 0; // Reset 'count' } // Printing result for (int i : results) { if (i != -1) { System.out.println("Element: " + i + ", Number of occurences: " + maxCount); } } } credit to: https://stackoverflow.com/users/2670792/christian for the code I can't thumbs up so I'd just like to say here THANKS EVERYONE WHO ANSWERED.
favorite count: 0
has answer: http://stackoverflow.com/a/21466467

http://stackoverflow.com/comment/32230327
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21372581
type: Comment
has text: What if you flush the output (`pw.flush();`) after each time you write?

http://stackoverflow.com/a/21408629
has body: I guess that you want to add some details to A instance with inheriting B and C class from A class. I recommand you to read documentation about inheritance and discriminator value/column. On the documentation of hibernate you will see how to - use the concept of inheritance and TABLE_PER_CLASS strategy - and describe the descriminator column (your type column) Edit : but i recommand you to use another strategy like SINGLE_TABLE_PER_CLASS. Note that a JPA provider don't have to support the TABLE_PER_CLASS strategy, and also, this particular startegy have consequences on performance. *Second Edit : * Ok : i would suggest you to use polymorphism for B and C class because they use something in common => the link whith the base class A ! You could have : Class A * Member list of DetailsItf and DetailItf (interface) | AbstractDetail (SINGLE_TABLE_PER_CLASS strategy with discriminator colum ou TABLE_PER_CLASS) implements DetailItf | |-B inherits from Details |-C inherits from Details Then you have to use an AbstractDetail class in your base A class like : @LazyCollection(LazyCollectionOption.FALSE) @OneToMany( targetEntity=foo.pck.AbstractDetail.class ) private List&lt;DetailsItf&gt; details = new ArrayList&lt;DetailItf&gt;(); And on usage, you should make a B myB = new B(); // saving myB entity A myA = new A(); myA.addDetails(myB); // saving myA You should also do specific queriez basing you on TYPE() JPQL specific keywords or, on using FROM CLASS in jpql but you have to create a proof of concept and validate performances.
score: 2
accepted answer of: http://stackoverflow.com/q/21408218
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21408218
upvote count: 2
type: Answer

http://stackoverflow.com/q/21424573
type: UnansweredQuestion
has title: SocketChannel not receiving data with Applet
has answer: http://stackoverflow.com/a/21424899
tagged with: java
type: Question
tagged with: applet
score: 0
answer count: 1
has body: I have this code which when i call from a standalone java application,it works well in that i can connect to the server send and receive data from the server successfully. But when i use the same code in an applet,I can connect and send data but cannot receive data and am not getting any error message on either the server or the client. They are both connecting to the same server application hence am eliminating issues with the server. i have granted all permissions to the Applet Your help will be highly appreciated Main Application Code public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { List&lt;String&gt; bb=new ArrayList&lt;String&gt;(); bb.add("Customer"); bb.add("ID"); byte [] serialized=ECSStreamUtil.serializeObject(bb); ByteBuffer toSend=ByteBuffer.allocate(serialized.length); toSend.put(serialized); toSend.flip(); JavaApplication1.write(toSend); toSend.clear(); } catch(Exception ex) { ex.printStackTrace(); } } public static void main(String args[]) throws Exception{ /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); new JavaApplication1(); JavaApplication1 code package javaapplication1; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; public class JavaApplication1 { static int x; private static SocketChannel client ; public JavaApplication1()throws Exception { client = SocketChannel.open(); // nonblocking I/O client.configureBlocking(false); // Connection to host port 4444 client.connect(new java.net.InetSocketAddress("localhost",4444)); // Create selector Selector selector = Selector.open(); // Record to selector (OP_CONNECT type) SelectionKey clientKey = client.register(selector, SelectionKey.OP_CONNECT); // Waiting for the connection while (true) { if(selector…

http://stackoverflow.com/a/26187120
answers question: http://stackoverflow.com/q/21457007
score: 0
type: Answer
has body: You can do is as two set of doubly nested loops, first do the bottom left triangle and the diagonal. Then the top right triangle. You can see this running as a fiddle http://jsfiddle.net/SalixAlba/76zdLbp7/. var size=5; var x=0; var y=0; // Set up data array, store the index of the point var data = new Array(size); for(var i=0;i&lt;size;++i) { data[i]=new Array(size); } var pos=1; // Bottom right triangle for(var i=0;i&lt;size;++i) { // should be size for(var j=0;j&lt;=i;++j) { x = size - i + j - 1; y = size - j - 1; data[y][x] = pos; console.log(i,j,x,y); ++pos; } } // Top left triangle for(var i=0;i&lt;size-1;++i) { for(var j=0;j&lt;size-1-i;++j) { x = j; y = size - i - j - 2; data[y][x] = pos; console.log(i,j,x,y); ++pos; } } var res=""; for(var i=0;i&lt;size;++i) { res = res + data[i].toString() + "\n"; } $("textarea#output").val(res);

http://stackoverflow.com/comment/32401440
has text: When I tried it, I didn't get an exception (but it just printed out `first middle last`).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21468625

http://stackoverflow.com/q/21479814
tagged with: manifest
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I am trying to get rid of the "block applet" warning message while loading external resources from a signed applet (mixing code). If I leave the applet like it is right now, it displays the warning message, and clicking "no block" makes the applet work properly. On the other hand, If I just modify the applet to add the "Trusted-library: true" attribute to the manifest file in order to accept non-signed external resources, it makes the applet crash. Debugging the applet, I've found that it crashes while running the following line: ResourceBundle bundle = ResourceBundle.getBundle("conf/basic","en_EN"); The exception thrown is: java.util.MissingResourceException: Can't find bundle for base name conf/basic, locale en_EN I have checked that conf folder with file basic_en_EN.properties is present at the same level that the applet jar (otherwhise it would not work even without trusted-library) Reading Java 7 doc it says that adding trusted-library should fix the mixing signed/unsigned code problem, but it doesn't. Furthermore, in Java 7 doc it doesn't say anything about ResourceBundle.getBundle() method issues, but it does in Java 6 doc: Code in a jar file that is to be marked with the Trusted-Library manifest attribute may need to be modified slightly if it uses calls that are class loader dependent, such as the single parameter version of Class.forName(), Class.getResource(), and Class.getResourceAsStream(), some variants of java.util.ResourceBundle.getBundle(), and any other methods which operate relative to their immediate caller's defining loader. Changes only need to be made if the requested class or resource might be found in a jar file which is not a Trusted-Library (and is therefore loaded by the normal Web Start or applet class loader). Even I'm working with Java 7, I've found this post where they explain a method to replace getBundle() in Java 6. I've tried it without any result. My Manifest file is: Manifest-Version: 1.0 Created-By: Company Main-Class: src.appl…
answer count: 0
tagged with: java
upvote count: 1
has title: Java Manifest Trusted-library and ResourceBundle.getBundle()
type: UnansweredQuestion

http://stackoverflow.com/comment/113417448
score: 0
has text: JCodec 2.6.0 is not able to start reading from the middle of a stream. I believe it works great when you load a file but when you feed it packets it doesn't work out of the box. I have made modifications so it parses the NALUs accordingly. But there is more work needed to take care of SPS/PPS units.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21437410

http://stackoverflow.com/a/21373907
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21373842
score: 0
answers question: http://stackoverflow.com/q/21373842
type: Answer
has comment: http://stackoverflow.com/comment/32233507
has body: Trying to stay close to the spirit of your code (not necessarily the most efficient way of doing things): You need to split on "nothing" - i.e. String[] temp = result.split(""); Updated code based on updated question: String result; Integer sum = 123; int[] resultArray = new int[32]; Integer ii; result = Integer.toBinaryString(sum); String[] temp = result.split(""); ii = 0; for(String s: temp) { try { resultArray[ii++] = Integer.parseInt(s); } catch (NumberFormatException e) { // do nothing } } int n = ii; for (ii = 0; ii &lt; n; ii++) { System.out.print(resultArray[ii]); } System.out.println(); Output: 01111011 I limited the size of the array to 32 - typical for an int… If you expect that sum may be a longer type, you need to adjust accordingly. Incidentally, it would be faster to use string[] temp = result.toCharArray(); ii = 0; for(char s: temp) { resultArray[ii++] = s - '0'; } int n = ii; for (ii = 0; ii &lt; n; ii++) { System.out.print(resultArray[ii]); } since you know that result is purely numerical.
has comment: http://stackoverflow.com/comment/32232556
has comment: http://stackoverflow.com/comment/32232707

http://stackoverflow.com/a/21501518
has body: Here's an example you can run. I used a Map as you were trying to do. There may be a lot of code, but what your interested in is this Map&lt;String, JTextField&gt; fields; .... JTextField field = new JTextField(15); fields.put(fieldName, field); .... public class ButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); String fieldName = button.getText(); JTextField field = fields.get(fieldName); System.out.println(field.getText()); } } I just put the JTextField in a Map. When I want to access it, I just use JTextField field = fields.get("textfield name"); In the example below, just type in something to the field, then click the button next to it. You will see that the button has the same name as the text field key in the map, so I just use that to print the value in the text field import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class Test2 { Map&lt;String, JTextField&gt; fields; Map&lt;String, JLabel&gt; labels; public Test2() { fields = new HashMap&lt;&gt;(); labels = new HashMap&lt;&gt;(); JPanel mainPanel = new JPanel(new GridLayout(10, 1)); for (int i = 1; i &lt;= 10; i++) { JPanel panel = createPanel("Text Field " + i); mainPanel.add(panel); } JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(mainPanel); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { new Test2(); } }); } private JPanel createPanel(String fieldName) { JPanel panel = new JPanel(); JTextField field = new JTextField(15); field.…
answers question: http://stackoverflow.com/q/21501142
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32459107
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32459176
has comment: http://stackoverflow.com/comment/32459144
has comment: http://stackoverflow.com/comment/32459036

http://stackoverflow.com/q/21437177
has title: In the given code, there is no definition of getArea. But there are no errors? How?
type: Question
has comment: http://stackoverflow.com/comment/32344295
has answer: http://stackoverflow.com/a/21437381
score: -2
has comment: http://stackoverflow.com/comment/32344258
answer count: 3
has comment: http://stackoverflow.com/comment/32344323
favorite count: 0
has answer: http://stackoverflow.com/a/21437232
has comment: http://stackoverflow.com/comment/32344351
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/52240785
upvote count: 0
has body: In the given code, the programmer hasn't defined the methods like getArea and nowhere is mentioned which parameter in brackets is "width" and which is "height". I am new to Java. Please help me understand the code. Thats the code taken from http://docs.oracle.com/javase/tutorial/java/javaOO/objects.html public class CreateObjectDemo { public static void main(String[] args) { // Declare and create a point object and two rectangle objects. Point originOne = new Point(23, 94); Rectangle rectOne = new Rectangle(originOne, 100, 200); Rectangle rectTwo = new Rectangle(50, 100); // display rectOne's width, height, and area System.out.println("Width of rectOne: " + rectOne.width); System.out.println("Height of rectOne: " + rectOne.height); System.out.println("Area of rectOne: " + rectOne.getArea()); // set rectTwo's position rectTwo.origin = originOne; // display rectTwo's position System.out.println("X Position of rectTwo: " + rectTwo.origin.x); System.out.println("Y Position of rectTwo: " + rectTwo.origin.y); // move rectTwo and display its new position rectTwo.move(40, 72); System.out.println("X Position of rectTwo: " + rectTwo.origin.x); System.out.println("Y Position of rectTwo: " + rectTwo.origin.y); } } This program creates, manipulates, and displays information about various objects. Here's the output: Width of rectOne: 100 Height of rectOne: 200 Area of rectOne: 20000 X Position of rectTwo: 23 Y Position of rectTwo: 94 X Position of rectTwo: 40 Y Position of rectTwo: 72
tagged with: java

http://stackoverflow.com/q/21397731
tagged with: swing
has body: I am testing table model and render. But I faced some problem in adjusting column width, I can't adjust column width as it's content text. I used JWindow and hide JFrame .I want to adjust column width of this table as I like........ but I can't though I used this code....... for(int i=0;i&lt;header.length;i++){ TableColumn col=table.getColumnModel().getColumn(i); if(i==0) col.setWidth(106); if(i==1) col.setWidth(157); if(i==2) col.setWidth(103); if(i==3) col.setWidth(103); } this is my whole code ....check this...pls........... import java.awt.AWTEvent; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.AWTEventListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.sql.SQLException; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JWindow; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import com.mysql.jdbc.ResultSet; import com.mysql.jdbc.Statement; public class ReportDamage extends JPanel { /** * */ private static final long serialVersionUID = 1L; private static JFrame f = new JFrame(); private static JTable table = new JTable(); private String[] header = { "Damage_Id", "Supplier_Stock_Id", "Quantity", "Date" }; private String[][] data = null; private DefaultTableModel table_model = new TableModel(); private static JLabel move; private JScrollPane scroll = new JScrollPane(table); private static JButton ok = new JButton("OK"); p…
type: Question
tagged with: java
has title: Can't adjust column width in swing
has comment: http://stackoverflow.com/comment/32275745
tagged with: jtable
tagged with: preferredsize
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32276848
answer count: 0
score: 0
tagged with: jtableheader

http://stackoverflow.com/q/21450814
score: 3
has body: There is the following code: getActionBar().setIcon(R.drawable.basket); Now I want to set listener for clicking by this icon. Is it possible? Thanks in advance!
possible better answer: http://stackoverflow.com/a/21451409
answer count: 2
has answer: http://stackoverflow.com/a/21451409
downvote count: 0
favorite count: 0
tagged with: android
has title: How to add click's listener for app's icon on ActionBar in Android?
accepted answer: http://stackoverflow.com/a/21450915
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21450915

http://stackoverflow.com/q/21505068
tagged with: java
has answer: http://stackoverflow.com/a/21505161
linked to: http://stackoverflow.com/q/21431114
type: Question
has comment: http://stackoverflow.com/comment/32465495
answer count: 2
duplicate of: http://stackoverflow.com/q/21431114
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21505077
has body: I have an array storing a series of numbers as follows: static final int CodeArray[] ={ 11, 011, 0011, 1011, 00011, 10011, 01011, 000011, 100011, 010011, ... } However when I access the values(using a for loop), it returns the following: 11 9 9 1011 9 10011 521 9 100011 4105 Why is there a difference in the values being printed from the ones stored?
linked to: http://stackoverflow.com/q/7971074
score: 0
tagged with: printing
has comment: http://stackoverflow.com/comment/32465838
has answer: http://stackoverflow.com/a/21505077
type: AnsweredQuestion
has title: Why is the output of this array different from the values stored in it?
possible better answer: http://stackoverflow.com/a/21505161

http://stackoverflow.com/comment/32203358
comment on: http://stackoverflow.com/q/21357608
score: 2
type: Comment
has text: 35 bytes is the default max for infrequent methods, if you call the methods often enough, much larger methods can be inlined (the default for frequent methods is JVM dependant). You can always increase this number to see it it improves your code's performance.
type: QuestionComment

http://stackoverflow.com/q/21507995
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: Integrating Java Applet in Grails
has body: So i have a working Grails application and as a part of it there is this Java applet. Currently these two parts live in two subversion directories (i.e. currently in the same repo, but two different top-level directories) and the applet is manually built and signed (this is an ant build). The resulting JAR File is then, again manually, copied to the apropriate directory in the grails source tree. This is then correctly included during the builing of the grails WAR file. So far, things work, but i would like to consolidate the sources and maybe even integrate the two build processes. Thinking about this here is my proposed course of action: Include applet source in grails project structure (I dont want the sources getting pulled into the war file) Construct a Build to compile, package, sign and move the applet to the target before the grails application is built in our CI environment. This can be done with multiple stage build in bamboo, somehow i guess.. So my question is: where do i put things (like DB scripts, documentation or this applet) in the grails souce tree that i dont want to be included in the war file being built? I know i can manipulate / confgure the staging phase, but is there some default way to do this?
score: 1
tagged with: java
tagged with: grails
type: Question
upvote count: 1
tagged with: applet
favorite count: 0

http://stackoverflow.com/comment/32253837
type: AnswerComment
comment on: http://stackoverflow.com/a/21385616
score: 0
type: Comment
has text: That's neat. Can you also include the import statement into your answer?

http://stackoverflow.com/q/21418275
answer count: 1
has comment: http://stackoverflow.com/comment/32311810
has comment: http://stackoverflow.com/comment/32311580
has body: Using Vaadin 7 I've created a simple login form that passes the username and password to a class that manages the database connection to an Oracle system. That class then logs in and creates a session. The following credentials work: Username: User1 Password: Password1 These credentials throw errors: Username: user1@email.com Password: Password1 Both are valid users in the database. I've confirmed this by using the above credentials in the Oracle SQL Developer. My suspicion is that the JDBC driver doesn't like either the '@' or the '.' in the username. Is there a way to escape either character so the JDBC driver ignores it in the connect string? Stack Trace: Jan 28, 2014 5:07:48 PM oracle.jdbc.driver.OracleDriver registerMBeans SEVERE: Error while registering Oracle JDBC Diagnosability MBean. javax.management.MalformedObjectNameException: Invalid character ' ' in value part of property at javax.management.ObjectName.construct(Unknown Source) at javax.management.ObjectName.&lt;init&gt;(Unknown Source) at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:303) at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213) at java.security.AccessController.doPrivileged(Native Method) at oracle.jdbc.driver.OracleDriver.&lt;clinit&gt;(OracleDriver.java:209) at oracle.jdbc.pool.OracleDataSource.&lt;clinit&gt;(OracleDataSource.java:94) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.feith.core.Host.getUserConnection(Host.java:82) at com.feith.core.FddSession.&lt;init&gt;(FddSession.java:96) at com.feith.userregistration.DatabaseSessionController.DBConnect(DatabaseSessionController.java:123) at com.feith.userregistration.DatabaseSessionController.&lt;init&gt;(DatabaseSessionController.java:59) at com.feith.userregistration.UserLogin.login(UserLogin.java:158) at com.feith.userregistration.UserLogin$1.buttonClick(UserLogin.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMe…
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc
tagged with: java
has comment: http://stackoverflow.com/comment/32311936
type: Question
has title: JDBC Oracle Driver Has Issue With Usernames Containing Special Characters
has answer: http://stackoverflow.com/a/21418541
score: 0

http://stackoverflow.com/a/21369311
accepted answer of: http://stackoverflow.com/q/21369253
has body: Drop the else part of if else and make all of them ifs . Only one of those if elses can be executed. What happens if pixel is the most down and most left pixel? It will be only used as the most bottom one, as the if-else statement won't get to the col part. I suggest you change it to if (row &lt; lines[TOP]) { lines[TOP] = row; } if (row &gt; lines[BOTTOM]) { lines[BOTTOM] = row; } if (col &lt; lines[LEFT]) { lines[LEFT] = col; } if (col &gt; lines[RIGHT]) { lines[RIGHT] = col; } And no, you can't group left border with right border, as they can be on the same pixel.
answers question: http://stackoverflow.com/q/21369253
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21370576
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32260373
favorite count: 0
has title: Admob Crashing immediately
tagged with: android
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21395364
score: 1
tagged with: java
tagged with: admob
type: Question
has body: I'm trying to put admob on my newly created app. I'm doing it with XML. Here's my XML: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/back1" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" ads:adUnitId="ca-app-pub-4994556056318402/2453336176" ads:adSize="BANNER" ads:loadAdOnCreate="true"/&gt; And here's the java super.onCreate(savedInstanceState); AdView adView = (AdView)findViewById(R.id.adView); //ads AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); And logcat: 01-26 17:50:42.392: D/dalvikvm(12060): GC_FOR_ALLOC freed 71K, 2% free 8906K/9016K, paused 15ms, total 15ms 01-26 17:50:42.392: I/dalvikvm-heap(12060): Grow heap (frag case) to 9.732MB for 1048592-byte allocation 01-26 17:50:42.408: D/dalvikvm(12060): GC_FOR_ALLOC freed &lt;1K, 2% free 9930K/10044K, paused 13ms, total 13ms 01-26 17:50:42.454: D/AndroidRuntime(12060): Shutting down VM 01-26 17:50:42.454: W/dalvikvm(12060): threadid=1: thread exiting with uncaught exception (group=0x4160a700) 01-26 17:50:42.454: E/AndroidRuntime(12060): FATAL EXCEPTION: main 01-26 17:50:42.454: E/AndroidRuntime(12060): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.doritofacestudios.doritofacemath/com.doritofacestudios.doritofacemath.MainActivity}: java.lang.NullPointerException 01-26 17:50:42.454: E/AndroidRuntime(12060): at android.app.ActivityThread.pe…
has answer: http://stackoverflow.com/a/21395364

microbenchmark
tags question: http://stackoverflow.com/q/21432400
tag name: microbenchmark
type: Tag

http://stackoverflow.com/q/21455115
has answer: http://stackoverflow.com/a/21455329
answer count: 1
tagged with: hash
has body: We already have an application being developed and now we want to secure(encrypting\hashing) the table columns in the database (MS SQL Server 2008). These few columns are like passwords, credit card numbers, SSN etc. It is Java (1.5) based application and we are not using any api's like hibernate. Everything has been done from scratch. I want to secure this data in such a way that it is not useful for anyone reading it. Can someone please advice how to do it (best practices) and what are the disadvantages in terms of performance? Can this be done at database level (I am not talking about the whole db encrytion)? Thanks
type: UnansweredQuestion
tagged with: encryption
tagged with: java
type: Question
has title: MS SQL Server: Securing column level data
tagged with: sql-server
tagged with: security
score: 0

http://stackoverflow.com/comment/32331300
type: Comment
type: QuestionComment
has text: `date[1].getTime()==date[2].getTime()` Is what you are looking for.
comment on: http://stackoverflow.com/q/21429810
score: 2

http://stackoverflow.com/q/21392002
favorite count: 0
has comment: http://stackoverflow.com/comment/32266233
type: AnsweredQuestion
downvote count: 0
tagged with: bit-manipulation
possible better answer: http://stackoverflow.com/a/21392508
has comment: http://stackoverflow.com/comment/32294126
has title: How to convert string to a 32-bit aligned byte array in java?
has comment: http://stackoverflow.com/comment/32295031
type: Question
has answer: http://stackoverflow.com/a/21394649
has comment: http://stackoverflow.com/comment/32295865
has comment: http://stackoverflow.com/comment/32296191
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21392102
accepted answer: http://stackoverflow.com/a/21392102
has body: The title itself might not be self-explaining. Let me show an example: _test is 5f 74 65 73 74 (totally 5 bytes in ascii) However for some reason I need to pack it into a byte array like: 5f 74 65 73 74 00 00 00 (the last 3 bytes of 0 are padding bytes to do the alignment) In other words, I need to calculate the number of padding bytes before I use write() to write those bytes one by one. I can use this way to get the number I want: (4 - str.length() % 4) % 4 but I'm curious if there is another efficient way to get that (e.g. bit-wise operation).
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21392508

http://stackoverflow.com/q/21416375
score: 0
accepted answer: http://stackoverflow.com/a/21416557
tagged with: oracle-database
has body: I am using JPA(hibernate) and faced with problem. I have 2 entities. 1 is a 'Planes' and the second one is 'Air-port'. What I am creating now is a search web application, and I am trying to prepare all parts for it. So User needs to search 'planes' by 'Air-port', so it is 'OneToMany' relationship. But the problem is, that If I make it 'OneToMany' for example like this: Planes entity //... @OneToMany(mappedBy='plane') private Set&lt;Planes&gt; planes = new HashSet&lt;Planes&gt;(); //... and accordingly to this, Air-port entity //... @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="AirPort_ID") private Planes plane; But It does not fit, because in this situation, a plane has only 1 air-port. This is not true. So, when User hits an Air-port ID, it will select all planes in it. But still, each plane will have only 1 Air-Port. So, to solve this, maybe it will be more better to use ManyToMany? That Airport can have many planes, and plane can have many airports.
type: AnsweredQuestion
has title: What relationship choose for 2 tables
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21416557
answer count: 2
tagged with: jpa
possible better answer: http://stackoverflow.com/a/21416537
has answer: http://stackoverflow.com/a/21416537
has comment: http://stackoverflow.com/comment/32308053

http://stackoverflow.com/a/21493348
has comment: http://stackoverflow.com/comment/32445224
has body: It doesn't seem a good idea to have an opened PrintWriter on the file and use a RandomAccessFile at the same time. If you close your writer and open a new one on the file (instead of using RandomAccessFile) I think it will suit your needs.
has comment: http://stackoverflow.com/comment/32449025
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21493177
has comment: http://stackoverflow.com/comment/32445349

http://stackoverflow.com/q/21507899
has answer: http://stackoverflow.com/a/21507948
tagged with: inheritance
score: 0
has body: Is there a class in Java(JDK) with no abstract methods inside but still declared as an abstract class?
answer count: 1
tagged with: polymorphism
favorite count: 0
type: UnansweredQuestion
tagged with: oop
tagged with: java
upvote count: 1
downvote count: 1
has title: Abstract class with no abstract methods inside
type: Question

http://stackoverflow.com/comment/32252471
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21384865
has text: Ok, it works fine with : public MyThread (int nb,Fenetre fe) { this.nb = nb ; this.fen=fe; }
score: 0

http://stackoverflow.com/comment/32253536
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21385450
type: Comment
has text: File file = new File("myfil"); try (FileInputStream fis = new FileInputStream(file)) { int content; while ((content = fis.read()) != -1) { // convert to char and display it System.out.print((char) content); }......I tried this.But I want the url in string format

http://stackoverflow.com/a/21358953
has body: The code is expecting a list of JCheckBox objects - so this works CheckBoxList cbList = new CheckBoxList(); // the class you have JCheckBox check1 = new JCheckBox("One"); JCheckBox check2 = new JCheckBox("two"); JCheckBox[] myList = { check1, check2}; list of checkbox object cbList.setListData(myList); // set the list data for the object Small Swing program using your class below util; import javax.swing.*; public class HelloWorldSwing { private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); CheckBoxList cbList = new CheckBoxList(); JCheckBox check1 = new JCheckBox("One"); JCheckBox check2 = new JCheckBox("two"); JCheckBox[] myList = { check1, check2}; cbList.setListData(myList); frame.getContentPane().add(cbList); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21358240

http://stackoverflow.com/a/21468002
has comment: http://stackoverflow.com/comment/32426921
has comment: http://stackoverflow.com/comment/32401548
has body: I always recommend the simplest pattern: extract method First step String questions[] = {"question1", "question2".....}; if (isQuestion1Selected()) { setNewAnswersHere() } private boolean isQuestionSelected() { return textview.gettext().equals("question1") &amp;&amp; radioA.isSelected == true; } private void setNewAnswersHere(){ RadioA.setText("newAnswerHere"); RadioB.setText("......); } But this is just first step :) Second step String questions[] = {"question1", "question2".....}; if (isQuestionSelected(1)) { setNewAnswersHere() } private boolean isQuestionSelected(int number) { return textview.gettext().equals("question" + number) &amp;&amp; radioA.isSelected == true; } private void setNewAnswersHere(){ RadioA.setText("newAnswerHere"); RadioB.setText("......); }
has comment: http://stackoverflow.com/comment/32404808
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21467798
answers question: http://stackoverflow.com/q/21467798
has comment: http://stackoverflow.com/comment/32400774
type: Answer
has comment: http://stackoverflow.com/comment/32411840

http://stackoverflow.com/comment/121596728
has text: Depends on the length of the phone number, but one could use an array of bits, with each bit representing whether the phone number exists or not. For unique 7 digit phone numbers, you would need 10^7 bits, where 10^6 bits are set.
comment on: http://stackoverflow.com/q/21411197
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21494217
answers question: http://stackoverflow.com/q/21486915
type: Answer
has body: Since you seem to be building an object store on top of PostgreSQL, why not use an object store instead? I'd start with OpenStack Swift: OpenStack Block Storage (Swift) Swift docs or, alternately, a distributed network file system, if that's closer to your needs. (ab)using PostgreSQL as a network file system isn't going to get you far if you care about performance. The only time I'd do that would be when I needed ACID semantics - such as atomic commits of some database changes along with a file they relate to. You don't get atomic commit over multiple PostgreSQL instances (though you get close, with prepared tranactions) so I'm guessing that's not your use case. If it isn't, I suggest looking for the right too for the right job.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/36591266
answers question: http://stackoverflow.com/q/21442477
type: Answer
has body: Yeah. That's how a modem works - and in some places (old British telephony), they had to use the exact hardware of the phone company, so the modem really would emit noises into the mouthpiece and listen to the earpiece. It sounds like you want something with a lot more tolerance than a classic modem, though; how much data do you need to transmit? Consider the DTMF protocol - that's how touch-tone phones send messages to IVR systems. You could send any of sixteen data values (0-9, *, #, A-D; not many keypads have A-D, but they're part of the spec), and you could adjust your button-press time according to need. You could press each button for half a second, allowing one byte per second of arbitrary data - and a human could listen in on that, which would be a lot of fun :)
score: 0

http://stackoverflow.com/q/21430093
has answer: http://stackoverflow.com/a/21430967
has answer: http://stackoverflow.com/a/21434058
has body: I have a multidimentional array that is for a JTable. But it is not displaying the data correctly in the JTable its displaying like this from up to down on each row : nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 50 50 50 50 50 50 50 50 50 ###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.### minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 300 300 300 300 300 300 300 300 300 0:1000 0:1000 0…
possible better answer: http://stackoverflow.com/a/21430967
accepted answer: http://stackoverflow.com/a/21434058
type: AnsweredQuestion
tagged with: nested-loops
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32332139
has title: Multi-dimensional array with nested loop not displaying correctly
tagged with: jtable
score: 0

http://stackoverflow.com/comment/32305880
score: 0
has text: There are a bunch of good XML-in-Java tutorials on IBM's [DeveloperWorks XML](https://www.ibm.com/developerworks/xml/) website, among other places.
comment on: http://stackoverflow.com/q/21411639
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32393776
comment on: http://stackoverflow.com/q/21464443
score: 1
has text: What?! Please post a working code example and clarify your question, what you really want to do!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21387601
has comment: http://stackoverflow.com/comment/32257451
has body: I have XML contained in a string which has many invalid xml tags for an element, where a tag is "invalid" if it starts with a number. For example, the following are invalid: &lt;1&gt;....&lt;/1&gt;, &lt;123abc&gt;, etc. In XML, we'd identify certain tags as invalid: &lt;tag1&gt; ----&gt; valid tag &lt;1tagname&gt;....&lt;/1tagname&gt; ---&gt;invalid tagname &lt;2tagname&gt;....&lt;/2tagname&gt; ---&gt;invalid tag name &lt;/tag1&gt; ----&gt; valid tag I want to fetch a list of invalid xml tags and I want to add a special string as a prefix let's say "item" so as to convert invalid to valid tag name. I am using Java language compatiable regex.
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32257251
favorite count: 0
has comment: http://stackoverflow.com/comment/32257335
has title: Get a list of all invalid XML tags using Regex?
has comment: http://stackoverflow.com/comment/32257305
tagged with: regex
has comment: http://stackoverflow.com/comment/32257592
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21388623
type: Question
possible better answer: http://stackoverflow.com/a/21388024
has answer: http://stackoverflow.com/a/21388024
accepted answer: http://stackoverflow.com/a/21388623

http://stackoverflow.com/comment/32465420
comment on: http://stackoverflow.com/q/21505008
score: 1
type: QuestionComment
has text: What is `c`? Function doesn't depend on it. What is it supposed to do? What is `ulam(x, ++)`? Now it is an infinite loop for any odd `x` as `x = x*2 + 1` makes another odd number larger than `x` and so gets back to that option. I assume you wanted `x = x/2 + 1`.
type: Comment

http://stackoverflow.com/q/21469006
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21472497
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: i have a couple of questions about activity's i have a activity which i want to create some options for it. for eg. i want the user to be able to change the font size of text views. i am a noob in java and eclipse. first i thought i can change the xml values via java but then i found out that i can't and they are read only. so what is the best solution for creating options which are visual like changing colors and font sizes and picture through entire project? for eg. i have 10 activities and inside each activity i have some text views. i want to change all of the font sizes. in xml you can create a dimen and all of the text views with android:fontSize:"@dimen/example will have the same size. but in java it takes more code and time. what should i do ? couple of examples would be nice thanks in advance
has answer: http://stackoverflow.com/a/21472497
type: Question
has title: How to create Options for activity
tagged with: eclipse

http://stackoverflow.com/comment/32226714
type: AnswerComment
type: Comment
has text: Numerous possible reasons, what Exception are you receiving in the log? If you need more help you should post your code & preferably crash logs.
comment on: http://stackoverflow.com/a/21369705
score: 0

http://stackoverflow.com/comment/32349155
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21436873
has text: i removed it and since i don't need dist, i changed the code to finalDist1 = Double.valueOf(result[0]); finalDist2 += finalDist1; distanceText.setText(String.valueOf(finalDist2));. shown in above most latest log cat.

http://stackoverflow.com/comment/32204800
has text: Please post the entire exception as an edit.
type: Comment
comment on: http://stackoverflow.com/q/21358387
type: QuestionComment
score: 3

http://stackoverflow.com/a/21434427
has body: Your solution is very uneffective since you don't take advantage of the optimization algorythms like hashing: You should use a HashSet or a HashMap to find fastly if an element is contained. In addition collections have ready methods like retainAll() to keep only the existing elements (HashSet implements Collection so it's a good candidate for your needs) retainAll: Retains only the elements in this collection that are contained in the specified collection (optional operation) HashSet row1 = new HashSet(); row1.add("Kiwi"); ... HashSet row2 = new HashSet(); row2.add... System.out.println( row1.retainAll(row2) );
score: 1
answers question: http://stackoverflow.com/q/21434258
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32400634
type: Comment
has text: "especially when there's only 5-6 columns". That's exactly why this is a maintenance issue. There might not be 5-6 column next year, and then you have to go back to all the different places using select * and fix them. The code clearly shows he only wants specific columns, and also implies (from the name method getAllLogs) he wants all the rows. So using LIMIT is actually bad advice because it changes the requirement. Not using select * is good advice because it accomplishes the same thing with better design. Less code != better.
type: AnswerComment
comment on: http://stackoverflow.com/a/21467043
score: 0

http://stackoverflow.com/q/21374006
has comment: http://stackoverflow.com/comment/32235385
has answer: http://stackoverflow.com/a/21377193
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32233509
tagged with: itext
has body: I have this code protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); try{ response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "inline; filename=details.pdf"); try{ Document document = new Document(PageSize.A4, 20, 20, 130, 20); PdfWriter writer=PdfWriter.getInstance(document, output); document.open(); BaseFont bf = BaseFont.createFont("c:/windows/fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); writer.setPageEvent(new HeaderAndFooter(date)); XMLWorkerHelper worker = XMLWorkerHelper.getInstance(); List arrlist = new ArrayList(); List arrlist1 = new ArrayList();//user list List arrlist2 = new ArrayList();//time list Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/765a", "root", "root"); Statement st=con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rs=st.executeQuery("SELECT * FROM user_start2 where date='"+date+"' "); while(rs.next()){ arrlist.add(rs.getString("data")); arrlist1.add(rs.getString("users")); arrlist2.add(rs.getString("strtime")); } for(int i=0;i&lt;interval+1;i++){ String str =(String) arrlist.get(i); String str1 ='\n'+(String) arrlist1.get(i); String str2 =(String) arrlist2.get(i); String string =str.replace("&lt;p&gt;","\n").replace("&lt;/p&gt;", "\n"); document.add(new Paragraph(str1+"("+str2+")",new com.itextpdf.text.Font(bf, 10))); document.add(new Paragraph(str2,new com.itextpdf.text.Font(bf, 10))); document.add(new Paragraph(string,new com.itextpdf.text.Font(bf, 12))); } document.close(); response.setContentLength(output.size()); OutputStream os = response.getOutputStream(); output.writeTo(os); os.flush(); os.close(); con.close(); }catch(IOException e){e.printStackTrace();} }catch(IOException e){e.printStackTrace();} catch(DocumentException e) {} catch(Exception e) { } //PDF READER // Create a reader t…
has title: Add page number to pdf using pdfstamper(Itext)
has comment: http://stackoverflow.com/comment/32235772
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32233229
tagged with: java
has comment: http://stackoverflow.com/comment/32235197
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/32235832
has comment: http://stackoverflow.com/comment/32238037
favorite count: 0
accepted answer: http://stackoverflow.com/a/21377193
tagged with: pdfstamper
has comment: http://stackoverflow.com/comment/32235952
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/32233168

http://stackoverflow.com/a/21414603
answers question: http://stackoverflow.com/q/21414342
has body: You are trying to print the numerical value of C i.e. for the case 2 + 3 and want to print 5, but when doing the cast of (char) 5 you get the control character ENQ (See ASCII Characters) which will most likely not be printable by the console. As given in another answer try Character.forDigit(C, 10) But this will only work for single digit answers. If more digits are required you might want to use a string and try String.valueOf(C)
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32304964
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/32305073

http://stackoverflow.com/comment/32345259
type: QuestionComment
has text: Import packages related jars not exist in classpath. so it throws such errors. so set `classpath`.
score: 1
comment on: http://stackoverflow.com/q/21437691
type: Comment

http://stackoverflow.com/q/21443225
has answer: http://stackoverflow.com/a/21443251
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21443267
has title: why I get nullpointerexception when I call methods of enum class in Java
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/32355843
tagged with: java
has comment: http://stackoverflow.com/comment/32355660
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32355917
tagged with: junit
accepted answer: http://stackoverflow.com/a/21443251
possible better answer: http://stackoverflow.com/a/21443267
has body: Here is my simple interface and an enum that implements it. I have written a very simple JUnit Test case, which fails because of NullPointerException. I do not understand why this Exception is thrown. I have constructed an enum object in the test class. public interface Account { public String getName(); public boolean isBillable(); } public enum NonBillableAccount implements Account { SICK_LEAVE("SickLeave"), VACATION("Vacation"), BUSINESS_DEVELOPMENT("businessDevelopment"); private String leaveType; private NonBillableAccount(String leavetype) { this.leaveType = leavetype; } @Override public String getName() { return this.leaveType; } @Override public boolean isBillable() { return false; } } And the JUnit test case here public class NonBillableAccountTest { Account ac = null; @Before public void setUp() throws Exception { Account ac = NonBillableAccount.BUSINESS_DEVELOPMENT; } @Test public void testGetName() { assertEquals(ac.getName(),"businessDevelopment"); } @Test public void testIsBillable() { assertEquals(ac.isBillable(), false); } }
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/1092099
has comment: http://stackoverflow.com/comment/32356258

http://stackoverflow.com/q/21417489
downvote count: 2
accepted answer: http://stackoverflow.com/a/21417607
upvote count: 6
has body: In Java, int x = 0; (int)(-1.0 / x) -&gt; Integer.MinValue (int)(1.0 / x) -&gt; Integer.MaxValue But in C#, int x = 0; (int)(-1.0 / x) -&gt; Int32.MinValue (int)(1.0 / x) -&gt; Int32.MinValue!! The behavior would be the same if the "unchecked" statement/operator is used, and if "checked" is used instead then it's an overflow exception. But surely, in an unchecked context, one would except 1.0 / x (where x = 0) to result in Int32.MaxValue, not Int32.MinValue. Am I missing something?
score: 4
tagged with: integer-overflow
has comment: http://stackoverflow.com/comment/32310293
has answer: http://stackoverflow.com/a/21417607
has answer: http://stackoverflow.com/a/21417560
favorite count: 0
has title: Why does (int)(1.0 / x) where x = 0 results in In32.MinValue rather than Int32.MaxValue?
possible better answer: http://stackoverflow.com/a/21417560
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32310235
tagged with: java
has comment: http://stackoverflow.com/comment/32310114
linked to: http://stackoverflow.com/q/14244668
type: Question
tagged with: c#
answer count: 2
has comment: http://stackoverflow.com/comment/32310058

http://stackoverflow.com/comment/32207689
comment on: http://stackoverflow.com/q/21359774
score: 0
type: Comment
has text: @user2023050 What!? `map[x][y] = tile;`?
type: QuestionComment

http://stackoverflow.com/q/21413938
possible better answer: http://stackoverflow.com/a/21414091
type: Question
accepted answer: http://stackoverflow.com/a/21413970
has body: I'm trying to read some props from backupData.properties. It locates in WEB-INF/classes/. This is how I do: public class Configures { private static final String INPUT_FILE = "WEB-INF//classes//backupData.properties"; public static String getMail() { Properties prop = new Properties(); try { //load a properties file prop.load(new FileInputStream(INPUT_FILE)); //get the property value return prop.getProperty("mail"); } catch (IOException ex) { ex.printStackTrace(); } return null; } } What INPUT_FILE should contain? I was trying to put it in src, like src//backupData.properties, but it throws FileNotFoundException. I googled that file should locate in CLASSPATH(in WEB-INF/classes as I understood). What is wrong? PS. I'm using Spring.
answer count: 2
has comment: http://stackoverflow.com/comment/32303666
tagged with: properties
has answer: http://stackoverflow.com/a/21414091
tagged with: spring-mvc
type: AnsweredQuestion
has title: FileNotFoundException with properties file
has answer: http://stackoverflow.com/a/21413970
score: 0
tagged with: java

http://stackoverflow.com/comment/32340010
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21434453
has text: I think your cursor is `null`. Check `sampleDB.rawQuery` whether it returns the Cursor instance
type: Comment

jsp
tags question: http://stackoverflow.com/q/21438701
tags question: http://stackoverflow.com/q/21502542
tags question: http://stackoverflow.com/q/21439089
tags question: http://stackoverflow.com/q/21387153
tags question: http://stackoverflow.com/q/21390019
tags question: http://stackoverflow.com/q/21430653
tags question: http://stackoverflow.com/q/21465180
tags question: http://stackoverflow.com/q/21437985
tags question: http://stackoverflow.com/q/21355168
tags question: http://stackoverflow.com/q/21360891
tags question: http://stackoverflow.com/q/21427593
tags question: http://stackoverflow.com/q/21509973
tags question: http://stackoverflow.com/q/21425965
tags question: http://stackoverflow.com/q/21503640
tags question: http://stackoverflow.com/q/21513879
tags question: http://stackoverflow.com/q/21417710
tags question: http://stackoverflow.com/q/21393506
tags question: http://stackoverflow.com/q/21422168
tags question: http://stackoverflow.com/q/21486120
tags question: http://stackoverflow.com/q/21454160
tags question: http://stackoverflow.com/q/21427731
tags question: http://stackoverflow.com/q/21442592
tags question: http://stackoverflow.com/q/21352462
tags question: http://stackoverflow.com/q/21416796
tags question: http://stackoverflow.com/q/21485840
tags question: http://stackoverflow.com/q/21427383
tags question: http://stackoverflow.com/q/21459178
tags question: http://stackoverflow.com/q/21434082
tags question: http://stackoverflow.com/q/21471097
tags question: http://stackoverflow.com/q/21457408
tags question: http://stackoverflow.com/q/21484727
tags question: http://stackoverflow.com/q/21402027
tags question: http://stackoverflow.com/q/21377981
tags question: http://stackoverflow.com/q/21424931
tags question: http://stackoverflow.com/q/21472682
tags question: http://stackoverflow.com/q/21422185
tags question: http://stackoverflow.com/q/21367184
tags question: http://stackoverflow.com/q/21470881
tags question: http://stackoverflow.com/q/21363210
tags question: http://stackoverflow.com/q/21496278
type: Tag
tags question: http://stackoverflow.com/q/21424957
tags question: http://stackoverflow.com/q/21373837
tags question: http://stackoverflow.com/q/21480040
tags question: http://stackoverflow.com/q/21478886
tags question: http://stackoverflow.com/q/21418101
tags question: http://stackoverflow.com/q/21401976
tags question: http://stackoverflow.com/q/21514233
tags question: http://stackoverflow.com/q/21422464
tags question: http://stackoverflow.com/q/21469531
tags question: http://stackoverflow.com/q/21378122
tags question: http://stackoverflow.com/q/21403290
tags question: http://stackoverflow.com/q/21507762
tags question: http://stackoverflow.com/q/21454857
tags question: http://stackoverflow.com/q/21364826
tags question: http://stackoverflow.com/q/21401852
tags question: http://stackoverflow.com/q/21508212
tags question: http://stackoverflow.com/q/21446883
tags question: http://stackoverflow.com/q/21452418
tags question: http://stackoverflow.com/q/21465767
tag name: jsp
tags question: http://stackoverflow.com/q/21459021
tags question: http://stackoverflow.com/q/21442412
tags question: http://stackoverflow.com/q/21511233
tags question: http://stackoverflow.com/q/21366750
tags question: http://stackoverflow.com/q/21496645
tags question: http://stackoverflow.com/q/21352648
tags question: http://stackoverflow.com/q/21361243
tags question: http://stackoverflow.com/q/21496836
tags question: http://stackoverflow.com/q/21485194
tags question: http://stackoverflow.com/q/21502149
tags question: http://stackoverflow.com/q/21403254
tags question: http://stackoverflow.com/q/21502292
tags question: http://stackoverflow.com/q/21473959
tags question: http://stackoverflow.com/q/21457329
tags question: http://stackoverflow.com/q/21387990
tags question: http://stackoverflow.com/q/21371968
tags question: http://stackoverflow.com/q/21432039
tags question: http://stackoverflow.com/q/21409408
tags question: http://stackoverflow.com/q/21499695

http://stackoverflow.com/q/21398476
has answer: http://stackoverflow.com/a/21401645
tagged with: jquery
tagged with: servlets
tagged with: ajax
linked to: http://stackoverflow.com/q/3582671
answer count: 1
has comment: http://stackoverflow.com/comment/32277003
downvote count: 0
has comment: http://stackoverflow.com/comment/32280701
favorite count: 0
has body: I have a ajax call that sends a value to the Servlet and Servlet creates a html file then returning the absolute path of the html file that has been created. In response from the server is "C:\Users\Ker\Documents\NETBEANS PROJECT\Titanium\build\web\default\result.html" and in the ajax $(function() { $("#BTNRUN").click(function() { var html = $("#HTML").val(); var body1 =html.replace('%','^'); var body2=body1.replace('&amp;','|'); var css = $("#CSS").val(); var js = $("#JS").val(); var dataString = 'RUN=1&amp;BODY=' + body2 + '&amp;CSS=' + css + '&amp;JS=' + js; $.ajax({ type: "POST", url: "TitaniumServlet", data: dataString, success: function(data) { window.open(data); } }); return false; }); }); it opens a new browser but i alway go to about:blank page. is there something wrong with the adress? edit: try { main_path is the context path of the project File file = new File(main_path + "\\result.html"); if (file.createNewFile()) { System.out.println("File is created!"); } else { System.out.println("File already exists."); file.delete(); file.createNewFile(); } writer = new PrintWriter(new FileOutputStream(file, false)); writer.write(html codes here); return file.getAbsolutePath(); } catch (FileNotFoundException ex) { Logger.getLogger(ProcessRun.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ProcessRun.class.getName()).log(Level.SEVERE, null, ex); }
has comment: http://stackoverflow.com/comment/32276886
has comment: http://stackoverflow.com/comment/32276916
has title: opening new window with jquery
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32278829
has comment: http://stackoverflow.com/comment/32277232
has comment: http://stackoverflow.com/comment/32279378
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32276829

http://stackoverflow.com/comment/32433855
comment on: http://stackoverflow.com/a/21487596
type: Comment
score: 0
has text: have you tried my suggestion, they are the part of best practices even if ur code crashes for something your resources are get closed
type: AnswerComment

http://stackoverflow.com/comment/32339816
type: Comment
type: QuestionComment
has text: Where in the `do-while` or `while` loop? If you are not able to print the logs while iterating the records, then you have problem in the record fetching
score: 0
comment on: http://stackoverflow.com/q/21434453

http://stackoverflow.com/comment/32349720
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21439802
has text: If you can't do IO, go the route of creating 3 processes - 1 would act as your "server" while the other 2 would be your "clients." Your server launches first and receives requests, and stores them in its app memory. Any client that connects is pushed the messages on the server. With timestamps, you can ensure they only get the latest messages. You can do this with Sockets (http://www.oracle.com/technetwork/java/socket-140484.html)

http://stackoverflow.com/q/21431537
score: 1
tagged with: java
has body: I have the following JSON: "propertyName": "{"1":[{"1":"value1","2":"value2","3":false}]}" the first property being the count of items in the array following having a map of properties. What is the best way to deserialize this using Jackson if I want to fill up a class holding these values: class MyHolder { name = "value1"; age = "value2"; female = false; } for instance.
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32334506
has answer: http://stackoverflow.com/a/21432611
tagged with: jackson
linked to: http://stackoverflow.com/q/8362913
answer count: 2
downvote count: 0
has title: Jackson deserializing hash map
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32334028
has answer: http://stackoverflow.com/a/21435793
accepted answer: http://stackoverflow.com/a/21435793
possible better answer: http://stackoverflow.com/a/21432611

http://stackoverflow.com/a/21456580
has body: You need N nested loops, which is what makes it hard. You can achieve this using recursion though. static &lt;E&gt; ArrayList combine(ArrayList&lt;E&gt; soFar, ArrayList&lt;E&gt;... lists) { // Rather than constantly making and remaking this list could just use one // and pass it around and add stuff to it. This works though. ArrayList&lt;ArrayList&lt;E&gt;&gt; combs=new ArrayList&lt;ArrayList&lt;E&gt;&gt;(); // Loop through the first list looking for elements for(E e:lists[0]) { // Create a new List to build this combination ArrayList&lt;E&gt; temp = new ArrayList&lt;&gt;(soFar); // Add this element to the combination temp.add(e); // If there are more lists recurse down if (lists.length &gt; 1) { // Use recursion to add all combinations of the remaining lists combs.addAll(combine(temp, lists.subList(1))); } else { // There are no more lists so we are done, add temp to the combos combs.add(temp); } } return combs; } // Call this method to start things going, the other one should probably be private static &lt;E&gt; ArrayList combine(ArrayList&lt;E&gt;... lists) return combine(new ArrayList&lt;E&gt;(), lists); }
accepted answer of: http://stackoverflow.com/q/21456449
answers question: http://stackoverflow.com/q/21456449
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/32381347
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32380917
downvote count: 0

http://stackoverflow.com/comment/32435726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21462884
has text: i Keep forgeting to mention, yes i get the same error running it from the command line. Checking the binray file.
score: 0

jframe
tags question: http://stackoverflow.com/q/21505343
tags question: http://stackoverflow.com/q/21505477
tags question: http://stackoverflow.com/q/21355799
tags question: http://stackoverflow.com/q/21505712
tags question: http://stackoverflow.com/q/21387777
tags question: http://stackoverflow.com/q/21509059
tags question: http://stackoverflow.com/q/21468622
tags question: http://stackoverflow.com/q/21397183
tags question: http://stackoverflow.com/q/21353913
tags question: http://stackoverflow.com/q/21391750
tags question: http://stackoverflow.com/q/21357286
tags question: http://stackoverflow.com/q/21359892
tag name: jframe
tags question: http://stackoverflow.com/q/21503273
tags question: http://stackoverflow.com/q/21366919
tags question: http://stackoverflow.com/q/21450519
tags question: http://stackoverflow.com/q/21437949
tags question: http://stackoverflow.com/q/21500771
tags question: http://stackoverflow.com/q/21492821
tags question: http://stackoverflow.com/q/21432279
tags question: http://stackoverflow.com/q/21408620
tags question: http://stackoverflow.com/q/21354028
tags question: http://stackoverflow.com/q/21459718
tags question: http://stackoverflow.com/q/21501840
tags question: http://stackoverflow.com/q/21434873
tags question: http://stackoverflow.com/q/21461506
tags question: http://stackoverflow.com/q/21474152
tags question: http://stackoverflow.com/q/21356609
tags question: http://stackoverflow.com/q/21360081
tags question: http://stackoverflow.com/q/21350011
tags question: http://stackoverflow.com/q/21389628
tags question: http://stackoverflow.com/q/21358791
tags question: http://stackoverflow.com/q/21354529
tags question: http://stackoverflow.com/q/21494550
tags question: http://stackoverflow.com/q/21362530
tags question: http://stackoverflow.com/q/21369306
tags question: http://stackoverflow.com/q/21422431
tags question: http://stackoverflow.com/q/21365432
tags question: http://stackoverflow.com/q/21505895
tags question: http://stackoverflow.com/q/21392286
tags question: http://stackoverflow.com/q/21355547
tags question: http://stackoverflow.com/q/21374361
tags question: http://stackoverflow.com/q/21461134
tags question: http://stackoverflow.com/q/21486174
tags question: http://stackoverflow.com/q/21382726
type: Tag
tags question: http://stackoverflow.com/q/21366225
tags question: http://stackoverflow.com/q/21359268

http://stackoverflow.com/q/21417359
has answer: http://stackoverflow.com/a/21417750
score: 0
has title: Call constructor on double array via Streams
tagged with: constructor
has comment: http://stackoverflow.com/comment/32310141
has comment: http://stackoverflow.com/comment/32310003
has answer: http://stackoverflow.com/a/21425248
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32309923
tagged with: java-stream
tagged with: java
has body: I am wondering if the following is possible with Java 8, for: Patch[][] patches = new Patch[width][depth]; I want to call the constructor using Streams, I know there is Arrays.stream(patches) which would give me a Stream&lt;Patch[]&gt;, so unfortunately I do not think that is of any use (yet in my idea). In old Java this would come down to the simple: for (int w = 0; w &lt; width; w++) { for (int z = 0; z &lt; depth; z++) { patches[w][z] = new Patch(); } } The most useful method would be one that destructs a T[][] to a Stream&lt;T&gt; I think. To rephrase what I actually want: Convert the double for-loop to a statement using Java 8, most likely involving Stream.
has comment: http://stackoverflow.com/comment/32310181
type: Question
accepted answer: http://stackoverflow.com/a/21425248
answer count: 2
has comment: http://stackoverflow.com/comment/32310133
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21417750

http://stackoverflow.com/comment/32313855
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21419327
type: AnswerComment
has text: @AshotKarakhanyan Can you expand on why it is better to initialize them as List objects if they inherit the methods from List interface anyways?

http://stackoverflow.com/q/21508850
answer count: 1
has comment: http://stackoverflow.com/comment/32472033
has answer: http://stackoverflow.com/a/21508891
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/32472193
type: Question
accepted answer: http://stackoverflow.com/a/21508891
tagged with: imageview
score: 0
has body: i'm trying to build a simple app that downloads a png file from my pc decodes it and sets it in an imageview in a new activity that start after a button press. everything that has to do with the networking, and decoding of the file seems to work properly, but i seem to be getting a lot of errors when using "findviewbyid", (android studio) it suggests the correct id but when i run it, exceptions are thrown and the app crashes. (When creating a new activity in android studio it creates a placeholder fragment. Should I write the code in the OncreateView of the fragment?) activity xml: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.app.show" tools:ignore="MergeRootFrame" /&gt; fragment xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.example.app.show$PlaceholderFragment"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/fromaster" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /&gt; &lt;/RelativeLayout&gt; java code (onCreate): public class show extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show); ImageView v; v = (ImageView) findViewById(R.id.fromaster); byte[] raw; if (v == null){Log.d("at view","empty");} raw = getIntent().getByteArrayExtra("pic"); Bitmap bitmap = BitmapFactory.decodeByteArra…
has title: nullpointerexcetion at findviewbyid

http://stackoverflow.com/a/21486802
answers question: http://stackoverflow.com/q/21486683
type: Answer
score: 2
downvote count: 0
has body: To go to ne next activity add this to you onItemClickListner: Intent intent = new Intent(this, ActivityTwo.class); this.startActivity (intent); All saving of tha activity must be made on this overriden method @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putBoolean("MyBoolean", true); savedInstanceState.putDouble("myDouble", 1.9); savedInstanceState.putInt("MyInt", 1); savedInstanceState.putString("MyString", "Welcome back to Android"); // etc. } The savedInstanceState bundle will be passed again to your activty in it's OnCreate method so you can retreive those values again a reassigned them to where they were. If eveything is set up correctly, to go back to the previous activity you only need to call finish() on the current activity. Hope it helped!
has comment: http://stackoverflow.com/comment/32432186
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21486683

http://stackoverflow.com/a/21485866
downvote count: 0
has comment: http://stackoverflow.com/comment/32430493
answers question: http://stackoverflow.com/q/21485590
type: Answer
has comment: http://stackoverflow.com/comment/32431270
has body: Move vote to SliderMoved: class SliderMoved implements ChangeListener { private int vote; public void stateChanged(ChangeEvent e) { this.vote = ratingS.getValue(); // do something with the vote, you can even access // methods and fields of the outer class } public int getVote() { return this.vote; } } SliderMoved sm = new SliderMoved(); ratingS.addChangeListener(sm); // if you need access to the actual rating... int value = rattingS.getValue(); // ...or int value2 = sm.getVote(); EDIT Or alternatively, pass a model class to the change listener public class Person { private String name; private int vote; public int getVote() { return this.vote; } public void setVote(int vote) { this.vote = vote; } // omitting other setter and getter } Person is used as follows: class SliderMoved implements ChangeListener { private Person person; public SliderMoved(Person person) { this.person = person; } public void stateChanged(ChangeEvent e) { this.person.setVote(ratingS.getValue()); } public Person getPerson() { return this.person; } } Person person = new Person(); ratingS.addChangeListener(new SliderMoved(person)); // access the vote int vote = person.getVote();
score: 5
has comment: http://stackoverflow.com/comment/57223897
upvote count: 5

http://stackoverflow.com/comment/32308512
type: Comment
type: QuestionComment
score: 1
has text: Obviously, the JDBC driver is missing. You need to add the MySQL JDBC library to your project's classpath. Get it from here: http://dev.mysql.com/downloads/connector/j
comment on: http://stackoverflow.com/q/21416619

http://stackoverflow.com/q/21511511
has title: How to arrange my GUI in java
score: -2
type: UnansweredQuestion
downvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/21511540
type: Question
tagged with: java
has body: Hello I'm trying to make a gui for my java program but I'm stuck. I have made my buttonPanel but I don't know how to do next. I also want that when I click the ADD button to open a new window. And I don't know how to add on the right side of my buttons another panel in which I could list my students. And last thing under the panel that lists the stundents I would like to have some options to sort them ( like those with grades bigger than 5 etc). I have managed to make my buttonPanel but I don't know how to continue. Please help me. import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @SuppressWarnings("serial") public class MySwingTry extends JFrame { JPanel buttonPanel; public MySwingTry() { buttonPanel = new JPanel(new GridLayout(8,0,5,0)); JButton addButton = new JButton("Add student"); JButton deleteButton = new JButton("Delete student"); JButton printAllButton = new JButton("Print all"); JButton printNrOfStudentsButton = new JButton("Print nr."); JButton writeButton = new JButton("Write File"); JButton readButton = new JButton ("Read File"); JButton serializeButton = new JButton("Serialize File"); JButton deserializeButton = new JButton("DeserializeButton"); BoxLayout boxLayout1 = new BoxLayout (buttonPanel, BoxLayout.Y_AXIS); buttonPanel.setLayout(boxLayout1); buttonPanel.add(addButton); buttonPanel.add(deleteButton); buttonPanel.add(printAllButton); buttonPanel.add(printNrOfStudentsButton); buttonPanel.add(writeButton); buttonPanel.add(readButton); buttonPanel.add(serializeButton); buttonPanel.add(deserializeButton); this.add(buttonPanel); } // public void actionPerformed(ActionEvent event) { // if (event.getSource() == myButton) // myLabel.setText("My button clicked"); // } public static void main(String[] args) { MySwingTry first = new MySwingTry(); first.setTitle("First try"); first.setSize(300,500); first.setDefaultCloseOperation(EXIT_ON_CLOSE); first.setVisible(true); } }
has comment: http://stackoverflow.com/comment/32476700
upvote count: 0
answer count: 1
tagged with: layout-manager
favorite count: 0

http://stackoverflow.com/a/21352069
type: Answer
score: 1
upvote count: 1
has body: As you pointed out, most of the Java data structures getting rid of duplicates rely on hashcode/equals methods. Since you cannot modify the code of T and want to define the equality yourself, I suggest you create a wrapper of it where you can properly override the hashcode/equals methods: public class MyT { private final T t; public MyT(T t) { this.t = t; } // + getter // + define hashcode and equals based on t } Afterwards, you can simply convert your List&lt;T&gt; into List&lt;MyT&gt;. Then you can use a LinkedHashSet&lt;MyT&gt; that removes duplicates based on hashcode/equals you just implemented and also keeps the ordering of your original list. Finally you can easily convert it back to a List&lt;T&gt; if necessary.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21352024
answers question: http://stackoverflow.com/q/21352024

http://stackoverflow.com/q/21448365
downvote count: 11
answer count: 2
has answer: http://stackoverflow.com/a/21448667
score: -11
has comment: http://stackoverflow.com/comment/32365514
favorite count: 0
has body: how to remove smallest value digit from an integer and return the rest of it without using string.Like if we have number 4412,then reomive the 1 and return 442. I did the coding for extracting the smallest number but dont know how to combine rest of them. public class RemoveSmallestDigit { static int testcase1 = 4487; static int testcase2 = 1111; public static void main(String args[]){ RemoveSmallestDigit testInstance = new RemoveSmallestDigit(); int result = testInstance.removeSmallestDigit(testcase1); System.out.println(result); } //write your code here public int removeSmallestDigit(int num){ int small=9; int digit=0; while(num!=0){ digit=num%10; num=num/10; if(digit&lt;=small){ small=digit; } } System.out.println(small); return small; } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21448395
upvote count: 0
has title: how to remove smallest value digit from an integer and return the rest of it without using string
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32365525
has comment: http://stackoverflow.com/comment/32365265

http://stackoverflow.com/comment/32248429
comment on: http://stackoverflow.com/a/21382804
type: AnswerComment
score: 1
type: Comment
has text: nice answer. But still, do not would be better to use a Constructor for OAuthHelper instead of using onPreExecute?

http://stackoverflow.com/a/21383227
downvote count: 0
answers question: http://stackoverflow.com/q/21383176
has comment: http://stackoverflow.com/comment/32249499
has comment: http://stackoverflow.com/comment/32249453
has comment: http://stackoverflow.com/comment/32249899
type: Answer
score: 1
upvote count: 1
has body: \ is used for escaping in Java - so every time you actually want to match a backslash in a string, you need to write it twice. In addition, and this is what most people seem to be missing - replaceAll() takes a regex, and you just want to replace based on simple string substitution - so use replace() instead. (You can of course technically use replaceAll() on simple strings as well by escaping the regex, but then you get into either having to use Pattern.quote() on the parameters, or writing 4 backslashes just to match one backslash, because it's a special character in regular expressions as well as Java!) A common misconception is that replace() just replaces the first instance, but this is not the case: Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. ...the only difference is that it works for literals, not for regular expressions. In this case you're inadvertently escaping r, which produces a carriage return feed! So based on the above, to avoid this you actually want: String test = "\\\\r New Value"; and: test = test.replace("\\\\r", "\\r");

http://stackoverflow.com/q/21356853
has comment: http://stackoverflow.com/comment/32202144
has body: I have been trying to parse a specific date string to change it to another format. Current Format: Sep 17, 2013 9:24:02 AM Desired Format: 09-17-2013 09:24 Note that the desired format is military time. I have been attempting to parse the first time using this: SimpleDateFormat parser = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a", Locale.getDefault()); try { Date date = parser.parse(cell3.getStringCellValue()); t.time = new SimpleDateFormat("MM-dd-yyyy HH:mm", Locale.getDefault()).format(date); } catch (ParseException e) { Log.e("Bad","date"); t.time = cell3.getStringCellValue(); e.printStackTrace(); } The logs never show the error, so no Exception is being raised, but the date's remain in their original format. The issue is that t.time is assigned the date string in the original format. So t.time is assigned Sep 17, 2013 9:24:02 AM when I want it to be 09-17-2013 09:24 Anyone have an idea what I am doing wrong? Thanks, Mike
tagged with: android
answer count: 1
tagged with: parsing
tagged with: time
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21356891
tagged with: date
type: Question
score: 0
has title: Parsing Specific Date String

http://stackoverflow.com/comment/32337778
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21433500
has text: Very true, excuse me. Answer fixed.

http://stackoverflow.com/a/21424710
type: Answer
answers question: http://stackoverflow.com/q/21424607
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21424607
has body: Problem may due to the project can not find posrtgesql JDBC driver when running . so add jar in the path of class libraries. Get a PostgreSQL JDBC driver at this URL : http://jdbc.postgresql.org/download.html
score: 0

http://stackoverflow.com/comment/32401484
comment on: http://stackoverflow.com/q/21467914
score: 0
type: Comment
type: QuestionComment
has text: Have you inspected the DOM at all? Is the tooltip just an attribute or a widget drawn by GWT? What classes are applied?

http://stackoverflow.com/q/21474608
has answer: http://stackoverflow.com/a/21474742
tagged with: hashcode
score: -2
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/32411275
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21474742
upvote count: 0
tagged with: equals
has body: Here i just want to ask one question which i faced in Java interview. Question was like how hashmap works.I explained and answered all following questions.But i stuck at one question,which was: Is it better to have more bucket of objects in collection or less bucket?and why? Please help me here with your view
tagged with: java
has comment: http://stackoverflow.com/comment/32441947
has title: Java Collection:Collection framework:Less bucket is good to store object in collection or large number of bucket?
tagged with: collections
type: Question

http://stackoverflow.com/comment/32450970
comment on: http://stackoverflow.com/q/21497123
type: Comment
type: QuestionComment
has text: what do you understand by the word constructor?
score: 0

http://stackoverflow.com/q/21499820
has answer: http://stackoverflow.com/a/21499895
has body: i would like to do a dynamic song list represented as JPanel,with song items also represented as JPanel's,added to parent song list JPanel Here's my code / Constructor of MainContext class public MainContext() { initComponents(); PanelItem item=new PanelItem(); songListPanel.add(item); item.setEnabled(true); item.setVisible(true); item.setSongLabel("bla bla"); songListPanel.revalidate(); } This is what i get What i want is that in that left panel will be shown multiple PanelItem's hope you can help
type: Question
score: 1
tagged with: java
tagged with: jpanel
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32455799
has comment: http://stackoverflow.com/comment/32455689
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has title: JPanel does not show added components
tagged with: swing

http://stackoverflow.com/comment/32341207
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21433420
has text: Do you have installed Feature Pack for Web 2.0?

http://stackoverflow.com/comment/32269400
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21393975
has text: I don't want to give the full answer so you can learn however instead of having all the if statements you should try and use else if and else. Check out the Java tutorial on Control Flow here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html

http://stackoverflow.com/q/21484221
tagged with: google-app-engine
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32694265
tagged with: web-services
has comment: http://stackoverflow.com/comment/32427697
has answer: http://stackoverflow.com/a/29842146
tagged with: java
type: Question
answer count: 2
has body: My Google App Engine application use a web service, this web service is pretty slow to respond and sometimes my application crashes : java.net.SocketTimeoutException: Timeout while fetching URL: http://... To call this web service, I use classes generated with wsimport (Java tool to parse an existing WSDL file and generate required files). I need to change the default deadline (5 seconds) either for this call or globally for all my app URL fetches. App engine docs : You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 60 seconds for HTTP requests and 10 minutes for task queue and cron job requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline. Source : https://developers.google.com/appengine/docs/java/urlfetch/#Java_Making_requests I tried to add this lines (in strong below) in my code to change the deadline but it did'nt work : URL urlConnection = new URL(url); URLConnection connection = urlConnection.openConnection(); connection.setConnectTimeout(180000); // 3 minutes connection.setReadTimeout(180000); // 3 minutes SWS webService = new SWS(urlConnection, new QName("http://...", "SWS")); Note : SWS is the main class generated by wsimport from my WSDL
score: 2
tagged with: webservice-client
downvote count: 0
linked to: http://stackoverflow.com/q/9934970
has title: How I can change default timeout for web services call on Google app engine?
favorite count: 0
has answer: http://stackoverflow.com/a/35880851

http://stackoverflow.com/comment/32454336
has text: unselect the row and see what happens ... (that's the whole point of the problem, as you noticed yourself ;-)
score: 1
comment on: http://stackoverflow.com/a/21496932
type: AnswerComment
type: Comment

pid
tags question: http://stackoverflow.com/q/21462332
tags question: http://stackoverflow.com/q/21351974
tag name: pid
type: Tag

http://stackoverflow.com/a/21362707
has comment: http://stackoverflow.com/comment/32212111
has comment: http://stackoverflow.com/comment/32212140
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Add the new view which you have created in generate() method to the activity view using addView method.
accepted answer of: http://stackoverflow.com/q/21362605
answers question: http://stackoverflow.com/q/21362605

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

http://stackoverflow.com/q/21496651
has answer: http://stackoverflow.com/a/21497217
tagged with: android-button
has answer: http://stackoverflow.com/a/21496787
has comment: http://stackoverflow.com/comment/32450373
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/32565769
has title: buttons doesn't work inside a ListView
accepted answer: http://stackoverflow.com/a/21496787
has comment: http://stackoverflow.com/comment/32571419
has body: I have a Button inside a ListView. I want to go to another Activity when it is clicked. But I get this error: No enclosing instance of the type Appointment is accessible in scope @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View vi=convertView; if(convertView==null) vi = inflater.inflate(R.layout.item_row, null); TextView txtsection = (TextView)vi.findViewById(R.id.section); TextView txtdoctor = (TextView)vi.findViewById(R.id.doctor); TextView txtdate = (TextView)vi.findViewById(R.id.date); TextView txttime = (TextView)vi.findViewById(R.id.time); btchange = (Button)vi.findViewById(R.id.change); btchange.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(context, Available.class); startActivity(i); } }); btdelete = (Button)vi.findViewById(R.id.delete); txtsection.setText(item.section); txtdoctor.setText(item.doctor); txtdate.setText(item.date); txttime.setText(item.time); return vi; }}
has comment: http://stackoverflow.com/comment/32567233
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32450270
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32450195
has comment: http://stackoverflow.com/comment/32597318
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21497217

http://stackoverflow.com/comment/32206783
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21358895
type: Comment
has text: Also, would you be willing to work with me outside of SO? ex: Sype

http://stackoverflow.com/a/21511179
score: 1
has comment: http://stackoverflow.com/comment/32476305
has comment: http://stackoverflow.com/comment/32476292
has comment: http://stackoverflow.com/comment/32476345
has body: It should be grid.split("\n"); not instance.split("\n")
upvote count: 1
has comment: http://stackoverflow.com/comment/32476637
has comment: http://stackoverflow.com/comment/32476929
type: Answer
answers question: http://stackoverflow.com/q/21511133
has comment: http://stackoverflow.com/comment/32476859
has comment: http://stackoverflow.com/comment/32476601
downvote count: 0

http://stackoverflow.com/q/21492529
has answer: http://stackoverflow.com/a/21536607
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/739689
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32443565
type: Question
has comment: http://stackoverflow.com/comment/32443469
linked to: http://stackoverflow.com/q/2989560
has comment: http://stackoverflow.com/comment/32443409
downvote count: 0
accepted answer: http://stackoverflow.com/a/21536607
tagged with: jackson
has title: How to serialize complex Json object to QueryString for HTTP Get using Jackson?
favorite count: 0
has comment: http://stackoverflow.com/comment/32443504
has answer: http://stackoverflow.com/a/21513696
answer count: 3
tagged with: android
has body: Say that I have following objects: public class ComplexJacksonObject extends BaseJsonObject { public int Start; public int Count; public Person MyPerson; public class Person extends BaseJsonObject { public String Firstname; public String Lastname; public Address Where; } public class Address extends BaseJsonObject { public String Street; public int Number; } } Obviously when I request JSON of this with Jackson I get something like: public String toJson(ComplexJacksonObject obj) { try { return generateMapper().writeValueAsString(obj); } catch (JsonProcessingException e) { e.printStackTrace(); return null; } } // returned: {"MyPerson":{"Firstname":"First","Lastname":"Last","Where":{"Street":"Street","Number":15}},"Count":1,"Start":2} However what I need for QueryString is that top property pairs are converted to Key=Value&amp; format, so something like: MyPerson={"Firstname":"First","Lastname":"Last","Where":{"Street":"Street","Number":15}}&amp;Count=1&amp;Start=2 Plus of course MyPerson=[This_Part_Needs_To_Be_Url_Encoded]. Is there any generic method in Jackson that would do this for me automatically? Or will I be forced to come up with something my own? Some String replacement regex? Any ideas?
tagged with: regex
possible better answer: http://stackoverflow.com/a/21492603
has answer: http://stackoverflow.com/a/21492603
upvote count: 1
has comment: http://stackoverflow.com/comment/32443529
linked to: http://stackoverflow.com/q/18408599

http://stackoverflow.com/q/21365135
has title: Avoiding ambiguous methods caused by extends/implements
type: Question
tagged with: operator-overloading
has comment: http://stackoverflow.com/comment/32216375
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32216421
tagged with: generics
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21365193
has body: I have a convenience function which takes various types of objects and converts them in a serializable sort of way. For example, JSON-like objects are converted into JSON: public static &lt;T&gt; String process( List&lt;T&gt; list ) { if( list instanceof JSONArray ) { return ((JSONArray) list).toJSONString( ); } // stringify the list } public static String process( JSONAware object ) { // array, map, value, ... return object.toJSONString( ); } I'm using the org.json.simple library, so JSONArray extends ArrayList implements JSONAware. But that means that when I send a JSONArray, I get: reference to process is ambiguous I'm aware that it could equally go to either method, which is why I have equivalent implementations in both. Clearly I could replace both functions with one which takes arbitrary Object types, but that would remove a lot of compile-time checking which I'm not happy about. I could also rename one of the functions to force a particular choice, but that complicates the API. Is there some way I can force a particular choice, or make it obvious to the compiler that it doesn't matter which method gets called in these cases?
tagged with: java

network-programming
tags question: http://stackoverflow.com/q/21399093
tags question: http://stackoverflow.com/q/21481451
type: Tag
tags question: http://stackoverflow.com/q/21363205
tag name: network-programming
tags question: http://stackoverflow.com/q/21443173
tags question: http://stackoverflow.com/q/21437188
tags question: http://stackoverflow.com/q/21455679
tags question: http://stackoverflow.com/q/21403910
tags question: http://stackoverflow.com/q/21397715
tags question: http://stackoverflow.com/q/21366304

http://stackoverflow.com/q/21398959
accepted answer: http://stackoverflow.com/a/21399747
has comment: http://stackoverflow.com/comment/32278070
has title: File is not Deleting
possible better answer: http://stackoverflow.com/a/21399020
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3809418
has answer: http://stackoverflow.com/a/21399020
tagged with: java
has comment: http://stackoverflow.com/comment/32278077
has comment: http://stackoverflow.com/comment/32278308
type: Question
has comment: http://stackoverflow.com/comment/32277555
has answer: http://stackoverflow.com/a/21399155
score: 0
answer count: 3
upvote count: 1
has body: Am trying to deleting particular file in a folder starting with name TRTHIndicative_. But files are not deleting,am using below code testMethod(inputDir); testMethod(outputFile); private static void testMethod(String dirName){ File directory = new File(dirName); // Get all files in directory File[] files = directory.listFiles(); for (File file : files) { if (file.getName().startsWith("Indicative_")) { // Delete each file if(file.exists()){ System.out.println("File is there!"); } if (file.delete()) { // Failed to delete file System.out.println("Failed to delete " + file); } else { System.out.println("Deleted file succsfully"); } } } please check and let me know if anything wrong.
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21399747

http://stackoverflow.com/comment/32372705
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21452837
type: AnswerComment
has text: aah, I missed that, how silly I am. Thanks for your valuable answer. :)

http://stackoverflow.com/comment/32263592
score: 0
type: AnswerComment
has text: Hi, it is giving me error on this line if (value1 > String.valueOf(0) || value1 < String.valueOf(8)), saying that the < and > operator is undefined for the value string.
type: Comment
comment on: http://stackoverflow.com/a/21388168

http://stackoverflow.com/comment/32273162
score: 0
type: QuestionComment
has text: No problem. You figured it out for yourself :)
type: Comment
comment on: http://stackoverflow.com/q/21396032

http://stackoverflow.com/comment/32325473
comment on: http://stackoverflow.com/q/21416264
type: Comment
type: QuestionComment
has text: ok i replaced that with int lati=(int)Loc.getLatitude(); nok.obtainMessage(lati).sendToTarget(); i dont get the new point exception but i still am not able to see the lat in the Activity class
score: 0

http://stackoverflow.com/comment/32227984
score: 0
has text: You haven't initialized it. Java does what you tell it to do.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21371308

http://stackoverflow.com/q/21398021
has comment: http://stackoverflow.com/comment/32276372
has answer: http://stackoverflow.com/a/21398068
has body: Getting error on My array Adapter class .The error is on Startavtivity line i dont know why it is its working on other pahes but it shows error on this page .So could you please help me out ERROR" The Constructor Intent(MyArrayAdapter,Class&lt;Add_new_employee &gt;undefined) package com.example.employeemanager; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.TextView; import android.widget.Toast; public class MyArrayAdapter extends ArrayAdapter&lt;Student&gt; { Context context; int layoutResourceId; ArrayList&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); public MyArrayAdapter(Context context, int layoutResourceId,ArrayList&lt;Student&gt; studs) { super(context, layoutResourceId, studs); this.layoutResourceId = layoutResourceId; this.context = context; this.students = studs; } @Override public View getView(int position, View convertView, ViewGroup parent) { View item = convertView; StudentWrapper StudentWrapper = null; if (item == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); item = inflater.inflate(layoutResourceId, parent, false); StudentWrapper = new StudentWrapper(); StudentWrapper.name = (TextView) item.findViewById(R.id.textName); StudentWrapper.age = (TextView) item.findViewById(R.id.textAge); StudentWrapper.address = (TextView) item.findViewById(R.id.textAddr); StudentWrapper.edit = (Button) item.findViewById(R.id.btnEdit); StudentWrapper.delete = (Button) item.findViewById(R.id.btnDelete); Stu…
answer count: 2
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/21398068
upvote count: 2
has title: Getting error on start activity
has comment: http://stackoverflow.com/comment/32276077
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21398919
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21398919
type: AnsweredQuestion

http://stackoverflow.com/comment/32364930
comment on: http://stackoverflow.com/q/21448098
has text: For the last part i was wondering of another way to write for(int x:cookiesSold). But i got it now it should have been: for(int i = 0; i<numOfGirls;i++){ if(cookiesSold[i] >= 0 && cookiesSold[i] <= 10 ){ cookies1++; }else if(cookiesSold[i] >= 11 && cookiesSold[i] <=20 ){ cookies2++; }else if(cookiesSold[i] >= 21 && cookiesSold[i] <=30 ){ cookies3++; }else if(cookiesSold[i] >= 31 ){ cookies4++; } }
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21393379
type: Answer
has comment: http://stackoverflow.com/comment/32293728
upvote count: 3
has body: now the output hangs at waitFor() When you start an external process from Java using Runtime.exec you must read any output that the process produces otherwise the process may block (source: JavaDocs for java.lang.Process). Use ProcessBuilder instead, and call redirectErrorStream to merge the standard output and error streams, then read all the content from process.getInputStream() until you reach EOF. Only then is it safe to call waitFor. ProcessBuilder will also help with the spaces issue, as you must split up the command line into individual words yourself ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.getAbsolutePath());
has comment: http://stackoverflow.com/comment/32268544
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32268441
answers question: http://stackoverflow.com/q/21392344
score: 3
accepted answer of: http://stackoverflow.com/q/21392344

http://stackoverflow.com/comment/32315966
comment on: http://stackoverflow.com/a/21420483
score: 0
type: Comment
has text: Thanks for the response. +1. But I am actually more concerned with how to read the extras on the android side, as stated in the OP: `So my question is, in Java, how do I read those extra portions?`. Sorry for the confusion.
type: AnswerComment

http://stackoverflow.com/comment/32376367
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21454229
has text: The advice of using `JASPER_PRINT_LIST` is useful in your case. This both posts are relevant to your question.
type: Comment

http://stackoverflow.com/a/21352569
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32195011
accepted answer of: http://stackoverflow.com/q/21352551
has body: Replace position % 8 ==0 by position % 8 == 3
answers question: http://stackoverflow.com/q/21352551
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32467205
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21505886
has text: Ouh? I shall go give that a try post haste! thank you!

http://stackoverflow.com/comment/32202892
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21356448
has text: +1 to the question. I found the following description in 'Mastering the Java Persistence API' book: "The find() operation returns a managed entity instance in all cases except when invoked outside of a transaction on a transaction-scoped entity manager. In this case, the entity instance is returned in a detached state." so the above description seems to be contradictory to the class in which find() is invoked outside of a transaction on an extended entity manager ... or we are missing something here (?)
score: 1

http://stackoverflow.com/comment/32372785
comment on: http://stackoverflow.com/a/21451887
score: 0
has text: you have to design it in both orientation as i given the link follow that. and accept the ans if get solved
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21442821
type: Answer
has comment: http://stackoverflow.com/comment/32399672
has body: Maybe you write to the buffer to early? If you have many threads, you should try to use AtomicInteger to be sure all threads get the same values of X and Y (it's worth the effort!).
has comment: http://stackoverflow.com/comment/32355022
score: 0
has comment: http://stackoverflow.com/comment/32398405
answers question: http://stackoverflow.com/q/21442768

http://stackoverflow.com/comment/32317523
has text: @MattD That's a rather large issue on its own. Our application receives tile bitmaps from a geoserver to be placed over top a google map android map. Unfortunately geoserver does not set opacity of the tiles (as far as we can tell); this must be done client-side. Unfortunately, android does not seem to have the usual `BufferedImage`-type classes I would normally use in Java, with the exception of [`Bitmap`](http://developer.android.com/reference/android/graphics/Bitmap.html), which does not do what I need.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21419558
type: Comment

http://stackoverflow.com/comment/32218802
type: QuestionComment
comment on: http://stackoverflow.com/q/21366491
has text: +1; this is the most complete and well-written new question I have seen in a few days.
score: 0
type: Comment

http://stackoverflow.com/q/21508044
has comment: http://stackoverflow.com/comment/32470627
linked to: http://stackoverflow.com/q/7804335
tagged with: java
has answer: http://stackoverflow.com/a/21508059
linked to: http://stackoverflow.com/q/10695143
type: Question
answer count: 2
has title: Splitting a String using split() not getting required result
score: 0
duplicate of: http://stackoverflow.com/q/7804335
has body: I have a String(freeText) "Manas \"Jaikant IBM\"". I want to split into two strings: String normalMatch="Manas"; String exactMatch="Jaikant IBM"; It means that String normalMatch contains Manas and String exactMatch contains Jaikant IBM. i am using the split() method of String class in Java String[] splittedText= freeText.split("\\s"); I am getting 3 string elements but i need 2 string elements only.
has answer: http://stackoverflow.com/a/21508056
type: UnansweredQuestion

http://stackoverflow.com/comment/32482508
comment on: http://stackoverflow.com/a/21514425
type: Comment
score: 0
has text: I just posted it for m.sharifi
type: AnswerComment

http://stackoverflow.com/q/21504480
tagged with: java
tagged with: cycle
has answer: http://stackoverflow.com/a/21504553
has title: Java previous button cycle
type: Question
has body: I am trying to create previous and next buttons in addition to my first and last buttons. I have managed to get them all to work. However, I cannot seem to get the previous and next buttons to cycle through the array and instead I get errors when reaching the end. I'm not even sure where to start, but all help is very much appreciated! JButton firstButton = new JButton("First"); buttonPanel.add(firstButton); firstButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bookIndex = 0; prepareDisplay(inventoryBook[bookIndex], textArea); } }); JButton previousButton = new JButton("Previous"); buttonPanel.add(previousButton); previousButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bookIndex = bookIndex - 1; prepareDisplay(inventoryBook[bookIndex], textArea); } }); JButton nextButton = new JButton("Next"); buttonPanel.add(nextButton); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bookIndex = bookIndex + 1; prepareDisplay(inventoryBook[bookIndex], textArea); } }); JButton lastButton = new JButton("Last"); buttonPanel.add(lastButton); lastButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bookIndex = (inventoryBook.length - 1); prepareDisplay(inventoryBook[bookIndex], textArea); } });
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21504531
has answer: http://stackoverflow.com/a/21504531
has answer: http://stackoverflow.com/a/21504547
score: 0
has comment: http://stackoverflow.com/comment/32464412
tagged with: button
has answer: http://stackoverflow.com/a/21504555
answer count: 4
tagged with: swing
accepted answer: http://stackoverflow.com/a/21504547
type: AnsweredQuestion

http://stackoverflow.com/q/21508930
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32472969
has comment: http://stackoverflow.com/comment/32473183
has answer: http://stackoverflow.com/a/23442286
has title: Android: Issue with regex matcher.find() always returns false
downvote count: 0
answer count: 1
favorite count: 0
has body: I want to create a payment form like the below sample: When user fills his credit card number, it should display the card logo on the left hand side in the edit text. Below is my code with which I started: String pattern = "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$"; final Pattern pattern1 = Pattern.compile(pattern); edtCardNo.addTextChangedListener(new TextWatcher() { private boolean mFormatting; // this is a flag which prevents the // stack overflow. private int mAfter; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub mAfter = after; } @Override public void afterTextChanged(Editable s) { Log.e("CCTest", "after text changed"); // TODO Auto-generated method stub if (!mFormatting) { Log.e("CCTest", "after text changed if"); mFormatting = true; // using US formatting... if (mAfter != 0) { // in case back space ain't clicked... Log.e("CCTest", "after text changed mAfter != 0 " + s.toString()); Matcher matcher = pattern1.matcher(s.toString()); Log.e("CCTest", "after text changed mAfter != 0 " + matcher.find()); while (matcher.find()) { Log.e("CCTest", "matcher find"); if (s.charAt(0) == '4') { Log.e("CCTest", "matcher find if"); Toast.makeText(getApplicationContext(), "VISA", Toast.LENGTH_LONG).show(); } } } mFormatting = false; } } }); } But, matcher.find() always returns false hence toast message is not showing up. I am not getting where did I made mistake.
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: regex
score: 2

http://stackoverflow.com/q/21453978
has title: Internal cast of collection elements
favorite count: 0
score: -1
has body: In Java is there a way to cast the following: ArrayList&lt;IMyType&gt; list into ArrayList&lt;MyType&gt; if MyType implements IMyType ?
has answer: http://stackoverflow.com/a/21454108
linked to: http://stackoverflow.com/q/2745265
has answer: http://stackoverflow.com/a/21454140
has comment: http://stackoverflow.com/comment/32374762
answer count: 5
has answer: http://stackoverflow.com/a/21454011
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21454140
tagged with: java
accepted answer: http://stackoverflow.com/a/21454108
tagged with: collections
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21454067
tagged with: casting
has answer: http://stackoverflow.com/a/21454134
upvote count: 0
has comment: http://stackoverflow.com/comment/32374795

http://stackoverflow.com/comment/32415328
comment on: http://stackoverflow.com/a/21476418
score: 0
type: Comment
has text: What did you not understand? You make an array of objects and each element points to an object therefor. Matrix[][] 2d_matrix_to_matrix = new Matrix[10][10]; Matrix[0][0] = new Matrix(int m, int n); This creates 2d squared array containing each element a matrix of size m x n
type: AnswerComment

http://stackoverflow.com/comment/32477529
type: QuestionComment
comment on: http://stackoverflow.com/q/21511981
type: Comment
has text: What do mean upload via native Java? You want to POST/PUT to a http URL? Why not do that via Java, not the browser. The browser has all sorts of protections around the upload feature, for security reasons.
score: 0

http://stackoverflow.com/comment/32308502
has text: If you want to, say, "ORDER BY categoryId ASC, date DESC", you will need a custom index to support this. [This page](https://developers.google.com/appengine/docs/java/config/indexconfig) should help.
comment on: http://stackoverflow.com/q/21406407
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21411320
type: Question
has comment: http://stackoverflow.com/comment/32299120
has comment: http://stackoverflow.com/comment/32299789
has comment: http://stackoverflow.com/comment/32299151
has comment: http://stackoverflow.com/comment/32299108
answer count: 2
accepted answer: http://stackoverflow.com/a/21411717
has comment: http://stackoverflow.com/comment/32299305
linked to: http://stackoverflow.com/q/8561710
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32299395
has comment: http://stackoverflow.com/comment/32299464
tagged with: double
has comment: http://stackoverflow.com/comment/32299418
has comment: http://stackoverflow.com/comment/32299495
possible better answer: http://stackoverflow.com/a/21411867
type: AnsweredQuestion
has title: caching of java.lang.Double
has comment: http://stackoverflow.com/comment/32299171
has answer: http://stackoverflow.com/a/21411867
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21411717
has comment: http://stackoverflow.com/comment/32299146
upvote count: 1
has body: I have lots of Doubles in my program (notice the capital D) and I was thinking of a possible caching mechanism. By looking at the Double constructors / factories, none is actually implementing a "cache" (like the way Integer, works, for example when using valueOf). I was thinking to implement such a cache by using a HashMap&lt;String,Double&gt; where the key is the string representation. Any visible drawbacks / cons of such implementation? I wonder why this wasn't done or provided yet by Java.

http://stackoverflow.com/comment/32318521
has text: why not using menu options?
comment on: http://stackoverflow.com/q/21422294
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21499012
tagged with: request
tagged with: php
tagged with: http
type: Question
has body: I have an application (Java) that needs to send json to a php web service. This is my method to send User in JSON : public void login(User user) throws IOException { Gson gson = new Gson(); String json = gson.toJson(user); System.out.println(json); String url = "http://localhost/testserveur/index.php"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection)obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("json", json); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.flush(); } int responseCode = con.getResponseCode(); System.out.println(responseCode); } And my php code : $string=$_POST['json']; I tried to insert in my database but $_POST['json'] does not exist.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32454618
has title: Java HTTP POST request (JSON) to PHP server
has answer: http://stackoverflow.com/a/21508841
score: 0
has answer: http://stackoverflow.com/a/21499194
answer count: 3
has answer: http://stackoverflow.com/a/21499931
type: UnansweredQuestion

logging
tags question: http://stackoverflow.com/q/21471408
tags question: http://stackoverflow.com/q/21399433
tags question: http://stackoverflow.com/q/21373549
tag name: logging
tags question: http://stackoverflow.com/q/21440854
tags question: http://stackoverflow.com/q/21427499
tags question: http://stackoverflow.com/q/21441149
tags question: http://stackoverflow.com/q/21412935
tags question: http://stackoverflow.com/q/21435990
tags question: http://stackoverflow.com/q/21430298
tags question: http://stackoverflow.com/q/21421081
tags question: http://stackoverflow.com/q/21476851
tags question: http://stackoverflow.com/q/21368757
type: Tag
tags question: http://stackoverflow.com/q/21375066
tags question: http://stackoverflow.com/q/21512629
tags question: http://stackoverflow.com/q/21436212

http://stackoverflow.com/q/21383984
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32250770
possible better answer: http://stackoverflow.com/a/21384138
upvote count: 2
has answer: http://stackoverflow.com/a/21384138
has answer: http://stackoverflow.com/a/21384193
accepted answer: http://stackoverflow.com/a/21384193
has answer: http://stackoverflow.com/a/21384186
favorite count: 0
has body: I am attempting to call a custom class and method on my Application start-up to perform dev testing. I have stored the setting for my test class and method in my SettingsClass as shown below. public class SettingsClass { public static final boolean BOOT_TEST = true; public static final String BOOT_CLASS = "MyClass"; public static final String BOOT_METHOD = "MyMethod"; } My Main Class. public class MainClass { public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException { if(SettingsClass.BOOT_TEST) { Method method = getDeclaredMethodClass(SettingsClass.BOOT_CLASS).getDeclaredMethod(SettingsClass.BOOT_METHOD); method.invoke(); System.exit(1); } } Is it possible to perform the above action? Any help would be appreciated.
answer count: 4
has title: Invoking a Class and Method Using Variables In Java
has comment: http://stackoverflow.com/comment/32250805
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21384222
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/32300481
type: AnswerComment
has text: alright now i suddenly dont get a malformed packet when using port 6000. still not fixed though
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21408768

http://stackoverflow.com/q/21407840
has answer: http://stackoverflow.com/a/21408197
has comment: http://stackoverflow.com/comment/74671582
upvote count: 36
accepted answer: http://stackoverflow.com/a/21408197
type: AnsweredQuestion
tagged with: validation
downvote count: 0
favorite count: 0
has body: For quite some time I try to figure out where validation of user input should take place in a Spring MVC application. In many online blogs and tutorials I basically read that a controller should validate the users input and, if invalid, respond to the user by showing a page containing the error message. My current understanding of the Spring and Spring MVC layering system, however, is that a Controller is a only shallow interface between the application logic (service layer) and the "web world", allowing usage of the service layer from the web. Also, as far as I can see, Spring MVC does only provide reasonable tools for validation in a Controller. If now validation takes place in a Controller, if at some later point I want to untie the application logic from the "web world", validation logic must be reimplemented in the new environment (e.g. a desktop application using Swing). In my opinion, the ability to decide which operations are "valid" on domain objects, and what "valid" states such objects may have, is core part of the service layer, and not the concern of some other part of the application (e.g. Controllers). In this context, why is it "good practice" to place input validation logic in the controller layer and not the service layer?
type: Question
answer count: 2
has title: Validation in Spring MVC in Controllers or Service Layer?
possible better answer: http://stackoverflow.com/a/21408306
tagged with: spring
has answer: http://stackoverflow.com/a/21408306
tagged with: spring-mvc
tagged with: java
score: 36

http://stackoverflow.com/comment/117210273
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33569459
has text: How do you create the s3Client?, what is builder? what should contain s3RelativeFilePath?

http://stackoverflow.com/a/21410078
has body: I can think of two techniques for this. Technique: Old School Use a parameter of type WebRequest in the handler method. This gives access to the request parameters. Then you query the parameters you care about to determine the source of the request and to determine the parameters that you require. @RequestMethod("/blammy") public String blammy( final ModelMap model, final WebRequest webRequest) { String something = webRequest.getParameter("something"); if ("hoot".equals(something)) { ... process a hoot request } else if ("bark".equals(something)) { ... process a bark request } } Technique: Front Controller Proved a method for each form then forward the call to a common method. @RequestMethod("/fish") public String fish( @ModelAttribute final Fish fish, final ModelMap model) { return commonMethod(model, (Animal)fish); } @RequestMethod("/cat") public String cat( @ModelAttribute final Cat cat, final ModelMap model) { return commonMethod(model, (Animal)cat); } public String commonMethod( final ModelMap model, final Animal animal) { ... blam }
score: 0
answers question: http://stackoverflow.com/q/21409408
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21409408
type: Answer
has comment: http://stackoverflow.com/comment/32299647

android
tags question: http://stackoverflow.com/q/21446445
tags question: http://stackoverflow.com/q/21423537
tags question: http://stackoverflow.com/q/21359944
tags question: http://stackoverflow.com/q/21424846
tags question: http://stackoverflow.com/q/21413349
tags question: http://stackoverflow.com/q/21362571
tags question: http://stackoverflow.com/q/21473983
tags question: http://stackoverflow.com/q/21447855
tags question: http://stackoverflow.com/q/21368723
tags question: http://stackoverflow.com/q/21404162
tags question: http://stackoverflow.com/q/21379302
tags question: http://stackoverflow.com/q/21459277
tags question: http://stackoverflow.com/q/21500807
tags question: http://stackoverflow.com/q/21477657
tags question: http://stackoverflow.com/q/21436806
tags question: http://stackoverflow.com/q/21488441
tags question: http://stackoverflow.com/q/21398631
tags question: http://stackoverflow.com/q/21499619
tags question: http://stackoverflow.com/q/21465611
tags question: http://stackoverflow.com/q/21488438
tags question: http://stackoverflow.com/q/21498381
tags question: http://stackoverflow.com/q/21468747
tags question: http://stackoverflow.com/q/21432911
tags question: http://stackoverflow.com/q/21392944
tags question: http://stackoverflow.com/q/21364344
tags question: http://stackoverflow.com/q/21432781
tags question: http://stackoverflow.com/q/21419960
tags question: http://stackoverflow.com/q/21459982
tags question: http://stackoverflow.com/q/21408199
tags question: http://stackoverflow.com/q/21430553
tags question: http://stackoverflow.com/q/21402641
tags question: http://stackoverflow.com/q/21374557
tags question: http://stackoverflow.com/q/21364461
tags question: http://stackoverflow.com/q/21416840
tags question: http://stackoverflow.com/q/21473679
tags question: http://stackoverflow.com/q/21435953
tags question: http://stackoverflow.com/q/21467204
tags question: http://stackoverflow.com/q/21420264
tags question: http://stackoverflow.com/q/21398453
tags question: http://stackoverflow.com/q/21374638
tags question: http://stackoverflow.com/q/21422294
tags question: http://stackoverflow.com/q/21501075
tags question: http://stackoverflow.com/q/21499084
tags question: http://stackoverflow.com/q/21368551
tags question: http://stackoverflow.com/q/21400851
tags question: http://stackoverflow.com/q/21420997
tags question: http://stackoverflow.com/q/21497856
tags question: http://stackoverflow.com/q/21391651
tags question: http://stackoverflow.com/q/21362605
tags question: http://stackoverflow.com/q/21469006
tags question: http://stackoverflow.com/q/21451139
tags question: http://stackoverflow.com/q/21492247
tags question: http://stackoverflow.com/q/21477707
tags question: http://stackoverflow.com/q/21452099
tags question: http://stackoverflow.com/q/21434453
tags question: http://stackoverflow.com/q/21414296
tags question: http://stackoverflow.com/q/21463777
tags question: http://stackoverflow.com/q/21422583
tags question: http://stackoverflow.com/q/21376957
tags question: http://stackoverflow.com/q/21454126
tags question: http://stackoverflow.com/q/21511850
tags question: http://stackoverflow.com/q/21382932
tags question: http://stackoverflow.com/q/21380321
tags question: http://stackoverflow.com/q/21423151
tags question: http://stackoverflow.com/q/21374255
tags question: http://stackoverflow.com/q/21457851
tags question: http://stackoverflow.com/q/21485651
tags question: http://stackoverflow.com/q/21393082
tags question: http://stackoverflow.com/q/21352851
tags question: http://stackoverflow.com/q/21366157
tags question: http://stackoverflow.com/q/21432458
tags question: http://stackoverflow.com/q/21369586
tags question: http://stackoverflow.com/q/21381214
tags question: http://stackoverflow.com/q/21501651
tags question: http://stackoverflow.com/q/21394370
tags question: http://stackoverflow.com/q/21478339
tags question: http://stackoverflow.com/q/21449147
tags question: http://stackoverflow.com/q/21423518
tags question: http://stackoverflow.com/q/21468073
tags question: http://stackoverflow.com/q/21396694

http://stackoverflow.com/comment/32301108
type: QuestionComment
has text: Related: [incompatible types and fresh type-variable](http://stackoverflow.com/questions/20543966/incompatible-types-and-fresh-type-variable)
comment on: http://stackoverflow.com/q/21409802
score: 0
type: Comment

http://stackoverflow.com/comment/32295413
has text: I don't think Mockito works well with static methods... See this http://stackoverflow.com/questions/4482315/why-does-mockito-not-mock-static-methods for example
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21409230

http://stackoverflow.com/q/21428402
tagged with: vimeo
tagged with: java
has answer: http://stackoverflow.com/a/21506405
tagged with: vitamio
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21428562
type: UnansweredQuestion
tagged with: android
has title: Vitamio Not working @android app
has body: I am trying to implement Vitamio lib for vimeo but it's always showing message that it can't play. Even I tried for youtube, it's not working because of the same error message. mVideoView.setVideoPath("//www.youtube.com/embed/Bp3i71jaWNo"); //or vimeo mVideoView.setMediaController(new MediaController(this)); mVideoView.requestFocus(); mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { // optional need Vitamio 4.0 mediaPlayer.setPlaybackSpeed(1.0f); } }); On logcat I can see this message: avformat_open_input no such file or directory error (1, -2) Or this one: avformat_open_input i/o error -5
type: Question
tagged with: android-mediaplayer

http://stackoverflow.com/comment/32315002
type: Comment
comment on: http://stackoverflow.com/a/21411761
has text: I am starting programmer but I am really thankful; to you , You have help me a lot, but request you tp please at least give me the hint what changes need to be done in pair class thanks a lot
score: 0
type: AnswerComment

http://stackoverflow.com/a/21371064
type: Answer
score: 8
has body: Here's a pretty simple test to check behavior (Spring 4.0.0.RELEASE) @Controller @RequestMapping("/service") public class NewController { @RequestMapping(method = RequestMethod.GET) public @ResponseBody String test(ModelMap model) { System.out.println(requestEntity.request.getAttribute("type")); // get it requestEntity.request.setAttribute("type", "Scope"); // set it so that we can make sure that our second request doesn't contain it System.out.println(requestEntity.request.getClass()); return "whatever"; } @Autowired private Foo requestEntity; } and @Component public class Foo { @Autowired public HttpServletRequest request; } If you send a request, you'll note that the attribute returned is always null and that the class is something like class com.sun.proxy.$Proxy19 Therefore you are always getting a different HttpServletRequest object even though the @Component bean is singleton scoped. Here's the explanation: When you instantiate a WebApplicationContent, it registers some special ObjectFactory instances for resolving some web types in the underlying BeanFactory. This is done in WebApplicationContextUtils.registerWebApplicationScopes(..). One of these is the following beanFactory.registerResolvableDependency(ServletRequest.class, new RequestObjectFactory()); When Spring scans your beans and determines that it needs to autowire the HttpServletRequest (which is a sub type of ServletRequest) field, it will look in its map of resolvable dependencies and get this RequestObjectFactory. Because this is an ObjectFactory and the injection target is an interface type, Spring will create a Proxy of that type that delegates to the object created/returned by the RequestObjectFactory on each request. This is done in AutowireUtils.resolveAutowiringValue(..). As such, your Foo bean does not need to be request scoped.
answers question: http://stackoverflow.com/q/21370678
accepted answer of: http://stackoverflow.com/q/21370678
type: AcceptedAnswer
downvote count: 0
upvote count: 8

http://stackoverflow.com/a/21360172
has body: In addition to the other good answers about using AsyncTask or runOnUiThread(), you could define a private member as a Runnable, like this: private Runnable mytask = new Runnable() { @Override public void run() { runOnUiThread(new Runnable() { public void run() { demoBt.setText("Running..."); } }); try { sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } runOnUiThread(new Runnable() { public void run() { demoBt.setText("Finished..."); } }); } }; Then, whenever you want to run it, do new Thread(mytask).start();
score: 5
answers question: http://stackoverflow.com/q/21359813
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/21448563
has body: I think what you have will work fine. You can make the line break part a little more compact if you want, and you don't need ^ and $ if you are using matches(): String regex = ".{0,100}(?:[\r\n]+.{0,100}){0,2}"; EDIT After some more thoughts I realized the newline suggestion above will match 4 (or more) lines as long as a couple of them are empty. So, we are back to your suggested example. Oh well, at least the start and end characters can be omitted. String regex = ".{0,100}(?:(?:\r\n|[\r\n]).{0,100}){0,2}";
accepted answer of: http://stackoverflow.com/q/21448378
has comment: http://stackoverflow.com/comment/32366702
answers question: http://stackoverflow.com/q/21448378
type: Answer
upvote count: 4
downvote count: 0
type: AcceptedAnswer
score: 4

http://stackoverflow.com/comment/32462171
comment on: http://stackoverflow.com/q/21390972
score: 0
type: Comment
type: QuestionComment
has text: So if I'm understanding that correctly, I would create overloads that look the same other than taking a Pointer arg in place of MSG. But using them, would it look like the current while loop setup with Pointer in place of MSG? The current code has changed a bit and looks like this: https://gist.github.com/Sharparam/ce0c8d2f04308d4c27f7 (See line 111 for message loop)

http://stackoverflow.com/a/21505646
has body: The docs for setUndecorated(boolean) clearly state.. Disables or enables decorations for this frame. This method can only be called while the frame is not displayable. ..
has comment: http://stackoverflow.com/comment/32466688
downvote count: 0
has comment: http://stackoverflow.com/comment/32466866
has comment: http://stackoverflow.com/comment/32466711
has comment: http://stackoverflow.com/comment/32466595
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21505477
score: 1

http://stackoverflow.com/q/21443204
answer count: 1
tagged with: wait
type: UnansweredQuestion
tagged with: events
tagged with: listener
type: Question
has comment: http://stackoverflow.com/comment/32357421
has body: My problem: I've got two events listeners attached to a JLabel and a variable A boolean A = false; public void mouseEntered(MouseEvent evt) { ... } public void mouseExited(MouseEvent evt) { ... } What I would like to do is the following: when mouseExited is triggered wait during X milliseconds for catching some changes (if happened) in the A variable due to some code into the mouseEntered event listener. I already tried with Timer but doesn't work --> I can't catch the new value of variable A during the wait period. I can only catch it after Timer is out. Any ideas to implement this?
has answer: http://stackoverflow.com/a/21456984
score: 0
tagged with: java
has title: Waiting between event listeners java

http://stackoverflow.com/comment/32372372
comment on: http://stackoverflow.com/a/21452380
has text: This is the code from the Javascript and I want to keep the allowDelete after the reloading or to reload again only the if-loop that waits the allowdelete . `<% if (Error) { %> <% } %> '`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32331630
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21428804
has text: A component can only have one parent container. Instead have each table object share the same model.
score: 3

http://stackoverflow.com/q/21461075
has title: Camel Multicast not working
has comment: http://stackoverflow.com/comment/32389168
accepted answer: http://stackoverflow.com/a/21461918
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
tagged with: routes
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21488756
has comment: http://stackoverflow.com/comment/32390243
has answer: http://stackoverflow.com/a/21488756
has body: Camel 2.11.0 here. I have the following Camel routes: &lt;route id="main-route"&gt; &lt;from uri="timer://runOnce?repeatCount=1&amp;amp;delay=10" /&gt; &lt;to uri="bean:loggingBean?method=main" /&gt; &lt;to uri="bean:processorBean?method=doSomething" /&gt; &lt;to uri="bean:loggingBean?method=afterProcessing" /&gt; &lt;multicast&gt; &lt;to uri="direct:validator" /&gt; &lt;to uri="direct:rejector" /&gt; &lt;/multicast&gt; &lt;/route&gt; &lt;route id="validator-route"&gt; &lt;from uri="direct:validator" /&gt; &lt;to uri="bean:loggingBean?method=validator" /&gt; &lt;/route&gt; &lt;route id="rejector-route"&gt; &lt;from uri="direct:rejector" /&gt; &lt;to uri="bean:loggingBean?method=rejector" /&gt; &lt;/route&gt; ...where the loggingBean looks like: public class LoggingBean { public void main(Exchange e) { System.out.println("Starting main route..."); } public void afterProcessing(Exchange e) { System.out.println("Processing input..."); } public void validator(Exchange e) { System.out.println("In validator route..."); } public void rejector(Exchange e) { System.out.println("In rejector route..."); } } When I run this code, I get the following console output: Starting main route... Processing input... In validator route... Because we're multi-casting here, I would have expected it to also include the rejector's output and look like: Starting main route... Processing input... In validator route... In rejector route... So it seems that the Multicaster is only sending to the first element nested inside it (in the Spring XML) and not the second. Hmmm, interesting. So then I changed the &lt;multicast&gt; element to look like the following: &lt;multicast&gt; &lt;to uri="direct:rejector" /&gt; &lt;to uri="direct:validator" /&gt; &lt;/multicast&gt; This time, the console output is as follows: Starting main route... Processing input... In rejector route... So this is confirmed: the &lt;multicast&gt; is only broadcasting the exchange to the first child element listed underneath it.…
score: 0
has answer: http://stackoverflow.com/a/21461918
tagged with: multicast

http://stackoverflow.com/comment/32216480
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/21365174
has text: _It's not working_ doesn't tell us anything. Do you get any errors? In what way isn't it working?

http://stackoverflow.com/comment/32217558
type: Comment
comment on: http://stackoverflow.com/q/21365759
has text: ...so maybe you should `trim` before splitting?
type: QuestionComment
score: 0

http://stackoverflow.com/a/21407364
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/21406751
upvote count: 1
has body: Your AbstractChecker is doing a Selenium test, your ActivityInstrumentationTestCase2 does an Android Instrument Test. With the information you provided it is not actually possible to combine the two and even if it was I don't think you would get the result you expected. You should look within the AbstractChecker framework and see what functionality you want. Abstract and extract this out into a class that you can use as a composite for yourActivityInstrumentationTestCase2. Java does not support multiple inheritance therefore you cannot do Test extends AbstractChecker and ActivityInstrumentationTestCase2 { A good programming approach is to prefer composition over inheritance, that way you would not get into the situation, and you could compose your Test of a Checker and TestCase. It is no secret what ActivityInstrumentationTestCase2 does for you here is the source take a look. If you want to consider composition something like: public class Test extends ActivityInstrumentationTestCase2 { // Forced extension due to library private final Checker checker; public Test(){ super((Class&lt;Activity&gt;) launchActivityClass); checker = SomeFactory.getChecker(); } // do your tests and use your checker } So I'm sorry but I think the answer to your question is no, but hopefully there are some keywords in the above to help you research more.

http://stackoverflow.com/comment/32480682
comment on: http://stackoverflow.com/q/21513597
score: 0
type: Comment
type: QuestionComment
has text: Did you implement `equals` for your ArticuloED?

http://stackoverflow.com/q/21419783
has answer: http://stackoverflow.com/a/21421687
favorite count: 0
has body: I am using the poi library to deal with the MS files. To extract the embedded ole object for docx, xlsx and pptx, I use method:PackagePart pp = src.getAllEmbedds() But for the old format of MS files like doc, xls and ppt, there is no such method. So I am using the extractor: POITextExtractor[] embeddedExtractors = ExtractorFactory.getEmbededDocsTextExtractors(oleTextExtractor); But this can only extract the text not the whole file. Can anyone help me with extracting doc, ppt and xls files?
has answer: http://stackoverflow.com/a/43875267
possible better answer: http://stackoverflow.com/a/43875201
type: AnsweredQuestion
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/21421687
has title: Extract embedded files from doc using java
has answer: http://stackoverflow.com/a/43875201
upvote count: 1
type: Question
tagged with: java
downvote count: 0
score: 1
answer count: 3

http://stackoverflow.com/comment/32391318
comment on: http://stackoverflow.com/q/21439690
score: 0
type: QuestionComment
has text: Yes, I have the gson dependecy in the pom.xml. It works for some dependencies, but not for gson.
type: Comment

http://stackoverflow.com/q/21453203
has answer: http://stackoverflow.com/a/21455335
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jaxb
score: 0
answer count: 2
has title: JSon array of arrays
linked to: http://stackoverflow.com/q/9853017
has comment: http://stackoverflow.com/comment/32374061
tagged with: arrays
has comment: http://stackoverflow.com/comment/32374838
has comment: http://stackoverflow.com/comment/32374722
has answer: http://stackoverflow.com/a/21481235
has comment: http://stackoverflow.com/comment/32373404
tagged with: xsd
has comment: http://stackoverflow.com/comment/32373510
has comment: http://stackoverflow.com/comment/32374974
has body: I'm trying to write a JSon document and its relative xsd file in order to generate JAXB classes and I don't think if I'm doing it in the right way. what I want is a structure like this: team -name="name" -game="game" -intarray int int ... int -values [int1, int2] [int1, int2] ... [int1, int2] -stringarrays [string1, string2,...., stringn] [string1, string2,...., stringn] ... [string1, string2,...., stringn] so I wrote my xsd and a example string in the json file to attempt to read it example line: {"name": "Team 1", "game": "game", "intarray": [1, 2, 3, 4, 5, 6], "values": [[10,20], [10,80], [10,30], [10,60], [10,50], [10,30]], "stringarrays": [["Azione", "Azione"], ["Azione", "Azione"], ["Azione", "Azione"], ["Azione", "Azione"], ["Azione", "Azione"], ["Azione", "Azione"]]} and this is my xsd <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/teams" xmlns:tns="http://www.example.org/teams" elementFormDefault="qualified"> eclipse keeps telling me that I have a MalformedJson, i think the problem is with the json line, i think that the xsd is almost correct, but i could be wrong :) The code that writes the JSON document looks like this: Gson gson = new Gson(); String json = gson.toJson(team); try { FileWriter gwriter = new FileWriter("c:\\file.json"); gwriter.write(json); gwriter.close(); } catch(Exception e) { } Which produces this JSON document: { "nome":"team1", "game":"game", "intarray":[1,2], "arrayofintarrays":{ "couple":[] }, ‌​"arrayofstringarrays":{ "mossearray":[] } } This JSON document is then read with like this: Team[] teams_loaded= null; try { Reader reader = new InputStreamReader(DexLoader.class.getClassLoader().getResourceAsStream("teams.tx‌​t")); Gson gson = new GsonBuilder().create(); JsonReader read = new JsonReader(reader); teams_loaded = gson.fromJson(read, Team[].class); } catch(Exception c) { c.printStackTrace(); } thanks!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32380361
type: Question
has comment: http://stackoverflow.com/comment/32374546

http://stackoverflow.com/comment/32395318
type: Comment
has text: @gian1200, no, because the alignment is correct on API 17 and below, but not ont API 18 and above. I changed the android:targetSdkVersion to 17 instead of 19 and the problem disappeared, but it is a trick, not a solution : /
type: QuestionComment
comment on: http://stackoverflow.com/q/21444425
score: 0

http://stackoverflow.com/a/21355567
type: Answer
accepted answer of: http://stackoverflow.com/q/21355520
has body: You should be looping over all the lines - and then if the line matches, then print it out (or whatever). For example: while (scanner.hasNextLine()) { String line = scanner.nextLine(); // Now check the line, and do whatever you need. } Or you could still use findInLine, just explicitly calling nextLine as well: while (scanner.hasNextLine()) { if (scanner.findInLine(...)) { ... } // Read to the end of the line whether we found something or not scanner.nextLine(); }
answers question: http://stackoverflow.com/q/21355520
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32459557
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21497353
type: Comment
has text: @Hustl3r28 However, when it's not a back to back click, that would imply that a *different* button has been pressed. So you need to keep track of the other buttons.

http://stackoverflow.com/q/21426093
score: 0
answer count: 3
has body: I have a simple java project in intellij idea, I want to create a BufferedReader object from a local file in my project with local path to it, like this: BufferedReader reader = new BufferedReader(new FileReader("/LOCAL/PATH/TO/PRIMES.TXT")); but I'm getting an error saying "no such file or directory" when I try with some local paths like: /resources/primes.txt or /primes.txt or primes.txt my file is located in src/resources/primes.txt how should I fix this?
has comment: http://stackoverflow.com/comment/32324779
has answer: http://stackoverflow.com/a/21426235
has answer: http://stackoverflow.com/a/21426681
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15281428
tagged with: java
has comment: http://stackoverflow.com/comment/32324805
has answer: http://stackoverflow.com/a/21426229
type: Question
has title: how to use local project files with local paths
tagged with: relative-path

http://stackoverflow.com/q/21443440
has body: I want to create an applet with first form have multiple button, each button takes me to another form to perform a specific task. How to do that using a Java applet?
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/32361016
answer count: 1
tagged with: applet
score: 0
tagged with: japplet
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/21446037
has title: How to navigate between applet forms?
tagged with: java
type: Question

http://stackoverflow.com/a/21494132
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/32446591
score: 1
answers question: http://stackoverflow.com/q/21494106
has comment: http://stackoverflow.com/comment/32446736
has body: Replace every "@" in user or password with "%40"
upvote count: 2

http://stackoverflow.com/a/21412262
has comment: http://stackoverflow.com/comment/32313722
score: 2
has comment: http://stackoverflow.com/comment/32301475
has comment: http://stackoverflow.com/comment/32301513
downvote count: 0
has comment: http://stackoverflow.com/comment/32306548
has comment: http://stackoverflow.com/comment/32301065
type: Answer
answers question: http://stackoverflow.com/q/21412148
upvote count: 2
has body: First you don't need 2 arrays, you just need one of them, and keep state of capitalization (in a boolean isCapital for example). Second, if you use an array of letters, that would be far easier to use for your problem. char[] letters = {'A', 'B', 'C'...}; Then you just have to apply the shift to the index of the letter modulus the size of the array.

http://stackoverflow.com/comment/32426732
comment on: http://stackoverflow.com/a/21472111
type: Comment
score: 0
has text: Just added the answer above. Take another look.
type: AnswerComment

http://stackoverflow.com/q/21406511
tagged with: java
has answer: http://stackoverflow.com/a/21406789
accepted answer: http://stackoverflow.com/a/21406789
type: Question
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to know what is really local and remote EJB. Is remote an EJB which is the same jar file ? Is remote an EJB which is in another JVM ? What is it anyway? If I have deployed two different EAR files in the same server domain do I need to lookup for EJBs in each other? Lookup is achieved through annotations ? I mean EJB 3.1.
has title: What is Remote EJB?
score: 1
has comment: http://stackoverflow.com/comment/32290580
tagged with: ejb-3.1
tagged with: jakarta-ee
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2986993

http://stackoverflow.com/comment/32311915
score: 5
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21418508
has text: Where is the stack trace?

http://stackoverflow.com/comment/32287427
comment on: http://stackoverflow.com/a/21404741
score: 0
type: AnswerComment
type: Comment
has text: Also, how big are the images you are loading?

http://stackoverflow.com/q/21419963
favorite count: 0
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21424376
upvote count: 3
tagged with: java
downvote count: 1
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/32319549
tagged with: apache-camel
has title: How can I make Apache Camel Routes faster?
tagged with: routes
has comment: http://stackoverflow.com/comment/32326632
accepted answer: http://stackoverflow.com/a/21424376
has body: What I would like to do is increase the speed of the routes, meaning I would like to achieve more routes being executed per second. Can I run some of the 100 routes I am running right now at the same time on separate threads? If so, how do I do this? I am running a plain route like this and gathering the starting and ending time of the main loop: import java.util.Calendar; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.AdviceWithRouteBuilder; import org.apache.camel.impl.DefaultCamelContext; public class TestAdviceRoute extends AdviceWithRouteBuilder { @Override public void configure() throws Exception { from("direct:start") .routeId("Doug") .process(new PrintProcessor()) .end() ; } } @SuppressWarnings("deprecation") public static void main(String[] args) throws Exception{ CamelContext context = new DefaultCamelContext(); System.out.println("Start Time:" + Calendar.getInstance().getTime()); for (int i = 0; i &lt; 100; i++) { context.addRoutes(new TestAdviceRoute()); context.getRouteDefinition("Doug").adviceWith(context, new WrapRoute()); context.createProducerTemplate().sendBody("direct:start", "Doug"); context.stop(); } System.out.println("End Time:" + Calendar.getInstance().getTime()); } } Note: I have already checked out Apache Camel - AsyncProcessing but I did not find this very helpful for increasing the speed of a single route. It did however allow for a reduced time when trying to run two different routes at the same time.
answer count: 1
tagged with: asynchronous

http://stackoverflow.com/q/21511978
has comment: http://stackoverflow.com/comment/32477816
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21512399
has comment: http://stackoverflow.com/comment/32478027
tagged with: multithreading
has title: Synchronization Issue when using ExecutorCompletionService
has comment: http://stackoverflow.com/comment/32477552
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32478100
has body: I have a scenario where text files are generated dynamically on daily basis. 0 to 8 per day. size of each file can be small to big. depending on day's data. Need to run some checks (business checks , Rules) on them. I implemented in following way , Its not behaving as expected , seems i have done something wrong For Storing results i have following class , there will be 1 Result class for 1 file public class Result { private String fileName; private Map&lt;RuleTypes, String&gt; allResult = new HashMap&lt;RuleTypes, String&gt;(); // setter , getter , constructor .. POJO } Rules are like public class ValidateRule1 implements Rule { private String fileName; public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } @Override public void init() { // TODO Auto-generated method stub } @Override public void runRule() { System.out.println("Start running ... Rule 1 for "+fileName); try { Random r = new Random(); int sleepRandomTime = r.nextInt(15-1) + 1; Thread.sleep(sleepRandomTime) ; // simulate rule execution } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("End running ... Rule 1 for "+fileName); } @Override public RuleTypes getRuleName() { return RuleTypes.Rule1; } } Rule Factory is like public static Rule getRule(RuleTypes ruleName) { Rule result=null; switch(ruleName) { case Rule1 : result = new ValidateRule1(); // todo singleton break; case Rule2 : result = new ValidateRule2(); // todo singleton break; case Rule3 : result = new ValidateRule3(); // todo singleton break; ... } } I call Rules in following way , I use RuleFactory to create a rule ( creates singleton objects for Rules ) final ConcurrentLinkedQueue&lt;Rule&gt; rulesToExecuteForModel = new ConcurrentLinkedQueue&lt;Rule&gt;(); rulesToExecuteForModel.add(RuleFactory.getRule(RuleTypes.Rule1)); rulesToExecuteForModel.add(RuleFactory.getRule(RuleTypes.Rule2)); rulesToExecuteForModel.add(Rul…
accepted answer: http://stackoverflow.com/a/21512399

http://stackoverflow.com/q/21466125
has title: How to pass query time out parameter to DB2 stored Proc
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21466858
tagged with: db2
accepted answer: http://stackoverflow.com/a/21466858
type: AnsweredQuestion
tagged with: sql
type: Question
possible better answer: http://stackoverflow.com/a/21466611
has answer: http://stackoverflow.com/a/21466611
tagged with: stored-procedures
has body: I have a interface where users can select a stored proc and pass parameters to the stored proc. Based on what the user selects, the query can run for a long time. If the query takes more than 5 minutes I want to stop the query and send an email to the user asking him to contact the developer. Basically how do we pass a time out parameter to query?
score: 0

http://stackoverflow.com/a/21350374
type: Answer
has body: The answers given here are mainly to make the method static, which is fine for a program this size. However, as projects get bigger not everything will be in your main anymore, and thus you get this static/non-static issue on a larger scale as your other classes won't be static. The solution then becomes to make a class for your Main, as such: public class Main { public static void main( String[] args ) { Ideone ideone = new Ideone(); Then another file which houses your class Ideone: public class Ideone { Scanner key; public Ideone() { key = new Scanner(System.in); int t = key.nextInt(); for(int i=0;i&lt;t;i++){ int a = key.nextInt(); int b = key.nextInt(); a=compute(a); b=compute(b); System.out.println(a+b); } // end constructor int compute(int a){ int basea=0, digit; int temp=a; while(temp&gt;0){ digit = temp%10; temp/=10; if(digit&gt;(basea-1))basea=digit+1; } temp=a; a=0; int count=0; while(temp&gt;0){ digit = temp%10; temp/=10; a+=digit*Math.pow(basea,count); count++; } return a; } // end compute } // end class As for your main file. What I do will work, but better practice is to follow the code example given here: http://docs.oracle.com/javase/tutorial/uiswing/painting/step1.html Applying this practice will ensure that you do not have static/non-static issues anywhere in your project, as the only thing that is static is the initialization of your actual code, which then handles all codes / further initilization of other classes (which is all non-static)
answers question: http://stackoverflow.com/q/21349999
score: 0

http://stackoverflow.com/comment/88298990
comment on: http://stackoverflow.com/a/21441634
has text: @devssh Streams are lazy constructs, you cannot assume that you have all elements in the stream in memory at all times so you can't do better than `O(n)` in general.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32461820
type: Comment
type: QuestionComment
has text: It is likely that JApplet is opaque, the other problem is your mixing heavy and light weight components, which presents a z-order issue. A better solution would be to separate the application logic from the container, so that you can simply move it between top level containers...You should also know that applets have a very restrictive privileges, meaning, it's very unlikely that it will have access to the local drive
score: 0
comment on: http://stackoverflow.com/q/21503031

http://stackoverflow.com/q/21350812
has comment: http://stackoverflow.com/comment/32191221
has comment: http://stackoverflow.com/comment/32191309
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21350963
accepted answer: http://stackoverflow.com/a/21350963
tagged with: url
has answer: http://stackoverflow.com/a/21351302
has title: Java URL getContent Android
has answer: http://stackoverflow.com/a/21351043
tagged with: android
has comment: http://stackoverflow.com/comment/32191099
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21351043
has comment: http://stackoverflow.com/comment/32191142
has comment: http://stackoverflow.com/comment/32191117
tagged with: java
has comment: http://stackoverflow.com/comment/32191164
has comment: http://stackoverflow.com/comment/32191197
has comment: http://stackoverflow.com/comment/32191183
has body: I have no idea how to do what I am doing, and I am just trying to hack something together really quickly. But here's what I've got: public void newScanThing(String scanFormat, String scanContent){ URL u; try { u = new URL("http://www.searchupc.com/handlers/upcsearch.ashx?request_type=3&amp;access_token=A98AC4EC-830D-4F6B-89D6-D6954361A8CA&amp;upc=" + scanContent.toString()); BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream())); String stringBuff; String scanData = ""; while ((stringBuff = br.readLine()) != null){ scanData += stringBuff; } br.close(); formatTxt.setText("FORMAT: " + scanFormat + " DATA: I don't crash."); } catch (MalformedURLException mue) { // crash } catch (IOException ioe) { // crash }I know which line causes it to crash, and it is the scanData = new ... line. But I have no idea why. If you were to visit the link I visit, you would see the only thing in that URL is a single string. It's not even any HTML or anything, it's just a string. Here is my function call: newScanThing("UPC_A","816983011311"); Anyways, what the heck am I doing wrong? I've never used this before. And I need to get this string for a proof of concept due in about 12 hours, and I have a lot of work to do after I get the string. So tips? Gestures at the right answer? Maybe just a quick and dirty explanation of what I am doing wrong, how to do it right and why it works that way? LogCat: 01-25 05:53:42.367: D/libEGL(13564): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 01-25 05:53:42.382: D/libEGL(13564): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 01-25 05:53:42.390: D/libEGL(13564): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so 01-25 05:53:42.492: D/OpenGLRenderer(13564): Enabling debug mode 0 01-25 05:53:42.500: E/SensorManager(13564): thread start 01-25 05:53:42.507: D/SensorManager(13564): registerListener :: handle = 1 name= BMA254 Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEvent…
type: Question
has comment: http://stackoverflow.com/comment/32191274

jtextfield
tags question: http://stackoverflow.com/q/21359892
tags question: http://stackoverflow.com/q/21413101
tags question: http://stackoverflow.com/q/21439652
tags question: http://stackoverflow.com/q/21405589
tags question: http://stackoverflow.com/q/21462201
tags question: http://stackoverflow.com/q/21419251
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/21432937
tags question: http://stackoverflow.com/q/21499240

http://stackoverflow.com/comment/32404315
type: QuestionComment
type: Comment
has text: hint: Don't double declare your variables in the `Person` class
score: 0
comment on: http://stackoverflow.com/q/21470474

http://stackoverflow.com/q/21363175
upvote count: 1
has comment: http://stackoverflow.com/comment/32217999
has comment: http://stackoverflow.com/comment/32212981
has comment: http://stackoverflow.com/comment/32221764
type: Question
has answer: http://stackoverflow.com/a/21363668
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21364012
tagged with: javadoc
possible better answer: http://stackoverflow.com/a/21363668
has comment: http://stackoverflow.com/comment/32212932
has comment: http://stackoverflow.com/comment/32218239
has comment: http://stackoverflow.com/comment/32212990
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32213359
favorite count: 0
has body: I don't like the way the Javadoc "Contant Field Values" page lists String constants. Example: public static final String REGEXP_PATTERN = "^\\s*$"; On the Javadoc page this constant will be listed with a value of ^\\s*$ which I think is just plain wrong, it should have been ^\s*$. The fact that javac requires \ to be escaped is irrelevant. The value of the field - if you ask me - is ^\s*$, and this is what Javadoc should list. Is there are way I can achieve this? The issue at hand is that - believe or not - our Javadoc documentation is also being used by non-Java people. And for non-Java people is just doesn't make sense.
has comment: http://stackoverflow.com/comment/32213719
has answer: http://stackoverflow.com/a/21364012
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32221935
has comment: http://stackoverflow.com/comment/40268250
has title: Javadoc Constant Field Values for Strings

http://stackoverflow.com/comment/32287368
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/21404804
type: Comment
has text: no it is not that. When inJustDecodeBounds is true the bitmap is not decoded

http://stackoverflow.com/a/21441388
upvote count: 3
answers question: http://stackoverflow.com/q/21441273
downvote count: 0
has body: You need to store the name you have read fro the Scanner in a class member, then return that class member when calling GetName (). Otherwise you will lose the name you have read, and will have to read it again (and thus prompt the user again for input). For example: class TeamInfo { Scanner nScan = new Scanner(System.in); String name = null; public String GetName(){ if (name == null) { name = nScan.nextLine(); } return name; } On a different note, you should read on Java naming conventions. A method name should not start with a capital letter.
type: Answer
score: 3

sockets
tags question: http://stackoverflow.com/q/21511598
tags question: http://stackoverflow.com/q/21501841
tags question: http://stackoverflow.com/q/21355028
tags question: http://stackoverflow.com/q/21497658
tags question: http://stackoverflow.com/q/21365679
tags question: http://stackoverflow.com/q/21365046
tags question: http://stackoverflow.com/q/21479022
tags question: http://stackoverflow.com/q/21406815
tags question: http://stackoverflow.com/q/21420495
tags question: http://stackoverflow.com/q/21422998
tags question: http://stackoverflow.com/q/21402203
tags question: http://stackoverflow.com/q/21360415
tags question: http://stackoverflow.com/q/21424127
tags question: http://stackoverflow.com/q/21417101
tags question: http://stackoverflow.com/q/21368450
tags question: http://stackoverflow.com/q/21417214
tags question: http://stackoverflow.com/q/21365249
tags question: http://stackoverflow.com/q/21392780
tags question: http://stackoverflow.com/q/21397778
tags question: http://stackoverflow.com/q/21429072
tags question: http://stackoverflow.com/q/21434392
tags question: http://stackoverflow.com/q/21499954
tags question: http://stackoverflow.com/q/21486685
type: Tag
tags question: http://stackoverflow.com/q/21491699
tags question: http://stackoverflow.com/q/21355671
tags question: http://stackoverflow.com/q/21484886
tags question: http://stackoverflow.com/q/21364925
tags question: http://stackoverflow.com/q/21361291
tags question: http://stackoverflow.com/q/21505019
tags question: http://stackoverflow.com/q/21432144
tags question: http://stackoverflow.com/q/21408356
tags question: http://stackoverflow.com/q/21392412
tags question: http://stackoverflow.com/q/21436787
tags question: http://stackoverflow.com/q/21403940
tags question: http://stackoverflow.com/q/21433750
tags question: http://stackoverflow.com/q/21369269
tag name: sockets
tags question: http://stackoverflow.com/q/21371849
tags question: http://stackoverflow.com/q/21353474
tags question: http://stackoverflow.com/q/21365845
tags question: http://stackoverflow.com/q/21356526
tags question: http://stackoverflow.com/q/21476310
tags question: http://stackoverflow.com/q/21425414

http://stackoverflow.com/comment/32355555
has text: Maybe default constructors ?
type: Comment
comment on: http://stackoverflow.com/a/21442900
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32476776
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21511454
has text: @JB Nizet ok my friend
type: AnswerComment

http://stackoverflow.com/q/21381607
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: eclipse
tagged with: classpath
type: Question
possible better answer: http://stackoverflow.com/a/21381802
has comment: http://stackoverflow.com/comment/32246141
answer count: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/21381696
has body: Apologies if this has been asked before - if it has, I'm obviously searching for the wrong thing. It's not the first time I've been stumped by java, eclipse and how they find source files. I have a folder of java sources and I wish to copy them in to the 'src/com' folder and have this 'just work'. If I copy the files directly, eclipse and java fail to recognise them so I assume that somewhere there's a file that tells the IDE that there's a folder of files in there that's included in the project. I'd like to know how to do this via config files and via the IDE UI. Unfortunately, the two obvious files (.project and .classpath) don't seem to reference the existing directories at all (.classpath contains a line &lt;classpathentry kind="src" path="src"/&gt; that I'd assume would auto-scan that directory for files but it doesn't appear to) Finally, are .classpath and .project java concepts or eclipse concepts? Thank you for your time.
has title: Getting eclipse to recognise new source folders
has comment: http://stackoverflow.com/comment/32246067
favorite count: 0
has answer: http://stackoverflow.com/a/21381802
has answer: http://stackoverflow.com/a/21381696
linked to: http://stackoverflow.com/q/7186676
has comment: http://stackoverflow.com/comment/32246330
has comment: http://stackoverflow.com/comment/32246048

http://stackoverflow.com/q/21397185
score: 2
has answer: http://stackoverflow.com/a/21397315
has comment: http://stackoverflow.com/comment/32277731
tagged with: java
has comment: http://stackoverflow.com/comment/32274858
type: Question
answer count: 2
downvote count: 0
tagged with: jar
tagged with: linux
tagged with: bash
tagged with: shell
favorite count: 0
has title: Compile and execute java via bash shell
has answer: http://stackoverflow.com/a/21397345
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32274894
has body: I'm trying to write a shell code that will execute my Java program. I tried this: #!/bin/sh COMPILECMD="javac server.jar" RUNCMD="java -jar server.jar 12777" $COMPILECMD $RUNCMD But I got this error: error: Class names, 'server.jar', are only accepted if annotation processing is explicitly requested 1 error Failed to load Main-Class manifest attribute from server.jar In the command line I don't use the jar file, I just compile and then execute: javac server.java java server 12777

http://stackoverflow.com/a/21425568
accepted answer of: http://stackoverflow.com/q/21391347
answers question: http://stackoverflow.com/q/21391347
score: 0
type: AcceptedAnswer
type: Answer
has body: This issue has been fixed. Fix is delivered within 3.0.0-milestone2. See Apache JIRA issue CXF-5529.

http://stackoverflow.com/comment/32244949
has text: I edited the answer to give an idea of how it's used. Please try if it is what you are looking for and let us know whether that solves your problem.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21380722

http://stackoverflow.com/comment/32697082
type: Comment
type: QuestionComment
has text: I'm not asking anyone for giving me a piece of code but give me a direction to go?
comment on: http://stackoverflow.com/q/21501770
score: 0

http://stackoverflow.com/comment/32417388
comment on: http://stackoverflow.com/q/21478182
score: 0
type: Comment
has text: @RohitJain , thanks for nice saying "ArrayList is a dynamically increasing array."
type: QuestionComment

http://stackoverflow.com/comment/32289377
type: Comment
has text: Button. When a user clicks on the clear selection button, it is supposed to enable the buttons that have just been clicked and leave out those that the user has clicked forming a whole word in the wordlist
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21405431

http://stackoverflow.com/q/21412620
type: UnansweredQuestion
tagged with: maven
has title: Extending org.eclipse.equinox.http.registry.servlets does not work
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32325793
has body: Im trying to make an servlet extension to org.eclipse.equinox.http.registry.servlets extension point, but cant get it working. Ill try to write down my proccess so maybe someone can tell me what im doing wrong or what i didnt do :) So, first i made just a jetty server with a default servlet. Here was my initial pom: 4.0.0 com.example myserver 0.0.1-SNAPSHOT jar myserver http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <bundle.symbolicName>myserver</bundle.symbolicName> <bundle.namespace>com.example</bundle.namespace> junit junit 3.8.1 test org.osgi org.osgi.core 4.3.0 org.eclipse.jetty jetty-servlet 8.1.10.v20130312 org.apache.felix maven-bundle-plugin true bundle-manifest process-classes manifest META-INF ${bundle.symbolicName} ${pom.version} ${bundle.namespace}.myserver.App org.osgi.framework, javax.servlet, javax.servlet.http, org.eclipse.jetty.server, org.eclipse.jetty.servlet Here is my App thats a bundle activator: package com.example.myserver; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class App implements BundleActivator { public void start(BundleContext context) throws Exception { Server server = new Server(8080); ServletContextHandler c = new ServletContextHandler(server, "/"); c.addServlet(new ServletHolder(new HelloWorldServlet()),"/test"); server.start(); server.join(); } public void stop(BundleContext context) throws Exception { // TODO Auto-generated method stub } } And here is my servlet: package com.example.myserver; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class HelloWorldServlet extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServlet…
type: Question
has comment: http://stackoverflow.com/comment/88245270
has comment: http://stackoverflow.com/comment/32322117
has answer: http://stackoverflow.com/a/61984679
tagged with: servlets
has comment: http://stackoverflow.com/comment/32328033
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32311987
favorite count: 0
tagged with: osgi

linked-list
tags question: http://stackoverflow.com/q/21507551
tags question: http://stackoverflow.com/q/21465232
tags question: http://stackoverflow.com/q/21413442
tag name: linked-list
tags question: http://stackoverflow.com/q/21444573
tags question: http://stackoverflow.com/q/21418468
tags question: http://stackoverflow.com/q/21468753
tags question: http://stackoverflow.com/q/21498192
type: Tag
tags question: http://stackoverflow.com/q/21505855
tags question: http://stackoverflow.com/q/21491635
tags question: http://stackoverflow.com/q/21360376
tags question: http://stackoverflow.com/q/21493234
tags question: http://stackoverflow.com/q/21416251
tags question: http://stackoverflow.com/q/21417597
tags question: http://stackoverflow.com/q/21368546
tags question: http://stackoverflow.com/q/21439198
tags question: http://stackoverflow.com/q/21470508

http://stackoverflow.com/comment/32442660
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21491550
type: QuestionComment
has text: @afsantos I am using this code ' originalImage = ImageIO.read(Frame.class.getResourceAsStream("/resources/colorwheel.png"));' but it gives me an error that input == null (IllegalArgumentException). Do you have any idea on how I could load a image from my jar file?

recursion
type: Tag
tags question: http://stackoverflow.com/q/21478811
tags question: http://stackoverflow.com/q/21474297
tags question: http://stackoverflow.com/q/21430496
tags question: http://stackoverflow.com/q/21490246
tags question: http://stackoverflow.com/q/21514008
tag name: recursion
tags question: http://stackoverflow.com/q/21426901
tags question: http://stackoverflow.com/q/21420029
tags question: http://stackoverflow.com/q/21380856
tags question: http://stackoverflow.com/q/21505008
tags question: http://stackoverflow.com/q/21493062
tags question: http://stackoverflow.com/q/21496283
tags question: http://stackoverflow.com/q/21465034
tags question: http://stackoverflow.com/q/21365112
tags question: http://stackoverflow.com/q/21437788
tags question: http://stackoverflow.com/q/21496538
tags question: http://stackoverflow.com/q/21392829
tags question: http://stackoverflow.com/q/21426688
tags question: http://stackoverflow.com/q/21464367
tags question: http://stackoverflow.com/q/21372192
tags question: http://stackoverflow.com/q/21507513
tags question: http://stackoverflow.com/q/21503213
tags question: http://stackoverflow.com/q/21486971
tags question: http://stackoverflow.com/q/21444455
tags question: http://stackoverflow.com/q/21406965
tags question: http://stackoverflow.com/q/21467794

http://stackoverflow.com/q/21361042
possible better answer: http://stackoverflow.com/a/21361147
has answer: http://stackoverflow.com/a/21361147
downvote count: 0
has title: Why do I get heap outOfMemory exception?
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/32209261
has comment: http://stackoverflow.com/comment/32209236
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/32209571
upvote count: 6
type: AnsweredQuestion
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/32209630
has comment: http://stackoverflow.com/comment/32209220
has answer: http://stackoverflow.com/a/21361433
has answer: http://stackoverflow.com/a/21361381
type: Question
has comment: http://stackoverflow.com/comment/32209213
has comment: http://stackoverflow.com/comment/32209427
has body: I'm trying to allocate a large matrix (around 10GB). I'm working on 64 bit machine with a 64 bit JVM. My process then should have 2^64 bytes available and I've set the JVM heap size to be 128G (I have 16GB of RAM in my machine if that matters). My understanding was that I should get the memory from the OS and that unneeded matrix cells would be swapped out by the OS. However I'm getting the above exception. Edit: This is how I'm defining the matrix: Jama.Matrix A = new Matrix(num_words, num_documents); Where num_words is approximately 100k and num_documents is approximately 35k. Also worth mentioning that the type is double Edit2: Relevant flags: -Xms40m -Xmx128g -d64
accepted answer: http://stackoverflow.com/a/21361381
has comment: http://stackoverflow.com/comment/32209225
has comment: http://stackoverflow.com/comment/32209198
answer count: 3
has comment: http://stackoverflow.com/comment/32209143

http://stackoverflow.com/q/21410829
has body: I'm getting strange behavior in memcached, in particular, behavior that is strange in its consistency. Here is my test: @Test public void testMemc() { logger.info("Setting head."); memc.set(env.memcachedQueueKeys().head, 3600, 0); logger.info("Set head; incrementing."); memc.incr(env.memcachedQueueKeys().head, 1); logger.info("Incremented."); } And here is the output: 28 11:04:52.932 INFO; Setting head. 2014-01-28 11:04:52.933 WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for q:unittest:scannedemails:w. 28 11:04:52.933 INFO; Set head; incrementing. 2014-01-28 11:04:52.935 WARN net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for q:unittest:scannedemails:w. FAILED: testMemc net.spy.memcached.OperationTimeoutException: Mutate operation timed out,unable to modify counter [q:unittest:scannedemails:w] at net.spy.memcached.MemcachedClient.mutate(MemcachedClient.java:1484) at net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1529) at me.unroll.emailroller.ActOnScanResultsTest.testMemc(ActOnScanResultsTest.java:295) Most of my intuition for this kind of error fails me here. The following things are all strange: Why does it always fail exactly once to set? Why does it permanently fail to increment after seeming to succeed at set? This is on a high-load server (yes, it's a little wrong to be running a test on a load-bearing server, but if it catches issues like this there's at least some advantage). What can cause this consistent failure? There is only one node.
type: AnsweredQuestion
score: 1
tagged with: spymemcached
tagged with: java
tagged with: timeout
type: Question
accepted answer: http://stackoverflow.com/a/21412679
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21412679
has title: Increment times out; set always succeeds after retry
tagged with: memcached

http://stackoverflow.com/comment/32359891
comment on: http://stackoverflow.com/q/21445425
has text: Yes MagicMan, that's my question
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/77482595
type: Comment
has text: Regex works as well, `Character.toString(c).matches("^[a-zA-Z0-9]")` to just have alphanumeric and digits.
comment on: http://stackoverflow.com/a/21460519
score: 0
type: AnswerComment

http://stackoverflow.com/a/21381546
accepted answer of: http://stackoverflow.com/q/21381302
type: Answer
answers question: http://stackoverflow.com/q/21381302
score: 2
downvote count: 0
has body: If your date string has "AM/PM" and your hour has range of 01-12 then you should use h to parse the hour You can try dd-MMM-yy hh.mm.ss.000000000 a as input format. If you see the documentation (SimpleDateFormat) of K, its range is 0-11, hence the parsing fails.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32246300

http://stackoverflow.com/comment/32263261
comment on: http://stackoverflow.com/q/21390773
type: Comment
type: QuestionComment
has text: The ideal way would be to have the method return the array.
score: 0

http://stackoverflow.com/comment/32237774
comment on: http://stackoverflow.com/q/21376738
has text: @Rugal You can't write to the filesystem with JavaScript.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32247698
comment on: http://stackoverflow.com/q/21376330
score: 0
type: Comment
type: QuestionComment
has text: Your solution appears to be necessary? See my comment to Peter below..

http://stackoverflow.com/q/21423209
has comment: http://stackoverflow.com/comment/32319847
tagged with: expression
score: 0
has answer: http://stackoverflow.com/a/21423569
has answer: http://stackoverflow.com/a/21423253
possible better answer: http://stackoverflow.com/a/21423569
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21423253
has body: How could i use a regular-expression in java to extract URLs in the form /p/{any set of characters}/bugs/{any set of numbers start from 0 to 999} From text file. I tried one as the following final String regex = "(\\/p\\/.*\\/bugs\\/(\\d{0,3}))"; But i didn't work fine for me.
has title: regular expression for specific URL
type: Question
answer count: 2

http://stackoverflow.com/comment/32341397
has text: Also, learning about the compiler helps you learn about the language itself and that's always a plus.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21435019
type: AnswerComment

http://stackoverflow.com/comment/32426703
type: QuestionComment
comment on: http://stackoverflow.com/q/21483682
has text: @injecteer Java doesn't have `goto`
score: 0
type: Comment

http://stackoverflow.com/q/21365234
tagged with: java
upvote count: 1
type: Question
has title: Issue with Java HashMap Assignment
has answer: http://stackoverflow.com/a/21365333
has body: For some reason this function in my project is failing: public void SetPlayersLineups(HashMap&lt;Integer, Player&gt; _players, ArrayList&lt;Integer&gt; _lineup, boolean isAwayTeam) { System.out.println(_players.get(2)); //works properly System.out.println(_players.get(2).getNumberHits()); //null pointer exception if (isAwayTeam) { this.awayLineup = _lineup; this.awayPlay = _players; } else { this.homeLineup = _lineup; this.homePlay = _players; } } /* from Player class */ public int getNumberHits() { return this.hits; } I have a Player class, with a member get function getNumberHits(). The this.awayPlay and this.homePlay properties are not being set correctly. So I debugged with the System.out.println statements. The first returns a Player instance correctly. But when I call the get function I get a null pointer exception. Any ideas?
possible better answer: http://stackoverflow.com/a/21365332
answer count: 3
has answer: http://stackoverflow.com/a/21365332
downvote count: 0
has answer: http://stackoverflow.com/a/21365308
favorite count: 0
accepted answer: http://stackoverflow.com/a/21365308
type: AnsweredQuestion
score: 1

spring-mvc
tags question: http://stackoverflow.com/q/21367972
tags question: http://stackoverflow.com/q/21383051
tags question: http://stackoverflow.com/q/21485287
tags question: http://stackoverflow.com/q/21405606
tags question: http://stackoverflow.com/q/21496987
tags question: http://stackoverflow.com/q/21474128
tags question: http://stackoverflow.com/q/21365643
tags question: http://stackoverflow.com/q/21480404
tags question: http://stackoverflow.com/q/21494762
tags question: http://stackoverflow.com/q/21404102
tags question: http://stackoverflow.com/q/21364034
tags question: http://stackoverflow.com/q/21436231
tags question: http://stackoverflow.com/q/21500286
tags question: http://stackoverflow.com/q/21476986
tags question: http://stackoverflow.com/q/21483635
tags question: http://stackoverflow.com/q/21403254
tags question: http://stackoverflow.com/q/21499249
tags question: http://stackoverflow.com/q/21457329
tags question: http://stackoverflow.com/q/21352681
tags question: http://stackoverflow.com/q/21371390
tags question: http://stackoverflow.com/q/21481990
tags question: http://stackoverflow.com/q/21471993
tags question: http://stackoverflow.com/q/21409408
tags question: http://stackoverflow.com/q/21432137
tags question: http://stackoverflow.com/q/21499695
tags question: http://stackoverflow.com/q/21488252
tags question: http://stackoverflow.com/q/21383679
tags question: http://stackoverflow.com/q/21434949
tags question: http://stackoverflow.com/q/21376572
tags question: http://stackoverflow.com/q/21404782
tags question: http://stackoverflow.com/q/21410317
tags question: http://stackoverflow.com/q/21439089
tags question: http://stackoverflow.com/q/21390019
tags question: http://stackoverflow.com/q/21407840
tag name: spring-mvc
tags question: http://stackoverflow.com/q/21432483
tags question: http://stackoverflow.com/q/21435250
tags question: http://stackoverflow.com/q/21360967
tags question: http://stackoverflow.com/q/21509973
tags question: http://stackoverflow.com/q/21495296
tags question: http://stackoverflow.com/q/21486120
tags question: http://stackoverflow.com/q/21505997
tags question: http://stackoverflow.com/q/21370678
type: Tag
tags question: http://stackoverflow.com/q/21459255
tags question: http://stackoverflow.com/q/21398999
tags question: http://stackoverflow.com/q/21480009
tags question: http://stackoverflow.com/q/21485840
tags question: http://stackoverflow.com/q/21397793
tags question: http://stackoverflow.com/q/21404518
tags question: http://stackoverflow.com/q/21426519
tags question: http://stackoverflow.com/q/21475590
tags question: http://stackoverflow.com/q/21407607
tags question: http://stackoverflow.com/q/21470881
tags question: http://stackoverflow.com/q/21375317
tags question: http://stackoverflow.com/q/21379858
tags question: http://stackoverflow.com/q/21448288
tags question: http://stackoverflow.com/q/21404055
tags question: http://stackoverflow.com/q/21453846
tags question: http://stackoverflow.com/q/21378361
tags question: http://stackoverflow.com/q/21500750
tags question: http://stackoverflow.com/q/21444612
tags question: http://stackoverflow.com/q/21463882
tags question: http://stackoverflow.com/q/21493225
tags question: http://stackoverflow.com/q/21412895
tags question: http://stackoverflow.com/q/21463687
tags question: http://stackoverflow.com/q/21364826
tags question: http://stackoverflow.com/q/21401005
tags question: http://stackoverflow.com/q/21512706
tags question: http://stackoverflow.com/q/21413938
tags question: http://stackoverflow.com/q/21504297
tags question: http://stackoverflow.com/q/21433914
tags question: http://stackoverflow.com/q/21420145
tags question: http://stackoverflow.com/q/21417256
tags question: http://stackoverflow.com/q/21375961
tags question: http://stackoverflow.com/q/21441699
tags question: http://stackoverflow.com/q/21425634
tags question: http://stackoverflow.com/q/21414750

http://stackoverflow.com/q/21371104
has title: Creating a method that accepts a string and a length (integer) as parameters
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/21371211
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21371198
has body: I am trying to teach myself more about the relationships between methods. In doing this, I am writing a program that has multiple methods. I have one method (createSpace) that is called from the main method. It seemingly was straight forward but I realized I needed my createSpace method to 1) accept BOTH a string and an int as parameters, 2) pad the parameter string with designated number of spaces and 3) return a padded string. Most of this seems pretty good to me. For 2, I will write a for loop that gives the designated number of spaces that I want. For 3, I will designate my method to be a return type. But I am having a bit of trouble with 1, which is frustrating as it it the first part to this. How does one create a method that accepts two types of values (strings and ints) as parameters? Hopefully this question makes sense.
has comment: http://stackoverflow.com/comment/32227553
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/32227620
favorite count: 0

http://stackoverflow.com/comment/32346883
type: QuestionComment
type: Comment
has text: How does the current code work or does it work? Affecting layout params on touch move could cause serious hiccups on performance.
comment on: http://stackoverflow.com/q/21438313
score: 0

http://stackoverflow.com/comment/32265218
type: Comment
comment on: http://stackoverflow.com/a/21376198
score: 0
type: AnswerComment
has text: The half is OK. You don't need to inspect (strs[1], strs[0]) provided you already did so for (strs[0], strs[1]).

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

http://stackoverflow.com/comment/32198855
score: 0
comment on: http://stackoverflow.com/q/21355121
type: Comment
type: QuestionComment
has text: I'm just not really sure how to define a prime number or a perfect square within java. I'm really looking for an algorithm that can determine if any given number is a prime, and an algorithm that determines if a number is a perfect square. Those are my main issues. I'm sorry if I'm not being very clear, it's my first time posting a question here.

http://stackoverflow.com/a/21424701
answers question: http://stackoverflow.com/q/21424607
type: Answer
has body: The org.postgresql.Driver class is not in your classpath.
score: 0

http://stackoverflow.com/comment/32213135
has text: Define 'template engine' please. Because in your question heading it mentions "with a tag".
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21363210
type: QuestionComment

http://stackoverflow.com/a/21360901
upvote count: 1
has comment: http://stackoverflow.com/comment/32209104
has comment: http://stackoverflow.com/comment/32209462
score: 1
has body: When you go over the ascii table value of 255, wrap it to 0 onwards. Something like: int randomKey = 2; //However you want to assign the value - do it. ... //This is how you "encrypt" a character. Example character is 'a'. int character = 'a'; int encryptedChar = character + randomKey; if (encryptedChar &gt; 255) { encryptedChar -= 255; } When "decrypt"ing follow the reverse logic. However this is a very weak "encryption". A cryptanalyst will break it in no time! Also note java char is 16 bit. Value can be more than 255. You should ensure input characters are in the range 0-255. Reject values beyond that.
answers question: http://stackoverflow.com/q/21360875
downvote count: 0
has comment: http://stackoverflow.com/comment/32209970
type: Answer

http://stackoverflow.com/comment/32440304
type: Comment
comment on: http://stackoverflow.com/q/21447002
score: 0
has text: I started a new program in Eclipse and it is working fine. I don't know what the problem was with the previous one. It kept having the bug in main method, compilation error. It may have had something to do with file management. One thing that was different was that I did not have the Package Explorer view, and now I do.
type: QuestionComment

http://stackoverflow.com/q/21354429
favorite count: 0
has answer: http://stackoverflow.com/a/21357600
accepted answer: http://stackoverflow.com/a/21357600
has body: I'm using Struts2-json-plugin-2.3.16 with the same version of the framework. I get an empty response from JSON. The JavaScript/jQuery function. var timeout; var request; function getUsers() { if(!request) { request = $.ajax({ datatype:"json", type: "GET", contentType: "application/json; charset=utf-8", url: "testJsonAction.action", success: function(response) { var user= response.user; alert(user); }, complete: function() { timeout = request = null; }, error: function(request, status, error) { if(status!=="timeout"&amp;&amp;status!=="abort") { alert(status+" : "+error); } } }); timeout = setTimeout(function() { if(request) { request.abort(); alert("The request has been timed out."); } }, 30000); } } This function is called, when a button is clicked. &lt;s:form namespace="/admin_side" action="Test" validate="true" id="dataForm" name="dataForm"&gt; &lt;input type="button" name="btnUser" id="btnUser" value="Click" onclick="getUsers();"/&gt; &lt;/s:form&gt; The action class: @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value = "json-default") public final class TestAction extends ActionSupport { private User user; private static final long serialVersionUID = 1L; public TestAction() { } @JSON(name = "user") public User getUser() { return user; } public void setUser(User user) { this.user = user; } @Action(value = "testJsonAction", results = { @Result(type = "json", name = ActionSupport.SUCCESS, params = {"enableSMD", "true", "enableGZIP", "true", "excludeNullProperties", "true"})}) public String executeAction() throws Exception { try { user = new User(); user.setName("Tiny"); user.setDob(new SimpleDateFormat("dd-MMM-YYYY").parse("29-Feb-2000")); user.setLocation("India"); } catch (ParseException ex) { Logger.getLogger(TestAction.class.getName()).log(Level.SEVERE, null, ex); } return ActionSupport.SUCCESS; } @Action(value = "Test", results = { @Result(name = ActionSupport.SUCCESS, location = "Test.jsp"), @Result(name = ActionSupport.INPUT, loca…
type: AnsweredQuestion
has title: How to use JSON-RPC in Struts 2
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32202511
linked to: http://stackoverflow.com/q/21368194
type: Question
has comment: http://stackoverflow.com/comment/32201700
has comment: http://stackoverflow.com/comment/32201371
answer count: 1
tagged with: jquery
tagged with: struts2
has comment: http://stackoverflow.com/comment/32198973
tagged with: json-rpc
has comment: http://stackoverflow.com/comment/32199103
upvote count: 1
has comment: http://stackoverflow.com/comment/32198942
has comment: http://stackoverflow.com/comment/32201530
has comment: http://stackoverflow.com/comment/32201063

http://stackoverflow.com/q/21370433
has comment: http://stackoverflow.com/comment/32226468
score: 0
linked to: http://stackoverflow.com/q/504103
tagged with: loops
has body: I wrote a program for a Java class I am taking to search a String array of 10 elements for a specific target. The program searches for the target from the beginning of the array to the end of the array and then searches from the end of the array to the beginning of the array. Each search is timed and looped 1000 times. After each search method has been looped 1000 times, the fastest search method is chosen to search the array for whatever number of 'reps' I passed as an argument in the main method. The problem I am having is when I change the number of loops to beyond 2000. From roughly 2100 the time it takes to search the array in nanoseconds is frequently 0. Is this because the JVM has warmed up and the time it takes to search a 10 element array can't be measured in nanoseconds? I realize that probably sounds silly. I am just going to paste the whole program here for reference(the program is far from complete but compiles and runs): public class LinearStringSearch { // Array filled with random Strings String[] randomStrings = {"apple", "yellow", "fire", "wood", "zinc", "ram", "mouse", "fish", "cheese", "dirt"}; // Save target arguments for global access(console printing purposes) int indexOfTarget; String target; String target2; long startTime; long startTime2; long estimatedTime; long estimatedTime2; long sumForward; long sumBackward; long counterFrontToEnd; long counterEndToFront; long counterTied; // Arrays for search times ArrayList&lt;Long&gt; forwardSearchTimes = new ArrayList&lt;&gt;(); ArrayList&lt;Long&gt; backwardSearchTimes = new ArrayList&lt;&gt;(); /** * * @param target - the item you want to retrieve from array * @param sa - the name of the array * @return i - the target, otherwise return error code: -1 */ int linearStringSearch(String target, String[] sa) { this.target = target; // set class variable for print access startTime = System.nanoTime(); // Start speed test for(int i = 0; i &lt; sa.length; ++i) { if (sa[i].equals(target)) { estimatedTime =…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32226504
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32226607
has title: Why does my array search take 0 nanoseconds after search is looped beyond 2000 times?
has answer: http://stackoverflow.com/a/21371044
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21371044
has comment: http://stackoverflow.com/comment/32226511

http://stackoverflow.com/q/21514328
has comment: http://stackoverflow.com/comment/32481918
tagged with: java
has comment: http://stackoverflow.com/comment/32482092
type: Question
has body: I have a problem with Google+ button integration in my app. I get an error, NullPointerException. I get the error on line: mPlusOneButton.initialize("https://market.android.com/details?id=" + getPackageName(), Here's my code: public class PlusOne extends Activity implements ConnectionCallbacks, OnConnectionFailedListener { private static final int REQUEST_CODE_RESOLVE_ERR = 9000; private ProgressDialog mConnectionProgressDialog; private PlusClient mPlusClient; private ConnectionResult mConnectionResult; private PlusOneButton mPlusOneButton; protected void onResume() { super.onResume(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPlusClient = new PlusClient.Builder(this, this, this).clearScopes() .build(); mPlusOneButton.initialize("https://market.android.com/details?id=" + getPackageName(), new OnPlusOneClickListener() { @Override public void onPlusOneClick(Intent intent) { mPlusOneButton.setVisibility(View.INVISIBLE); startActivityForResult(intent, 0); } }); setContentView(R.layout.plus); } @Override protected void onStart() { super.onStart(); mPlusClient.connect(); } @Override protected void onStop() { super.onStop(); mPlusClient.disconnect(); } @Override public void onConnectionFailed(ConnectionResult result) { if (mConnectionProgressDialog.isShowing()) { if (result.hasResolution()) { try { result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR); } catch (SendIntentException e) { mPlusClient.connect(); } } } mConnectionResult = result; } @Override protected void onActivityResult(int requestCode, int responseCode, Intent intent) { if (requestCode == REQUEST_CODE_RESOLVE_ERR &amp;&amp; responseCode == RESULT_OK) { mConnectionResult = null; mPlusClient.connect(); } } @Override public void onDisconnected() { } public void onConnected() { } @Override public void onConnected(Bundle arg0) { // TODO Auto-generated method stub } } And LogCat: 02-02 19:08:04.713: E/AndroidRuntime(27086): FATAL EXCEPTION: mai…
has title: Google+ button integration...NulPointerException
score: 0
has answer: http://stackoverflow.com/a/21514413
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/21514413
has comment: http://stackoverflow.com/comment/32481994
has comment: http://stackoverflow.com/comment/32482007
has comment: http://stackoverflow.com/comment/32481993
type: AnsweredQuestion

http://stackoverflow.com/q/21453254
upvote count: 32
has answer: http://stackoverflow.com/a/55330069
tagged with: android-activity
has answer: http://stackoverflow.com/a/60482626
tagged with: android-context
has body: I'm passing the Activity context to a dialog but that dialog is global to other Activities, so its possible that other activities create that dialog too. My question is how can I determine that Activity context is a specific Activity? I'm passing ActivityContext like this : private Activity ActivityContext; public MessageDialog(Activity context,int DialogStyle,int Dialog_Layout,String Msg) { super(context,DialogStyle,Dialog_Layout); this.ActivityContext = context; this.Msg = Msg; }
score: 32
accepted answer: http://stackoverflow.com/a/21453290
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21453290
has title: Determine if context is a Specific Activity
favorite count: 0
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/55330069

http://stackoverflow.com/comment/32406891
comment on: http://stackoverflow.com/q/21471929
has text: Why would you think it isn't?
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21464367
has comment: http://stackoverflow.com/comment/32392832
has comment: http://stackoverflow.com/comment/32392764
has answer: http://stackoverflow.com/a/21464843
possible better answer: http://stackoverflow.com/a/21464686
type: AnsweredQuestion
has title: eli5 can't understand this recursion process
accepted answer: http://stackoverflow.com/a/21464556
linked to: http://stackoverflow.com/q/5533895
tagged with: java
has body: public int recursive(int x){ if(x&gt;10){ return x; } int y = x + 1; int r = recursive(y); System.out.println(y + " Y" + " R" + r + " X " + x); return r; } public static void main(String[] args) { System.out.println(new a().recursive(1)); } This is a recursion I made to simplify a different method I could not understand but it has the same code line for line basically. I don't understand what is happening on this line int r = recursive(y);. I don't understand what the return r; even returns to or how it actively loops. When I system print R, it is always the same value each iteration which throws me off. If I change return r to return 555 the code still works but just returns 555 to the call from main. output 11 Y R11 X 10 10 Y R11 X 9 9 Y R11 X 8 8 Y R11 X 7 7 Y R11 X 6 6 Y R11 X 5 5 Y R11 X 4 4 Y R11 X 3 3 Y R11 X 2 2 Y R11 X 1 11 Please eli5, I have viewed some recursion videos but they do not use a recursion thats laid out like this, with a return after a recursive call. int r = recursive(y);, how does r get its value here, and continue the loop, can't figure it out. It says set r equal to the return of recursive(y), but the return is r itself when the value for r has not been set or something? Another issue I am having is how the system print is running as well, because I thought when the recursive part runs, it instantly restarts the method but it seems the entire method is running and looping
has comment: http://stackoverflow.com/comment/32393079
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/21464556
has comment: http://stackoverflow.com/comment/32392991
has comment: http://stackoverflow.com/comment/32392954
has answer: http://stackoverflow.com/a/21464686
has comment: http://stackoverflow.com/comment/32392793
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32392774

http://stackoverflow.com/comment/92185153
score: 0
comment on: http://stackoverflow.com/q/21406407
type: Comment
type: QuestionComment
has text: Does .order("param1").order("param2") equate to "ORDER BY param1, param2" or "ORDER BY param2, param1"?

http://stackoverflow.com/comment/32370129
type: AnswerComment
has text: @GordThompson It looks like the Microsoft SQL Server JDBC Driver uses holdable `ResultSet`s by default, see [Using Holdability](http://technet.microsoft.com/en-us/library/ms378765.aspx)
type: Comment
comment on: http://stackoverflow.com/a/21434205
score: 1

http://stackoverflow.com/comment/32365394
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21448392
type: Comment
has text: @user2864740: that's exactly correct; the issue is the implementation of `new T[]`.

http://stackoverflow.com/q/21492506
tagged with: java
type: Question
answer count: 1
tagged with: variables
has answer: http://stackoverflow.com/a/21492520
favorite count: 0
accepted answer: http://stackoverflow.com/a/21492520
has title: Why can't Java resolve the variable in this for each loop?
has body: In the following for each loop, I get a "bird cannot be resolved" error at lines marked !. I have setup an interface Bird implemented by an abstract class BirdType of which Cardinal, Hummingbird, Bluebird, and Vulture are children. getColor() and getPosition() methods are defined in the abstract class while fly() is unique to each of the child classes. This client code was actually provided by my professor to test the interface/inheritance relations I have setup. Note I have tested the interface, abstract class and child classes and they all seem to work. I think the issue is with the for-each loop but I can provide code for the other classes if needs be. Any advice? import java.awt.*; public class Aviary { public static final int SIZE = 20; public static final int PIXELS = 10; public static void main(String[] args){ //create drawing panel DrawingPanel panel = new DrawingPanel(SIZE*PIXELS,SIZE*PIXELS); //create pen Graphics g = panel.getGraphics(); //create some birds Bird[] birds = {new Cardinal(7,4), new Cardinal(3,8), new Hummingbird(2,9), new Hummingbird(16,11), new Bluebird(4,15), new Bluebird(8,1), new Vulture(3,2), new Vulture(18,14)}; while (true){ //clear screen g.setColor(Color.WHITE); g.fillRect(0, 0, SIZE*PIXELS, SIZE*PIXELS); //tell birds to fly and redraw birds for (Bird bird : birds) bird.fly(); ! g.setColor(bird.getColor()); ! Point pos = bird.getPosition(); g.fillOval((int)pos.getX()*PIXELS, (int)pos.getY()*PIXELS, PIXELS, PIXELS); panel.sleep(500); } } }
has comment: http://stackoverflow.com/comment/32443170
upvote count: 3
downvote count: 2
tagged with: resolve
tagged with: foreach
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/21381820
linked to: http://stackoverflow.com/q/530012
has body: I need to load data from Postgres to Oracle. While reading data from Postgres I got the date in below format "2013-02-13 00:30:22.402" now I need to load this date into oracle db I tried but getting exception String dd = "2013-02-13 00:30:22.402"; DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); java.sql.Date dateform=(Date) formatter.parse(dd); System.out.println(dateform); Throws this exception: Exception in thread "main" java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date at ghg.main(ghg.java:26)
accepted answer: http://stackoverflow.com/a/21381894
tagged with: postgresql
answer count: 3
has comment: http://stackoverflow.com/comment/32247240
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/32246823
tagged with: jdbc
has answer: http://stackoverflow.com/a/21382024
possible better answer: http://stackoverflow.com/a/21381892
has answer: http://stackoverflow.com/a/21381894
duplicate of: http://stackoverflow.com/q/530012
has comment: http://stackoverflow.com/comment/32246507
has title: Converting String into SQl Date format
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21381892
type: Question
score: 0

http://stackoverflow.com/a/21440781
has comment: http://stackoverflow.com/comment/32358429
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32357139
has comment: http://stackoverflow.com/comment/32351419
accepted answer of: http://stackoverflow.com/q/21438412
has comment: http://stackoverflow.com/comment/32358546
score: 2
has body: Make the function return a pair (state, lca). state must be one of: 0: Neither v1 nor v2 appear at or under root; lca is meaningless. 1: Only v1 appears at or under root; lca is meaningless. 2: Only v2 appears at or under root; lca is meaningless. 3: Both v1 and v2 appear at or under root, and have LCA equal to lca. The function should begin by checking for base cases: LCABT(Node root, int v1, int v2) { if (root == null) then return (0, null); Otherwise, recurse on its left and right children, to see if one of them solves the problem all by itself: (s1, lca1) = LCABT(root.left, v1, v2); (s2, lca2) = LCABT(root.right, v1, v2); and if either s1 or s2 is 3, then the LCA has already been found (it's either lca1 or lca2, respectively) and can be returned immediately. (In fact, you can even obtain a speedup by checking whether s1 == 3 before making the second call to LCABT(): if it is, then we already have the LCA and don't need the second call.) if (s1 == 3) then return (3, lca1); if (s2 == 3) then return (3, lca2); Otherwise, set s = s1 | s2 (i.e. bitwise OR). If s == 3 then we know that root is the LCA, but we haven't yet considered all ways in which it can be the LCA: it can still be the LCA when only one of v1 and v2 is present at or under its children, provided that the other value is at root itself: s = s1 | s2; if (root.data == v1) then s = s | 1; if (root.data == v2) then s = s | 2; Now all cases in which root is the LCA imply s == 3, so if s == 3 then we can return (3, root) immediately: if (s == 3) then return (3, root); Otherwise, at most one of v1 and v2 is at or under root, so we should return a value indicating which one it is: return (s, null); } Finally, the original top-level call to LCABT() should obviously regard the function as succeeding only when it returns a state value of 3. Another advantage of this algorithm over yours is that it will not be fooled by duplicate copies of either v1 or v2 in the tree.
has comment: http://stackoverflow.com/comment/32358737
has comment: http://stackoverflow.com/comment/32356298
has comment: http://stackoverflow.com/comment/32357117
has comment: http://stackoverflow.com/comment/32356178
has comment: http://stackoverflow.com/comment/32356439
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21438412

http://stackoverflow.com/a/21383429
has comment: http://stackoverflow.com/comment/32250213
has body: Why do you want to delete the BOM byte? You just need to read the file to a string with the encoding the file has and then write the string to a file using UTF-8 encoding.
score: 0
has comment: http://stackoverflow.com/comment/32250079
has comment: http://stackoverflow.com/comment/32250068
type: Answer
has comment: http://stackoverflow.com/comment/32249851
has comment: http://stackoverflow.com/comment/32249564
answers question: http://stackoverflow.com/q/21383289

http://stackoverflow.com/q/21447229
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21449074
tagged with: java
type: Question
answer count: 2
tagged with: google-maps
has body: So, I have searched high and low to find an answer to this problem. I am trying to figure out how to modify the snippet text of a marker placed on my Google Map (map api v2), in an onPostExecute() call of an asynctask. How I would like to use this in my project, is to update the snippet text once the user has clicked on a marker. Sort of like an update to the information that is pre-set already on that marker. Example, in order of operation: User selects a marker on my map, Asynctask is triggered (through the onMarkerClickListener()) Asynctask preExecute() changes text of snippet to "Fetching next arrival time..." Asynctask doInBackground() queries my database for the requested data Asynctask postExecute() sets the selected marker snippet text to "Next: 4:15PM" I have tried a few different methods, and have arrived at a concise and reasonable solution, but it does not work. The problem I get, is that the marker needs to be of 'final' type, and when I do that, it does not update the snippet text that is displayed to the user, however it still runs through the asynctask and completes successfully. The following is the code I've tried: map.setOnMarkerClickListener(): map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { // Update marker next stop time updateMarkerSnippet(marker); return false; } }); updateMarkerSnippet(): public void updateMarkerSnippet(final Marker marker) { final String title = marker.getTitle(); AsyncTask&lt;Void, Void, Void&gt; update = new AsyncTask&lt;Void, Void, Void&gt;() { private String nextArrival = ""; @Override protected Void onPreExecute() { marker.setSnippet("Fetching next arrival time..."); } @Override protected Void doInBackground(Void... voids) { nextArrival = db.getNextArrival(title); // db is my database sql class (runs queries) return null; } @Override protected void onPostExecute(Void result) { marker.setSnippet("Next: " + nextArrival); } }; update.execute((Voi…
downvote count: 0
has answer: http://stackoverflow.com/a/21449074
favorite count: 0
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/38075991
upvote count: 2
has answer: http://stackoverflow.com/a/38075991
tagged with: android
has title: How to modify snippet text of Google Maps v2 Markers in Asynctask?

http://stackoverflow.com/comment/32454027
type: AnswerComment
score: 0
has text: Thank you for your answer, but I also want to use android as streaming server.
type: Comment
comment on: http://stackoverflow.com/a/21498751

http://stackoverflow.com/comment/32210694
type: AnswerComment
has text: `WrapLayout` is an extension to `FlowLayout`, you can change the `hgap` and `vgap` via the constructor, try passing `0, 0` to it instead
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21361706

http://stackoverflow.com/a/43112126
has comment: http://stackoverflow.com/comment/95263871
type: Answer
has body: Here's a variant that passes numerous project properties to the test JVM as system properties. I prefer project properties over system properties to increase flexibility. task intTest(type: Test) { systemProperties project.properties.subMap(["foo", "bar"]) } Which may be passed on the command-line: $ gradle intTest -Pfoo=1 -Pbar=2 And retrieved in your test: String foo = System.getProperty("foo");
downvote count: 0
has comment: http://stackoverflow.com/comment/95321189
answers question: http://stackoverflow.com/q/21406265
has comment: http://stackoverflow.com/comment/95096276
score: 10
has comment: http://stackoverflow.com/comment/90196910
upvote count: 10

http://stackoverflow.com/comment/32219114
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21366560
has text: @JBNizet It can create millions of *small* arrays, large (thousands, millions of elements) arrays are a different matter. And many important programs don't spend the majority (let alone 99.99999%) of their time waiting for user input. Even those who do may have *latency* constraints that make optimizations worthwhile. Not to condone premature optimization, but I prefer to dismiss these concerns for *right* reasons.
score: 0

http://stackoverflow.com/q/21434668
has comment: http://stackoverflow.com/comment/32339929
tagged with: java
has answer: http://stackoverflow.com/a/21447838
score: -1
type: Question
upvote count: 0
has title: Add jProgressBar to Java mail application
has comment: http://stackoverflow.com/comment/32339906
tagged with: jakarta-mail
linked to: http://stackoverflow.com/q/277007
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jprogressbar
downvote count: 1
has body: I'm trying develop a Java application for sending email. I'm using Java mail. I want to add file attachment option for this application. I did it. But now I need to add a jProgressBar to this application for viewing attachment uploading progress. I haven't idea about adding a jPogressBar to viewing uploading progress.

http://stackoverflow.com/a/21458457
answers question: http://stackoverflow.com/q/21444856
type: Answer
has body: In such point-of-view, I can also claim that Struts2 is not needed too because I can implement my web application using C++. Could you accept? I think no, because using an MVC pattern such Struts2 makes your application more clean and maintainable. Also, you do not have to redo things again yourself when they're implemented already. In same way, if you want to use already implemented and tested best practices and also if you would like to save time and money by not doing things from scratch, and if you like maintainable codes using separated concerns ... then you need to use Struts2 custom validators instead of that ugly validate method (It's ugly because aspects such validations should not mixed with business logic - see AOP).
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/32459604
type: QuestionComment
has text: I'm pretty sure you don't need the Maven dependencies, so remove those. And add to the `servlet-api` the following: ` provided `, since the container already has, though you need it to compile your code.
comment on: http://stackoverflow.com/q/21500676
score: 0
type: Comment

http://stackoverflow.com/comment/32366711
type: Comment
comment on: http://stackoverflow.com/a/21430327
has text: its giving me name= null
type: AnswerComment
score: 0

http://stackoverflow.com/q/21439064
tagged with: entity
has comment: http://stackoverflow.com/comment/32434915
score: 0
has answer: http://stackoverflow.com/a/21443072
has body: I have a question and I didn't find what I wanted to do. I'm using google Endpoints with appengine and Objectify. I have an entity Round which need the key of an entity Game just created. So when I have to create a new Game I create my new game and after that I create the round with the new key. I use the function .now() to save the game but sometimes the game is not created and I have a Round created without any Game. Because it was problematic I decided to loop to get the game until it's created, but I know it's a very bad way to do it and I am wondering what I can use instead. Before : //Create a new game Game game = new Game(pending_game.getPlayer(),pending_game.getApplicant()); ofy().save().entity(game).now(); //Get the player just created game = ofy().load().type(Game.class).filter("player1 =", pending_game.getPlayer()).filter("player2 =", pending_game.getApplicant()).first().now(); Key&lt;Game&gt; key_game = Key.create(Game.class, game.getId()); //We add the new round Round round = new Round(key_game,generateWord()); ofy().save().entity(round).now(); Now : //Create a new game Game game = new Game(pending_game.getPlayer(),pending_game.getApplicant()); ofy().save().entity(game).now(); Key&lt;Game&gt; key_game = null; //Get the player just created for(int i=0; i&lt;5 &amp;&amp; key_game == null;i++) { //Get the key of the new game created game = ofy().load().type(Game.class).filter("player1 =", pending_game.getPlayer()).filter("player2 =", pending_game.getApplicant()).first().now(); key_game = Key.create(Game.class, game.getId()); } //We add the new round Round round = new Round(key_game,generateWord()); ofy().save().entity(round).now(); Thanks for your help.
tagged with: google-cloud-endpoints
linked to: http://stackoverflow.com/q/3645582
tagged with: objectify
linked to: http://stackoverflow.com/q/14546456
tagged with: google-app-engine
has title: Objectify : Use an entity key juste created
linked to: http://stackoverflow.com/q/3750287
accepted answer: http://stackoverflow.com/a/21443072
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1

command-line
tags question: http://stackoverflow.com/q/21398755
tags question: http://stackoverflow.com/q/21455505
tags question: http://stackoverflow.com/q/21485436
tags question: http://stackoverflow.com/q/21378945
tags question: http://stackoverflow.com/q/21433172
type: Tag
tags question: http://stackoverflow.com/q/21412457
tag name: command-line

http://stackoverflow.com/a/21469272
has body: Cast the object to a Rectangle, not a Shape (getX() is defined in class Rectangle, not in Shape): Rectangle r = (Rectangle) shapes.get(i); r.getX(); However this is not probably what you want: if you have a list of Shapes, not all of them will be Rectangles. You can check whether the object is a Rectangle or not before using it: Shape j = (Shape) shapes.get(i); if (j instanceof Rectangle) { ((Rectangle) j).getX(); }
score: 1
answers question: http://stackoverflow.com/q/21469108
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32381677
comment on: http://stackoverflow.com/q/21458321
has text: How does it not work? At what point in the code does it fail?
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32398850
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21467322
score: 0
has text: It depends on your database, and if it supports them. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/clauses002.htm for Oracle.

http://stackoverflow.com/q/21388576
has title: how to find the most frequent character in a big string using java?
has comment: http://stackoverflow.com/comment/32259034
has answer: http://stackoverflow.com/a/21388951
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32259142
has comment: http://stackoverflow.com/comment/32259047
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32259203
has comment: http://stackoverflow.com/comment/32259056
has comment: http://stackoverflow.com/comment/32259085
has comment: http://stackoverflow.com/comment/32259005
has comment: http://stackoverflow.com/comment/32259084
has comment: http://stackoverflow.com/comment/32259429
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21388731
has comment: http://stackoverflow.com/comment/32259030
upvote count: 1
has comment: http://stackoverflow.com/comment/32259274
type: Question
has comment: http://stackoverflow.com/comment/32259187
has comment: http://stackoverflow.com/comment/32259241
has body: i'm working on an assignment that i have to find the most four frequent characters in a string. i write this so far. import java.util.Scanner; public class FindTheMostOccur { public static void main (String[] args) { String input; String example = "how to find the most frequent character in a big string using java?"; String[] array = new String[example.length()]; for (int i = 97; i &lt; 123; i++) { int mostFrequent =0; for( int j = 0; j &lt; example.length(); j++) { if(example.charAt(j) == i) { ++mostFrequent; } } System.out.println( (char)i + " is showing " + mostFrequent+ " times "); } } } Here is the output for this example. a is showing 5 times b is showing 1 times c is showing 2 times d is showing 1 times e is showing 4 times f is showing 2 times g is showing 3 times h is showing 3 times i is showing 5 times j is showing 1 times k is showing 0 times l is showing 0 times m is showing 1 times n is showing 5 times o is showing 3 times p is showing 0 times q is showing 1 times r is showing 4 times s is showing 3 times t is showing 6 times u is showing 2 times v is showing 1 times w is showing 1 times x is showing 0 times y is showing 0 times in this examle : t, a,i,n I DON"T NEED SOMEONE TO COMPLETE THE PROGRAM FOR ME, however i need some ideas how to find the most four frequent character in this example.
has answer: http://stackoverflow.com/a/21388654
tagged with: char
has answer: http://stackoverflow.com/a/21388755
has answer: http://stackoverflow.com/a/21388745
downvote count: 0

http://stackoverflow.com/comment/88404139
type: AnswerComment
type: Comment
has text: @fernandohur Yes I agree, but this feels like a mapreduce to get the last element while all it needs is to access the last element by memory. Looks like the job of an array but arrays are inherently imperative instead of declarative. Fits the criteria for an inbuilt method called last()?
comment on: http://stackoverflow.com/a/21441634
score: 0

arrays
tags question: http://stackoverflow.com/q/21357941
tags question: http://stackoverflow.com/q/21438064
tags question: http://stackoverflow.com/q/21397422
tags question: http://stackoverflow.com/q/21481073
tags question: http://stackoverflow.com/q/21436157
tags question: http://stackoverflow.com/q/21507813
tags question: http://stackoverflow.com/q/21501021
tags question: http://stackoverflow.com/q/21445425
type: Tag
tags question: http://stackoverflow.com/q/21407966
tags question: http://stackoverflow.com/q/21359980
tags question: http://stackoverflow.com/q/21364232
tags question: http://stackoverflow.com/q/21376281
tags question: http://stackoverflow.com/q/21505211
tags question: http://stackoverflow.com/q/21425108
tags question: http://stackoverflow.com/q/21408800
tags question: http://stackoverflow.com/q/21419112
tags question: http://stackoverflow.com/q/21358412
tags question: http://stackoverflow.com/q/21473706
tags question: http://stackoverflow.com/q/21505068
tags question: http://stackoverflow.com/q/21443380
tags question: http://stackoverflow.com/q/21501644
tags question: http://stackoverflow.com/q/21452388
tags question: http://stackoverflow.com/q/21504760
tags question: http://stackoverflow.com/q/21368156
tags question: http://stackoverflow.com/q/21443606
tags question: http://stackoverflow.com/q/21483942
tags question: http://stackoverflow.com/q/21507555
tags question: http://stackoverflow.com/q/21423292
tags question: http://stackoverflow.com/q/21371308
tags question: http://stackoverflow.com/q/21416315
tags question: http://stackoverflow.com/q/21503160
tags question: http://stackoverflow.com/q/21463674
tags question: http://stackoverflow.com/q/21442914
tags question: http://stackoverflow.com/q/21370075
tags question: http://stackoverflow.com/q/21464823
tags question: http://stackoverflow.com/q/21459985
tags question: http://stackoverflow.com/q/21469202
tags question: http://stackoverflow.com/q/21419862
tags question: http://stackoverflow.com/q/21360085
tags question: http://stackoverflow.com/q/21392994
tags question: http://stackoverflow.com/q/21506198
tags question: http://stackoverflow.com/q/21392057
tags question: http://stackoverflow.com/q/21509383
tags question: http://stackoverflow.com/q/21487325
tags question: http://stackoverflow.com/q/21480772
tags question: http://stackoverflow.com/q/21416512
tags question: http://stackoverflow.com/q/21372428
tags question: http://stackoverflow.com/q/21470665
tags question: http://stackoverflow.com/q/21417359
tags question: http://stackoverflow.com/q/21415414
tags question: http://stackoverflow.com/q/21466924
tags question: http://stackoverflow.com/q/21495773
tags question: http://stackoverflow.com/q/21393199
tags question: http://stackoverflow.com/q/21410967
tags question: http://stackoverflow.com/q/21361109
tags question: http://stackoverflow.com/q/21388483
tags question: http://stackoverflow.com/q/21413608
tags question: http://stackoverflow.com/q/21423064
tags question: http://stackoverflow.com/q/21492348
tags question: http://stackoverflow.com/q/21367900
tags question: http://stackoverflow.com/q/21372769
tags question: http://stackoverflow.com/q/21423965
tags question: http://stackoverflow.com/q/21358740
tags question: http://stackoverflow.com/q/21498910
tags question: http://stackoverflow.com/q/21424605
tags question: http://stackoverflow.com/q/21366227
tags question: http://stackoverflow.com/q/21403069
tags question: http://stackoverflow.com/q/21395998
tags question: http://stackoverflow.com/q/21436068
tags question: http://stackoverflow.com/q/21373245
tags question: http://stackoverflow.com/q/21501142
tags question: http://stackoverflow.com/q/21424313
tags question: http://stackoverflow.com/q/21446566
tags question: http://stackoverflow.com/q/21394583
tags question: http://stackoverflow.com/q/21506049
tags question: http://stackoverflow.com/q/21394440
tags question: http://stackoverflow.com/q/21367252
tags question: http://stackoverflow.com/q/21366560
tags question: http://stackoverflow.com/q/21493234

http://stackoverflow.com/q/21350835
has answer: http://stackoverflow.com/a/21350944
answer count: 2
has title: Async task not working
type: UnansweredQuestion
tagged with: android
has body: Hey i have a problem with my android application.I'm trying to download text from given url to Editable box but when i'm running application and hit the button it suddenly stops working.I am using asynctask to download, also eclipse tells me that class DownloadTask is not used locally public void sendMessage(View view) throws IOException { new DownloadTask().execute(); } private class DownloadTask extends AsyncTask{ protected Object doInBackground(Object... params) { // TODO Auto-generated method stub try { EditText tf = (EditText) findViewById(R.id.editText1); String kupa = tf.getText().toString(); Document doc; doc = Jsoup.connect(kupa).get(); String title = doc.text(); TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(title); } catch (IOException e) { e.printStackTrace(); } return null; } protected void onPostExecute(String result) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(result); } } Also i added two lines of code to my onCreate method StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); If this helps min api is 10,target is 16 cheers guys
score: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32191112
type: Question
tagged with: jsoup
has answer: http://stackoverflow.com/a/21351160
has comment: http://stackoverflow.com/comment/32191261

http://stackoverflow.com/comment/32317470
score: 0
type: AnswerComment
has text: But if he really wants to execute the code in separate thread then what?
comment on: http://stackoverflow.com/a/21421735
type: Comment

http://stackoverflow.com/q/21455346
type: Question
tagged with: ssl
upvote count: 3
tagged with: security
has comment: http://stackoverflow.com/comment/115100655
has comment: http://stackoverflow.com/comment/32394631
answer count: 1
favorite count: 0
tagged with: encryption
has answer: http://stackoverflow.com/a/21455845
accepted answer: http://stackoverflow.com/a/21455845
has body: I've got a small website and it's security is important to me. I don't have the money to buy an SSL certificate so I thought of making one myself (theoretically with java, although I still don't know how would I then decrypt it on the sever side). The users won't trust it like they trust SSL but it would provide the security I'm looking for. I read a few articles about SSL and I think I got the math behind it but I didn't understand How does it protect from sniffing. If SSL encrypts the password/info/whatever on the client's computer and than sends it to the server for decryption, what problem would there be for a sniffer to sniff the encoded password and send it to the server?
type: AnsweredQuestion
score: 3
has title: How does SSL protect the data against sniffing?
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32377074

http://stackoverflow.com/comment/32261274
type: QuestionComment
comment on: http://stackoverflow.com/q/21389650
type: Comment
has text: Short of running with [DTrace](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dtrace.1.html), you might check the [FAQ](http://www.oracle.com/technetwork/java/index-137037.html#Q_What_kinds_of_graphics_hardwar) where you would have seen `-Dsun.java2d.trace=[log[,timestamp]],[count],[out:<filename>],[help],[verbose]`.
score: 0

http://stackoverflow.com/comment/32431534
type: Comment
has text: damn! Does using another activity means using a separate thread... or I got to handle multi threading directly on my mainactivity?
comment on: http://stackoverflow.com/q/21478106
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32476723
has text: @codegeek I already show you how to do that in the first example of the two that I wrote. Am I missing something here?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21511090

http://stackoverflow.com/q/21431114
has body: public class Test { public static void main(String[] args) { int i = 012; System.out.println(i); } } Why the output is : 10?
linked to: http://stackoverflow.com/q/565634
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/21431163
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32369567
type: Question
has answer: http://stackoverflow.com/a/21431135
accepted answer: http://stackoverflow.com/a/21431135
has answer: http://stackoverflow.com/a/21431223
has answer: http://stackoverflow.com/a/21431192
has comment: http://stackoverflow.com/comment/32333204
has title: Clarification about "int" number that begins with 0
has comment: http://stackoverflow.com/comment/32333685
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21431163

http://stackoverflow.com/a/21474498
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21474389
answers question: http://stackoverflow.com/q/21474389
has body: The for loop is the correct way to draw it, your problem is probably the amount of data you are trying to draw in one frame and/or the number of pixels you are trying to push through the system. If you want good performance on Android your best bet will be to use the graphics hardware it provides. There are various game frameworks available that will make that easier for you and give you much better performance than you will get otherwise. If not then you will need to break up the drawing and still run the same effective logic but spread out so you draw a few tiles per frame.
type: Answer

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/21492118
tags question: http://stackoverflow.com/q/21359095
tags question: http://stackoverflow.com/q/21395952
tags question: http://stackoverflow.com/q/21448004
tags question: http://stackoverflow.com/q/21362278
tags question: http://stackoverflow.com/q/21479060
tags question: http://stackoverflow.com/q/21397183
type: Tag
tags question: http://stackoverflow.com/q/21459528
tags question: http://stackoverflow.com/q/21421150
tags question: http://stackoverflow.com/q/21476420
tags question: http://stackoverflow.com/q/21399996
tags question: http://stackoverflow.com/q/21505249
tags question: http://stackoverflow.com/q/21355434
tags question: http://stackoverflow.com/q/21513736
tags question: http://stackoverflow.com/q/21467193
tags question: http://stackoverflow.com/q/21429246

http://stackoverflow.com/comment/32250833
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21384025
type: Comment
has text: That was.. you're awsome guys. Thank you very much.. very greatful !

http://stackoverflow.com/comment/32279275
score: 1
has text: http://vanillajava.blogspot.co.uk/2011/08/readingwriting-gc-less-memory.html
comment on: http://stackoverflow.com/q/21400016
type: QuestionComment
type: Comment

mime-types
tags question: http://stackoverflow.com/q/21429762
tag name: mime-types
type: Tag

http://stackoverflow.com/comment/32308449
comment on: http://stackoverflow.com/q/21414720
type: QuestionComment
has text: @claj... That is not even close
score: 0
type: Comment

http://stackoverflow.com/q/21420624
has answer: http://stackoverflow.com/a/27664855
has title: AES encryption base64().encodetoString unidentified by java netbean
has body: I am currently working on an AES encryption 256 bit function found here: http://deveshsharma.info/2012/10/09/256-bit-aes-password-based-encryption-in-java What I am trying to do now is to see the output of the code above. But NetBean can't read encodeAsString after I import it. import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; ... byte[] encryptedTextBytes = cipher.doFinal(plainText.getBytes("UTF-8")); return new Base64().encodeAsString(encryptedTextBytes); When I check with (alt+enter on encodeAsString), the error is "cannot find symbol .. Base64 is internal proprietary API and may be removed in a future release"
has answer: http://stackoverflow.com/a/21420714
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 0
score: -2
linked to: http://stackoverflow.com/q/10759392
tagged with: base64
accepted answer: http://stackoverflow.com/a/21420714
favorite count: 0
answer count: 3
tagged with: aes
possible better answer: http://stackoverflow.com/a/21420834
has answer: http://stackoverflow.com/a/21420834
downvote count: 2

http://stackoverflow.com/comment/54749246
type: QuestionComment
comment on: http://stackoverflow.com/q/21404830
has text: This might also be helpful: http://stackoverflow.com/questions/19449738/long-startup-delay-for-java-webstart-application-since-java-1-7-0u40
score: 0
type: Comment

http://stackoverflow.com/comment/32395684
type: Comment
has text: @whitewolfpgh: oh, so you're asking is it better to add the JButton directly to the contentPane vs. adding it to a JPanel that is then added to the contentPane. The answer: whichever works best for you in this situation. My experience has been that when I find myself adding a button to a GUI, I often find myself adding several more buttons, so I often create a JPanel, say buttonPanel, that often uses a `GridLayout(1, 0, 5, 0)` (1 row, variable columns, 5 space between,...) or something similar so that I have a nice row of buttons.
type: AnswerComment
comment on: http://stackoverflow.com/a/21465489
score: 0

http://stackoverflow.com/q/21477283
tagged with: code-generation
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/21478481
score: 3
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21477621
has comment: http://stackoverflow.com/comment/32420200
has comment: http://stackoverflow.com/comment/32571393
favorite count: 0
has comment: http://stackoverflow.com/comment/33142039
downvote count: 1
has title: Writing a code generator that refers to existing Java classes
upvote count: 4
has comment: http://stackoverflow.com/comment/32424441
has body: I'm trying to evaluate different approaches to have some code in our Java project generated automatically from definitions in a domain-specific language while building the project. I have manually written a code generator or two in the past but I have no experience with existing code generation frameworks. We have not yet decided whether to use such a framework or build the generator by hand. I need help with a conceptual problem; I would like to understand how a code generator can be built which allows the DSL to refer to existing (hand-written) Java classes, methods and fields. It should be possible to refer to classes that are in the same compilation unit (e.g. Maven project) as the generated Java classes. This means that those hand-written classes cannot be compiled before the code generator is run and the code generator would have to look at Java source files in addition to everything required to be on the classpath for compiling those classes. How do existing frameworks handle such cases, if at all? Do they parse the Java source files themselves or do they re-use some machinery of the Java compiler? I think this is the same problem that any (non-dynamic) non-Java language targeting the JVM faces, if it allows its own code to reference Java classes and vice-versa in the same compilation units. Maybe it is helpful to look at how those compilers work, unless they circumvent javac by also include a Java compiler themselves. There are multiple reasons why the code generator needs access to the classes in the Java files of the same compilation unit: I would like to provide semantics similar to those in Java where I can import &lt;package&gt;.* and then use the names of those classes without fully qualifying the name of each of them. I would like to reject code in the DSL if it refers to symbols that don't exists or don't meet some required criteria. There will be cases where I want to generate code that depends on the members of a class or the signatures of methods.…
tagged with: dsl
type: UnansweredQuestion

http://stackoverflow.com/comment/32341386
type: QuestionComment
comment on: http://stackoverflow.com/q/21434924
has text: @user3249322 Could you post please a compilable example? You're missing braces in this one (in your for per example).
score: 0
type: Comment

http://stackoverflow.com/q/21374099
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/29035474
type: Question
downvote count: 0
has title: How to keep Java 32 and 64 Bit at the same version?
has body: can anybody please explain to me how I can keep Java 64Bit and 32Bit at the same Patchlevel on my Win7 x64 machine? The java updater is really a disappointment, and it does not even tell you which version it is actually updatinmg, all it is good for is trying to get you new adware (toolbars) installed, really a pain :( Nevertheless, this is what my system looks like at the moment, and the java updater installed tells me everything is okay: How can this be fixed?
answer count: 1
favorite count: 0
tagged with: windows-7
type: UnansweredQuestion
tagged with: 64-bit

http://stackoverflow.com/comment/32222301
type: Comment
comment on: http://stackoverflow.com/a/21368216
type: AnswerComment
score: 1
has text: OP, now I think you're not looking for an efficient way (in terms of time complexity) but just for a shorter way to do this with some Java code.

http://stackoverflow.com/q/21473959
has answer: http://stackoverflow.com/a/26374052
has body: I am trying to add or insert values into table of database using servlet and jsp and MySQL Workbench as database. These are the following details: 1.> Register.java package register.com; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.*; import javax.servlet.*; /** * Servlet implementation class Register */ @WebServlet("/register") public class Register extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Register() { super(); // TODO Auto-generated constructor stub } /** * @see Servlet#init(ServletConfig) */ public void init(ServletConfig config) throws ServletException { // TODO Auto-generated method stub } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method 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 response.setContentType("text/html"); PrintWriter pw = response.getWriter(); //String connectionURL = "jdbc:mysql://127.0.0.1:3306/newData";// newData is the database //Connection connection; Connection conn=null; String url="jdbc:mysql://localhost:3306/"; String dbName="userlogindb"; String driver="com…
possible better answer: http://stackoverflow.com/a/21474232
answer count: 7
has answer: http://stackoverflow.com/a/21474232
has answer: http://stackoverflow.com/a/21483632
favorite count: 0
has answer: http://stackoverflow.com/a/37261285
has answer: http://stackoverflow.com/a/30647753
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23033724
accepted answer: http://stackoverflow.com/a/21483632
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32410218
tagged with: mysql
downvote count: 1
type: Question
has title: insert data into database using servlet and jsp in eclipse
upvote count: 5
tagged with: jsp
has comment: http://stackoverflow.com/comment/32410030
has comment: http://stackoverflow.com/comment/32419351
score: 4
has answer: http://stackoverflow.com/a/26064823
tagged with: servlets

http://stackoverflow.com/a/21447111
has comment: http://stackoverflow.com/comment/32365081
has comment: http://stackoverflow.com/comment/32365154
has comment: http://stackoverflow.com/comment/32490372
has comment: http://stackoverflow.com/comment/32427730
has comment: http://stackoverflow.com/comment/32365044
has comment: http://stackoverflow.com/comment/32362971
accepted answer of: http://stackoverflow.com/q/21446957
has comment: http://stackoverflow.com/comment/32363985
has comment: http://stackoverflow.com/comment/32488190
has comment: http://stackoverflow.com/comment/32363038
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32398193
downvote count: 0
has comment: http://stackoverflow.com/comment/32381070
answers question: http://stackoverflow.com/q/21446957
has comment: http://stackoverflow.com/comment/32365002
has comment: http://stackoverflow.com/comment/32363083
has comment: http://stackoverflow.com/comment/32368305
has comment: http://stackoverflow.com/comment/32363967
has comment: http://stackoverflow.com/comment/32368366
has comment: http://stackoverflow.com/comment/32368182
has body: I would use an Action. Here is the AbstractAction constructor public AbstractAction(String name, Icon icon) - Creates an Action with the specified name and small icon. Parameters: name - the name (Action.NAME) for the action; a value of null is ignored icon - the small icon (Action.SMALL_ICON) for the action; a value of null is ignored The benefit of using an Action is that is can be reused for components with similar purposes. So say you want to have an icon button in the toolbar to open a file, and also have a JMenuItem in a JMenu that also opens a file. They could share the same action, thus sharing the same icon, action command, and action to perform. Action action = new AbstractAction("someActionCommand", someIcon) { @Override public void actionPerformed(ActionEvent e) { // do something. } }; toolbar.add(action); The above will automatically put the icon for you, but not the String. In a JMenuItem it would put both the String and the icon. Then just add the Action to the tool bar. See more at How to use Actions To answer you real question, as @MadProgrammer noted, you should be loading your images as an embedded resource, using ImageIcon icon = new ImageIcon(MyClass.class.getResource("/resources/images/image.png")); where the /resources/images directory is in the src, and getResource() returns a URL. Upon build, your IDE should copy the files into the class path for you. ProjectRoot src resources images image.png You'll come to find that when using a file from the file system, will not work upon time of deployment Here's an example, where the JMenuItem and the JToolBar button share the same action. Notice that in the JToolBar all I have to do is add the Action, I don't need to create a button for it. The JToolBar automatically makes it a button, without the action command I use this "open.gif" from the below file structure and use ImageIcon icon = new ImageIcon( ActionTest.class.getResource("/resources/image/open.gif")); Here's the result Here's the code. Enjoy…
has comment: http://stackoverflow.com/comment/32427710
has comment: http://stackoverflow.com/comment/32368294
has comment: http://stackoverflow.com/comment/32381244
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/q/21376258
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has body: I created a StringManager for different languages and like to read characters like öäü from the xml but this fails. I get some "fanzy characters" so not the right ones. here i do parse the xml public StringManager() { FileHandle handle = Gdx.files.internal(MainClass.config.getValueOf( String.class, FILE)); try { // parse the xml. Its an hashtable than! this.xml = this .parse(Base64Coder.decodeString(handle.readString())); } catch (Exception e) { Logger.error(e.getMessage()); return; } i know that the decoding doesnt do something to that. Tried decoded too. This is how i get a String: public String getString(String stringname) { try { return this.xml.get(stringname); // catch if not found } catch (com.badlogic.gdx.utils.GdxRuntimeException e) { Logger.error("String not found: " + stringname + " " + e.getMessage()); return ""; } } and here is a small sett from the xml &lt;root&gt; &lt;!-- German --&gt; &lt;de_DE&gt; .... &lt;level_text&gt;level&lt;/level_text&gt; &lt;skill_name&gt;Skill Name&lt;/skill_name&gt; &lt;back_to_skillmenu&gt;Zurück zum Skillmenu&lt;/back_to_skillmenu&gt; &lt;!-- here it does not return the right value --&gt; &lt;back_to_game&gt;Zurück zum Spiel&lt;/back_to_game&gt; &lt;!-- here it does not return the right value --&gt; &lt;/de_DE&gt; &lt;/root&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/32237196
has comment: http://stackoverflow.com/comment/32236922
type: AnsweredQuestion
tagged with: libgdx
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21376618
accepted answer: http://stackoverflow.com/a/21376618
type: Question
upvote count: 1
answer count: 1
tagged with: string
favorite count: 0
has title: parsing/reading öäü from xml file

http://stackoverflow.com/q/21493022
has body: Ive got a while loop that keeps running as long as an if is true at least once per loop but i cant find the reason why the loop wont stop. (there are a couple more ifs but i removed them because they are the exact same) boolean changed = true; do{ boolean stopLoop = false; if(remove1=="") { EquipmentSlot1.setText(EquipmentSlot2.getText()); EquipmentSlot2.setText(""); stopLoop = true; } if(remove2=="") { EquipmentSlot2.setText(EquipmentSlot3.getText()); EquipmentSlot3.setText(""); stopLoop = true; } if(remove3=="") { EquipmentSlot3.setText(EquipmentSlot4.getText()); EquipmentSlot4.setText(""); stopLoop = true; } if(stopLoop = false) { changed = false; } }while(changed);
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21493030
has title: do-while loop wont end and crashes program
type: Question
tagged with: do-while
answer count: 2
has answer: http://stackoverflow.com/a/21493056
score: 0
tagged with: while-loop
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/32444022

http://stackoverflow.com/q/21484162
has answer: http://stackoverflow.com/a/22296545
type: AnsweredQuestion
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21485276
favorite count: 0
has answer: http://stackoverflow.com/a/21484304
possible better answer: http://stackoverflow.com/a/21484213
has title: java.lang.IndexOutOfBoundsException: No group 1 | Pattern matching
has body: I am trying to extract the value of version from Accept header which can be of the form "vnd.example-com.foo+json; version=1.1" here is my code for extracting the version val resourceVersionPattern: Pattern = Pattern.compile("(?&lt;=version=).*") def getResourceVersion(acceptHeader: String): String = { import java.util.regex.Matcher val matcher: Matcher = resourceVersionPattern.matcher(acceptHeader) if(matcher.find()) ("v" + matcher.group(1)).trim() else "v1.0" } When I am invoking the above function which is intended to extract version (for example can be of the form v1.0 or v1.5 or v2.5) getResourceVersion("vnd.example-com.foo+json; version=1.1") I get following exception: java.lang.IndexOutOfBoundsException: No group 1 at java.util.regex.Matcher.group(Matcher.java:487) at .getResourceVersion(&lt;console&gt;:12) at .&lt;init&gt;(&lt;console&gt;:11) at .&lt;clinit&gt;(&lt;console&gt;) at .&lt;init&gt;(&lt;console&gt;:11) at .&lt;clinit&gt;(&lt;console&gt;) at $print(&lt;console&gt;) 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 scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704) at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920) at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43) at scala.tools.nsc.io.package$$anon$2.run(package.scala:25) at java.lang.Thread.run(Thread.java:744) I think I am doing something wrong in my regex or the input string has some illegal charecters which I am not able to identify with my limited knowledge of Regular expression. Help me find out the reason.
type: Question
has answer: http://stackoverflow.com/a/21484213
tagged with: scala
tagged with: regex
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21485276
answer count: 4

http://stackoverflow.com/q/21470508
tagged with: java
accepted answer: http://stackoverflow.com/a/21470800
score: 0
has comment: http://stackoverflow.com/comment/32404422
answer count: 1
tagged with: mergesort
tagged with: sorting
has title: mergesort using linkedList not working correctly - implemented in Java
has comment: http://stackoverflow.com/comment/32404490
has answer: http://stackoverflow.com/a/21470800
type: AnsweredQuestion
tagged with: linked-list
has comment: http://stackoverflow.com/comment/32404414
has body: I have implemented mergesort method for a custom LinkedIntList which is nothing but a LinkedList class. I am having difficulty in understanding why it fails. That is it does not produce any result. I gave gone through the code multiple times and I could not figure out. Here is the code: class ListNode { public int data; // data stored in this node public ListNode next; // link to next node in the list // post: constructs a node with data 0 and null link public ListNode() { this(0, null); } // post: constructs a node with given data and null link public ListNode(int data) { this(data, null); } // post: constructs a node with given data and given link public ListNode(int data, ListNode next) { this.data = data; this.next = next; } } LinkedIntList class: public class LinkedIntList { public ListNode front; // Constructs an empty list. public LinkedIntList() { this(null); } public LinkedIntList(ListNode node){ front=node; } public String toString() { if (front == null) { return "[]"; } else { String result = "[" + front.data; ListNode current = front.next; while (current != null) { result += ", " + current.data; current = current.next; } result += "]"; return result; } public void sort(){ front=mergeSort(front); } public ListNode mergeSort(ListNode node) { //ystem.out.println("merge sort is called"); //first get middle of linkedlist, using two pointers //you can also get this by size/2 //step 1: get middle pointers if (node==null || node.next==null) return null; ListNode runner=node.next.next; ListNode walker=node; while(runner!=null &amp;&amp; runner.next!=null){ runner=runner.next.next; walker=walker.next; } //At this point walker is in center ListNode right=walker.next; walker.next=null; ListNode left=node; left=mergeSort(left); right=mergeSort(right); node=merge(left,right); return node; } //merge of two linkedlist happens here private ListNode merge(ListNode l1, ListNode l2) { if (l1==null){ return l2; } if (l2==null){ return l1; } ListNode head=null; ListNode curr=…
type: Question
has comment: http://stackoverflow.com/comment/32404441
tagged with: algorithm

http://stackoverflow.com/q/21501055
tagged with: java
has title: Eclipse package needed to run successfully
has answer: http://stackoverflow.com/a/21507256
type: Question
tagged with: eclipse
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21507256
has comment: http://stackoverflow.com/comment/32457941
tagged with: package
has comment: http://stackoverflow.com/comment/32458072
has comment: http://stackoverflow.com/comment/32458315
has body: I'm just beginning at running simple Java programs with Eclipse. The udemy.com tutorial I'm working from starts each program with public class followed by the main method. I get an error in main method compilation error, unless I start a file from scratch and include the package line at the beginning. It runs fine when package is included. I don't understand why this is necessary. Most of the tutorials and example code I've looked at do not include the package line.
type: AnsweredQuestion

http://stackoverflow.com/q/21470120
has title: Property file not found in JAR file
score: 0
has body: I have a project which has Main method to invoke the application. Which is bundled in a JAR file. I am trying to invoke the application using following line: java -jar sample.jar -sample 123 This sample.jar bundled with config/config.properties in it. I have following line of code to read the property file from the JAR. InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("config/config.properties"); OR InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("/config/config.properties"); This code is not able to find property file from the JAR file, While this property file is already exist in the JAR. Does any one know the solution on this ?
has comment: http://stackoverflow.com/comment/32403667
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32404114
tagged with: java
has comment: http://stackoverflow.com/comment/32403739
tagged with: classpath
has answer: http://stackoverflow.com/a/21470996
type: Question
has comment: http://stackoverflow.com/comment/32404548
answer count: 1
tagged with: jar

http://stackoverflow.com/a/21492653
has comment: http://stackoverflow.com/comment/32555090
has comment: http://stackoverflow.com/comment/32558687
has comment: http://stackoverflow.com/comment/32525981
has comment: http://stackoverflow.com/comment/32528223
has comment: http://stackoverflow.com/comment/32528454
score: 0
has comment: http://stackoverflow.com/comment/32568530
answers question: http://stackoverflow.com/q/21489300
type: Answer
has body: 1.Is my observed Hibernate behaviour the intended behaviour? The behavior is correct. You just trying to do operations that are not protected against concurrent data modification :) If you have to split the operation into two sessions. Just find the object for update again and check if it is still there, throw exception if not. If there is one then lock it by using em.(class, primary key, LockModeType); or using @Version or @Entity(optimisticLock=OptimisticLockType.ALL/DIRTY/VERSION) to protect the object till the end of the transaction. 2.If so, is it the same behaviour when calling merge on a JPA EntityManager instead of a Hibernate Session? Probably: yes 3.If the answer to 2. is yes, why is nobody complaining about it? Because if you protect your operations using pessimistic or optimistic locking the problem will disappear:) The problem you are trying to solve is called: Non-repeatable read
has comment: http://stackoverflow.com/comment/32519722
has comment: http://stackoverflow.com/comment/32525757

http://stackoverflow.com/a/21505681
type: Answer
upvote count: 15
has comment: http://stackoverflow.com/comment/32466625
accepted answer of: http://stackoverflow.com/q/21505522
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21505522
downvote count: 0
score: 15
has body: Your program fails in this test case int[] arr5 = {0,0,0,0,0,0,1,1,1,1,2,3,0,0,0,1,1,0,1,1,0,1,0,3}; Your result [0, 1, 3] Shouldn't it be [0,1,2,3]

http://stackoverflow.com/a/21450023
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21419707
has body: I just tried this which might or might not be your configuration. But the code as mentioned by you works perfectly fine for me. Here is what i have tried based on your question and mentioned information. If i just change the bean definition in the anotherConfig.xml file, it works fine for ClassA as well. Works for ClassB too applicationContext.xml &lt;import resource="classpath*:anotherConfig.xml"/&gt; &lt;context:component-scan base-package="com.appContextexample"/&gt; &lt;aop:aspectj-autoproxy/&gt; &lt;aop:config proxy-target-class="true"&gt; &lt;aop:pointcut id="addSubmitListener" expression="execution (* com.click.otherfoo.ClassB.methodB(..))"/&gt; &lt;aop:aspect ref="hijackBeforeAddSubmitListenerBean"&gt; &lt;aop:around method="proceedWhileNotDash" pointcut-ref="addSubmitListener"/&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; &lt;bean id = "hijackBeforeAddSubmitListenerBean" class = "com.appContextexample.HijackBeforeAddSubmitListenerBean"/&gt; &lt;/beans&gt; anotherConfig.xml &lt;bean id="classA" class="com.click.otherfoo.ClassB"&gt;&lt;/bean&gt; Application.java This is the starting point. public class Application { public static void main(final String[] args) { final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); final ClassB bean = (ClassB) context.getBean("classA"); bean.methodB("test"); System.out.println("appContext created" + bean); } ClassB.java package com.click.otherfoo; public class ClassB { public void methodB(final String str) { System.out.println(str); } } And finally the Aspect. public class HijackBeforeAddSubmitListenerBean { public Object proceedWhileNotDash(final ProceedingJoinPoint pjp) throws Throwable { System.out.println("Called the aspect"); pjp.proceed(); return null; }

http://stackoverflow.com/comment/32194947
type: Comment
type: QuestionComment
has text: they are telling that I have to fix setCurrentTimeOnView method and specially underlining this line in the method "timePicker1.setVisibility(View.INVISIBLE);"... but if u see my class Promillekalkulator, it has exactly the same methods .. n its working
score: 0
comment on: http://stackoverflow.com/q/21352851

http://stackoverflow.com/q/21422422
has title: Does JVM memory overhead scale linearly, or is it constant?
tagged with: java
has comment: http://stackoverflow.com/comment/32318663
has comment: http://stackoverflow.com/comment/32361299
has body: In my experience, a C program that uses around 10 megabytes of resident memory may use around 40 to 50 MB when translated into Java, and around 100 in Clojure or Scala. My question is whether this JVM memory overhead scales linearly; if the C version used 1 gigabyte, would the Java version require 4 GB? Or is the JVM memory overhead more a constant factor, such that the 1 GB C program might only use 1.5 GB in Java? I'm aware that I could benchmark this, but I think hearing people's experience regarding JVM memory use in production would be more informative than an artificial benchmark, which could be skewed to favour either result depending on how it was designed.
has comment: http://stackoverflow.com/comment/32318618
has answer: http://stackoverflow.com/a/21422439
downvote count: 4
type: AnsweredQuestion
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/32326539
type: Question
accepted answer: http://stackoverflow.com/a/21422439
score: -2
tagged with: clojure
upvote count: 2
has comment: http://stackoverflow.com/comment/32318622
tagged with: scala
answer count: 1
has comment: http://stackoverflow.com/comment/32322504
has comment: http://stackoverflow.com/comment/32319388
has comment: http://stackoverflow.com/comment/32328358

iframe
tags question: http://stackoverflow.com/q/21453634
tag name: iframe
tags question: http://stackoverflow.com/q/21479198
tags question: http://stackoverflow.com/q/21505373
type: Tag
tags question: http://stackoverflow.com/q/21385904

http://stackoverflow.com/comment/32406374
score: 0
type: Comment
type: QuestionComment
has text: You sure it's a java project and you have a jdk defined?
comment on: http://stackoverflow.com/q/21471541

http://stackoverflow.com/a/21442636
upvote count: 1
type: Answer
has body: Either delete the supportv4.jar from your project and use the one bundled in ActionBarSherlock, or update the supportv4.jar in ActionbarSherlock and then delete the one in your project. You see, the conflict arises because with ActionBarSherlock comes a version of the supportv4.jar, so your classpath has two versions of the same jar.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21441589

http://stackoverflow.com/comment/32535548
type: Comment
type: AnswerComment
has text: try adding the entity part which will add the body content
comment on: http://stackoverflow.com/a/21415000
score: 0

http://stackoverflow.com/q/21472309
has answer: http://stackoverflow.com/a/21472338
has answer: http://stackoverflow.com/a/21472337
has title: Is there a better way to add objects to an ArrayList in java? Everytime i try to add or set something new it changes the whole array to that object
tagged with: java
possible better answer: http://stackoverflow.com/a/21472337
has body: I am making a card game and attempting to use a Card object made up of two string elements: the value of the card and the suit, and creating an ArrayList of these card objects. I have attempted this with the code below and have noticed that everytime i add a new element, i see that every element is changed to have the same data as the most recently added element Here's my code: import java.util.*; public class testArrayList { public static void main(String args[]) { ArrayList&lt;Card&gt; deck= new ArrayList&lt;Card&gt;(); String cValues[] = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; int cVLength= cValues.length; String cSuit[] = {"Hearts", "Diamonds", "Clubs", "Spades"}; int cSLength= cSuit.length; for(int k=0; k&lt;cVLength; k++) { for(int j=0; j&lt;cSLength; j++) { deck.add(new Card(cValues[k],cSuit[j]); } } System.out.println(deck.get(0).getValue()+ " "+ deck.get(0).getSuit()); System.out.println(deck.get(1).getValue()+ " "+ deck.get(1).getSuit()); System.out.println(deck.get(50).getValue()+ " "+ deck.get(50).getSuit()); System.out.println(deck.get(51).getValue()+ " "+ deck.get(51).getSuit()); } } class Card { private static String value; private static String suit; public Card(String v, String s) { value = v; suit = s; } public static String getValue() { return value; } public static String getSuit() { return suit; } } please help anything is greatly appreciated!
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21472338
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/comment/32245639
has text: +1. As seen in the [docs](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html) - `public final class String extends Object`.
type: Comment
comment on: http://stackoverflow.com/a/21381385
score: 2
type: AnswerComment

http://stackoverflow.com/comment/32262129
comment on: http://stackoverflow.com/q/21390079
score: 0
type: Comment
type: QuestionComment
has text: That `getZustand()` method hurts, I hope they are atleast teaching you that you should never change values in getters. Even though I'm wondering why they are doing it themselves if they are teaching you.

http://stackoverflow.com/a/21412442
score: 2
has body: JSCH doesn't have a single function to recursively send or receive a directory through SFTP. Your code will have to build the list of files and directories to be created on the remote system, then call ChannelSftp.mkdir() and ChannelSftp.put() to create the directories and files. Also remember that you need to create parent directories before you create subdirectories. For example, mkdir("/foo/bar/baz") will fail if directory /foo/bar doesn't exist.
upvote count: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21409780

http://stackoverflow.com/a/21392145
answers question: http://stackoverflow.com/q/21381566
has body: Well I solved via a subreport, with columns instead of the list directly because that seems to be the issue, I don't know if it is the most optima solution but it worked for me.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21381566

http://stackoverflow.com/a/30398588
score: 2
has body: You have another flaw in there that might catch you, that I've run into with log4j json. "appender-ref": { "ref":"Console" }, "appender-ref": { "ref":"File" } Try this instead, as it is now, it will only catch one appender. "appender-ref": [{ "ref":"Console" }, { "ref":"File" }]
downvote count: 0
answers question: http://stackoverflow.com/q/21435990
type: Answer
upvote count: 2

http://stackoverflow.com/q/21463105
type: Question
has comment: http://stackoverflow.com/comment/32390570
has title: Exception in thread main" java.util.InputMismatchException
has comment: http://stackoverflow.com/comment/32391410
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32390566
has comment: http://stackoverflow.com/comment/32391575
has comment: http://stackoverflow.com/comment/32390592
has body: I am getting an error message from the output when I typed : 199.99 Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:909) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextFloat(Scanner.java:2388) at myproject2.Myproject2.main(Myproject2.java:11) but my code doesn't have any errors: package myproject2; import java.util.Scanner; public class Myproject2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter purchase amount: "); double purchaseAmount = input.nextDouble(); double tax = purchaseAmount * 0.06; System.out.println("Sales tax is " + (int)(tax * 100) / 100.0); } } Please help me!
has comment: http://stackoverflow.com/comment/32393889
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21463166
has answer: http://stackoverflow.com/a/21463174

http://stackoverflow.com/q/21377014
answer count: 2
has comment: http://stackoverflow.com/comment/32239275
accepted answer: http://stackoverflow.com/a/21452454
has comment: http://stackoverflow.com/comment/32238537
has answer: http://stackoverflow.com/a/21377216
has comment: http://stackoverflow.com/comment/32238216
has body: <%@page import="org.json.JSONObject"%> <%@page import="java.lang.Thread.State"%> <%@page import="net.sf.json.JSONArray"%> <%@ page language="java" import="java.io.*,java.sql.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here <% try{ Class.forName("com.mysql.jdbc.Driver"); String mySqlUrl = "jdbc:mysql://localhost:3306/permit"; Connection con = DriverManager.getConnection(mySqlUrl ,"root","moodle123"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from enterprisemaster where `enterpriseId=1001");` JSONArray respJson = new JSONArray(); java.sql.ResultSetMetaData rsmd = rs.getMetaData(); int numColumns = rsmd.getColumnCount(); while (rs.next()) { JSONObject obj = new JSONObject(); for (int i = 1; i < numColumns + 1; i++) { String columnName = rsmd.getColumnName(i); obj.put(columnName, rs.getString(columnName)); } respJson.put(obj); } respJson.toString(); System.out.println(respJson); } catch(Exception e) { System.out.println(e); } %> type Exception report message An exception occurred processing JSP page /JsonCreation.jsp at line 36 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /JsonCreation.jsp at line 36 33: obj.put(columnName, rs.getString(columnName)); 34: 35: } 36: respJson.put(obj); 37: } 38: respJson.toString(); 39: System.out.println(respJson); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) root cause javax.servlet.ServletException: java.lang.NoClas…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32239292
has answer: http://stackoverflow.com/a/21452454
possible better answer: http://stackoverflow.com/a/21377216
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32238380
type: Question
has comment: http://stackoverflow.com/comment/32238130
has comment: http://stackoverflow.com/comment/32238993
score: 0
has comment: http://stackoverflow.com/comment/32238661
has title: java code to create json array

http://stackoverflow.com/a/59223512
has body: import java.util.Scanner; public class Factorial { public static void main(String[] args){ Scanner scn = new Scanner(System.in); System.out.println("Enter the number to find factorial"); int o=scn.nextInt(); int count=0,b=o-1,res=(o*(o-1)),r=0; while(count!=1) { count=b-1; r=count*res; res=r; r=1; b=b-1; } System.out.println(res); } }
answers question: http://stackoverflow.com/q/21482785
score: 0
type: Answer

http://stackoverflow.com/a/21419381
accepted answer of: http://stackoverflow.com/q/21419283
has body: You need to supply weightx and weighty values with the GridBagConstraints which affect how the individual components react to changes in the size the parent container and how much "weight" the take up within the given cell Take a look at How to use GridBagLayout for more details import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestGridBagLayout { public static void main(String[] args) { new TestGridBagLayout(); } private JPanel mainPanel; private JPanel p1; private JPanel p2; private JPanel p3; public TestGridBagLayout() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } mainPanel = new JPanel(); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); //P1 FILL P1 WITH 64 BUTTONS p1 = new JPanel(); p1.setLayout(new GridLayout(8, 8)); p1.setMinimumSize(new Dimension(600, 600)); p1.setMaximumSize(new Dimension(600, 600)); p1.setPreferredSize(new Dimension(600, 600)); for (int y = 0; y &lt; 8; y++) { for (int x = 0; x &lt; 8; x++) { JButton btn = new JButton(x + " , " + y); p1.add(btn); } } //P2 FILL P2 WITH 4 BUTTONS p2 = new JPanel(); p2.setLayout(new GridLayout(4, 1)); p2.setMinimumSize(new Dimension(150, 100)); p2.setMaximumSize(new Dimension(150, 100)); p2.setPreferredSize(new Dimension(150, 100)); for (int i = 0; i &lt; 4; i++) { p2.add(new JButton("Button")); } //P3 p3 = new JPanel(); p3.setMinimumSize(new Dimension(100, 150)); p3.setMaximumSize(new Dimension(100, 150)); p3.setPreferredS…
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/21419283

http://stackoverflow.com/a/21497878
type: Answer
has body: Make your while loop like this while(mathOp.equals("+") || mathOp.equals("-") || mathOp.equals("//") || mathOp.equals("*")) Use String.equals() to compare string in Java, not == or !=. To explain more, you shouldn't use == or != while comparing String values in Java because they check for equality for the values in the right and left operands. i.e a memory address in case of String objects ,which will not be equal for two different objects. You can make use of == and != with primitive datatypes and compile time constants. There is also a concept called String constant pool which has the compile time String constants created by using assignment operator like String new = "new"; without using new operator during object creation which can be compared using == or !=.
answers question: http://stackoverflow.com/q/21497866
score: 0

http://stackoverflow.com/a/21414887
upvote count: 1
has comment: http://stackoverflow.com/comment/87585327
answers question: http://stackoverflow.com/q/21414831
has comment: http://stackoverflow.com/comment/87584165
type: AcceptedAnswer
downvote count: 0
has body: Yes, depending on the type of key store, you can create a SecretKeyEntry in a KeyStore. The SunJCE provider implements a "JCEKS" key store that accommodate secret key entries. static byte[] getPassword(KeyStore ks, String alias, char[] master) throws GeneralSecurityException, DestroyFailedException { if (!ks.entryInstanceOf(alias, KeyStore.SecretKeyEntry.class)) throw new IllegalArgumentException(); KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(master); try { KeyStore.SecretKeyEntry e = (KeyStore.SecretKeyEntry) ks.getEntry(alias, pp); return e.getSecretKey().getEncoded(); } finally { pp.destroy(); } } static void setPassword(KeyStore ks, String alias, byte[] password, char[] master) throws GeneralSecurityException, DestroyFailedException { SecretKey wrapper = new SecretKeySpec(password, "RAW"); KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(wrapper); KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(master); try { ks.setEntry(alias, entry, pp); } finally { pp.destroy(); } } You should be careful to "zero" the passwords as soon as you are done using them, just like I destroy() the PasswordProtection instance in a try-finally block. Otherwise a memory scraper like that used in the Target breach has a better chance of grabbing a key.
has comment: http://stackoverflow.com/comment/87585015
type: Answer
has comment: http://stackoverflow.com/comment/32307122
score: 1
accepted answer of: http://stackoverflow.com/q/21414831

http://stackoverflow.com/q/21381356
has comment: http://stackoverflow.com/comment/32245602
has body: What I would like to do is to create an instance of anonymous class and be able to refer it like this pseudo example: String s=new String { //make a subclass, //override method } Is this possible?
type: Question
tagged with: java
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21381385
has comment: http://stackoverflow.com/comment/32247851
accepted answer: http://stackoverflow.com/a/21381697
has answer: http://stackoverflow.com/a/21381385
has answer: http://stackoverflow.com/a/21381697
has title: Can refer to an instance of anonymous class?
type: AnsweredQuestion

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

http://stackoverflow.com/comment/32288491
type: Comment
has text: does the Jenkins documentation say that it is possible?
type: QuestionComment
comment on: http://stackoverflow.com/q/21405427
score: 0

http://stackoverflow.com/q/21439341
has title: Zooming JLayeredPane via JLayer and the LayerUI
has answer: http://stackoverflow.com/a/21445118
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/21445118
has body: It's been suggested on this Stack Overflow question that the best way to implement zooming in Swing applications is via the JLayer decorators provided with Java 7. I've been following the Oracle tutorial and think the best way to do this is by creating my own ZoomUI that extends the LayerUI. My thoughts so far are that this class will have a zoom member variable that is applied before painting the actual component. Then later on I can then use this same class to catch mouse events and dispatch them to their un-zoomed coordinates. I'm having a little trouble with the first step and cannot understand why the g2.scale(zoom, zoom) call is having no effect in my SSCCE below. import javax.swing.*; import javax.swing.plaf.LayerUI; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; public class Demo { public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final JLayeredPane panel = new JLayeredPane(); final ZoomUI layerUI = new ZoomUI(); final JLayer&lt;JComponent&gt; jLayer = new JLayer&lt;JComponent&gt;(panel, layerUI); Button zoomIn = new Button("Zoom In"); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { layerUI.zoom += 0.1; jLayer.repaint(); } }); zoomIn.setBounds(0,0,100,50); panel.add(zoomIn); Button zoomOut = new Button("Zoom Out"); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { layerUI.zoom -= 0.1; jLayer.repaint(); } }); zoomOut.setBounds(100,0,100,50); panel.add(zoomOut); frame.setPreferredSize(new Dimension(400,200)); frame.add(jLayer); frame.pack(); frame.setVisible(true); } }); } private static class ZoomUI extends LayerUI&lt;JComponent&gt; { public int zoom = 1.5; // Changing this value seems to have no effect @Override public void paint(Graphics g, J…
linked to: http://stackoverflow.com/q/21174997
tagged with: jlayer
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: zooming

global
type: Tag
tags question: http://stackoverflow.com/q/21507517
tag name: global
tags question: http://stackoverflow.com/q/21481345

http://stackoverflow.com/comment/32389602
has text: @user3253675 glad to help. 1) Components positioning and sizing are tasks handled by layout managers: see the link I've posted. 2) You can import an image or you can learn about [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/) on Swing components. 3) If my answer worked for you then don't forget to "accept" it: [How does accepting an answer work?](http://meta.stackexchange.com/a/5235).
type: Comment
comment on: http://stackoverflow.com/a/21460538
score: 0
type: AnswerComment

http://stackoverflow.com/q/21447002
has title: Eclipse obsolete methods on the stack
has comment: http://stackoverflow.com/comment/32380712
has comment: http://stackoverflow.com/comment/32440304
tagged with: macos
has comment: http://stackoverflow.com/comment/32366788
upvote count: 2
has body: I'm using Eclipse for Java on my Macbook air, OS 10.9. I keep getting the error Obsolete Methods on the Stack, with a warning about how it may cause problems with the virtual machine when I run very basic programs that have no errors. I ran a program that just had the class and the main method and I got this error. After the error box, the bug referred to the main method, but I know the syntax is correct because I used Eclipse's main method. import java.util.Scanner; public class Dowhile { public static void main(String[] args) { /*Scanner scanner = new Scanner(System.in); System.out.println("Enter a number"); int value = scanner.nextInt(); System.out.println(value);*/ /*do{ System.out.println("Enter a number "); int value = scanner.nextInt(); } while(value != 5); System.out.println("Got 5");*/ } } Update: I'm not getting the obsolete methods error now, just Exception in thread "main"... at line 5.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44104625
score: 2
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/71028021
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32381309
favorite count: 0

http://stackoverflow.com/comment/32323285
has text: Increased the Size to 2000 and everything worked Fine, i Can Now Enroll Fingers in Database.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21421450

http://stackoverflow.com/q/21350011
type: Question
tagged with: jtable
downvote count: 0
answer count: 1
has title: Java How to disable the JTable editable when click it
favorite count: 0
upvote count: 2
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21350100
has body: public class AdminControlPanel extends javax.swing.JFrame I'm using the JFrame class...so it will automatically inherit the JFrame class... But problem now is I want to disable the cell editing in the JTable...How to do it even I'm not inherit the AbstractTableModel???

http://stackoverflow.com/comment/32193163
score: 0
comment on: http://stackoverflow.com/q/21352024
type: Comment
type: QuestionComment
has text: @Antoinecoding Exactly, how are you defining `equality`, if you are not overriding `equals`? And if you are overriding `equals`, then consider overriding `hashCode`.

http://stackoverflow.com/comment/32499738
comment on: http://stackoverflow.com/a/21508341
type: AnswerComment
has text: wao .....its working fine i have added this code in in zoomIn button may i need to add this in zoomOut button as well if yes then how?
score: 0
type: Comment

http://stackoverflow.com/a/21437896
score: 1
has comment: http://stackoverflow.com/comment/32345942
upvote count: 1
answers question: http://stackoverflow.com/q/21437838
type: Answer
has comment: http://stackoverflow.com/comment/32345753
has body: You need to call out.flush() when you are done.
downvote count: 0

http://stackoverflow.com/comment/32412377
has text: http://stackoverflow.com/questions/1805200/retrieve-java-annotation-attribute - Your custom annotation should have retentionpolicy as runtime
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21458103

http://stackoverflow.com/comment/32259241
type: QuestionComment
has text: aliteralmind: where do i have to create that array? inside the second for loop or outside it.
comment on: http://stackoverflow.com/q/21388576
score: 0
type: Comment

http://stackoverflow.com/comment/32482147
type: Comment
comment on: http://stackoverflow.com/a/21514425
has text: How are you inflating your list row ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32205986
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21359107
score: 0
has text: Sure, give me a second.

http://stackoverflow.com/q/21475002
possible better answer: http://stackoverflow.com/a/21475030
has answer: http://stackoverflow.com/a/21475046
accepted answer: http://stackoverflow.com/a/21475046
has answer: http://stackoverflow.com/a/21475030
has comment: http://stackoverflow.com/comment/32411782
favorite count: 0
upvote count: 3
tagged with: constructor
has body: As part of an assignment I'm supposed to create a bunch of rectangles and put each of those objects within an ArrayList, which is to be initialized in a constructor. I think I've confused myself. Eclipse is telling me that I can't use .add(new_rec) with this object because it is of type (Double, Double). I assume because the ArrayList is simply &lt;Double&gt; this is causing some issue. Aside from that I think I'm misguided somewhere else, but I'm not sure where. public class WhyWontThisWork { WhyWontThisWork(Double name, Double rec_name){ Rectangle new_rec = new Rectangle(23.1,43.0); ArrayList&lt;Double&gt; name = new ArrayList&lt;Double&gt;(); for(int i = 0; i &lt; 10; i++){ name.add(new_rec); } } } ...and the Rectangle class looks like... public class Rectangle { private double length; private double width; public Rectangle(double length, double width){ this.length = length; this.width = width; }
has title: Initializing an ArrayList within a constructor
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32411732
type: Question
has answer: http://stackoverflow.com/a/21475060
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32411758
answer count: 6
has answer: http://stackoverflow.com/a/21475049
has answer: http://stackoverflow.com/a/21475064
tagged with: arraylist
has answer: http://stackoverflow.com/a/21475103

spring
tags question: http://stackoverflow.com/q/21456494
tags question: http://stackoverflow.com/q/21367972
tags question: http://stackoverflow.com/q/21473391
tags question: http://stackoverflow.com/q/21450306
tags question: http://stackoverflow.com/q/21418251
tags question: http://stackoverflow.com/q/21511588
tags question: http://stackoverflow.com/q/21379568
tags question: http://stackoverflow.com/q/21511326
tags question: http://stackoverflow.com/q/21371633
tags question: http://stackoverflow.com/q/21402896
tags question: http://stackoverflow.com/q/21372045
tags question: http://stackoverflow.com/q/21484280
tags question: http://stackoverflow.com/q/21383051
tags question: http://stackoverflow.com/q/21379010
tags question: http://stackoverflow.com/q/21485287
tags question: http://stackoverflow.com/q/21445507
tags question: http://stackoverflow.com/q/21405606
tags question: http://stackoverflow.com/q/21496987
tags question: http://stackoverflow.com/q/21474128
tags question: http://stackoverflow.com/q/21493560
tags question: http://stackoverflow.com/q/21365643
tags question: http://stackoverflow.com/q/21456593
tags question: http://stackoverflow.com/q/21428588
tags question: http://stackoverflow.com/q/21494762
tags question: http://stackoverflow.com/q/21513459
tags question: http://stackoverflow.com/q/21428302
tags question: http://stackoverflow.com/q/21404102
tags question: http://stackoverflow.com/q/21456683
tags question: http://stackoverflow.com/q/21388977
tags question: http://stackoverflow.com/q/21365456
tags question: http://stackoverflow.com/q/21490521
tags question: http://stackoverflow.com/q/21364034
tags question: http://stackoverflow.com/q/21427924
tags question: http://stackoverflow.com/q/21403726
tags question: http://stackoverflow.com/q/21500286
tags question: http://stackoverflow.com/q/21470409
tags question: http://stackoverflow.com/q/21350966
tags question: http://stackoverflow.com/q/21379824
tags question: http://stackoverflow.com/q/21408653
tags question: http://stackoverflow.com/q/21476986
tags question: http://stackoverflow.com/q/21462752
tags question: http://stackoverflow.com/q/21458196
tags question: http://stackoverflow.com/q/21487432
tags question: http://stackoverflow.com/q/21425769
tags question: http://stackoverflow.com/q/21459742
tags question: http://stackoverflow.com/q/21483635
tags question: http://stackoverflow.com/q/21499249
tags question: http://stackoverflow.com/q/21369619
tags question: http://stackoverflow.com/q/21457329
tags question: http://stackoverflow.com/q/21383457
tags question: http://stackoverflow.com/q/21381186
tags question: http://stackoverflow.com/q/21467553
tags question: http://stackoverflow.com/q/21418916
tags question: http://stackoverflow.com/q/21352681
tags question: http://stackoverflow.com/q/21374550
tags question: http://stackoverflow.com/q/21371390
tags question: http://stackoverflow.com/q/21443191
type: Tag
tags question: http://stackoverflow.com/q/21421793
tags question: http://stackoverflow.com/q/21464967
tags question: http://stackoverflow.com/q/21432137
tags question: http://stackoverflow.com/q/21499695
tags question: http://stackoverflow.com/q/21462504
tags question: http://stackoverflow.com/q/21453141
tags question: http://stackoverflow.com/q/21455699
tags question: http://stackoverflow.com/q/21488252
tags question: http://stackoverflow.com/q/21383679
tags question: http://stackoverflow.com/q/21356000
tags question: http://stackoverflow.com/q/21406091
tags question: http://stackoverflow.com/q/21414869
tags question: http://stackoverflow.com/q/21455757
tags question: http://stackoverflow.com/q/21505301
tags question: http://stackoverflow.com/q/21426711
tags question: http://stackoverflow.com/q/21376572
tags question: http://stackoverflow.com/q/21488724
tags question: http://stackoverflow.com/q/21479331
tags question: http://stackoverflow.com/q/21377582
tags question: http://stackoverflow.com/q/21467439
tags question: http://stackoverflow.com/q/21402950
tags question: http://stackoverflow.com/q/21412701

http://stackoverflow.com/a/24569167
has comment: http://stackoverflow.com/comment/40434495
answers question: http://stackoverflow.com/q/21477884
has body: EDIT There is also a GUI way for doing this. It is accessed by selecting the module facebook in the project tree and pressing f4. Also you can just right-click the facebook and go to Open Module Settings near the bottom. It is shown in the pictures. The numbers in the picture are top sdk version at the time of writing. There is a simpler solution. The constants like ANDROID_BUILD_SDK_VERSION can be replaced with normal version "numbers". So instead of android { compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION defaultConfig { minSdkVersion 8 targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) } ..file can look like this: android { compileSdkVersion 19 buildToolsVersion '19.1.0' defaultConfig { minSdkVersion 15 targetSdkVersion 19 }
has comment: http://stackoverflow.com/comment/40458248
downvote count: 0
upvote count: 38
type: Answer
score: 38

http://stackoverflow.com/q/21467643
has body: I am currently attempting to port an android app to desktop. I realize that the majority of the android based code cannot be reused, but what about "smaller parts" which dont depend on the android architecture? I am mostly talking about support or math related classes like SparseArray, Matrix and so on.
type: Question
has title: Using parts of android lib in non-android project
tagged with: desktop
score: 0
has answer: http://stackoverflow.com/a/21468406
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/q/21428061
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21428206
accepted answer: http://stackoverflow.com/a/21428206
tagged with: amazon-web-services
upvote count: 3
answer count: 1
has title: Java Application on Amazon Web Services with Mobile and Web Clients
favorite count: 0
tagged with: rest
type: AnsweredQuestion
score: 3
has body: Our new start-up company is trying to build a mobile app with an accompanied website. We are trying to setup our application on Amazon Web Services. We have Java code running in an EC2 instance, which will store data in S3. We want clients (iOS and Web for now) to communicate with the Java Backend via a REST API. Ideally the website would be hosted under the same AWS account. The Java Code and REST API are already set up in a very basic form, but the setup of the Website is unclear, since this is new to us all. We also would like to evaluate beforehand if such a setup is even feasible. Since I am in charge of the Website i have already spend hours researching this specific setup, but i simply lack experience in cloud/backend development to come to a conclusion. Here are some questions we would like to answer: Where would the HTML files and accompanied JavaScript etc. files be stored? How can data (images etc.) that is stored within S3 by the JAVA code be accessed from the Website directly? How could something like bootstrapping of data within HTML files be achieved (in JSON format preferably)? How could the server be set up to compress certain files like CSS or JavaScript? Please point me into the right direction, any comment is appreciated.
downvote count: 0

checkboxlist
tags question: http://stackoverflow.com/q/21501207
type: Tag
tag name: checkboxlist
tags question: http://stackoverflow.com/q/21358240

http://stackoverflow.com/comment/49215925
comment on: http://stackoverflow.com/q/21463743
score: 0
type: Comment
type: QuestionComment
has text: Check my detailed answer with screenshots on [how to use ZXing in Android app](http://stackoverflow.com/a/30572168/165071)

http://stackoverflow.com/q/21355326
type: Question
answer count: 2
tagged with: session
has title: How to log out in wicket permanently?
has answer: http://stackoverflow.com/a/21780861
tagged with: logout
type: UnansweredQuestion
tagged with: wicket
has answer: http://stackoverflow.com/a/21355689
tagged with: invalidation
linked to: http://stackoverflow.com/q/233507
has body: I have a Wicket application (the url is: localhost:7001/myWicketApp) which starts with a sign in ask. This works fine. In my home page, I have a Sign Out link. What I want: If I click on this link, it should sign out from the session, and go to an another web page, etc. www.google.com I wrote this java code for log out: private AjaxLink createSignOutLink() { return new AjaxLink("signOutLink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { S2rtSession.get().invalidate(); S2rtSession.get().logout(); throw new RedirectToUrlException("http://www.google.com"); } }; } What happening: When I click on it, it goes to the new page (www.google.com), so it seems like it works fine. BUT: When I click on the browser's BACK button (or I type again my URL without closing the browser and press ENTER), it goes back to my page WITHOUT asking for username and password. So the sign out didn't happend. What is missing? Is there a way, to sign out permanently, or the browser is caching the username and password, and without closing the browser, it won't work? I hope there is a way, to remove everything from the cache and the session. Thank you!
score: 0
tagged with: java

http://stackoverflow.com/comment/32399370
has text: What is the indication that `remove()` doesn't work?
score: 0
comment on: http://stackoverflow.com/q/21467769
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21357959
type: Answer
answers question: http://stackoverflow.com/q/21353808
score: 0
has body: Java 8 Java 8 includes a new java.time.* package, defined by JSR 310, inspired by Joda-Time (but re-architected). These new classes supplant the notoriously troublesome classes of java.util.Date, java.util.Calendar, and java.text.SimpleDateFormat. Mock Clock Amongst the new classes is the abstract class, Clock. The designers had exactly your need in mind, a pluggable replacement for the system clock to create fake "mock" date-time values to facilitate testing. The Clock class is meant to be extended by you (or others) for whatever unnatural behavior you desire. Pass an instance of that altered clock to the other java.time.* classes. Those other classes will use your Clock as a source of date-time data rather than the computer/JVM's real clock. Joda-Time Looks like Joda-Time may have something similar. Read this discussion about a "MillisProvider". Apparently referring to DateTimeUtils.MillisProvider.

http://stackoverflow.com/q/21376803
tagged with: refactoring
has answer: http://stackoverflow.com/a/21376923
has answer: http://stackoverflow.com/a/21376839
has title: Refactoring two code
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21377373
favorite count: 0
answer count: 4
score: 2
has body: My project need to parse two type of text data into database. one format is like this: 19 <begin> 2013-08-15,2013-08-15,pek001,123456,08654071,CANX,,,,,,011 <end> one is like that 27 <begin> 2012-11-02,08683683,pek001,00001234,vvip,1 <end> the difference of the two text is between the begin and end tag. so our parsing code come out: first one is: inputStreamReader = new InputStreamReader(new FileInputStream(FileOne),"gbk"); --different place br=new BufferedReader(inputStreamReader); lineNumber = 0; boolean isDataContent = false; while (br.ready()) { String line = br.readLine(); if(line == null){ continue; } if(line.contains(" ")) { try { lineNumber = Integer.parseInt(StringTools.getDigitalInString(line)); } catch (NumberFormatException e) { log.error("there is no lineNumber。"); } continue; } if(line.trim().equals("<begin>")) { isDataContent = true; continue; } if(line.trim().equals("<end>")) { break; } if(isDataContent) { insertFirstToDatabase(line,vo); --just this is different. } } second one is : inputStreamReader = new InputStreamReader(new FileInputStream(FileTwo),"gbk"); --different place br=new BufferedReader(inputStreamReader); lineNumber = 0; boolean isDataContent = false; while (br.ready()) { String line = br.readLine(); if(line == null){ continue; } if(line.contains(" ")) { try { lineNumber = Integer.parseInt( StringTools.getDigitalInString(line)); } catch (NumberFormatException e) { log.error("there is no lineNumber"); } continue; } if(line.trim().equals("<begin>")) { isDataContent = true; continue; } if(line.trim().equals("<end>")) { break; } if(isDataContent) { insertSecondToDatabase(line,vo); --only this is different. } } The two piece of code is in two different service code. How can I refactor this reduplicate code? so that each place Just only call one same function to check the lineNumber.
has answer: http://stackoverflow.com/a/21377030
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21393199
has comment: http://stackoverflow.com/comment/32267917
has comment: http://stackoverflow.com/comment/32268099
has comment: http://stackoverflow.com/comment/32309664
tagged with: coin-flipping
score: 0
has title: Getting errors for unknown reason
has body: Trying to design a coin flipper program that asks the user to state how many times they would like to flip a coin (# of flips must be under 1000). I then get a random number from 1-10 and assign that number to each array index declared based on the number of flips the user would lke. I seem to be getting three errors involving the inability to resolve symbols on the math.random line. Any help would be appreciated. import java.io.*; import java.util.*; public class coinFlip { public static void main(String[] args) throws IOException { // declare in as a BufferedReader; used to gain input from the user BufferedReader in; in = new BufferedReader(new InputStreamReader(System.in)); //declare variables int flips; int anArray[]; int x; int r; System.out.println("How many times would you like to flip your coin?"); flips = Integer.parseInt(in.readLine()); if(flips &lt;= 1000) { System.out.println("You want to flip " + flips + " times"); anArray = new int[flips]; for(x = 0; x &lt;= flips; x++) { r = Math.round(Math.random()*9)+1; anArray[x] = r; System.out.println(anArray[x]); } } } }
accepted answer: http://stackoverflow.com/a/21393236
tagged with: input
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21393296
tagged with: java
has answer: http://stackoverflow.com/a/21393296
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32267977
tagged with: arrays
has answer: http://stackoverflow.com/a/21393236

http://stackoverflow.com/comment/32397086
type: QuestionComment
has text: Have you seen [build-info](http://grails.org/plugin/build-info) plugin ?
score: 2
comment on: http://stackoverflow.com/q/21466456
type: Comment

http://stackoverflow.com/q/21481551
score: 2
has title: Replace duplicate java objects including all references
downvote count: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21483699
upvote count: 2
has body: I know we already had questions about the replacement of object instances, and the answer was always: even if you can, never do it, it's dark magic, but I am not sure how to solve my problem, so let me explain... I'm parsing data about certain vehicles and their specific modules to store in a database (it's about a game). Each Vehicle has among other data a number of ComaptibleModules: class Vehicle { String id; // other stuff... CompatibleModules modules; } ComaptibleModules contains lots of objects descending of the Module-class (e.g. Engine extends Module) in a complex arragement (dependencies and stuff). class CompatibleModules { Engine defaultEngine; List&lt;Engine&gt; compatibleEngines; // other stuff... } It is to be expected that the same Module is referenced multiple times in this class. I'm only getting the data on a per-vehicle basis, so even if some vehicles share the same modules (which they do, excessively), I'm writing a new Module object for each vehicle. After I'm done with parsing, I want to optimize the database by removing the duplicates and storing the Modules separately, so the vehicles do only reference the modules by ID. And that's where the problem starts: I can easily get all the Modules out of the CompatibleModules-structure of each Vehicle, store them in a HashSet and thereby detect collisions. But after I've detected a collision, it is not a trivial task to replace all references of the duplicate in the CompatibleModules with the original one. What would be an elegant way to replace all references of the duplicates in this scenario?
favorite count: 0
tagged with: reference
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21481692
tagged with: object

http://stackoverflow.com/q/21410243
downvote count: 0
has comment: http://stackoverflow.com/comment/32297712
has comment: http://stackoverflow.com/comment/32298256
favorite count: 0
has title: Run service every 30 minutes without using wakelocks
has comment: http://stackoverflow.com/comment/32298066
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/32297826
upvote count: 2
type: UnansweredQuestion
has body: tl;dr: my app doesn't update my SharedPreferences with the last value from the server because sometimes the phone is sleeping. Explanation: I'm new in this android world, and I've been working on my first "real" application but I'm having a few issues right know... Here's how I need my application to work: Check every 30 minutes for new data (data is pulled from a json file on my server) If the data is different from the stored on the phone, then store the new data and send a notification to the user. (I'm using SharedPreferences for the "storage") Here's what I used to try to achieve that: MainActivity.java / Activity (my main activity, duh') cargarJson.java / AsyncTask (a class that pulls json data and returns a jsonobject). Cargar = Load (in spanish) DolarService.java / IntentService (The service creates a loadJson object and execute it, then sends the notification). AlarmReceiver.java / BroadcastReceiver (It's a receiver that has an AlarmManager that executes my DolarService every 30 minutes and runs everytime the phone boot up and when the user runs the app for the first time). I kind of managed to do it, but the problem is that I don't want to use wakelocks because it drains the battery really fast. My AlarmManager doesn't use wakelocks so when it sends the notification every 30 minutes it contains the last value stored in the SharedPreferences when the phone was "awake" and not the new data from the server. Here's my source: https://gist.github.com/anonymous/d5cccf5ba331f041630e My question: how do I keep my up-to-date data in my SharedPreferences (updating it every 30 minutes) without using wakelocks. Also, is something wrong with my approach to do this app ? Thank you in advance and sorry for my poor english, I tried my best to explain my situation!
has answer: http://stackoverflow.com/a/21410411
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/21410372
has comment: http://stackoverflow.com/comment/32297604
answer count: 2
has comment: http://stackoverflow.com/comment/32298599

http://stackoverflow.com/comment/32229706
type: QuestionComment
comment on: http://stackoverflow.com/q/21372192
score: 0
has text: @Prince Yes, was I not clear on that? I'll update the question!
type: Comment

http://stackoverflow.com/q/21418582
tagged with: int
tagged with: android
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/21418695
tagged with: count
upvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I need to carry my int value from one method to another, but I didnt find any solution. One method counts number of objects and the number needs to be "delivered" to another and check, if the count equals to something. Do you have any idea, how to do it? Check my codes below: @Override protected void onPostExecute(Void result) { ParseQuery&lt;Animal&gt; query = ParseQuery.getQuery(Animal.class); query.countInBackground(callcount = new CountCallback(){ public void done(int count, ParseException e) { if (e == null) { Log.v("count is" + count, "count is"); //I need to export int count from "done" method to another } else { } } }); } And the secont method, which has to recieve that value and use it: @Override public void onScrollStateChanged(AbsListView view, int scrollState) { //i need to set int count from method above here int threshold = 1; int counter = mListView.getCount(); if (scrollState == SCROLL_STATE_IDLE) { if (mListView.getLastVisiblePosition() &gt;= counter - threshold) { updateData(); } } Whole code: public class Fragment1 extends Fragment { static ListView mListView; static AnimalAdapter mAdapter; static ProgressBar mProgressBar; static EditText mEditText; static LayoutInflater inflater; CountCallback callcount; int g_count = 0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.animalsfrag, container, false); mListView = (ListView)rootView.findViewById(R.id.animal_list); View header = getActivity().getLayoutInflater().inflate(R.layout.header, null); header.setPadding(2, 8, 4, 2); mListView.setVisibility(View.INVISIBLE); mListView.requestFocus(); mListView.addHeaderView(header); View footie = getActivity().getLayoutInflater().inflate(R.layout.footer, null); mListView.addFooterView(footie); footie.setVisibility(View.INVISIBLE); mProgressBar = (ProgressBar) rootView.findViewById (R.id.loading_animals); mProgressBar.setVisibility(View.VISIBLE); RemoteD…
type: Question
has title: How to get int value from one method to another
accepted answer: http://stackoverflow.com/a/21418695
downvote count: 0
favorite count: 0
tagged with: listview

http://stackoverflow.com/q/21479105
has comment: http://stackoverflow.com/comment/32418752
has title: Changing a file name, without rewrite it
type: Question
accepted answer: http://stackoverflow.com/a/21479132
has comment: http://stackoverflow.com/comment/32418623
has answer: http://stackoverflow.com/a/21479165
upvote count: 2
linked to: http://stackoverflow.com/q/1158777
tagged with: java
answer count: 3
tagged with: file
has comment: http://stackoverflow.com/comment/32418766
downvote count: 1
duplicate of: http://stackoverflow.com/q/1158777
has comment: http://stackoverflow.com/comment/32418882
has answer: http://stackoverflow.com/a/21479132
possible better answer: http://stackoverflow.com/a/21479154
has answer: http://stackoverflow.com/a/21479154
type: AnsweredQuestion
score: 1
has body: I am trying to write a code that just changes the file name without reading and writing it with a different name, is there any built in function for that? I tried to search for and if not, the best way would be rewriting it with a new name?
has comment: http://stackoverflow.com/comment/32418842
favorite count: 0

http://stackoverflow.com/a/21471163
answers question: http://stackoverflow.com/q/21471119
has comment: http://stackoverflow.com/comment/32406127
upvote count: 1
has comment: http://stackoverflow.com/comment/32406138
type: Answer
has body: You can simplify it by doing the num1 to num2 comparison first, and not messing around with any math if num1 is greater. move this to the top: if (num3 &lt; 1 || num2 &lt; num1){ return 0; Looking at your code again it appears as num3 increases, your result approaches (num2-num1)/2. Just wondering what your are doing here?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32406159

http://stackoverflow.com/comment/32388407
type: AnswerComment
has text: Very smart code you have done there. Im jealous lol Problem is I cant use it cause of permissions on social media sites. Im just wondering if theres a way to get into the browser and take the source code from the current webpage the user is on.. a social media site..
type: Comment
comment on: http://stackoverflow.com/a/21461355
score: 0

http://stackoverflow.com/q/21366227
has comment: http://stackoverflow.com/comment/32218312
has comment: http://stackoverflow.com/comment/32218287
answer count: 3
tagged with: string
has title: java -Sorting Strings, some kind of
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21366265
has answer: http://stackoverflow.com/a/21366367
has comment: http://stackoverflow.com/comment/32218486
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32218411
tagged with: java
downvote count: 3
has body: Basicly I have two arrays of Strings. One of the String contains a number, the second string contains text and a number. How can I match these together, please? Example: private String[] StringArray1 = {"5648", "4216", "3254", "2541", "10"}; private String[] StringArray2 = {"Derp: 10", "Herp: 3254", "peter: 2541", "jdp: 4216", "dieter: 5648"}; Output should be: dieter: 5648 jdp: 4216 Herp: 3254 peter: 2541 Derp: 10 Well, all I want is to sort StringArray2 for values, so it starts with the highest and I can print it out then.
possible better answer: http://stackoverflow.com/a/21366265
type: Question
has answer: http://stackoverflow.com/a/21366404
score: -2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21366367
tagged with: sorting

http://stackoverflow.com/comment/32212238
type: AnswerComment
comment on: http://stackoverflow.com/a/21356647
score: 0
type: Comment
has text: @user3235117 What don't you understand? The syntax?

http://stackoverflow.com/q/21508295
has comment: http://stackoverflow.com/comment/32471362
has comment: http://stackoverflow.com/comment/32471110
favorite count: 0
has answer: http://stackoverflow.com/a/21508326
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32471079
tagged with: java
has comment: http://stackoverflow.com/comment/32471117
has comment: http://stackoverflow.com/comment/32471093
tagged with: collections
accepted answer: http://stackoverflow.com/a/21508326
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32471091
has body: Much like you wouldn't use a Vector for a list of Cat objects at a vet, but would instead use an ArrayList, you also wouldn't use an ArrayList for a list of key/value pairs but might opt for a HashMap. What is the correct choice for Path? In case anyone finds this, I found this: http://java.dzone.com/articles/performance-java-collections It has performance benchmarks of ArrayList, HashMap, and LinkedList. Very useful to see the exact differences in the various situations.
score: -1
tagged with: nio
has comment: http://stackoverflow.com/comment/32471081
has title: What is the correct/proper Collection to use with java.nio.file.Path?
upvote count: 0
has comment: http://stackoverflow.com/comment/32471074
answer count: 1

http://stackoverflow.com/comment/32345331
type: Comment
comment on: http://stackoverflow.com/a/21436923
type: AnswerComment
has text: @doctordoder Sorry, I missed that it's an `ArrayList` of `String[][]`. That's why I deleted the comment.
score: 0

http://stackoverflow.com/comment/32365358
type: Comment
comment on: http://stackoverflow.com/a/21448062
has text: @AZ_ That depends on configuration. What value is it generating after the formatting?
score: 0
type: AnswerComment

http://stackoverflow.com/a/21380878
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32258740
has body: The problem with using a string comparison is that in a string compare 12 comes before 9, not after it. You will need to convert it to either a long (if it fits within the range of a 64 bit integer) or a BigInteger and then do the comparison using them. For the long do: if (Long.parseLong(str1) &gt; Long.parseLong(str2)) { } or: int comparison = Long.compare(Long.parseLong(str1), Long.parseLong(str2)); The final option would be to do your own string comparator which scans from the start of the string comparing one digit at a time but if the strings are not equal length treats the shorter one as though it was left padded with 0.
has comment: http://stackoverflow.com/comment/32248386
has comment: http://stackoverflow.com/comment/32253239
answers question: http://stackoverflow.com/q/21380701
upvote count: 2
has comment: http://stackoverflow.com/comment/32253855
type: Answer

http://stackoverflow.com/comment/32214187
type: QuestionComment
has text: What is `lProduct` in `new ArrayList<lProduct>()`, and do you have the option to use Java 8?
score: 0
comment on: http://stackoverflow.com/q/21363926
type: Comment

http://stackoverflow.com/q/21367939
tagged with: border
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21370378
has answer: http://stackoverflow.com/a/21370378
has answer: http://stackoverflow.com/a/21368085
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21368085
has title: empty gap between JPanel in Borderlayout
tagged with: java
tagged with: swing
type: Question
tagged with: jpanel
has body: i am trying to add empty gap between two JPanel, i tried to add the border like this mypanel.setBorder(createEmptyBorder(0, 0, 3, 0)); but in the same time i have created a using the method createBevelBorder(BevelBorder.RAISED so i am losing the second Border because of the first

http://stackoverflow.com/a/48905786
score: 0
has body: In WebMvcConfig, ensure you have the AjaxThymeLeafViewResolver configured correctly. The bean name must be provided as EXACTLY @Bean(name = "thymeleafViewResolver"). Why? Well I guess without naming the AjaxThymeleafViewResolver bean, the default bean name is just ajaxThymeleafViewResolver or something whereas spring only cares about a bean called thymeleafViewResolver similar to interfaces and concrete implementations. Eg you're saying to spring that we want to configure a thymeleafViewResolver to be an instance of AjaxThymeleafViewResolver to provide the specialized ajax handling for partial fragments. Here is my config. This is a really subtle detail and its found in one of the thymeleaf spring mvc guides. &lt;bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.AjaxThymeleafViewResolver"&gt; &lt;property name="viewClass" value="org.thymeleaf.spring4.view.FlowAjaxThymeleafView" /&gt; &lt;property name="templateEngine" ref="templateEngine" /&gt; &lt;/bean&gt; http://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html#spring-webflow-integration Mapping that xml into java using spring boot is given below. @Configuration public class WebMvcConfig implements WebMvcConfigurer { @Autowired private WebFlowConfig webFlowConfig; @Autowired private SpringTemplateEngine springTemplateEngine; @Bean public FlowHandlerMapping flowHandlerMapping() { FlowHandlerMapping handlerMapping = new FlowHandlerMapping(); handlerMapping.setOrder(-1); handlerMapping.setFlowRegistry(webFlowConfig.flowRegistry()); return handlerMapping; } @Bean public FlowHandlerAdapter flowHandlerAdapter() { FlowHandlerAdapter handlerAdapter = new FlowHandlerAdapter(); handlerAdapter.setFlowExecutor(webFlowConfig.flowExecutor()); handlerAdapter.setSaveOutputToFlashScopeOnRedirect(true); return handlerAdapter; } @Bean(name = "thymeleafViewResolver") public AjaxThymeleafViewResolver ajaxThymeleafViewResolver() { AjaxThymeleafViewResolver viewResolver = new AjaxThymeleafViewResolver(); viewReso…
type: Answer
answers question: http://stackoverflow.com/q/21356736

http://stackoverflow.com/a/21359996
answers question: http://stackoverflow.com/q/21359944
downvote count: 0
type: Answer
has body: Score of variable declared inside switch's case statement corresponds to switch block. Hence, you can't re-declare same variable in different cases. However, you can assign same variable different values, depending upon case. Object obj = null; switch(condition) { case 1: obj = new Object1(); break; case 2: obj = new Object2(); break; default: obj = new defaultObject(); break; } int getItem = obj != null ? obj.getItemFromObject() : -1;
has comment: http://stackoverflow.com/comment/32208181
upvote count: 1
has comment: http://stackoverflow.com/comment/32208120
score: 1
has comment: http://stackoverflow.com/comment/32208316
has comment: http://stackoverflow.com/comment/32208224

http://stackoverflow.com/a/21510298
has comment: http://stackoverflow.com/comment/32639106
downvote count: 0
answers question: http://stackoverflow.com/q/21510242
has body: Disable spinner 2 in your layout, and then enable and populate it when spinner 1 item is selected. Then do the same for spinner 3 based on spinner 2. spinner1.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parentView, View selectedItemView, int position, long id) { // Enable Spinner 2 // Set spinner 2 adapter } @Override public void onNothingSelected(AdapterView&lt;?&gt; parentView) { // Disable spinner 2 // Set spinner 2 adapter to empty list } });
accepted answer of: http://stackoverflow.com/q/21510242
type: AcceptedAnswer
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/32474710
upvote count: 1

http://stackoverflow.com/comment/33067096
score: 0
has text: I didn't but do now. Unfortunately, no change. Thanks for the suggestion.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21465812

http://stackoverflow.com/q/21479304
type: Question
has body: I'm converting some c# code to java System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command); // The following commands are needed to redirect the standard output. // This means that it will be redirected to the Process.StandardOutput StreamReader. procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; // Do not create the black window. procStartInfo.CreateNoWindow = true; // Now we create a process, assign its ProcessStartInfo and start it System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = procStartInfo; proc.Start(); // Get the output into a string string result = proc.StandardOutput.ReadToEnd(); // Display the command output. This is the code that i try to convert it to java. I dont know how to run a command and use process in java. I googled it and i found something like that : Process process = Runtime.getRuntime().exec(command); Integer result = process.exitValue(); In the line process.exitValue() it gives me java.lang.IllegalThreadStateException: process has not exited.
tagged with: c#
answer count: 2
has answer: http://stackoverflow.com/a/21479453
has answer: http://stackoverflow.com/a/21479404
accepted answer: http://stackoverflow.com/a/21479404
score: 0
has title: Using Process in java
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21479453

http://stackoverflow.com/comment/32430826
type: Comment
comment on: http://stackoverflow.com/a/21485386
type: AnswerComment
has text: But it's *not* correct because it doesn't explain why the answer is 4. As I said, if your answer can be applied to two languages which can give different results, then it doesn't explain either result. When an answer can be brief and still actually answer the question, that's great - but when brevity means not giving enough information, it makes the answer worthless IMO.
score: 0

http://stackoverflow.com/comment/32396336
score: 0
type: Comment
type: QuestionComment
has text: What you mean is to save an image rendered in a browser after being rotated? As jpg or png or whatelse?
comment on: http://stackoverflow.com/q/21465767

http://stackoverflow.com/q/21362571
favorite count: 0
has title: Sorting lists in android?
tagged with: android
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21362587
has body: (Note :i am not asking for code,if you have experience related to his topic,only then comment) I am populating a very big list using Mediastore(a database) and sorting it by name initially,(using the sort order parameter in the cursor) that is working fine.Now I want to re sort that list depending on what user chooses. So I am confused what should i use to sort?Should i use comparator ?Or should I use the cursor again ??I want the sorting to be very fast. Is sorting using cursor faster than Comparator ? Is Comparator good for very large lists ?? Is sorting using a database faster than any other thing ?? Please tell me what to go for ?
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21362587
downvote count: 0
answer count: 1
tagged with: sorting

http://stackoverflow.com/q/21417413
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21417643
has answer: http://stackoverflow.com/a/21417525
favorite count: 0
has comment: http://stackoverflow.com/comment/32309964
possible better answer: http://stackoverflow.com/a/21417525
tagged with: facebook
tagged with: php
has body: How photo tag is made in Facebook i want to know which programming languages tag is made with and if any one have example he can share it with me
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32310117
has title: How photo tag is made in facebook ?
tagged with: java
has answer: http://stackoverflow.com/a/21417643
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32309922

http://stackoverflow.com/comment/32452525
type: QuestionComment
has text: for that you have to also return arraylist for options.
score: 0
comment on: http://stackoverflow.com/q/21497856
type: Comment

http://stackoverflow.com/comment/32354569
comment on: http://stackoverflow.com/q/21438939
score: 0
type: Comment
type: QuestionComment
has text: @user3118604 I don't think it is preempted, that is the only possible explanation I can find when there's a single thread. But sounds far-fetched and I don't want to believe it is even possible.

http://stackoverflow.com/comment/32217863
type: QuestionComment
type: Comment
has text: can you copy your full code
comment on: http://stackoverflow.com/q/21365679
score: 0

http://stackoverflow.com/comment/32418477
comment on: http://stackoverflow.com/a/21425113
type: Comment
has text: I am using Scala IDE 3.0.0 (Eclipse SDK, Version: 3.7.2)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32357774
type: AnswerComment
comment on: http://stackoverflow.com/a/21444368
type: Comment
has text: I don't *think* it's actually talking about the day of the week - I think it's about the overall date. It's unclear at the moment though.
score: 0

http://stackoverflow.com/comment/32326062
comment on: http://stackoverflow.com/q/21426781
has text: I'm sure you tried using the `-U` force update option?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42699531
type: AnswerComment
type: Comment
has text: @Jona It's a label, and it's not common.
score: 1
comment on: http://stackoverflow.com/a/21354652

user-interface
tags question: http://stackoverflow.com/q/21358354
tags question: http://stackoverflow.com/q/21365570
tags question: http://stackoverflow.com/q/21392944
tags question: http://stackoverflow.com/q/21354529
tags question: http://stackoverflow.com/q/21497120
tags question: http://stackoverflow.com/q/21371628
tags question: http://stackoverflow.com/q/21373276
tags question: http://stackoverflow.com/q/21413530
tags question: http://stackoverflow.com/q/21474749
tags question: http://stackoverflow.com/q/21403383
tags question: http://stackoverflow.com/q/21424893
tags question: http://stackoverflow.com/q/21440346
tags question: http://stackoverflow.com/q/21505895
tags question: http://stackoverflow.com/q/21368990
tags question: http://stackoverflow.com/q/21417479
type: Tag
tags question: http://stackoverflow.com/q/21391790
tags question: http://stackoverflow.com/q/21510257
tags question: http://stackoverflow.com/q/21466578
tags question: http://stackoverflow.com/q/21487253
tags question: http://stackoverflow.com/q/21412838
tags question: http://stackoverflow.com/q/21456076
tags question: http://stackoverflow.com/q/21365009
tags question: http://stackoverflow.com/q/21501770
tags question: http://stackoverflow.com/q/21395834
tags question: http://stackoverflow.com/q/21466619
tags question: http://stackoverflow.com/q/21352769
tags question: http://stackoverflow.com/q/21507506
tags question: http://stackoverflow.com/q/21433232
tags question: http://stackoverflow.com/q/21507348
tags question: http://stackoverflow.com/q/21351534
tags question: http://stackoverflow.com/q/21369670
tags question: http://stackoverflow.com/q/21502083
tags question: http://stackoverflow.com/q/21418759
tags question: http://stackoverflow.com/q/21453255
tags question: http://stackoverflow.com/q/21426917
tags question: http://stackoverflow.com/q/21479730
tags question: http://stackoverflow.com/q/21480748
tags question: http://stackoverflow.com/q/21370687
tags question: http://stackoverflow.com/q/21431122
tags question: http://stackoverflow.com/q/21494321
tags question: http://stackoverflow.com/q/21513099
tags question: http://stackoverflow.com/q/21413101
tags question: http://stackoverflow.com/q/21459636
tags question: http://stackoverflow.com/q/21436604
tags question: http://stackoverflow.com/q/21433374
tag name: user-interface
tags question: http://stackoverflow.com/q/21351007
tags question: http://stackoverflow.com/q/21352030
tags question: http://stackoverflow.com/q/21467736
tags question: http://stackoverflow.com/q/21391520
tags question: http://stackoverflow.com/q/21421539

http://stackoverflow.com/comment/32470786
comment on: http://stackoverflow.com/q/21498951
score: 0
type: Comment
type: QuestionComment
has text: OO language says that if functions are virtual then there is run time polymorphism and in java all functions are virtual by default. if all functions are virtual and how java supports compile time polymorphism

http://stackoverflow.com/comment/32477696
type: Comment
has text: int[] nums = h.get("PID"); // nums[0] is 3, nums[1] is 5
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21511988

http://stackoverflow.com/comment/32463135
has text: I explained it all wrong, sorry, not my native language. I want to find out number of ones, separated by zeros.
comment on: http://stackoverflow.com/q/21503628
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/80426086
has text: @halfer Typo. looks like the code snippet was right though
type: Comment
comment on: http://stackoverflow.com/a/21451113
score: 1
type: AnswerComment

http://stackoverflow.com/a/21364648
downvote count: 0
answers question: http://stackoverflow.com/q/21364218
type: Answer
has body: Unless your camera can be mounted as an USB drive, you won't be able to directly access the memory card's file system. In order to communicate with your camera, you'll need to use the MTP or PTP protocol. There are some libraries out there that may help you achieve this, such as JPhoto or cameraptp.
score: 1
upvote count: 1

http://stackoverflow.com/a/21492331
accepted answer of: http://stackoverflow.com/q/21492247
answers question: http://stackoverflow.com/q/21492247
score: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/55981557
upvote count: 9
type: Answer
downvote count: 0
has body: You don't need to create a separate test project, but you can if you want to. Most people do it by creating a separate test folder in the same project. Whether you have a separate test project or just a test folder, you should replicate your package structure inside your test folder, so that each test class is testing an application class in the same package. Yes. Mockito is designed to be used with JUnit, or with some other testing framework, such as TestNG. Most people use it with JUnit. Most of the examples on the Mockito web site use JUnit. So, yes, you'll need the JUnit libraries, or the libraries for whatever other testing framework you choose. A Mockito test is a JUnit test (or a TestNG test, or whatever). So there's no "far more easier to run", as you put it. Just write a JUnit test that uses Mockito, and run it in the same way as any other JUnit test. Start with the Mockito web site and Mockito repository.

http://stackoverflow.com/comment/32291505
has text: All three of these answers provide complementary info, but this was a helpful way of looking at it. In my case I'm not so concerned about creation time. Just don't want to be instantiating and allowing release of many small objects, because the GC can cause animation hiccups.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21395845
type: Comment

http://stackoverflow.com/comment/32236484
score: 4
type: Comment
has text: @Rakesh: If what you're really asking (I'm not exactly sure from how you're phrasing it) is by what precise mechanism a `new String()` is immutable, then it is simple because `String` implements no public methods to change its contents, so there simply exists no interface by which to change it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21375710

http://stackoverflow.com/comment/32360483
type: AnswerComment
has text: That's right. I originally just overlooked removing it once it was no longer needed. I've fixed that since. Sorry.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21445640

http://stackoverflow.com/q/21447418
has comment: http://stackoverflow.com/comment/32363724
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21447601
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/32363819
tagged with: arrays
has body: This is supposed to be a dice app and each dice is supposed to alternate between 3 colors so each face value can be blue, yellow, or red, and so far I only am making the 1st dice colored. Now I have an array storing all the images to use for each color and theres 18 values in the array seeing as there's 6 sides of the dice and 3 colors for each sides. so I have my method taking 0-2 in the array which should be all just 1 in red blue and yellow, and then 2-5 should be 2 in red blue yellow. problem is whenever I run it, the total it shows is never the correct toal as the face value is always off. for example it will show a red 3 and a normal black and white 1 and the total will be 8. Any help would be greatly appreciated! public class MainActivity extends Activity { int[] images = new int[] { // dicex1 R.drawable.dicex1red, R.drawable.dicex1blue, R.drawable.dicex1yellow, // dicex2 R.drawable.dicex2red, R.drawable.dicex2blue, R.drawable.dicex2yellow, // dicex3 R.drawable.dicex3red, R.drawable.dicex3blue, R.drawable.dicex3yellow, // dicex4 R.drawable.dicex4red, R.drawable.dicex4blue, R.drawable.dicex4yellow, // dicex5 R.drawable.dicex5red, R.drawable.dicex5blue, R.drawable.dicex5yellow, // dicex6 R.drawable.dicex6red, R.drawable.dicex6blue, R.drawable.dicex6yellow, }; Random three = new Random(); MediaPlayer mp; ImageView dice1, dice2; TextView total; Button roll; int di1, di2, num; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); roll = (Button) findViewById(R.id.bRoll); total = (TextView) findViewById(R.id.tvTotal); dice1 = (ImageView) findViewById(R.id.IVdice1); dice2 = (ImageView) findViewById(R.id.IVdice2); mp = new MediaPlayer(); final Random random = new Random(); roll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mp.release(); di1 = random.nextInt(6); di1++; di2 = random.nextInt(6); di2++; if (di1 == 1) { numb(2); numColor(); } else…
score: 0
has title: Method isn't pulling the correct variable from an Array
tagged with: android
answer count: 1

http://stackoverflow.com/a/21546966
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21512902
has body: You cannot serialize your PersistenceContext. This would imply that you could for example send your MazeBean to another machine and access the same database. However, since EntityManager is an interface you could implement it yourself and make this implementation serializable. All calls would then be delegated to the actual EntityManager. However, you might just redesign your MazeBean instead what is most likely the cleaner solution.
accepted answer of: http://stackoverflow.com/q/21512902

http://stackoverflow.com/comment/32429186
type: QuestionComment
comment on: http://stackoverflow.com/q/21484735
has text: I changed the url to: '/GlassFishTestApp/GlassFishTestAppService'. I wasn't sure which "debugging console" you were referring to so I checked FireBug (no errors), and the Console in Eclipse -- and saw the following error: SEVERE: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog. That doesn't look good!
score: 0
type: Comment

http://stackoverflow.com/comment/32220831
comment on: http://stackoverflow.com/q/21365929
has text: Hi, I made some changes and got few more lines of error as shown below ! at WordCount.run(WordCount.java:24) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at WordCount.main(WordCount.java:47)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21450955
score: 0
answers question: http://stackoverflow.com/q/21444209
has comment: http://stackoverflow.com/comment/32386069
type: Answer
has comment: http://stackoverflow.com/comment/32381661
has comment: http://stackoverflow.com/comment/32381744
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/32385987
has body: To have a grid you could and should use camera: OrthographicCamera cam = new OrthographicCamera(8,8); You tell the camera to have a viewport of 8 x and 8 y. The cameras (0,0) point is in the middle of the screen. To have it at the left bottom you need to set its position to cam.translate(camWidth / 2, camHeight / 2); Now you can add your sqares at sqare.setX(0) for sqares on the bottom line or sqare.setY(3) to add it on the 4rd row from left to right. For the animations you could also use Actions, which allow you to add different movements to an actor and let him perform them over time. Example: actor.addAction(Actions.parallel(Actions.moveTo(float x, float y, float duration), Actions.rotateTo(float rotation, float duration))); With this code sample you tell your actor to move from his position to (x,y) in duration seconds and while he moves to this position he rotates from his current rotation to rotation in duration seconds. Hope this helps

http://stackoverflow.com/q/21351007
tagged with: swing
has body: I am trying to do a fairly basic swing GUI where a user can enter a url, choose a local file location etc. I am using multiple layout managers including boxlayout, borderlayout and flowlayout. The code is below. My problem is that some of the components are moving around when the user puts text into the optionsTxt jtextarea. Anyone know where I should start to stop this happening? Setup menu bar JButton menu_File = new JButton("File"); JButton menu_Edit = new JButton("Edit"); JToolBar toolBar = new JToolBar(); toolBar.add(menu_File); toolBar.add(menu_Edit); //Setup options area JPanel options = new JPanel(); options.setBorder(BorderFactory.createTitledBorder("Options")); BoxLayout layout_Options = new BoxLayout(options, BoxLayout.Y_AXIS); options.setLayout(layout_Options); JLabel optionsLblURL = new JLabel("Enter URL:"); optionsTxtUrl = new JTextArea(1,15); JLabel chooseDestLbl = new JLabel("Choose save location:"); chooseDest = new JButton("Browse"); chooseDest.addActionListener(this); options.add(optionsLblURL); options.add(optionsTxtUrl); options.add(chooseDestLbl); options.add(chooseDest); //Setup launch area JPanel launch = new JPanel(); launch.setBorder(BorderFactory.createTitledBorder("Launch")); launchBtnStart = new JButton("Start Download"); launchBtnStart.setVerticalAlignment(SwingConstants.CENTER); launchBtnStart.setHorizontalAlignment(SwingConstants.CENTER); launchBtnStart.addActionListener(this); launch.add(launchBtnStart); //Setup reporting area JPanel logging = new JPanel(); logging.setBorder(BorderFactory.createTitledBorder("Log")); BoxLayout layout_Logging = new BoxLayout(logging, BoxLayout.Y_AXIS); logging.setLayout(layout_Logging); JTextArea loggingTxt = new JTextArea(3,10); loggingTxt.setEditable(false); logging.add(pb); logging.add(loggingTxt); //Add components to window BorderLayout borderLayout = new BorderLayout(); setLayout(borderLayout); add("North", toolBar); add("West", options); add("East", launch); add("South", logging); setVisible(true…
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21351085
accepted answer: http://stackoverflow.com/a/21351085
score: 0
answer count: 1
tagged with: user-interface
has title: Swing GUI moving when user enters text

http://stackoverflow.com/a/21398544
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32276954
accepted answer of: http://stackoverflow.com/q/21398516
answers question: http://stackoverflow.com/q/21398516
type: Answer
has body: Change your sql to : String sql = "select max(contrno) contrno from cis";
upvote count: 5

swing
tags question: http://stackoverflow.com/q/21430145
tags question: http://stackoverflow.com/q/21489286
tags question: http://stackoverflow.com/q/21395148
tags question: http://stackoverflow.com/q/21512449
tags question: http://stackoverflow.com/q/21364798
tags question: http://stackoverflow.com/q/21480748
tags question: http://stackoverflow.com/q/21352740
tags question: http://stackoverflow.com/q/21500771
tags question: http://stackoverflow.com/q/21501988
tags question: http://stackoverflow.com/q/21501770
tags question: http://stackoverflow.com/q/21437922
tags question: http://stackoverflow.com/q/21401149
tags question: http://stackoverflow.com/q/21475799
tags question: http://stackoverflow.com/q/21395834
tags question: http://stackoverflow.com/q/21511768
tags question: http://stackoverflow.com/q/21494321
tags question: http://stackoverflow.com/q/21497119
tags question: http://stackoverflow.com/q/21466619
tags question: http://stackoverflow.com/q/21360528
tags question: http://stackoverflow.com/q/21388255
tags question: http://stackoverflow.com/q/21507506
tags question: http://stackoverflow.com/q/21415182
tags question: http://stackoverflow.com/q/21492821
tags question: http://stackoverflow.com/q/21387777
tags question: http://stackoverflow.com/q/21485488
tags question: http://stackoverflow.com/q/21354747
tags question: http://stackoverflow.com/q/21408620
tags question: http://stackoverflow.com/q/21498988
tags question: http://stackoverflow.com/q/21477540
tags question: http://stackoverflow.com/q/21360084
tags question: http://stackoverflow.com/q/21468622
tags question: http://stackoverflow.com/q/21356658
tags question: http://stackoverflow.com/q/21360954
tags question: http://stackoverflow.com/q/21464597
tags question: http://stackoverflow.com/q/21507966
tags question: http://stackoverflow.com/q/21494197
tags question: http://stackoverflow.com/q/21413101
tags question: http://stackoverflow.com/q/21397067
tags question: http://stackoverflow.com/q/21459950
tags question: http://stackoverflow.com/q/21501199
tags question: http://stackoverflow.com/q/21476420
tags question: http://stackoverflow.com/q/21463352
tags question: http://stackoverflow.com/q/21509676
tags question: http://stackoverflow.com/q/21359892
tags question: http://stackoverflow.com/q/21480242
tags question: http://stackoverflow.com/q/21486826
tags question: http://stackoverflow.com/q/21498658
tags question: http://stackoverflow.com/q/21450238
tags question: http://stackoverflow.com/q/21458690
tags question: http://stackoverflow.com/q/21488509
tags question: http://stackoverflow.com/q/21500162
tags question: http://stackoverflow.com/q/21369670
tags question: http://stackoverflow.com/q/21400129
tags question: http://stackoverflow.com/q/21480365
tags question: http://stackoverflow.com/q/21438559
tags question: http://stackoverflow.com/q/21412116
tags question: http://stackoverflow.com/q/21479611
tags question: http://stackoverflow.com/q/21423642
tags question: http://stackoverflow.com/q/21404797
tags question: http://stackoverflow.com/q/21365940
tags question: http://stackoverflow.com/q/21353147
tags question: http://stackoverflow.com/q/21438704
tags question: http://stackoverflow.com/q/21499820
tags question: http://stackoverflow.com/q/21510524
tags question: http://stackoverflow.com/q/21394894
tags question: http://stackoverflow.com/q/21446947
tags question: http://stackoverflow.com/q/21418632
tags question: http://stackoverflow.com/q/21439223
tags question: http://stackoverflow.com/q/21474152
tags question: http://stackoverflow.com/q/21489101
tags question: http://stackoverflow.com/q/21356609
tags question: http://stackoverflow.com/q/21419739
tags question: http://stackoverflow.com/q/21391457
tags question: http://stackoverflow.com/q/21364698
tags question: http://stackoverflow.com/q/21487418
tags question: http://stackoverflow.com/q/21471326
tags question: http://stackoverflow.com/q/21396136
tags question: http://stackoverflow.com/q/21437949
tags question: http://stackoverflow.com/q/21511790
tags question: http://stackoverflow.com/q/21439445

http://stackoverflow.com/a/21413177
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21413101
score: 3
type: Answer
has body: Suggestions: Don't use null layouts and absolute positioning. While it seems initially that using these tools is the easiest way to create complex GUI's, it's really a newbie fallacy, as the more you understand and use the layout managers, the more you'll find that they make the job of creating GUI's much easier, and the results much more attractive. Learn about and use the layout managers. Tutorial link. Consider using a BorderLayout and adding your JLabel BorderLayout.CENTER and the JTextField at BorderLayout.PAGE_END. As a side note, I generally avoid placing JTextFields in a BorderLayout.CENTER position since this will cause horizontal stretching of the field if the GUI changes size, which I don't think is aesthetically pleasing.
has comment: http://stackoverflow.com/comment/32302506
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21413101

http://stackoverflow.com/comment/32328855
has text: I tried this, but then nothing happens. Also tried to do a normal resize scrolled.setSize(bar.computeSize(SWT.DEFAULT, SWT.DEFAULT)) no luck there
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21428295

http://stackoverflow.com/comment/32332228
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21430447
type: Comment
has text: Look at using a sentence [BreakIterator](http://docs.oracle.com/javase/tutorial/i18n/text/about.html)

http://stackoverflow.com/q/21417214
tagged with: java
type: Question
downvote count: 0
has title: Sending a file using sockets (java) from a client to the server succeeds but the client freezes and does not exit the loop
tagged with: file-transfer
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21417448
upvote count: 2
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/32311648
score: 2
has comment: http://stackoverflow.com/comment/32309839
has body: I run the server and client on separate cmd windows. The server prints out "Upload successful" and indeed the file gets uploaded to the server but the client freezes and i have to quit the client process using Ctrl+C. It seems to me that the client cannot break out of the while loop. Please tell me where i am going wrong? (The code snippets are parts of much larger code body that i am writing to implement file read, write, read/write-lock, delete file etc from the server. Once a request to upload the file from the client is handled by the server I want the process to return to the command line menu i have incorporated with the client program[not shown below]. So it is important that the client returns to that user interface. Any help is greatly appreciated. Thanks in advance! ) Client side: // initialized client and server connection made... BufferedReader filePath = new BufferedReader(new InputStreamReader(System.in)); String pathname = filePath.readLine(); try{ File file_to_upload = new File(pathname); byte[] bytearray = new byte[(int) file_to_upload.length()]; OutputStream os = client1.getOutputStream(); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file_to_upload)); do { bis.read(bytearray, 0, bytearray.length); os.write(bytearray, 0, bytearray.length); os.flush(); bis.close(); } while (bis.read(bytearray, 0, bytearray.length)!= -1); } catch(FileNotFoundException e){ System.out.println(e); } catch(IOException e){ System.out.println(e); } System.out.println("\n" + inFromServer.readLine() + "\n"); client1.close(); break; server side: byte[] mybytearray = new byte[1]; InputStream is = server1accept.getInputStream(); FileOutputStream fos = new FileOutputStream("234rews"); BufferedOutputStream bos = new BufferedOutputStream(fos); int bytesRead = is.read(mybytearray, 0, mybytearray.length); bos.write(mybytearray, 0, bytesRead); bos.close(); outToClient.writeBytes("Uploaded"); System.out.println("Upload Successful");

http://stackoverflow.com/comment/32336528
score: 1
has text: ok thanks again, I just tried the other solution and it works fine
comment on: http://stackoverflow.com/a/21432110
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21428545
upvote count: 1
answer count: 1
has title: Java regex: how to back-reference capturing groups in a certain context when their number is not known in advance
has comment: http://stackoverflow.com/comment/32336646
tagged with: java
has comment: http://stackoverflow.com/comment/32331528
has comment: http://stackoverflow.com/comment/32329242
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32331850
linked to: http://stackoverflow.com/q/14897949
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21434277
has comment: http://stackoverflow.com/comment/32329089
has comment: http://stackoverflow.com/comment/32331878
favorite count: 0
has comment: http://stackoverflow.com/comment/32333273
type: Question
accepted answer: http://stackoverflow.com/a/21434277
tagged with: regex
tagged with: capturing-group
has body: As an introductory note, I am aware of the old saying about solving problems with regex and I am also aware about the precautions on processing XML with RegEx. But please bear with me for a moment... I am trying to do a RegEx search and replace on a group of characters. I don't know in advance how often this group will be matched, but I want to search with a certain context only. An example: If I have the following string "**ab**df**ab**sdf**ab**fdsa**ab**bb" and I want to search for "ab" and replace with "@ab@", this works fine using the following regex: Search regex: (.*?)(ab)(.*?) Replace: $1@$2@$3 I get four matches in total, as expected. Within each match, the group IDs are the same, so the back-references ($1, $2 ...) work fine, too. However, if I now add a certain context to the string, the regex above fails: Search string: abdfabsdfabfdsaabbb Search regex: (.*?)(ab)(.*?) This will find only the first match. But even if I add a non-capturing group to the original regex, it doesn't work (" (?:(.*?)(ab)(.*?))* "). What I would like is a list of matches as in the first search (without the context), whereby within each match the group IDs are the same. Any idea how this could be achieved?
linked to: http://stackoverflow.com/q/15268504

http://stackoverflow.com/q/21476847
possible better answer: http://stackoverflow.com/a/21477435
has answer: http://stackoverflow.com/a/21480054
has answer: http://stackoverflow.com/a/21477435
type: Question
answer count: 2
has body: I am trying to get the first value of a map by following TreeMap&lt;String, String&gt; myMap = new TreeMap&lt;String, String&gt;(); myMap.put("key1","value1"); myMap.put("key2","value2"); String first = myMap.firstEntry().getValue(); String firstOther = myMap.get(myMap.firstKey()); its working for me writing in Java In same i am using expression in jsf like following ${criterion.variableBindings.firstEntry.getValue()} In this scenario I didn't get the value.
tagged with: jsf
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/21480054
has title: Get the first value from map using expression
tagged with: jsf-1.2
type: AnsweredQuestion

http://stackoverflow.com/q/21358829
type: Question
tagged with: jndi
upvote count: 1
answer count: 1
has body: I have context.xml defined in META-INF as follow: &lt;Context path="/7Restaurant"&gt; &lt;Resource name="datasource" type="javax.sql.DataSource" auth="Container" maxActive="10" maxIdle="3" maxWait="10000" username="work" password="" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/7restaurant"/&gt; &lt;/Context&gt; I am about to deploy my web app (Servlet, in Tomcat 7). The only problem is that, how can I change the url, username, etc. to match that with the environment the WAR package is deployed. So, in essence, how could such a file is modified; or any other technique so that user can finely connect to the database in the environment it will be deployed on. I am so new in web-app eclipse, tomcat, postgresql stack; so I expect my question to be wrong, if that's the case; please let me know any other way to solve this. My context initializer in Java: package com.restaurant.web; import java.io.File; import java.io.InputStream; import java.io.StringWriter; import java.net.URL; import javax.naming.*; import javax.servlet.*; import javax.sql.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.*; import com.restaurant.dao.dbpostgres.DBDAO; import com.restaurant.setup.GeneralConfigurerSetup; import com.restaurant.web.Logger; import sun.java2d.loops.DrawGlyphListAA.General; public class Database implements ServletContextListener { private void contextInitialized2(ServletContext servletContext) throws Exception { /* //prepare META-INF/context.xml DocumentBuilder docbldr = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = docbldr.newDocument(); Element context = doc.createElement("Context"); context.setAttribute("path",…
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/21359025
has title: Lookup datasource with custom variable in runtime
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21359025
score: 1
tagged with: java

http://stackoverflow.com/comment/32443409
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21492529
type: QuestionComment
has text: Jackson produces JSON. If you only want `Person` to be JSON, pass that to the `ObjectMapper` and build the rest yourself.

http://stackoverflow.com/q/21466389
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32397813
has comment: http://stackoverflow.com/comment/32399279
answer count: 0
has comment: http://stackoverflow.com/comment/32397081
score: 1
has body: I am new to Android and I am having a problem. I am using a map, and on the map there are different colors. I am trying to get the colors to determine where I clicked on the map but getPixel() returns 0 every time. Can you please help me? public class ImageZoomActivity extends Activity { private ImageViewTouch mImageView; public Bitmap map; @Override protected void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); requestWindowFeature( Window.FEATURE_NO_TITLE ); setContentView( R.layout.imagezoom ); getWindow().addFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN ); bitmap_init(); selectImage(); click_map(); } @Override public void onContentChanged() { super.onContentChanged(); mImageView = (ImageViewTouch)findViewById( R.id.imageView1 ); click_map(); } public void bitmap_init() { map = BitmapFactory.decodeResource(getResources(), R.drawable.map); } public void selectImage() { mImageView.setImageBitmapReset(map, true); return; } public void click_map() { //final ImageView image_map = new ImageView(this); mImageView.setImageBitmap(map); mImageView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int x_coordinate = (int)event.getX(); int y_coordinate = (int)event.getY(); Bitmap bitmap = ((BitmapDrawable)mImageView.getDrawable()).getBitmap(); int pixel = bitmap.getPixel(x_coordinate,y_coordinate); if (event.getAction() == MotionEvent.ACTION_DOWN) { Log.d("Log", "Color: " + bitmap.getPixel(x_coordinate, y_coordinate) + " x: " + event.getX() + " y: " + event.getY()); } /*if (event.getAction() == MotionEvent.ACTION_UP) { }*/ return true; } }); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/32456166
type: Question
tagged with: java
downvote count: 0
linked to: http://stackoverflow.com/q/9245071
has comment: http://stackoverflow.com/comment/32456145
has title: getPixel always returns 0. why?
favorite count: 0
has comment: http://stackoverflow.com/comment/32423691
has comment: http://stackoverflow.com/comment/32398008
has comment: http://stackoverflow.com/comment/32398078
has comment: http://stackoverflow.com/comment/32396825
has comment: http://stackoverflow.com/comment/32399359

http://stackoverflow.com/comment/32333823
score: 0
has text: What do you mean with `When I print json it shows me whole json values` ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21431399

http://stackoverflow.com/comment/32198701
type: Comment
type: QuestionComment
has text: Save every line in a string buffer then execute the json (maybe with gson?) using stringBuffer.toString().. If your json is small (or big too maybe?) it could be an idea..
comment on: http://stackoverflow.com/q/21355256
score: 0

http://stackoverflow.com/q/21512596
tagged with: dictionary
score: 0
tagged with: java
has body: I have the method below in which I am fetching a map and storing it contents on another map as shown below ... public void generatetrp(String p1, String p2, String p3,String p4) { Map&lt;Integer, Integer&gt; finalresult2 = abcd.execute1(p1, p2, p3, p4,null, null, null, null); // now this map consists of key value pair and it will be the arguemts P5 AND P6 for next method call // map key will be arguement P5 and // map Value will be arguement P6 for (Map.Entry&lt;Integer, Integer&gt; entry : finalresult2.entrySet()) { abc.generateabcRange(String p1,String p2, String p3, String p4,String p5, String p6) ; below is the another method and this method is called from the previous method.. public void generateabcRange(String p1, String p2, String p3, String p4, String p5, String p6) { //method is running some buisness logic } Can you please advise how can I fetch the value from map one by one and inject the key and value to the arguements p5 and p6 at each iteration. }
has comment: http://stackoverflow.com/comment/32479487
tagged with: collections
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21512884
answer count: 0
duplicate of: http://stackoverflow.com/q/21512884
has title: fetching the value from map and addidng it to arguements of another method call
has comment: http://stackoverflow.com/comment/32478638
type: Question

http://stackoverflow.com/q/21494053
has comment: http://stackoverflow.com/comment/32446176
has comment: http://stackoverflow.com/comment/32446396
has comment: http://stackoverflow.com/comment/32446508
has comment: http://stackoverflow.com/comment/32446407
type: UnansweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/21494565
has comment: http://stackoverflow.com/comment/32446470
has comment: http://stackoverflow.com/comment/32446265
has comment: http://stackoverflow.com/comment/32446255
has answer: http://stackoverflow.com/a/34529787
has comment: http://stackoverflow.com/comment/32446373
has comment: http://stackoverflow.com/comment/32446469
tagged with: apache-commons
has comment: http://stackoverflow.com/comment/32446183
has body: I am trying to decode one of my files from dropbox. Using one of the post in this forum import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.StringUtils; String base64String = getFileResults.get_Response();//returns a file content in base64 String result = StringUtils.newStringUtf8(Base64.decodeBase64(base64String)); But the Netbeans keeps telling me that the decodeBase64() does not take string, but the API says that it takes a string in base 64. What am i missing?
tagged with: java
tagged with: base64
has comment: http://stackoverflow.com/comment/32446160
has title: base64 String decoding using Apache Commons
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32446095
has comment: http://stackoverflow.com/comment/32446355
downvote count: 0
has comment: http://stackoverflow.com/comment/32446360
has comment: http://stackoverflow.com/comment/32446205
favorite count: 0
has comment: http://stackoverflow.com/comment/32446341

http://stackoverflow.com/comment/32249626
comment on: http://stackoverflow.com/a/21383391
has text: I think you used "n" when you meant "x" a couple of times.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21420292
score: 3
has comment: http://stackoverflow.com/comment/48113607
has comment: http://stackoverflow.com/comment/48120774
accepted answer of: http://stackoverflow.com/q/21373549
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/48103423
has body: You need both the log4j-api-2.0 and the log4j-core-2.0 jar files in the classpath. If the core jar is not found, the api jar falls back to a SimpleLogger (console) implementation. By changing the config to &lt;configuration status="trace"&gt; you can see log4j2 internal logging that may help trouble-shoot configuration issues. (This also requires the log4j-core-2.0 jar though.) The log4j2.xml file can be in the classpath, or you can specify a location with system property -Dlog4j.configurationFile=/path/to/log4j2.xml,
answers question: http://stackoverflow.com/q/21373549

http://stackoverflow.com/comment/32473422
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21509652
has text: Use the `delta` time you get for each run of the loop, and fire the bullet only when a certain time elapsed.

http://stackoverflow.com/q/21479713
tagged with: string
tagged with: android
has comment: http://stackoverflow.com/comment/32419756
type: AnsweredQuestion
has body: How I can put a complicated json object in an array of strings? JSON sample { "FriendsList": [ { "username": "ChanServ", "avatar": "http:\/\/clavatars.photos-box.org\/chack.jpg" }, { "username": "kroot", "avatar": "http:\/\/clavatars.photos-box.org\/land2.jpg" }, { "username": "morrildl", "avatar": "http:\/\/clavatars.photos-box.org\/land3.jpg" }, { "username": "addo", "avatar": "http:\/\/clavatars.photos-box.org\/land8.jpg" } ] } and this is the code: protected void onPostExecute(String result) { super.onPostExecute(result); JSONObject json; try { json = new JSONObject(result); tvhttp.setText(json.toString(2)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
possible better answer: http://stackoverflow.com/a/21480422
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/21480422
has answer: http://stackoverflow.com/a/21479848
type: Question
score: 0
answer count: 2
has title: Convert json to string in java
accepted answer: http://stackoverflow.com/a/21479848

http://stackoverflow.com/comment/32297350
type: QuestionComment
score: 2
has text: When you say “I need to be able to divide through this value”, do you mean without producing a NaN, or without producing an overflow? Because dividing almost any finite value by the smallest positive nonzero double will produce overflow.
comment on: http://stackoverflow.com/q/21410359
type: Comment

http://stackoverflow.com/q/21428133
has comment: http://stackoverflow.com/comment/32331582
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21486927
tagged with: lookup
score: 1
tagged with: java
type: Question
tagged with: ejb
answer count: 1
downvote count: 0
has title: EJB lookup with InitialContext
has comment: http://stackoverflow.com/comment/32328658
has comment: http://stackoverflow.com/comment/32329193
has body: I have a problem to look up a EJB hosted on a server. The server itself is an SAP environment, which is basicly a modified tomcat. I tried several lookupstrings starting with java:comp/env/ and ejb:/ but nothing works. This is what the server says about the lookupstrings: ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal and for the remote part: ejb:/appName=mycompany.de/reboard~report~cs, jarName=mycompany.de~reboard~report~cs.jar, beanName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb, interfaceName=com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedRemote I tried diferent combinations of this lookup strings but all fail. I can get the Proxy object to the Bean tho by using this: InitialContext().lookup("ejb:/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedLocal"); But what i need as the direct bean access. Here is how the Bean is defined: @com.sap.engine.services.webservices.espbase.configuration.ann.rt.TransportBindingRT(AltPath="reboard/report/cs~ibsolution.de_com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb") @UsedReferences(srIds="05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815, 05bc3ba3-fd85-4381-b6f8-f8a4734b2815", wsdlLocations="ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl, ibsolution.de~reboard~report~cs.jar#META-INF/wsdl/consumed/src/wsdl/rootwsdl_BPMFacadeBeanImplService_BPMFacadeBeanImpl.wsdl") @Stateless(name="com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb") @EJB(name="BPMBean", beanInterface=BPMFacadeBeanSimplifiedL…
favorite count: 0
tagged with: initial-context

http://stackoverflow.com/a/21503463
has comment: http://stackoverflow.com/comment/32464624
has body: Yes it does. Like any fixed function matrix stack function glOrtho will operate on the currently active matrix. It is of uttermost importance to place perspective projections in the projection matrix. And you should do it for orthographic projections as well.
has comment: http://stackoverflow.com/comment/32463141
type: AcceptedAnswer
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/21503436
answers question: http://stackoverflow.com/q/21503436
score: 3
downvote count: 0

http://stackoverflow.com/comment/32248216
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21381804
has text: thanks for the answers, but I tried to not recreate the adapter, doesn't fix my problem.

http://stackoverflow.com/comment/32320708
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21423547
score: 0
has text: Can you clarify what "div id instead of select id" means?

http://stackoverflow.com/a/21360684
has comment: http://stackoverflow.com/comment/32214132
type: AcceptedAnswer
has body: I've tried to guess the overall structure of ProductList and Product from what was posted here. The problem is that the list and the fields of a list element appear to be in the context of a single class, i.e., ProductList. This won't do - two classes are required. // stores the data coming from a single Element ("item") of the document class Product { private String productType; private String hyperLinkParam; public setHyperLinkParam( String hlp ){ hyperLinkParam = hlp; } public setProductType( String pt ){ productType = pt; } } // Container for a list of products from an inventory class ProductList { private ArrayList &lt;Product&gt; pl = new ArrayList&lt;Product&gt; (); public ProductList() { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputStream url = getClass().getResourceAsStream("inventory.xml"); Document doc = db.parse(url); doc.getDocumentElement().normalize(); // loop through each item NodeList items = doc.getElementsByTagName("item"); for (int i = 0; i &lt; items.getLength(); i++){ Element e = (Element) items.item(i); // create the single product from the current item Product prod = new Product(); prod.setHyperLinkParam( e.getAttribute("name").toString() ); prod.setProductType( getTextValue( e, "productType") ); // add it to the list pl.add( prod ); } } void showList(){ for( Product prod: pl ){ System.out.print("getHyperLinkParam: " + prod.getHyperLinkParam()); System.out.println("getProductType: " + prod.getProductType()); } } } NB: Everything would be cleaner and clearer if the construction of a ProductList and of a Product would be in a Factory Class with Factory Methods makeProductList and makeProduct. A ProductList should have a method addProduct delegating the add to its pl member. And the knowledge of how to obtain a product list from the XML should be there and not in the constructor, and, similarly, the way the field values for a Product are obtained from an "item" element don…
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/21355168
has comment: http://stackoverflow.com/comment/32213657
upvote count: 1
answers question: http://stackoverflow.com/q/21355168
has comment: http://stackoverflow.com/comment/32218809

http://stackoverflow.com/q/21438985
tagged with: nio
answer count: 2
has body: Given an OS Windows 7 Enterprise (SP 1) 32-bit and JDK 1.7.0_25, Running the following Groovy code println Files.isReadable(Paths.get("foo.txt")) prints true The file resides on a local drive (within the same folder as the Groovy script) However, once I unplug the network cable and rerun, it prints false Can anyone shed a light on it?
has answer: http://stackoverflow.com/a/21439036
has comment: http://stackoverflow.com/comment/32348126
score: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/32362434
type: UnansweredQuestion
has title: Files.isReadable & network resolution
type: Question
has answer: http://stackoverflow.com/a/21439248
tagged with: java
has comment: http://stackoverflow.com/comment/32373869

http://stackoverflow.com/comment/32413124
type: AnswerComment
score: 0
has text: You can have new default target as build <delete dir="build" />
type: Comment
comment on: http://stackoverflow.com/a/21475176

http://stackoverflow.com/comment/32440736
has text: I would guess so but I don't know anything about SIP servlets.
type: Comment
comment on: http://stackoverflow.com/a/21490815
score: 0
type: AnswerComment

http://stackoverflow.com/a/21457777
has comment: http://stackoverflow.com/comment/32392490
has comment: http://stackoverflow.com/comment/32430670
accepted answer of: http://stackoverflow.com/q/21457469
type: Answer
answers question: http://stackoverflow.com/q/21457469
upvote count: 4
has comment: http://stackoverflow.com/comment/32430338
has comment: http://stackoverflow.com/comment/32380893
downvote count: 0
has body: I'm agree that this can be done (and should, maybe) with the standard Collections API, but anyway, in Guava you can do it like this: List&lt;String&gt; strList = Arrays.asList(new String[] {"one", "two", "3", "4"}); boolean exists = FluentIterable.from(strList).contains("two");
score: 4
type: AcceptedAnswer

http://stackoverflow.com/q/21391614
accepted answer: http://stackoverflow.com/a/21391819
answer count: 1
tagged with: android
type: AnsweredQuestion
has title: Android tilemap error
tagged with: java
has answer: http://stackoverflow.com/a/21391819
type: Question
has body: I'm trying to display a tilemap but when I run my app, there is nothing on the screen :c public class MainActivity extends Activity { LinearLayout tileMap; int width, height = 1; int[][] map = { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); tileMap = new LinearLayout(this); generate(tileMap, this); setContentView(tileMap); } @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; } void generate(LinearLayout tileMap, Context context) { for(int y = 0; y &lt; height; y++) { for(int x = 0 ; x &lt; width; x++) { ImageView tile = new ImageView(context); tile.setImageResource(R.drawable.wall); tileMap.addView(tile); } } } } Could you tell me what's wrong with my code ? I'm pretty sure that the problem's inside the generate function... I've already tried to do an ImageView array but it didn't work either ! Thanks :)
score: 0

http://stackoverflow.com/a/21403141
score: 0
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21403084
has comment: http://stackoverflow.com/comment/32284713
has body: You can create an array that will hold your bar values: Bar[] arr = {bar0,.....,bar9}; int numb = Character.getNumericValue(num); if(numb &lt; 0 || numb &gt;= arr.length){ return bar10; } else { return arr[numb]; }

http://stackoverflow.com/comment/32481695
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21514050
has text: @Sanjana Always take care in handling the exceptions explicitly. Your handling doesn't have to be intense, but at least logging the exception will go a long way.
score: 0

http://stackoverflow.com/q/21435497
tagged with: java
has comment: http://stackoverflow.com/comment/32342555
has comment: http://stackoverflow.com/comment/32346092
has comment: http://stackoverflow.com/comment/32341970
upvote count: 4
has answer: http://stackoverflow.com/a/21446134
downvote count: 0
answer count: 1
tagged with: string
score: 4
favorite count: 0
has body: Is the solution for Knuth–Morris–Pratt algorithm: Haystack: AAAAAAAAAA, Needle: AAA, which is: 3, correct? Because, there are 8 instances of AAA in the haystack, however as far as I understand the knuth-morris-pratt algorithm will only find 3. Am I wrong in thinking this? Can this problem be solved by finding out the borders for every suffix in the string? The following is my implementation of the KMP algorithm: public static int occurrenceOfSubstring(char[] target, char[] pattern) { int[] overlay = new int[pattern.length]; overlay[0] = -1; overlay[1] = 0; int i = 0, j = 1; while (j + 1 &lt; pattern.length) { if (pattern[i] == pattern[j]) { if (i == 0) { overlay[j + 1] = 1; } else { overlay[j + 1] = overlay[j] + 1; } i++; j++; } else if (pattern[j] == pattern[0]) { i = 0; } else { j++; } } int l = 0,count=0; for (int k = 0; k &lt; target.length; k++) { if (target[k] == pattern[l]) { if (l == pattern.length - 1) { l = 0; count++; } else { l++; } } else { l = overlay[l] == -1 ? 0 : overlay[l]; } } return count; }
has title: Knuth–Morris–Pratt algorithm
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/32346245

http://stackoverflow.com/a/21455762
type: Answer
has comment: http://stackoverflow.com/comment/32377817
has comment: http://stackoverflow.com/comment/32377731
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/32377549
has comment: http://stackoverflow.com/comment/32377650
has comment: http://stackoverflow.com/comment/32377469
type: AcceptedAnswer
downvote count: 0
has body: This is from the JavaDoc for ConcurrentModificationException: For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception. In your last loop, you sometimes do user.getSkillsList().add(skillObj); while iterating using user.getSkillsList().iterator().
accepted answer of: http://stackoverflow.com/q/21455699
has comment: http://stackoverflow.com/comment/32377436
answers question: http://stackoverflow.com/q/21455699

http://stackoverflow.com/comment/32211861
type: Comment
has text: I added this to GroceryItem: public String toString() { return getQuantity() + " " + getName() + " " + "(" + getPricePerUnit() + " /stk)" + " " + getCost(); BUT still the same output...
comment on: http://stackoverflow.com/a/21362516
score: 0
type: AnswerComment

http://stackoverflow.com/q/21487214
downvote count: 0
answer count: 1
favorite count: 0
tagged with: richfaces
linked to: http://stackoverflow.com/q/2158009
has answer: http://stackoverflow.com/a/21488184
upvote count: 1
has body: I'm doing this htmlAjaxSupport.setActionExpression(createMethodExpression( "#{questionarioMB.visualizarQuestoesFilhos}", null, new Class[0])); The method public void visualizarQuestoesFilhos() is called. But I want to call public void visualizarQuestoesFilhos(ActionEvent event) Because this way, I can get which component is being clicked. What do I need to set in htmlAjaxSupport to work?
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
has title: JSF / RichFaces - How to call programatically an ActionEvent from HtmlAjaxSupport (a4j:support)
type: Question
has comment: http://stackoverflow.com/comment/32433664
accepted answer: http://stackoverflow.com/a/21488184

http://stackoverflow.com/comment/32804599
type: Comment
has text: But when I add both `ActionListener` and `MouseListener` to a `JButton` `actionPerformed()` is executed before `mouseClicked`. How is this possible? Is it just because not only a mouse click can generate `ActionEvent`?
comment on: http://stackoverflow.com/a/21480214
score: 0
type: AnswerComment

http://stackoverflow.com/q/21483563
favorite count: 0
has title: Writing dates in csv files, some output as ######
upvote count: 1
tagged with: excel
has comment: http://stackoverflow.com/comment/32426511
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32426389
has answer: http://stackoverflow.com/a/21484130
accepted answer: http://stackoverflow.com/a/21484130
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32426399
downvote count: 0
answer count: 1
has body: I am writing an application where I let some threads write csv files with random numbers and random dates. However, some of the dates output as ######, but when I click them in Excell, they do show the correct date (e.g.11/4/2014 shows as ###### in Excell, but when I click on this cell, in the fx field it does show as 11/4/2014). Here is how I write my dates: Random random = new Random(); BufferedWriter bufferedWriter; GregorianCalendar cal = new GregorianCalendar(); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); writeLine(random, bufferedWriter, cal, df); private void writeLine(Random random, BufferedWriter bufferedWriter, GregorianCalendar cal, DateFormat df) throws IOException { String randomDateString; bufferedWriter.write(Double.toString(random.nextDouble() * 100)); bufferedWriter.write(","); randomDateString = createRandomDate(random, cal, df); bufferedWriter.write(randomDateString); bufferedWriter.newLine(); } private String createRandomDate(Random random, GregorianCalendar cal, DateFormat df) { int randomDayOfTheYear; Date randomDate; String randomDateString; randomDayOfTheYear = random.nextInt(365) + 1; cal.set(Calendar.YEAR, 2014); cal.set(Calendar.DAY_OF_YEAR, randomDayOfTheYear); randomDate = cal.getTime(); randomDateString = df.format(randomDate); return randomDateString; }
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/q/21400425
has answer: http://stackoverflow.com/a/21401569
type: Question
has answer: http://stackoverflow.com/a/21401558
has comment: http://stackoverflow.com/comment/32280042
tagged with: java
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32280168
has body: Please suggest me the best Java api for removing non English words and blocking incorrect words using I use an English words list file to parse the given string. The code is responding very slowly. ` String englishword; while ((englishword = br.readLine()) != null) { //System.out.println("@"+englishword); for (String word : wordsArray) { //System.out.println("#"+word); if(englishword.trim().toUpperCase().equals(word.trim().toUpperCase())) { linetmp = linetmp.replaceAll(word, " ").trim(); break; } } } if(linetmp!=null) for(String nonEnglish:linetmp.split("\\s+")) { line = line.replaceAll(nonEnglish, ""); } line = line.replaceAll(" +", " "); return line; Please suggest me if there is any faster way to do this Note: i am using Linux OS's dictionary listy
tagged with: algorithm
has title: Any Java functions for blocking non English words?
type: UnansweredQuestion
tagged with: text-mining
has answer: http://stackoverflow.com/a/21400756

http://stackoverflow.com/a/21478343
has body: No, to marshall with JAXB annotations, you need JAXB - that's what it does. Yes, you can use StAX as the output writer when you serialize a JAXB object tree using a Marshaller. They are two separate things. StAX is not faster than JAXB, it does something different - it is needed to create textual XML after JAXB has generated the correct XML events to tell StAX what the XML should look like. Use the following method on javax.xml.bind.Marshaller to send your JAXB objects to StAX: /** * Marshal the content tree rooted at jaxbElement into a * {@link javax.xml.stream.XMLStreamWriter}. * * @param jaxbElement * The content tree to be marshalled. * @param writer * XML will be sent to this writer. * * [...] * @since JAXB 2.0 */ public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer ) throws JAXBException;
type: Answer
answers question: http://stackoverflow.com/q/21477934
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21477934
has comment: http://stackoverflow.com/comment/32418494
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32419185

http://stackoverflow.com/comment/32463158
score: 3
type: Comment
type: QuestionComment
has text: So you want all members of a group to show the amount of members in the whole group?
comment on: http://stackoverflow.com/q/21503628

http://stackoverflow.com/comment/32244483
has text: 1) Install the "maven" package then!! 2) It most likely works in Eclipse because you are using an Eclipse with built-in Maven support. Look in the eclipse plugins directory ...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21374175

http://stackoverflow.com/a/21403625
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32339709
answers question: http://stackoverflow.com/q/21403054
has body: This is called method chaining. To understand this a simple example will help you. String a = "hellloo"; String b = a.toUpperCase().replace("LOO", "O").concat(" WORLD"); System.out.println(b); This is going to print HELLO WORLD. Remember the methods in method chaining are processed from left to right. Above it executes as toUpperCase() - "HELLLOO" replace("LOO", "O") - "HELLO" concat(" WORLD") - "HELLO WORLD" Assigns "HELLO WORLD" to string b. Similarly for the above code we first get the ContentPane and then add a panel to it. This reduces the amount of code required to achieve it. Normally it would be like Container container = getContentPane(); container.getContentPane(); Chaining reduces the code in half. Hope this helps.
type: Answer
score: 2

http://stackoverflow.com/a/21505741
answers question: http://stackoverflow.com/q/21505713
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21505713
has comment: http://stackoverflow.com/comment/32468600
has comment: http://stackoverflow.com/comment/32467470
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32467646
has body: Use the overloaded version of nextLong to read binary input binary = num.nextLong(2);
has comment: http://stackoverflow.com/comment/32467237
downvote count: 0
score: 1

http://stackoverflow.com/comment/37373369
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21404064
has text: Is that working with poi 3.10? I think poi has some references to awt components. ex org.apache.poi.hssf.usermodel.HSSFPicture

http://stackoverflow.com/a/21435538
score: 0
answers question: http://stackoverflow.com/q/21431641
type: Answer
has body: I modified the source code to use an Iterator to traverse the child element. This will allow for the Iterator to remove the element. I assume it is the Element with attribute displayName="Growth". If not, please clarify or experiment. String path="c:/work/play/java/test.xml"; File structureXml = new File(path); SAXBuilder saxb = new SAXBuilder(); Document document = saxb.build(structureXml); Element rootElement = document.getRootElement(); XMLOutputter xmlOutput = new XMLOutputter(); List structureList = rootElement.getChildren("structure"); Iterator itr = structureList.iterator(); while (itr.hasNext()) { Element structure = (Element)itr.next(); List elementList = structure.getChildren(); Iterator itr2 = elementList.iterator(); while (itr2.hasNext()) { Element option = (Element)itr2.next(); System.out.println(option.toString()); System.out.println(option.getName()); System.out.println(option.getAttributeValue("displayName")); if(option.getName().equalsIgnoreCase("filename") &amp;&amp; option.getAttributeValue("displayName").compareTo("Growth")==0){ itr2.remove(); } } }

http://stackoverflow.com/a/21351201
has comment: http://stackoverflow.com/comment/32212808
type: Answer
answers question: http://stackoverflow.com/q/21351036
has comment: http://stackoverflow.com/comment/32212537
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32213161
accepted answer of: http://stackoverflow.com/q/21351036
type: AcceptedAnswer
downvote count: 0
has body: Try this code: android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, newbright); Maybe cr in your code is null

http://stackoverflow.com/q/21379771
favorite count: 0
type: Question
has body: I am working in netbeans 7.0.1.. I made two jframes in it.. I made a method named close() in the in the main class: public void close(){ WindowEvent winClosingEvent=new WindowEvent(this,WindowEvent.WINDOW_CLOSING); Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent); } then i called this method where the new jframe is becoming visible. Now i have to set the defaultCloseOperation as "dispose" to to close previous jframe on the opening of new jframe in netbeans .. But i cant find the defaultCloseOperation option in my properties.. I tried doing it through coding but it dint work. Please help.. these are the available options in the properties of my netbeans:
accepted answer: http://stackoverflow.com/a/21379894
tagged with: netbeans
has title: defaultCloseOperation option missing in netbeans
has comment: http://stackoverflow.com/comment/32242832
upvote count: 1
tagged with: swing
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/21379894
type: AnsweredQuestion
downvote count: 0
tagged with: netbeans-7
score: 1

http://stackoverflow.com/comment/32357548
comment on: http://stackoverflow.com/a/21444172
type: Comment
score: 1
has text: @mystarrocks [This](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-ataspectj-advice-params) should explain it.
type: AnswerComment

http://stackoverflow.com/comment/32404707
type: Comment
score: 2
has text: Code compiles fine for me. Try saving your file and recompiling.
type: QuestionComment
comment on: http://stackoverflow.com/q/21470696

http://stackoverflow.com/q/21457361
possible better answer: http://stackoverflow.com/a/21471407
tagged with: jpa
tagged with: persistence
favorite count: 0
has body: I am trying to use JPA with Spring MVC, mySql. I understand from here What&#39;s the difference between JPA and Hibernate? that JPA may be used independently, but most web sources descibe it as only a specification, for which I need an implementation. So can I use JPA without persistence providers like EclipseLink, Hibernate etc and if so then How ?
accepted answer: http://stackoverflow.com/a/21458183
has title: Can I use JPA without an external persistence provider?
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21471407
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/9881611
tagged with: mysql
has answer: http://stackoverflow.com/a/21458183
downvote count: 1
type: Question
answer count: 2

http://stackoverflow.com/q/21470755
downvote count: 0
score: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/21472346
tagged with: android
has answer: http://stackoverflow.com/a/21472346
has answer: http://stackoverflow.com/a/79422444
answer count: 3
has title: Calendar day of month Android
has answer: http://stackoverflow.com/a/21474929
tagged with: loops
upvote count: 1
tagged with: calendar
has comment: http://stackoverflow.com/comment/32406077
has body: I choose the starting date (example 31/01/2014) and ending date (example 31/12/2014), I insert a record every month. If I get the next month is February 28th, but then I always get 28 though March, April, etc. .. How can I fix? I hope I explained SimpleDateFormat sdf1 = new SimpleDateFormat( "yyyy-MM-dd" ); ContentValues cv = new ContentValues(); for( int i=0; calendar1.getTime().before(calendar2.getTime()); i++ ) { calendar1.add(Calendar.MONTH, 1); if (calendar1.getTime().before(calendar2.getTime())) { String strDate = sdf1.format(calendar1.getTime()); cv.put(etableTable.DATE, strDate); db.insert(etableTable.TABLE_NAME, null, cv); ... } }
tagged with: java
tagged with: gregorian-calendar
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21474929

http://stackoverflow.com/comment/34930826
has text: @thetheodor Great, that it worked. Would you perhaps consider accepting this answer then? - I believe you have forgotten
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21570364

http://stackoverflow.com/a/21454305
upvote count: 1
has body: Could it be as simple as label.getText() ?
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32375248
accepted answer of: http://stackoverflow.com/q/21454286
answers question: http://stackoverflow.com/q/21454286
type: Answer
score: 1

bulkinsert
type: Tag
tags question: http://stackoverflow.com/q/21485461
tag name: bulkinsert

http://stackoverflow.com/q/21467462
has title: How to parse Bank information into particular format, plus java questions
tagged with: class
upvote count: 2
has answer: http://stackoverflow.com/a/21467514
accepted answer: http://stackoverflow.com/a/21467514
answer count: 2
tagged with: parsing
favorite count: 0
possible better answer: http://stackoverflow.com/a/21467625
has comment: http://stackoverflow.com/comment/32402487
has body: Doing a java assignment in CSE 205 at ASU, and I'm having a hard time understanding parsing. I've looked through our online textbook, and parsing rarely comes up and it's never given a full explanation. I've looked through the java api documentation a few times and I never understand what it's saying, so I hope someone isn't too frustrated as to explain how to do it. The class is: BankParser The BankParser class is a utility class that will be used to create bank objects from a string. The BankParser class cannot be instantiated. It has the following method: public static Bank bankParser(String lineToParse) The bankParser method's argument will be a string in the following format: bankName/bankID/city,state A real example of this string would be: Bank Arizona/10001/Phoenix,AZ The bankParser method will parse this string, pull out the information, create a new bank object, set the attributes of the object, and return it. So far this is my setup: public class BankParser { public static Bank bankParser(String lineToParse) { } } Also, in my Bank class I have this toString method: public String toString() { String printInfo = ("\nBank name:\t" + bankName + "\nBank ID:\t" + bankID + "\nBank address:\t" + bankAddress + "\n"); return printInfo; It gives me 2 markers in eclipse: that this overrides java.lang.Object.toString, and that the return type is missing. What does this all mean?? The return type is String, I don't see what the problem is with that, but the override I'm clueless EDIT; This is what I've come up with for bankParser public static Bank bankParser(String lineToParse) { String[] returnValue = lineToParse.split("/"); Bank temp = new Bank(); temp.setbankName(returnValue[0]); temp.setbankID(returnValue[1]); temp.setbankAddress = (returnValue[2]); //this one won't work, see below return temp; } } And THESE are the methods in Bank and Address that apply to bankParser public void setBankName(String bank1) { bankName = bank1; } public void setBankID(String bankID1)…
tagged with: tostring
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/32437103
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21467625

http://stackoverflow.com/comment/32198253
has text: Yes, in fact if I implement it in Asynctask it's asynchronous, so until the thread has finished the data won't be correctly set.If I am getting 15 epub files from the dropbox folder asynchronously, how can I tell the main thread the results are available?
score: 0
comment on: http://stackoverflow.com/q/21352845
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21413989
type: Question
has answer: http://stackoverflow.com/a/21415384
linked to: http://stackoverflow.com/q/58306
tagged with: breadth-first-search
score: 0
tagged with: java
answer count: 3
has body: I am trying to make an adjacent list for a directed graph, while the graph has multiple entry and exit points. In the graph the Nodes would be things like AND, OR, NOT, XOR, etc. and the Entry and Exit points will be a single bit (0 or 1). I've got the following Nodes: Entry A: 1 Entry B: 1 Entry C: 0 Exit D: ? Exit E: ? Node1: OR Node2: AND Node3: AND Node4: NOT Node5: AND Node6: OR Node7: NOT Node8: NOT Node9: AND Node10: AND Node11: OR And the following connections between them: Entry A: Node1, Node2 Entry B: Node1, Node2 Entry C: Node3, Node7, Node10 Node1: Node3, Node5 Node2: Node4, Node6 Node3: Node6 Node4: Node5 Node5: Node8, Node9 Node6: Exit D Node7: Node9 Node8: Node10 Node9: Node11 Node10: Node11: Node11: Exit E Picture: So now I need to calculate the bytes at the exits of D and E, by following the path of the directed graph. I found a link of a breath-first graph search with single entry and exit points here: Graph Algorithm To Find All Connections Between Two Arbitrary Vertices. How can I adapt this breath-first graph search in the link so I can have multiple entry and exit points, and at the same time remove/change the recursive part (since I'm getting StackOverflowErrors when using the code in the link above, even when I only have 1 entry and exit point).
tagged with: graph
has answer: http://stackoverflow.com/a/21414982
tagged with: algorithm
has answer: http://stackoverflow.com/a/21415041
type: UnansweredQuestion
has title: Breadth-first graph search with multiple entry and exit points
tagged with: adjacency-list

http://stackoverflow.com/comment/32227186
type: Comment
type: QuestionComment
has text: What do you think is wrong? What is the output that you don't expect? I see nothing wrong with this code (apart from the occasional superfluous bits, of course).
comment on: http://stackoverflow.com/q/21370847
score: 0

http://stackoverflow.com/comment/32326779
type: QuestionComment
comment on: http://stackoverflow.com/q/21427278
type: Comment
has text: dosa+idly+upma ABC with price Rs 39 rght ??
score: 0

http://stackoverflow.com/q/21413065
has comment: http://stackoverflow.com/comment/32302392
has body: I tried searching for this but had 0 luck with this. Here's my problem, on my webpage I have a button that at every click generates some data. I'm trying to automate this so Selenium could keep clicking on it for, say 50 times, after every 2 seconds and I can verify that the data is being generated correctly. How do I formulate my for loop to achieve this. Help is greatly appreciated.
tagged with: selenium-webdriver
has title: How to click on a same button multiple times using Selenium WebDriver with Java
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32302668
tagged with: selenium
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21415651
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32324244
type: QuestionComment
comment on: http://stackoverflow.com/q/21425695
has text: This will not compile `Thread t2=new Thread(t2)` (unless you are doing something very odd). Post your _real_ code.
score: 0
type: Comment

http://stackoverflow.com/comment/32456060
has text: @HovercraftFullOfEels just fixed :)
comment on: http://stackoverflow.com/a/21499979
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21480367
has answer: http://stackoverflow.com/a/21480492
has body: I have the following code: String regex = "Some String(.*\r?\n)*.*\\* testing .*\r?\n.*\r?\n.*children.*\r?\n"; Pattern p = Pattern.compile(regex); System.out.println(p.pattern()); String content = readFile(); // it return file content Matcher m = p.matcher(content); So when I test with a small file content it works fine. But with a large file content it gives the following error with my code: java.lang.StackOverflowError at java.util.regex.Pattern$GroupTail.match(Pattern.java:4606) at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$Ques.match(Pattern.java:4079) at java.util.regex.Pattern$Curly.match0(Pattern.java:4170) at java.util.regex.Pattern$Curly.match(Pattern.java:4132) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556) at java.util.regex.Pattern$Loop.match(Pattern.java:4683) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615) at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$Ques.match(Pattern.java:4079) at java.util.regex.Pattern$Curly.match0(Pattern.java:4170) at java.util.regex.Pattern$Curly.match(Pattern.java:4132) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556) at java.util.regex.Pattern$Loop.match(Pattern.java:4683) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615) at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$Ques.match(Pattern.java:4079) at java.util.regex.Pattern$Curly.match0(Pattern.java:4170) at java.util.regex.Pattern$Curly.match(Pattern.java:4132) at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556) at java.util.regex.Pattern$Loop.match(Pattern.java:4683) at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615) at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715) at java.util.regex.Pattern$Ques.match(Pattern.java:4079) at java.util.regex.Pattern$Curly.match0(Pattern.java:4170) at java.util.regex.Pattern$Curly.match(Pattern.java:4132) a…
has title: StackOverflowError while processing large file with regular expression
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/32427617
tagged with: large-files
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32420895
tagged with: stack-overflow
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32420697
has comment: http://stackoverflow.com/comment/32420746

http://stackoverflow.com/comment/32335632
has text: did you try to use UtilsExt.generateTag() http://hudson.jboss.org/hudson/job/jain-sip/lastSuccessfulBuild/artifact/javadoc/gov/nist/javax/sip/UtilsExt.html#generateTag()
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21384167
type: AnswerComment

http://stackoverflow.com/comment/53053186
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21422726
has text: @hirosht: Why to cast ?
score: 0

http://stackoverflow.com/a/21474929
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21470755
type: Answer
has body: Assuming that you speak about class GregorianCalendar - Instead of calendar1.add(Calendar.MONTH, 1) try to also call following method as work-around: static GregorianCalendar moveToEndOfMonth(GregorianCalendar gcal) { gcal.add(Calendar.MONTH, 1); // moving to some day of next month gcal.set(Calendar.DAY_OF_MONTH, 1); // moving to first day of current month gcal.add(Calendar.DATE, -1); // moving to last day of previous month } So your final code should look like: calendar1.add(Calendar.MONTH, 1); moveToEndOfMonth(calendar1); Why? The analysis of @DavidCAdams is right, see his answer.
has comment: http://stackoverflow.com/comment/32439593
has comment: http://stackoverflow.com/comment/32432501
score: 1
accepted answer of: http://stackoverflow.com/q/21470755
upvote count: 1
has comment: http://stackoverflow.com/comment/32431283

http://stackoverflow.com/q/21475163
tagged with: daemon
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Start multiple instances of Java daemon using Commons Daemon / JSVC
has body: I've daemonized a Java program using the Commons Daemon / JSVC library and am able to successfully start/stop one instance of my service. What I really need to do is to be able to launch multiple instances of my service, starting and stopping each with different command arguments. Probably not relevant to this problem but a little background.. my service incorporates an HTTP listener which is bound to a specific port. Each instance will be initialized to listen to a different port. My issue is I'm unable to launch more than a single instance of my Java class using the built in functionality Commons Daemon provides. Maybe I'm missing something. I'm a longtime Windows/C# developer but relatively new to Java/Linux/Shell-scripting. The shell script to launch the JSVC process and start/stop my daemon is below. It's what I found on this site in another post, with a few minor modifications. It passes through some command arguments my daemon requires, and I call this sh script from separate start and stop scripts that specify these parameters. #!/bin/sh # Setup variables EXEC=/usr/bin/jsvc JAVA_HOME=/usr/lib/jvm/java-7-oracle CLASS_PATH="/usr/share/java/commons-daemon-z.0.15.jar":"/opt/LuckyElephant/lib/LuckyElephant.jar" CLASS=co.rightside.luckyelephant.Main USER=ubuntu PID=/tmp/luckyelephant.pid LOG_OUT=/tmp/luckyelephant.out LOG_ERR=/tmp/luckyelephant.err ARGS="$*" do_exec() { $EXEC -home "$JAVA_HOME" -cp $CLASS_PATH -user $USER -outfile $LOG_OUT -errfile $LOG_ERR -pidfile $PID $1 $CLASS $ARGS } case "$1" in start) do_exec ;; stop) do_exec "-stop" ;; restart) if [ -f "$PID" ]; then do_exec "-stop" do_exec else echo "service not running, will do nothing" exit 1 fi ;; *) echo "usage: luckyelephant {start|stop|restart}" &gt;&amp;2 exit 3 ;; esac If launching more than one instance of a unique Java class in not possible in JSVC, what is an alternative? I need a safe and stable way to fire up multiple instances of this service (I'll be doing it remotely and programatically us…
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21475288
answer count: 3
tagged with: multiple-instances
has answer: http://stackoverflow.com/a/22286266
has answer: http://stackoverflow.com/a/28871827
tagged with: jsvc

http://stackoverflow.com/a/21442605
downvote count: 0
answers question: http://stackoverflow.com/q/21442451
type: Answer
has body: 4^(5^6) equals 4^15625, which is approximately 1,53*10^9407, a number which greatly exceeds the maximum value for the Long type, which is (2^64)-1. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
score: 4
upvote count: 4

http://stackoverflow.com/q/21372256
has comment: http://stackoverflow.com/comment/32230082
type: Question
has answer: http://stackoverflow.com/a/21372293
answer count: 2
downvote count: 0
score: 1
has body: When I run this, it displays all System.out.println("") statements in the case. How do I make it choose the correct if statement and nothing else? And if I could go back to the beginning after it finds an outcome, that would also be helpful. import java.util.Scanner; import java.util.Random; public class TEST { private static Scanner myScanner; public static void main(String[] args) { myScanner = new Scanner(System.in); Random myRandom = new Random(); int randomNumber; char reply; System.out.print("Rock(R) Paper(P) or Scissors(S)? "); reply = myScanner.findWithinHorizon(".", 0).charAt(0); randomNumber = myRandom.nextInt(3) + 1; switch (randomNumber) { case 1: if (reply == 'S' || reply == 's'); { System.out.println("Computer: Rock. You lost!"); } if (reply == 'R' || reply == 'r'); { System.out.println("Computer: Rock. You tied!"); } if (reply == 'P' || reply == 'p'); { System.out.println("Computer: Rock. You won!"); break; } case 2: if (reply == 'P' || reply == 'p'); { System.out.println("Computer: Paper. You tied!"); } if (reply == 'S' || reply == 's'); { System.out.println("Computer: Paper. You won!"); } if (reply == 'R' || reply == 'r'); { System.out.println("Computer: Paper. You lost!"); break; } case 3: if (reply == 'R' || reply == 'r'); { System.out.println("Computer: Scissor. You won!"); } if (reply == 'P' || reply == 'p'); { System.out.println("Computer: Scissor. You lost!"); } if (reply == 'S' || reply == 's'); { System.out.println("Computer: Scissor. You tied!"); break; } } } }
favorite count: 0
possible better answer: http://stackoverflow.com/a/21372288
has answer: http://stackoverflow.com/a/21372288
accepted answer: http://stackoverflow.com/a/21372293
has title: Rock Paper Scissor if statements not working
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21372717
tagged with: charsequence
has answer: http://stackoverflow.com/a/21373421
score: 0
tagged with: android
has title: Finding text change in EditText using TextWatcher
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21372868
type: Question
answer count: 2
has body: I'm trying to get what modification user has made to EditText, either insert or delete. I use TextWatcher but I don't get right result, moreover sometimes "getChar(start, end) has end before start" error. editText = (EditText) findViewById(R.id.MyEditText); editText.addTextChangedListener(new TextWatcher() { @override public void afterTextChanged(Editable s){} @override public void beforeTextChanged(CharSequence s, int start, int count, int after){ showToast("text removed: " + s.subSequence(start, count)); } @override public void onTextChanged(CharSequence s, int start, int before, int count){ showToast("text added: " + s.subSequence(start, count)); } } As you can see I use beforeTextChanged to get any text that's removed by user, and onTextChanged for insertion. Please shed some light here. Thanks! API is right here: http://developer.android.com/reference/android/text/TextWatcher.html#afterTextChanged(android.text.Editable) EDIT: I seem to figure it out...it's quite silly: s.subSequence(start, count)) should really be s.subSequence(start, start+count))

http://stackoverflow.com/comment/32328111
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21427868
has text: After I change JdbcOdbcConnection to JdbcOdbcDriver it doesn't display anything.

http://stackoverflow.com/comment/32338737
score: 0
has text: Man I cant get a thing out of that article.
type: AnswerComment
comment on: http://stackoverflow.com/a/21433752
type: Comment

http://stackoverflow.com/comment/32365862
type: Comment
has text: @priya: No, it would be `temp.indexOf(45)`. Or maybe `fib.indexOf(45)` - the naming in your question is inconsistent. Either way, that would return 3.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21448734

http://stackoverflow.com/q/21447152
favorite count: 0
possible better answer: http://stackoverflow.com/a/40302365
has answer: http://stackoverflow.com/a/40302365
tagged with: http://stackoverflow.com/tag/html
has body: Currently working on Selenium web driver and Java. I want to select the option which in the form of date picker. I tried to select the month from the date picker drop down. but it is showing follows Unable to locate element: {"method":"class name","selector":"ui-datepicker-month"} Command duration or timeout: 31 milliseconds So i need to make visible the element using java script executor but in the below code i have written as "document.getElementById('ui-datepicker-month') so again it is showing error as "document.getElementById('') is null Here is the HTML: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Here is the form i tried but it is not working: JavascriptExecutor executor42 = (JavascriptExecutor)driver; executor42.executeScript("document.getElementById('ui-datepicker-month').style.display='block';"); List<WebElement> select42 = new Select(driver.findElement(By.className("ui-datepicker-month"))).getOptions(); ((Select) select42).selectByValue("Jun"); Below are the stacktrace: FAILED: Login java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:192) at org.openqa.selenium.support.ui.FluentWait.(FluentWait.java:94) at org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:66) at org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:40) at test.OverviewAndEvolutionPR.performLogin(OverviewAndEvolutionPR.java:525) at test.OverviewAndEvolutionPR.Login(OverviewAndEvolutionPR.java:76) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.ja…
tagged with: selenium-webdriver
tagged with: selenium
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21447188
has answer: http://stackoverflow.com/a/21448888
tagged with: java
has title: Select values in the month drop down- Selenium Webdriver
accepted answer: http://stackoverflow.com/a/21447188
type: Question
answer count: 3
downvote count: 0
score: 1

http://stackoverflow.com/q/21425386
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: mybatis
has title: (re)scanning Mybatis mappers from the filesystem
accepted answer: http://stackoverflow.com/a/21425613
has body: The Mybatis (3.2) manual describes three ways to configure Mappers as follows: http://mybatis.github.io/spring/mappers.html Is there any way to extend any of these three procedures so that: Mapper XML files can be read from outside the classpath (i.e. from a filesystem location) Mapper XML files can be 'rescanned' for changes that have been made to defined queries since the Application started Thank you for any advice
answer count: 1
favorite count: 0
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/21425613

http://stackoverflow.com/q/21386211
has title: Retrieving content of hyperlinked slides in powerpoint files(.PPTX) through apache POI
type: Question
tagged with: java
has body: I am trying to get the text content of powerpoint files and replace with some other text. I have a powerpoint file of 20 slides. where 13,14,15,16 slides have hyperlink to 17,18,19 and 20th slide. I am using XMLSlideshow to traverse through the slides, But it gives only 16 slides. It does not give last 4 hyperlinked slides. Any idea really appreaciable in advance how can I get content of all hyperlinked slides and Replace by some other text. here is my code. public static void replaceContentInPPTX(File inputFile, File outputFile) throws IOException{ FileInputStream fis = null; FileOutputStream fos = null; XMLSlideShow ppt = null; try{ fis = new FileInputStream(inputFile); fos = new FileOutputStream(outputFile); ppt = new XMLSlideShow(fis); // System.out.println("Available slide layouts:"+ppt.getSlideMasters().length); /* for(XSLFSlideMaster master : ppt.getSlideMasters()){ XSLFShape[] shape = master.getShapes(); for(XSLFSlideLayout layout : master.getSlideLayouts()){ System.out.println(layout.getType()); } }*/ System.out.println("No of slides:"+ppt.getSlides().length); // gives 16 slides. for(XSLFSlide slide : ppt.getSlides()) { for(XSLFShape shape : slide){ if(shape instanceof XSLFTextShape) { XSLFTextShape txShape = (XSLFTextShape)shape; for (XSLFTextParagraph xslfParagraph : txShape.getTextParagraphs()) { String originalText = replaceUnwantedChar(xslfParagraph.getText()); if(! originalText.isEmpty()) { String translation = ""; if(translation != null ) { CTRegularTextRun[] ctRegularTextRun = xslfParagraph.getXmlObject().getRArray(); for(int index = ctRegularTextRun.length-1; index &gt; 0 ; index--){ xslfParagraph.getXmlObject().removeR(index); } ctRegularTextRun[0].setT(translation); } } } } } } ppt.write(fos); fos.close(); fis.close(); }catch(Exception ex){ ex.printStackTrace(); } }
score: 0
has comment: http://stackoverflow.com/comment/32257404
has comment: http://stackoverflow.com/comment/32275595
tagged with: apache-poi
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21482748
score: 9
answers question: http://stackoverflow.com/q/21482602
has comment: http://stackoverflow.com/comment/32458572
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32436772
has body: CLASSES != UNITS If you practice a good TDD, you will understand easily what is behind. IMO, you should test B's behavior without based on the fact that A would already be tested. Actually, there are three cases: A and B BELONGING TO THE SAME LAYER: If A is created through refactor cycle (extract class) of B (happens often while practicing a good TDD), then A should TOTALLY be left untested! No need to test it at all! Indeed, structure of code (in this case, separation of classes/SRP) should be independent of Unit concept; B and A in this case belonging to the same unit. If A existed BEFORE B, B should not be based on this fact, and B's whole behavior should be tested. A and B NOT BELONGING TO THE SAME LAYER (distinct boundaries for instance): If B is a GUI class, and A a business class, then A should be doubled/mocked when testing B, and also A should have a full test dedicated for it. Indeed, domain architecture should not be mingled with behavior/feature notion. To understand why, read this recent article of Uncle Bob dealing with this concept: http://blog.8thlight.com/uncle-bob/2014/01/27/TheChickenOrTheRoad.html?utm_source=hootsuite&amp;utm_campaign=hootsuite Excerpt of it: It is a common misconception that the design of the tests must mirror the design of the production code. TDD does not require, as the Author suggests, "that every unit in your system is paired with a well-designed [...] unit test." Indeed, that's one of the reasons that many of us have stopped calling them "unit" tests. Note: TDD doesn't care about "future", in the contrary, it helps you to write as much code as you need, no more. Therefore you should not worry about this: in the future there will be possibility that the B class will be removed or modified If you wrote good tests (I prefer the word "specs"), such removal would be detected immediately.
type: Answer
has comment: http://stackoverflow.com/comment/95849222
upvote count: 9
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21482602

http://stackoverflow.com/q/21415620
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32306780
has body: I am making a program for computer surveillance at the moment. It's for a competition in my country Croatia(InfoKup). I have several options for sending command to another PC, but I want to make the possibility for the command extension for people who know Java. So I want to make the user be able to add some of his custom commands for the program. For example something like Minecraft mods. I know it is possible, but how would I go about doing that. Any help would be greatly appreciated. My code on GitHub:GitHub Don't mind the stream thing. It's something my friend is experimenting with. EDIT: e.g. Currently I have the possibility to send popups to another PC. What if the extension maker knew the code to send cmd commands and wants to add that function. He makes an extension and puts it in the extension folder. Voila we have a new possibility. EDIT 2: Don't be so harsh on me pls :). Thx for the dynamic class loading tip. I have been looking into that, and it looks promising. Basically what I want to have possible is the user to drop the "mod/extension/whatever" in the "mod/extension/whatever" folder, and the program would load it and put all of the buttons declared in the class in to the GUI, and with them the function. I think I'm getting the hang of this, but any tips would be helpful. e.g. package sth.sth; import blah.blah.*; public class ClassSTH extends SchoolarButton{ public ClassSTH(String params){ super(params); } @Override public void OnClick(){ doStuff(); } } EDIT: The problem is easily solvable using Java Reflection! I wish someone posted that as an answer befpre blatanty downvoting a question because pf a GitHub link that was there to prpve that I've actually done something.
type: Question
has title: Making program extensions
has answer: http://stackoverflow.com/a/31620647
answer count: 1
has comment: http://stackoverflow.com/comment/32307027
tagged with: java
tagged with: extend
has comment: http://stackoverflow.com/comment/32307008
accepted answer: http://stackoverflow.com/a/31620647
has comment: http://stackoverflow.com/comment/32307057
score: -4
downvote count: 4
has comment: http://stackoverflow.com/comment/32306730
type: AnsweredQuestion

http://stackoverflow.com/q/21408570
type: Question
score: 5
tagged with: regex
tagged with: tokenize
tagged with: java
answer count: 1
has body: I'm implementing the Shunting Yard Algorithm in Java, as a side project to my AP Computer Science class. I've implemented a simple one in Javascript, with only basic arithmetic expressions (addition, subtraction, multiplication, division, exponentiation). To split that into an array, what I did was find each of the operators (+-*/^), as well as numbers and parentheses, and I put a space around them, and then I split it into an array. For example, the infix string 4+(3+2) would be made into 4 + ( 3 + 2 ), and then split on whitespace. However, I feel that this method is very slow, and it gets increasingly harder and inefficient to implement as you start to add mathematical functions, such as sine, cosine, tangent, absolute value, and others. What would be the best way to split a string like sin(4+3)-8 into an array ["sin","(" 4,"+",3,")","-",8]? I could use regex for this, but I don't really understand them well, and I'm trying to learn them, so if that would be the best solution to them, could the answerer please explain what it does?
has title: Tokenizing an infix string in Java
has answer: http://stackoverflow.com/a/21408785
upvote count: 5
tagged with: shunting-yard
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21408785

http://stackoverflow.com/comment/32399279
type: QuestionComment
has text: what do you mean with different coordinates? if you mean in different tests, then no, i always get 0. i will try to add those but it's hard because it says that the text is mostly code and i have to add more details but what i said i believe covers pretty much everything.
comment on: http://stackoverflow.com/q/21466389
score: 0
type: Comment

http://stackoverflow.com/comment/32407406
has text: I fully agree with MariuszS here. In [my article on the Mockito wiki](http://code.google.com/p/mockito/wiki/MockingObjectCreation), I mention a couple of ways you can use Mockito to help test code that creates new objects. Have a quick look and see if either of them are likely to be useful here.
type: AnswerComment
comment on: http://stackoverflow.com/a/21463693
type: Comment
score: 2

http://stackoverflow.com/q/21449252
has comment: http://stackoverflow.com/comment/32366813
has comment: http://stackoverflow.com/comment/32366868
has comment: http://stackoverflow.com/comment/32367400
has answer: http://stackoverflow.com/a/21467908
tagged with: android
has answer: http://stackoverflow.com/a/21449398
has comment: http://stackoverflow.com/comment/32366965
has comment: http://stackoverflow.com/comment/32366901
favorite count: 0
type: UnansweredQuestion
answer count: 4
has title: Android - Eclipse not deploying new build
has answer: http://stackoverflow.com/a/21468001
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32366932
type: Question
has answer: http://stackoverflow.com/a/21449429
has comment: http://stackoverflow.com/comment/32367358
has comment: http://stackoverflow.com/comment/32367314
has body: I've got this problem that after I do changes to My code and Run the project, I get this always in the console. Application already deployed. No need to reinstall. Starting activity authentication.LoginActivity on device nexus4testdev ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.myapp/authentication.LoginActivity } ActivityManager: Warning: Activity not started, its current task has been brought to the front Previously it used to uninstall old app and install the new one onto the device.Now it throws this in the console every time. After doing some research I found out that Java Builder has to enabled to resolve this problem. However I disabled Java Builder in the first place because I was getting The Type R is already defined error. It all started all of a sudden. Now I cannot deploy My app without manually uninstalling the app from the device which is a big headache. Any help appreciated. Edit: Now I saw the bin folder and noticed that the *.apk is never built.
downvote count: 0
linked to: http://stackoverflow.com/q/11105674

http://stackoverflow.com/q/21378295
has title: Creating a SWT.MOZILLA browser on Windows 64 bit and SWT 4.3
favorite count: 0
has comment: http://stackoverflow.com/comment/32240333
tagged with: swt
accepted answer: http://stackoverflow.com/a/21382091
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/44962070
has comment: http://stackoverflow.com/comment/32240511
tagged with: mozilla
has answer: http://stackoverflow.com/a/44962070
linked to: http://stackoverflow.com/q/44803502
type: Question
tagged with: xulrunner
downvote count: 0
score: 4
has body: I'm trying to create an SWT Browser widget of the SWT.MOZILLA type under windows 8 64Bit with SWT 4.3 64Bit. According to this, SWT 4.3 should support 64 Bit version on XULRunner 10.x or 24.x So, I have downloaded both the 10.x and 24.x 64 versions from here and unzipped under c:\xulrunner10 and c:\xulrunner24 respectively. If I start my java app pointing to xulrunner10 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner10) it works, however if I try with xulrunner24 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner24) I get the follwoing error: Exception in thread "main" org.eclipse.swt.SWTError: XPCOM error 0x80004005 at org.eclipse.swt.browser.Mozilla.error(Unknown Source) at org.eclipse.swt.browser.Mozilla.initXULRunner(Unknown Source) at org.eclipse.swt.browser.Mozilla.create(Unknown Source) at org.eclipse.swt.browser.Browser.&lt;init&gt;(Unknown Source) I also noticed that I get the same error if pointing to unexisting directory, however the folder c:\xulrunner24 exists and contains all the files as well as xulrunner.exe. How can I make xulrunner 24.x 64bit embeddable in my swt 4.3 app?
upvote count: 4
has answer: http://stackoverflow.com/a/21382091
has answer: http://stackoverflow.com/a/21378388
answer count: 3

http://stackoverflow.com/q/21358694
tagged with: agent-based-modeling
linked to: http://stackoverflow.com/q/1963494
answer count: 3
upvote count: 1
tagged with: simulation
has answer: http://stackoverflow.com/a/21358923
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21365460
has body: I'm in the process of creating a agent bases modelling program. So far I have the relavent classes to model a simulator, grid, different agents etc. I've also created a 2D array of object e.g. agents moving around the array doing whatever. I am familary with creating simple GUI's but how do I come about creating a pane\panel which then is added to the GUI. which shows the 2D array on run time with each object with its corresponding colour. Also I want to try and use the MVC pattern to basically display the simulation data differently. Such as one pane shows the different objects colour and another pane showing the same objects but every objects angry levels with different shades of red. Any guidelines would be really helpful also similar tutorials. Thanks
has title: Displaying 2D array contents on GUI colours
tagged with: model-view-controller
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21368123
type: Question

http://stackoverflow.com/q/21477348
has body: I can see a Checkstyle info which says - Wrong order for import, org.apache.log4j.Logger. I could not get much info on why I am getting this. Any help would be appreciated. Below is the code snippet: import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.Label; import jxl.write.WritableCell; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; import jxl.write.biff.RowsExceededException; import org.apache.log4j.Logger; import com.company.department.team.test.Configuration;
upvote count: 13
tagged with: checkstyle
possible better answer: http://stackoverflow.com/a/29725502
has answer: http://stackoverflow.com/a/21477455
has answer: http://stackoverflow.com/a/29725502
has answer: http://stackoverflow.com/a/54007645
tagged with: java
answer count: 5
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21477455
type: AnsweredQuestion
downvote count: 0
has title: How to remove Checkstyle info (wrong order for import org.apache.log4j.Logger)
favorite count: 0
score: 13
has answer: http://stackoverflow.com/a/21478839
type: Question
has answer: http://stackoverflow.com/a/78184228

http://stackoverflow.com/comment/32434354
comment on: http://stackoverflow.com/a/21486463
type: Comment
has text: Do not worry, it is used just one time. Thank you for your comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/21362605
has comment: http://stackoverflow.com/comment/32212059
type: Question
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32211963
has title: Why my View is not changing?
favorite count: 0
has answer: http://stackoverflow.com/a/21362707
tagged with: android
accepted answer: http://stackoverflow.com/a/21362707
has body: I have the following code: public class DrawView extends View { Paint paint = new Paint(); public DrawView(Context context) { super(context); } @Override public void onDraw(Canvas canvas) { paint.setColor(Color.BLACK); paint.setStrokeWidth(3); canvas.drawRect(30, 30, 80, 80, paint); paint.setStrokeWidth(0); paint.setColor(Color.CYAN); canvas.drawRect(33, 60, 77, 77, paint ); paint.setColor(Color.YELLOW); canvas.drawRect(33, 33, 77, 60, paint ); } } and the main class: public class MainActivity extends Activity { DrawView drawView; Button btn; View view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.button1); view = (View) findViewById(R.id.view1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { generate(); } }); } public void generate() { drawView = new DrawView(this); drawView.setBackgroundColor(Color.WHITE); view = drawView; } } the problem is: when I click the button, I cant see the DrawView and I dont't know why. EDIT: here is the xml code: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/root" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/generate" /&gt; &lt;View android:id="@+id/view1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt;
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/32272868
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21395998
has text: Do you care about heap memory versus stack?
score: 0

http://stackoverflow.com/comment/32271380
score: 0
type: Comment
type: QuestionComment
has text: the command is: -Dresume=false release:branch -DbranchName=${project.version} -DremoteTagging=false -DupdateWorkingCopyVersions=true I'm using version 2.4.1 of the release plugin.
comment on: http://stackoverflow.com/q/21390274

http://stackoverflow.com/comment/33120320
score: 0
type: AnswerComment
has text: this will be printed on the client side printer ?
type: Comment
comment on: http://stackoverflow.com/a/21378071

http://stackoverflow.com/a/21408028
downvote count: 0
answers question: http://stackoverflow.com/q/21390972
type: Answer
has body: So it turns out that you can't (or at least you have to do it in a different way than I did) have one class implement multiple callback interfaces. Creating explicit implementations of the different callback interfaces and assigning them to the callback fields in RazerManager solved it. This explains why the callback in Touchpad was working but not the ones in RazerManager (Touchpad implemented one interface while RazerManager did three). To demonstrate: public class MyClass { private static MyCallbackInterface myCallback; private MyClass() { myCallback = new CallbackInterface() { @Override public int callback(/* parameters */) { // Do stuff with data here return 0; } } nativeLib.SetCallback(myCallback); } It seems the native library or JNA gets confused somewhere when a single class implements more than one callback interface, and doesn't know which one to call. So it calls one at random (or the first one defined?).
score: 1
has comment: http://stackoverflow.com/comment/32295876
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21390972
type: AcceptedAnswer

http://stackoverflow.com/a/21464556
accepted answer of: http://stackoverflow.com/q/21464367
answers question: http://stackoverflow.com/q/21464367
has comment: http://stackoverflow.com/comment/32393227
has comment: http://stackoverflow.com/comment/32393614
has comment: http://stackoverflow.com/comment/32394246
has comment: http://stackoverflow.com/comment/32393943
has comment: http://stackoverflow.com/comment/32394286
has comment: http://stackoverflow.com/comment/32394108
has body: My friend it looks to me that your recursion breaking conditions is at r>10 so it always breaks at 11 thats the only cause............ suppose you have pass x=1 then your recursive(1) calls recursive(2), recursive(2) calls recursive(3), recursive(3) calls recursive(4) , recursive(4) calls recursive(5) , recursive(5) calls recursive(6), recursive(6) calls recursive(7), recursive(7) calls recursive(8), recursive(8) calls recursive(9), recursive(9) calls recursive(10), recursive(10) calls recursive(11) and then recursion breaks and at recursive(11) it returns you 11 at this line `int r = recursive(y); so r becomes 11 and then recursion(10) returns you r and then recursion(9) returns you are and so on ................. for whole stack
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32393304
has comment: http://stackoverflow.com/comment/32393088
type: Answer
has comment: http://stackoverflow.com/comment/32394889
has comment: http://stackoverflow.com/comment/32394396
score: 1
has comment: http://stackoverflow.com/comment/32395059
upvote count: 1

http://stackoverflow.com/q/21480942
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21480998
has answer: http://stackoverflow.com/a/21481028
type: Question
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32421733
favorite count: 0
has title: ArrayIndexOutOfBoundsException after String.split()
has answer: http://stackoverflow.com/a/21481024
accepted answer: http://stackoverflow.com/a/21480998
possible better answer: http://stackoverflow.com/a/21481024
has body: I got a string value from server: String fileName = requestServer(); //My log shows fileName="properties.txt" String name = fileName.trim().split(".")[0]; But when I try to get the name without ".txt" with above code, I got ArrayIndexOutOfBoundsException: length=0, index=0. I don't see where my code is wrong, why I get this exception?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/32421754

jbutton
tags question: http://stackoverflow.com/q/21445166
tags question: http://stackoverflow.com/q/21359095
tags question: http://stackoverflow.com/q/21366225
tags question: http://stackoverflow.com/q/21487253
tags question: http://stackoverflow.com/q/21494550
tags question: http://stackoverflow.com/q/21369306
tags question: http://stackoverflow.com/q/21359268
tags question: http://stackoverflow.com/q/21412838
tags question: http://stackoverflow.com/q/21439162
type: Tag
tags question: http://stackoverflow.com/q/21465462
tags question: http://stackoverflow.com/q/21513099
tags question: http://stackoverflow.com/q/21359835
tags question: http://stackoverflow.com/q/21353147
tag name: jbutton
tags question: http://stackoverflow.com/q/21497120

http://stackoverflow.com/a/21482663
answers question: http://stackoverflow.com/q/21482602
score: 5
downvote count: 0
type: Answer
upvote count: 5
has body: Definately write full tests for class A. You kind of answered your own question here: (...)maybe in the future there will be possibility that the B class will be removed or modified in the way that it might not use the same functionality from A class so it might leave some methods untested.

http://stackoverflow.com/a/36040395
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21467204
has body: As above carlo.marinangeli has suggested when you call fragmentPagerAdapter.getItem(1) you are getting a new instance of the fragment so you are referring to a different object So to get same object from you adapter you need to store your object. you can try following method in your adapter - public Fragment getFragmentAtPosition(int position) { return registeredFragments.get(position); } where registeredFragments is - private SparseArray&lt;Fragment&gt; registeredFragments = new SparseArray&lt;Fragment&gt;(); and fill this sparseArray in getItem method like below - @Override public Fragment getItem(int position) { switch (position) { case 0: fragment = FragmentPost.newInstance(position); registeredFragments.put(position, fragment); return fragment; } return null; }
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/21497123
has comment: http://stackoverflow.com/comment/32450970
downvote count: 4
has answer: http://stackoverflow.com/a/21497146
type: AnsweredQuestion
has body: My base class has a constructor with parameters (String, String, int) Three different classes inherit from it. Inherited class A has a constructor with parameters (String, String, int) too but with different implementation. My question is if I do not make a constructor in inherited classes B and C with parameters (String, String, int) will they inherit the base class' constructor ? I need the same implementation in B and C as in the base class.
tagged with: java
has title: Do I have to make constructors for all inherited classes in java?
type: Question
tagged with: inheritance
possible better answer: http://stackoverflow.com/a/21497146
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/32450962
favorite count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/21497157
accepted answer: http://stackoverflow.com/a/21497157
score: -3

http://stackoverflow.com/comment/32479184
comment on: http://stackoverflow.com/a/21512882
score: 2
type: Comment
has text: This reduces the odds that your process will be terminated. It will not prevent it. The user can still Force Stop the app from settings, for example.
type: AnswerComment

http://stackoverflow.com/comment/32451696
score: 0
type: AnswerComment
type: Comment
has text: yes you can but you don't need else part, long is a default 0, just control the empty part, it'll be enough. just put a = Double.parseDouble(inputA.getText().toString()) inside if control
comment on: http://stackoverflow.com/a/21497239

http://stackoverflow.com/comment/32250670
comment on: http://stackoverflow.com/a/21383255
score: 0
type: AnswerComment
type: Comment
has text: I don't want the lines value fixed from the beggining that's why I'm having an action listener to a button to get the desired size. Thank you for your answer though!

http://stackoverflow.com/a/21467548
has body: After discussion with the OP (see below), we've established that the actual problem was that there was a field named type in Ship, which was blocking visibility of the identically-named field in Entity. The obvious solution was to remove this field from Ship, allowing the superclass's field to be inherited as intended.
has comment: http://stackoverflow.com/comment/32398994
has comment: http://stackoverflow.com/comment/32399277
has comment: http://stackoverflow.com/comment/32399204
accepted answer of: http://stackoverflow.com/q/21467479
answers question: http://stackoverflow.com/q/21467479
has comment: http://stackoverflow.com/comment/32399065
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32399136
upvote count: 2
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32399056
downvote count: 1

http://stackoverflow.com/a/21380775
has comment: http://stackoverflow.com/comment/32287687
score: 3
answers question: http://stackoverflow.com/q/21380575
accepted answer of: http://stackoverflow.com/q/21380575
has comment: http://stackoverflow.com/comment/32259436
has body: "This is telling me there is only one entry in the list. I should be seeing at 4 entries The entry I am seeing is the last one of what I expect would be 4." You're creating a new DefaultTableModel each iteration. Don't do that. DefaultTableModel datamodel = new DefaultTableModel(data,columnNames); resultsTable.setModel(datamodel); Take the above out. Instead, set the model first. Then just .addRow(row) in the loop for (int column = 1; column &lt;= columnCount; column++) { columnNames.add(metaData.getColumnName(column)); System.out.println("ColumnNames "+columnNames ); } DefaultTableModel datamodel = new DefaultTableModel(columnNames, 0); table.setModel(datamodel); while (resultSet.next()) { Vector&lt;String&gt; vector = new Vector&lt;String&gt;(); for (int columnIndex = 1; columnIndex &lt;= columnCount; columnIndex++) { vector.add(resultSet.getString(columnIndex)); } datamodel.addRow(vector); } The constructor for the DefaultTableModel(columnNames, 0) where 0 is the number of initial rows. So all you need to do is add rows dynamically one by one in the while(rs.next()). For each row of data you get in a Vector just datamodal.addRow(vector) UPDATE Like I said, I don't know what you're doing wrong, but there's nothing wrong with my code. Here's a test program import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; public class TestTableModel { private ResultSet resultSet = null; public TestTableModel() throws SQLException { initDB(); JTable table = new JTable(getModel(resultSet)); JScrollPane scroll = new JScrollPane(table); JFrame frame = new JFrame("Test Table Model"); frame.add(scroll); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32262676
upvote count: 3
has comment: http://stackoverflow.com/comment/32272767
type: Answer
has comment: http://stackoverflow.com/comment/32263568
has comment: http://stackoverflow.com/comment/32286996

http://stackoverflow.com/comment/32324205
type: Comment
has text: It depend on your task.You have declare the Thread inside the loop.I dnt know y you need to declare Thread everytime the loop run.You can declare the Thread t1 outside and same use join outside too
comment on: http://stackoverflow.com/a/21425735
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32478924
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21512651
has text: I did not know I could view the Java Console error messages in the browser. There are not any error messages. For anyone reading after this: Here's how you view the console. http://www.java.com/en/download/help/javaconsole.xml
score: 0

http://stackoverflow.com/q/21487014
has body: I'm designing a db model where I want to have: User(id, role_id) (UserDetails) Permission(role_id, permission) (GrantedAuthority) Role(id, description) I'm using Hibernate and Spring security. I want every role to have list of permissions (GrantedAuthorities) using role_id rather than specific user having that. I'm kinda lost designing that. This is what I've came up with so far: public class User implements UserDetails, Serializable { @Id @GeneratedValue @Column(name = "id") private int id; @Column(name = "role_id", insertable = true, updatable = false) private int roleId; @OneToMany(fetch = FetchType.EAGER, mappedBy = "user", cascade = CascadeType.ALL) private List&lt;Permission&gt; permissions; } public class Permission implements GrantedAuthority, Serializable { @Id @GeneratedValue @Column(name = "id") private int id; @Column(name = "role_id", insertable = false, updatable = false) private int roleId; @Column(name = "permission") private String permission; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "role_id", nullable = false, insertable = false, updatable = false) private User user; } I've omitted the not so important code. The Role class isn't important for Spring security. I know I'm making a huge mistake somewhere but I just can't seem to figure out how to fix it. The issue is that it joins those two objects using user.id instead of user.roleId. I've tried different annotations but I just can't hook it up correctly. So the raw issue probably is that I'm trying to join 2 objects using a property from one and PK from another which might be a mistake. Edit: I've also tried to specify referencedColumnName on Permission class but it didn't work either. User can't log in. @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "role_id", nullable = false, insertable = false, updatable = false, referencedColumnName = "role_id") private User user;
has comment: http://stackoverflow.com/comment/32435274
type: Question
answer count: 2
tagged with: spring-security
has comment: http://stackoverflow.com/comment/32436425
score: 0
tagged with: hibernate-annotations
possible better answer: http://stackoverflow.com/a/21488652
has answer: http://stackoverflow.com/a/21488652
tagged with: spring
has answer: http://stackoverflow.com/a/21509874
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32436307
has title: Hibernate Spring security modified design how to
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/21509874

http://stackoverflow.com/comment/32198331
has text: How ??? --- I tried approach with setting node border but it's not it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21354747
score: 1

http://stackoverflow.com/comment/32353702
comment on: http://stackoverflow.com/q/21441928
type: Comment
score: 0
has text: Your changes needs to be installed into local repo with `mvn install` to be visible in other project. **BUt** you can import second project as module into Intellij. After this two projects can work without **install**
type: QuestionComment

selenium-webdriver
tags question: http://stackoverflow.com/q/21454493
tags question: http://stackoverflow.com/q/21376634
tags question: http://stackoverflow.com/q/21442898
tags question: http://stackoverflow.com/q/21507894
tags question: http://stackoverflow.com/q/21502978
tags question: http://stackoverflow.com/q/21422548
tags question: http://stackoverflow.com/q/21461347
tags question: http://stackoverflow.com/q/21437452
tags question: http://stackoverflow.com/q/21447152
tags question: http://stackoverflow.com/q/21474710
tags question: http://stackoverflow.com/q/21423547
tags question: http://stackoverflow.com/q/21494093
tags question: http://stackoverflow.com/q/21386822
tags question: http://stackoverflow.com/q/21419013
tags question: http://stackoverflow.com/q/21451522
tags question: http://stackoverflow.com/q/21459331
tags question: http://stackoverflow.com/q/21453634
tags question: http://stackoverflow.com/q/21384220
tags question: http://stackoverflow.com/q/21488682
tags question: http://stackoverflow.com/q/21372215
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/21449784
tags question: http://stackoverflow.com/q/21465140
tags question: http://stackoverflow.com/q/21421790
tags question: http://stackoverflow.com/q/21413065
tags question: http://stackoverflow.com/q/21359511
tags question: http://stackoverflow.com/q/21460412
tags question: http://stackoverflow.com/q/21479198
type: Tag
tags question: http://stackoverflow.com/q/21432576
tags question: http://stackoverflow.com/q/21377753
tags question: http://stackoverflow.com/q/21364127
tags question: http://stackoverflow.com/q/21481941

http://stackoverflow.com/comment/32522115
type: AnswerComment
score: 0
type: Comment
has text: nop, you can wrap the original map in your inner class implementation.
comment on: http://stackoverflow.com/a/21536244

http://stackoverflow.com/q/21483475
tagged with: split
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32426433
has title: How to Match AND Split REGEX
has comment: http://stackoverflow.com/comment/32426273
tagged with: android
tagged with: regex
has answer: http://stackoverflow.com/a/21483934
accepted answer: http://stackoverflow.com/a/21483934
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32426543
score: 2
type: AnsweredQuestion
tagged with: java
has body: How to split by ASCII Character group in REGEX (Android/Java) Actual String "আমি আছি i am ইংরেজি থেকে বাংলা" Expected Output আমি আছি i am ইংরেজি থেকে বাংলা
type: Question

http://stackoverflow.com/a/21433451
answers question: http://stackoverflow.com/q/21432911
score: 0
has body: You can use : StringBuffer liked_Users = new StringBuffer(); for(int j =0 ;j&lt;50;j++) { liked_Users.append("Your Text goes here : "+j); } Log.d("TAG","String is : "+liked_Users.toString());
type: Answer

http://stackoverflow.com/a/21429572
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21429424
downvote count: 0
has body: Use String.valueOf(object); Documentation.
type: Answer

http://stackoverflow.com/comment/32354911
type: Comment
score: 0
has text: @ElliottFrisch Since the effect is fully reproducible after entirely eliminating the outer loop, the conclusion is that this loop rearrangement either doesn't happen or doesn't account for any speed advantage.
type: QuestionComment
comment on: http://stackoverflow.com/q/21432400

http://stackoverflow.com/comment/32299334
type: Comment
type: AnswerComment
has text: Agreed, `long` is more compact that storing them in a `String`.
comment on: http://stackoverflow.com/a/21411295
score: 0

http://stackoverflow.com/q/21385630
has body: We were wishfully thinking that with Neo4j 2.0, concurrently querying and deleting nodes will no longer throw NotFoundException. Our previous system using Neo4j 1.9.3 was full of checks to handle this exception(very ugly code). Is there any better way to handle NotFoundException(if not eliminate) in neo4j 2.0 or, in the pipeline? Stack Trace: org.neo4j.graphdb.NotFoundException: Node 2432 not found at org.neo4j.kernel.impl.core.NodeManager.getNodeForProxy(NodeManager.java:425) at org.neo4j.kernel.impl.api.state.OldTxStateBridgeImpl.deleteNode(OldTxStateBridgeImpl.java:111) at org.neo4j.kernel.impl.api.state.TxStateImpl.nodeDoDelete(TxStateImpl.java:250) at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.nodeDelete(StateHandlingStatementOperations.java:100) at org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.nodeDelete(ConstraintEnforcingEntityOperations.java:140) at org.neo4j.kernel.impl.api.LockingStatementOperations.nodeDelete(LockingStatementOperations.java:196) at org.neo4j.kernel.impl.api.OperationsFacade.nodeDelete(OperationsFacade.java:428) at org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$NodeOperations.delete(TransactionBoundExecutionContext.scala:132) at org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$NodeOperations.delete(TransactionBoundExecutionContext.scala:130) at org.neo4j.cypher.internal.compiler.v2_0.spi.DelegatingOperations.delete(DelegatingQueryContext.scala:92) at org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compiler$v2_0$spi$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$delete(ExceptionTranslatingQueryContext.scala:118) at org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:118) at org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslating…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32266694
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32266507
tagged with: neo4j
has comment: http://stackoverflow.com/comment/32266734
has answer: http://stackoverflow.com/a/31028909
has comment: http://stackoverflow.com/comment/32290345
favorite count: 0
has title: How to handle NotFoundException elegantly in Neo4j 2.0?
has comment: http://stackoverflow.com/comment/32258149
has comment: http://stackoverflow.com/comment/32267156
tagged with: cypher
downvote count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/21371365
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21371204
has body: for (col = 0; col &lt; numbers.length; col++) { if (col &gt;= 0) { sum2 = sum2 + numbers[row][col]; col--; } You are incrementing col in the loop header and decrementing it again in the loop body. You want col to go from 0 to 9 and row to go from 9 to 0 (or the other way around). Since you start col at 0 and row at numbers.length-1, increment col and decrement row once per loop. Note that you can actually do this in the for loop header, using a , to separate statements: for (col = 0; col &lt; numbers.length; col++, row--)

http://stackoverflow.com/q/21500676
tagged with: maven
tagged with: java
has comment: http://stackoverflow.com/comment/32457479
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/32457569
has body: I create my first Maven web application which use database. When I use maven clean and install And when I run on Tomcat server I get this: SEVERE: Allocate exception for servlet UserController java.lang.ClassNotFoundException: com.store.connector.UserController I dont know what is the problem. After maven install, my UserController.class can be found in target -> NewStore-0.0.1-SNAPSHOT -> WEB-INF -> classes -> com -> store -> connector -> UserController.class My web.xml <?xml version="1.0" encoding="UTF-8"?> NewStore /index.jsp UserController UserController com.store.connector.UserController UserController /UserController pom.xml 4.0.0 NewStore NewStore 0.0.1-SNAPSHOT war NewStore org.apache.maven maven-core 3.0.3 org.apache.maven maven-plugin-api 3.0.3 mysql mysql-connector-java 5.1.28 junit junit 4.11 javax.servlet servlet-api 3.0-alpha-1 jstl jstl 1.2 Basicly UserController.java can be found in NewStore -> src -> main -> java -> com -> store -> connector UserController.java package com.store.connector; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.store.dao.UserDao; public class UserController extends HttpServlet { private static final long serialVersionUID = 1L; private static final String LIST_USER = "listUser.jsp"; private UserDao dao; public UserController() { super(); dao = new UserDao(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String forward = ""; String action = request.getParameter("action"); if (action.equalsIgnoreCase("listUser")) { forward = LIST_USER; request.setAttribute(forward, dao.getAllUsers()); } RequestDispatcher dispatcher = request.getRequestDispatcher(forward); dispatcher.forward(request, response); } }
has comment: http://stackoverflow.com/comment/32459604
has title: Maven web application - ClassNotFound Exception
has comment: http://stackoverflow.com/comment/32462092
score: 0
has comment: http://stackoverflow.com/comment/32457532
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21382003
has body: Quoting your Wikipedia-link, this would be the most correct double-checking-volatile solution: // Broken under Java 1.4 and earlier semantics for volatile class Foo { private volatile Helper helper; public Helper getHelper() { Helper result = helper; if (result == null) { synchronized(this) { result = helper; if (result == null) { helper = result = new Helper(); } } } return result; } } Because "the volatile field is only accessed once, which can improve the method's overall performance by as much as 25 percent". Alternatively you can use the Initialization-on-demand holder idiom: public class Something { private Something() {} private static class LazyHolder { private static final Something INSTANCE = new Something(); } public static Something getInstance() { return LazyHolder.INSTANCE; } } Which works because during class-loading the LazyHolder INSTANCE is not initialized until the class is actually accessed, which is during the getInstance() method. Or just stop doing over-complicated initialization for no particular reason and use the standard eager initialization: static final Singleton INSTANCE = new Singleton(); There are only very rare cases, where lazy initialization actually helps. And that is if your Singleton has a high initialization cost and is - during normal program execution - likely to not be used at all. But this case is usually an architectural issue and the lazy-initialization is just a quick &amp; dirty fix. So you should use the eager initialization unless you profiled your application and have determined this to be a strongly negative performance issue. But then there are still many other ways to solve this on an architectural level, instead of using a lazy-initialization.
score: 0
answers question: http://stackoverflow.com/q/21374188
type: Answer

http://stackoverflow.com/comment/32283600
score: 0
type: Comment
type: QuestionComment
has text: post your all logcat.
comment on: http://stackoverflow.com/q/21402584

http://stackoverflow.com/comment/32404414
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21470508
has text: oh, I struggled with debugger and my sole refugee now is SO..thats why I posted here!
score: 0

http://stackoverflow.com/a/21358923
has body: I'd create a queue (JMS for a very big list of agents, but there are some in-memory queue implementations that are faster to use) and would allow all your agents to write their states in there. Then in another side, I'd write a consumer that listens to the queue to get these states to be processed by your GUI as they're coming. If there are too many events, you may want to process them in batches, periodically, according to some refresh rate that makes sense for you.
type: Answer
answers question: http://stackoverflow.com/q/21358694
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32220766
has comment: http://stackoverflow.com/comment/32228309
upvote count: 1

http://stackoverflow.com/q/21371413
downvote count: 2
has answer: http://stackoverflow.com/a/21371497
upvote count: 1
tagged with: dialog
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21371762
type: Question
has answer: http://stackoverflow.com/a/21371492
has body: I have this code: &lt;EditText android:id="@+id/etC" android:layout_height="wrap_content" android:layout_width="fill_parent" android:hint="@string/amount_credits" android:inputType="number" android:imeOptions="actionDone" android:singleLine="true" /&gt; and AlertDialog.Builder creditsBox = new AlertDialog.Builder(this); edC = (EditText) findViewById(R.id.etC); creditsBox.setView(edC); //THIS LINE MAKES THE APP CRASH creditsBox.setMessage("Enter amount of credits") .setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub } }); AlertDialog creditsBoxC = creditsBox.create(); creditsBoxC.show(); Now I don't understand where is the problem. Can anyone help me please? Thanks.
has title: How to put an EditText in a DialogBox?
tagged with: android
answer count: 4
favorite count: 0
tagged with: android-edittext
has answer: http://stackoverflow.com/a/21376808
type: UnansweredQuestion

http://stackoverflow.com/comment/32235269
has text: Why not use PHP? Isn't it simpler to call out the SQL statements? What are the pros and cons of using JSP versus PHP if I may ask?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21374732
score: 0

http://stackoverflow.com/a/21463880
answers question: http://stackoverflow.com/q/21463743
has comment: http://stackoverflow.com/comment/32392049
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/32392409
has body: If you setup Zxing correctly, just need the code below... IntentIntegrator.initiateScan(BarcodeActivity.this, R.layout.capture, R.id.viewfinder_view, R.id.preview_view, true); // Call the Scanner Intenet And here you get the return from barcode reader @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case IntentIntegrator.REQUEST_CODE: IntentResult scanResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, data); if (scanResult == null) { return; } final String result = scanResult.getContents(); // Your result if (result != null) { System.out.print("Your result is: " + result); } break; default: } } LayoutCapture.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;SurfaceView android:id="@+id/preview_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerInParent="true" /&gt; &lt;jim.h.common.android.zxinglib.view.ViewfinderView android:id="@+id/viewfinder_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#00000000" /&gt; &lt;TextView android:id="@+id/status_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:background="#00000000" android:textColor="#ffffffff" android:textSize="14sp" /&gt; &lt;/FrameLayout&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/32392529
has comment: http://stackoverflow.com/comment/32392133
type: Answer
has comment: http://stackoverflow.com/comment/32402616

http://stackoverflow.com/comment/32373175
score: 0
type: Comment
type: QuestionComment
has text: Tried, Still same error.
comment on: http://stackoverflow.com/q/21452907

struts
tags question: http://stackoverflow.com/q/21452894
tag name: struts
tags question: http://stackoverflow.com/q/21414124
tags question: http://stackoverflow.com/q/21363987
tags question: http://stackoverflow.com/q/21494643
type: Tag
tags question: http://stackoverflow.com/q/21352462
tags question: http://stackoverflow.com/q/21386324
tags question: http://stackoverflow.com/q/21462385

http://stackoverflow.com/comment/32324073
type: Comment
has text: WebDriver driver = new ChromeDriver();
comment on: http://stackoverflow.com/q/21425668
score: 0
type: QuestionComment

http://stackoverflow.com/a/21426451
upvote count: 1
score: 1
has body: When embedding Felix (or any other OSGi framework) you create a boundary between the classloaders. The host and the bundles are not using the same classloaders meaning that classes from inside and outside are not compatible. In other words, accessing OSGi services from the host is particularly complex and require using reflection. For simplicity reasons, you should use the Factory service (and any other services) from a bundle and not from the host. If you really need to use them from the host, you have to configure the OSGi framework to export all the required packages from bundle 0.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21398859
has comment: http://stackoverflow.com/comment/32327965
has comment: http://stackoverflow.com/comment/32326943
has comment: http://stackoverflow.com/comment/32637017
answers question: http://stackoverflow.com/q/21398859
type: Answer

http://stackoverflow.com/comment/32365149
comment on: http://stackoverflow.com/q/21442452
has text: strange, although this is linux machine, wonder why file is not appended
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21381554
answers question: http://stackoverflow.com/q/21381393
downvote count: 0
score: 9
has body: In quartz 2.0.x a GroupMatcher class was introduced. So, to get job keys you should write something like this: scheduler.getJobKeys(GroupMatcher.jobGroupEquals(Scheduler.DEFAULT_GROUP)) Have a look at GroupMatcher javadoc: http://quartz-scheduler.org/api/2.2.0/org/quartz/impl/matchers/GroupMatcher.html By the way, there is a comprehensive migration guide from 1.8.x to 2.x on Quartz-Scheduler site: http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/migration-guide.html
type: AcceptedAnswer
upvote count: 9
accepted answer of: http://stackoverflow.com/q/21381393
type: Answer

http://stackoverflow.com/a/21358997
score: 4
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21356775
accepted answer of: http://stackoverflow.com/q/21356775
has body: In your case, this is only important for the ApplicationContext passed to the DispatcherServlet. That DispatcherServlet constructor states The given web application context may or may not yet be refreshed. If it has not already been refreshed (the recommended approach), then the following will occur: If the given context does not already have a parent, the root application context will be set as the parent. If the given context has not already been assigned an id, one will be assigned to it ServletContext and ServletConfig objects will be delegated to the application context postProcessWebApplicationContext will be called Any ApplicationContextInitializers specified through the "contextInitializerClasses" init-param or through the setContextInitializers property will be applied. refresh() will be called if the context implements ConfigurableApplicationContext If the context has already been refreshed, none of the above will occur, under the assumption that the user has performed these actions (or not) per their specific needs. So for the DispatcherServlet, you have to do the following AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(DispatcherConfig.class); // will take care of calling refresh() on the ApplicationContext ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); This is necessary for the DispatcherServlet configuration because some of the beans generated because of @EnableWebMvc (or the equivalent &lt;mvc:annotation-driven&gt;) require the ServletContext and/or ServletConfig objects which are provided by the Servlet container. The root context should not have such dependencies so it is safe to do AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(AppConfig.class); rootContext.refresh(); Note that you could just create the AnnotationConfigWebAppl…
type: AcceptedAnswer

http://stackoverflow.com/q/21465180
type: Question
has body: I need to compose a dynamic URL based on current host running the web application. I have a backgrund process launched on startup via ServletContextListener. This thread has to send emails to customers with a registration ticket. In the email text I need to print the complete URL to my webapp and the servlet. Lets say those emails like "click here to confirm your subscription or copy&amp;paste blabla...." How my I obtain the FQDN of my running webapp? It's not a servlet so I cannot relay on a HttpServletRequest instance and the server has many virtual hosts. Here is where I launch the thread: public class Initializer implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent arg0) { Log.addItem("SYSTEM START"); PasswordRecoveryListener pwlisten = new PasswordRecoveryListener(1000 * 60 * 1); pwlisten.start(); } } In arg0.getServletContext().getContextPath() I found nothing but the path. I looked for the hostname in the Context (where I have other constants) but without success.
has title: How to retrieve current server FQDN in a java class
score: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/32396586
has comment: http://stackoverflow.com/comment/32394352
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32420498
has comment: http://stackoverflow.com/comment/32420464
tagged with: web-applications

http://stackoverflow.com/a/21483664
score: 1
upvote count: 1
type: AcceptedAnswer
has body: It does not matter where you actually start a thread if the lifetime of that thread is reflected via your app process state: http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle Android does not care if there is a Thread running or not. Threads just run even when your app is considered an empty process "that doesn't hold any active application components." Don't abuse that, since users don't want that apps are secretly active although they look dead. If you want (and you should) that Android does not kill you randomly although your threads are not done you have to make sure that you keep e.g. a Service in started state. Creating a thread from within a Service (or just using IntentService) will primarily result in better, simpler &amp; cleaner code. For example because a Service has a Context and you can't leak your Activity from there. You also get free callbacks from the system. And leaks via threads are extremely easy. new Thread(new Runnable() { @Override public void run() { SystemClock.sleep(Long.MAX_VALUE); } }).start(); Will leak your activity if you just put it in e.g. onCreate because the anonymous inner Runnable keeps a reference to your Activity and will not release it until the thread stops running and is itself garbage collected. In case you really know what you are doing, feel free to start threads in Activities and sync their lifecycle manually to some empty Service. I would not recommend it because it's unlikely to be less work to do that correctly.
accepted answer of: http://stackoverflow.com/q/21471069
answers question: http://stackoverflow.com/q/21471069
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/32435662

http://stackoverflow.com/q/21393002
downvote count: 0
has comment: http://stackoverflow.com/comment/32267503
has answer: http://stackoverflow.com/a/21393131
has answer: http://stackoverflow.com/a/21393091
has answer: http://stackoverflow.com/a/21393074
tagged with: while-loop
type: Question
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/21393136
possible better answer: http://stackoverflow.com/a/21393073
favorite count: 0
has answer: http://stackoverflow.com/a/21393073
upvote count: 1
has comment: http://stackoverflow.com/comment/32267477
has body: I've been trying to get this to work for a while. I'm putting in three parallel empty arrays and it errors out saying that there is no line found. It ONLY works when I change the while statement to the number of elements. I am trying to make arrays that are the size of 15, but only fill the first ten array portions. Sorry if it sounds complicated, but basically I'm trying to say that the size of the array is 15, I only have 10 things to enter in the array, and the rest of them should be blank. while (text.hasNext() &amp;&amp; c &lt; nameArray.length) { nameArray[count] = text.nextLine(); intArray[count] = text.nextDouble(); doubleArray[count] = text.nextInt(); text.nextLine(); c++; } This does not work. while (text.hasNext() &amp;&amp; c &lt; 9) { nameArray[count] = text.nextLine(); intArray[count] = text.nextDouble(); doubleArray[count] = text.nextInt(); text.nextLine(); c++; } This does.
has comment: http://stackoverflow.com/comment/32268303
has title: Line Not Found on while loop?
tagged with: java
accepted answer: http://stackoverflow.com/a/21393136
answer count: 5
tagged with: loops
has comment: http://stackoverflow.com/comment/32267529
has comment: http://stackoverflow.com/comment/32267550
tagged with: arrays

http://stackoverflow.com/comment/38862390
has text: @Hardy, http://stackoverflow.com/questions/24168964/bean-validation-group-inheritance-isnt-working-with-group-sequence-provider
comment on: http://stackoverflow.com/q/21363481
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21364146
has comment: http://stackoverflow.com/comment/32214549
upvote count: 1
answers question: http://stackoverflow.com/q/21364125
downvote count: 0
score: 1
has body: You are using == on strings, which compares references, not actual equality. Always use string.equals(otherstring) instead. As for your problem, String result; is never initialised to null. If you declared it as a field, it would automatically have been assigned the value null, but inside the scope of a method it is undetermined. The data is whatever junk bytes happened to still be there. So do String result = null;.
type: Answer
has comment: http://stackoverflow.com/comment/32214643

http://stackoverflow.com/comment/32221159
score: 1
type: AnswerComment
type: Comment
has text: You really should try to avoid using arrays and switch to list of lists if you can or maybe look at the [Guava table](https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained#Table).
comment on: http://stackoverflow.com/a/21367457

http://stackoverflow.com/comment/32354016
score: 1
comment on: http://stackoverflow.com/q/21442286
has text: It wouldn't be much of a `long` if it stored and `int`.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21445048
type: Answer
has comment: http://stackoverflow.com/comment/32358987
answers question: http://stackoverflow.com/q/21445022
has body: How about this? url = url.replace("http://www.", ""); Wouldn't that work?
score: 0
has comment: http://stackoverflow.com/comment/32359057
has comment: http://stackoverflow.com/comment/32359023

http://stackoverflow.com/comment/32290801
type: AnswerComment
has text: I've added more detail to my answer. I take no responsibility whatsoever.
type: Comment
comment on: http://stackoverflow.com/a/21405773
score: 0

http://stackoverflow.com/comment/32389358
has text: Are there any other escape sequences involved, e.g. does the format use \\ to escape backslashes too? If you need to ignore \, but still split at \\, then you'll need something more powerful than regular expressions.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21462312
score: 0

http://stackoverflow.com/comment/32220011
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21366911
has text: you are 100% right, and I seriously apologize to you for not being polite. I should have made my question more clear, and not have been rude to people who tried to help me.

http://stackoverflow.com/q/21424981
has body: I have this XML which i using for my Java activity in Android. I want the contact number edittext to become visible when user selects female as a gender but it stays invisible when male is selected. Code is in its primary stage but I want this functionality to work. <?xml version="1.0" encoding="utf-8"?> <requestFocus /> <RadioButton android:id="@+id/radio0" android:layout_width="101dp" android:layout_height="wrap_content" android:checked="true" android:text="@string/male" /> <RadioButton android:id="@+id/radio1" android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/female" /> I am trying to use this XML and make the contact number visible only when female radio button is selected. Java file is: public class RegistrationActivity extends Activity implements RadioGroup.OnCheckedChangeListener{ private RadioGroup radioGroup1; private EditText et; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.registration); radioGroup1=(RadioGroup)findViewById(R.id.radioGroup1); //test listening to radio group radioGroup1.setOnCheckedChangeListener(this); et=(EditText)findViewById(R.id.editText5); } public void onCheckedChanged(RadioGroup group, int checkedId) { if(checkedId == R.id.radio1){ et.setVisibility(View.VISIBLE); } }
type: Question
has answer: http://stackoverflow.com/a/21425136
downvote count: 0
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21425130
has answer: http://stackoverflow.com/a/21425142
has title: I just cant see why edittext does not appear on checking a radio button
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32322885
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32322883
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21408494
has comment: http://stackoverflow.com/comment/32294186
type: AnsweredQuestion
upvote count: 0
tagged with: list
duplicate of: http://stackoverflow.com/q/993025
tagged with: java
downvote count: 2
has body: When trying to add/remove some stuff from/in a list in a loop java could raise ConcurrentModificationException exceptions. After searching in google I came across ways of overcoming the issue such as applying the interface iterator and when you want to remove an item you need to remove it from the list through the iterator itself using the remove() function. However, there isn't an add() function among the iterator's methods so the only way to add an element with no exception raised would be to use the loop for (int i = 0; i &lt; list.size(); i++) by using the index/position. However, this loop is extremely inefficient with large lists as you need to get the index position of the item in question by traversing all the way through the list. So my question is do you know any other way except the way I mentioned which you can use to add an item to a list? Thanks
type: Question
score: -2
linked to: http://stackoverflow.com/q/993025
accepted answer: http://stackoverflow.com/a/21408591
answer count: 1
has title: Avoid ConcurrentModificationException exception by adding items to a list
favorite count: 0
has answer: http://stackoverflow.com/a/21408591
has comment: http://stackoverflow.com/comment/32294181

http://stackoverflow.com/q/21440563
tagged with: java-web-start
has title: Webstart application: SecurityException: setContextClassLoader
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21460363
has body: I have a webstart application which connects to a web service. The manifest has: Permissions: all-permissions And the jnlp has: &lt;security&gt; &lt;all-permissions/&gt; &lt;/security&gt; However when the connection to the web service is created I get a java.lang.SecurityException: setContextClassLoader (full stack trace below). When I run the application directly (without webstart) it works fine. Is there anything that I should check or change in my setup to fix the problem? Note: I am using Java 8. The application was working fine with build 121 but fails with build 123, 124 or 125 (the most recent one). So either my setup is fine and a bug has been introduced between b121 and b123 or a bug has been fixed in b123 which exposes a problem in my setup. org.glassfish.hk2.api.MultiException: A MultiException has 2 exceptions. They are: 1. java.lang.SecurityException: setContextClassLoader 2. java.lang.IllegalStateException: Unable to perform operation: create on org.jvnet.hk2.internal.DynamicConfigurationServiceImpl at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:362) ~[na:na] at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:454) ~[na:na] at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:119) ~[na:na] at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2296) ~[na:na] at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:590) ~[na:na] at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:577) ~[na:na] at org.glassfish.hk2.utilities.ServiceLocatorUtilities.enablePerThreadScope(ServiceLocatorUtilities.java:89) ~[na:na] at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:144) ~[na:na] at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:137) ~[na:na] at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:352) ~[na:na] at org.glassfish.jersey.client.ClientConfig$…
score: 2
type: AnsweredQuestion
tagged with: classloader
upvote count: 2
tagged with: securityexception
type: Question
has answer: http://stackoverflow.com/a/21460363
tagged with: java

http://stackoverflow.com/comment/32190688
type: Comment
comment on: http://stackoverflow.com/a/21350538
has text: Just another option. To me it code looks cleaner with Math.max(..)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32208441
type: Comment
comment on: http://stackoverflow.com/q/21360131
has text: As an aside, my code currently assumes that the stream can be closed once the statement is executed, and appears to work correctly, but I don't see how I can be sure that it will always work.
score: 0
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/21376869
tags question: http://stackoverflow.com/q/21414007
tags question: http://stackoverflow.com/q/21364395
tags question: http://stackoverflow.com/q/21406751
tags question: http://stackoverflow.com/q/21450631
tags question: http://stackoverflow.com/q/21458991
tags question: http://stackoverflow.com/q/21354828
tags question: http://stackoverflow.com/q/21371643
tags question: http://stackoverflow.com/q/21394421
tag name: eclipse
tags question: http://stackoverflow.com/q/21400515
tags question: http://stackoverflow.com/q/21372807
tags question: http://stackoverflow.com/q/21370852
tags question: http://stackoverflow.com/q/21459178
tags question: http://stackoverflow.com/q/21477348
tags question: http://stackoverflow.com/q/21448248
tags question: http://stackoverflow.com/q/21370467
tags question: http://stackoverflow.com/q/21416617
tags question: http://stackoverflow.com/q/21482920
tags question: http://stackoverflow.com/q/21479474
tags question: http://stackoverflow.com/q/21397542
tags question: http://stackoverflow.com/q/21367756
tags question: http://stackoverflow.com/q/21416611
tags question: http://stackoverflow.com/q/21414203
tags question: http://stackoverflow.com/q/21505343
tags question: http://stackoverflow.com/q/21506052
tags question: http://stackoverflow.com/q/21423292
tags question: http://stackoverflow.com/q/21372306
tags question: http://stackoverflow.com/q/21482494
tags question: http://stackoverflow.com/q/21494025
tags question: http://stackoverflow.com/q/21383967
tags question: http://stackoverflow.com/q/21365009
tags question: http://stackoverflow.com/q/21445067
tags question: http://stackoverflow.com/q/21465873
tags question: http://stackoverflow.com/q/21395834
tags question: http://stackoverflow.com/q/21414782
tags question: http://stackoverflow.com/q/21474941
tags question: http://stackoverflow.com/q/21436446
tags question: http://stackoverflow.com/q/21488540
tags question: http://stackoverflow.com/q/21504224
tags question: http://stackoverflow.com/q/21482584
tags question: http://stackoverflow.com/q/21479266
tags question: http://stackoverflow.com/q/21367733
tags question: http://stackoverflow.com/q/21500692
tags question: http://stackoverflow.com/q/21466716
tags question: http://stackoverflow.com/q/21454493
tags question: http://stackoverflow.com/q/21366479
tags question: http://stackoverflow.com/q/21459891
tags question: http://stackoverflow.com/q/21421667
tags question: http://stackoverflow.com/q/21399509
tags question: http://stackoverflow.com/q/21365098
tags question: http://stackoverflow.com/q/21357286
tags question: http://stackoverflow.com/q/21502292
tags question: http://stackoverflow.com/q/21373837
tags question: http://stackoverflow.com/q/21514393
tags question: http://stackoverflow.com/q/21354725
tags question: http://stackoverflow.com/q/21465556
tags question: http://stackoverflow.com/q/21407097
tags question: http://stackoverflow.com/q/21497056
tags question: http://stackoverflow.com/q/21486683
tags question: http://stackoverflow.com/q/21366919
tags question: http://stackoverflow.com/q/21490755
tags question: http://stackoverflow.com/q/21512902
tags question: http://stackoverflow.com/q/21380809
tags question: http://stackoverflow.com/q/21358548
tags question: http://stackoverflow.com/q/21434806
tags question: http://stackoverflow.com/q/21514195
tags question: http://stackoverflow.com/q/21415243
tags question: http://stackoverflow.com/q/21506974
tags question: http://stackoverflow.com/q/21447002
tags question: http://stackoverflow.com/q/21362684
tags question: http://stackoverflow.com/q/21383686
tags question: http://stackoverflow.com/q/21508913
tags question: http://stackoverflow.com/q/21395502
tags question: http://stackoverflow.com/q/21360968
tags question: http://stackoverflow.com/q/21460708
tags question: http://stackoverflow.com/q/21374149
tags question: http://stackoverflow.com/q/21472110
tags question: http://stackoverflow.com/q/21372111
tags question: http://stackoverflow.com/q/21353773

http://stackoverflow.com/comment/32662698
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21493800
has text: Did you check it is not overridden?

http://stackoverflow.com/a/21382293
type: Answer
has comment: http://stackoverflow.com/comment/32247765
has comment: http://stackoverflow.com/comment/32247419
score: 0
has body: Handling large amount of static data (images/JS/CSS etc files) within the application is never a good idea. The best way is to handle the static data is to package them outside the application hierarchy like e.g some-place in the filing system and then access them there.
answers question: http://stackoverflow.com/q/21382183

http://stackoverflow.com/comment/32473667
comment on: http://stackoverflow.com/q/21509788
type: QuestionComment
score: 3
has text: You've kind of buried your main question under a lot of irrelevant information. The main question is: "**How do I ensure that `main.css` is served with the correct `Content-Type` header in WebLogic 9.x?**", right?
type: Comment

http://stackoverflow.com/q/21502742
has comment: http://stackoverflow.com/comment/32463060
upvote count: 1
tagged with: methods
has comment: http://stackoverflow.com/comment/32462747
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21502989
tagged with: java
has comment: http://stackoverflow.com/comment/32463668
score: -1
has comment: http://stackoverflow.com/comment/32463934
accepted answer: http://stackoverflow.com/a/21502989
tagged with: class
tagged with: arrays
has comment: http://stackoverflow.com/comment/32462607
favorite count: 0
has answer: http://stackoverflow.com/a/21502848
has comment: http://stackoverflow.com/comment/32463239
possible better answer: http://stackoverflow.com/a/21502915
has comment: http://stackoverflow.com/comment/32461144
has answer: http://stackoverflow.com/a/21502915
has comment: http://stackoverflow.com/comment/32462808
has body: I am trying to create a method called listFish() which lists (using System.out.println) all fish in a pond. I have created a toString method that goes as follows: public String toString() { return("A " + this.size + " cm " + this.species); } and I also created an add() method which takes a single Fish parameter and adds that fish to the pond, provided that the pond is not full. If the pond is full to capacity it does nothing. (If it is wrong please tell me): public Fish add(Fish x) { if (this.numFish &lt; fishes.length) { return x; } else { return null; } } What I am having trouble with in particular is creating a listFish() method, which lists (using System.out.println) all fish in the pond as follows: (it gets this information from the test code below) A 4cm Sunfish A 25 cm Pike A 20 cm Bass A 30 cm Perch A 4 cm Sunfish A 15 cm Pike A 9 cm Pike A 12 cm Bass A 5 cm Sunfish A 12 cm Sunfish . public class PondTestProgram { public static void main(String args[]) { // Create a pond with 10 fish Pond pond = new Pond(15); pond.add(new Fish(4, "Sunfish")); pond.add(new Fish(25, "Pike")); pond.add(new Fish(20, "Bass")); pond.add(new Fish(30, "Perch")); pond.add(new Fish(4, "Sunfish")); pond.add(new Fish(15, "Pike")); pond.add(new Fish(9, "Pike")); pond.add(new Fish(12, "Bass")); pond.add(new Fish(5, "Sunfish")); pond.add(new Fish(12, "Sunfish")); pond.listFish(); I was thinking that the method could look something like this but it has not been working out so far: public void listFish() { System.out.println(toString().add()); } so basically it would take the add method and toString and print out the fish's length and fish's name but so far I keep getting errors. Any help is appreciated, thank you!
has answer: http://stackoverflow.com/a/21502803
answer count: 4
has comment: http://stackoverflow.com/comment/32463480
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32463922
has comment: http://stackoverflow.com/comment/32462787
has title: Creating a method that lists fish from another method
has comment: http://stackoverflow.com/comment/32462793
downvote count: 2
has comment: http://stackoverflow.com/comment/32463928

http://stackoverflow.com/comment/32228309
type: Comment
comment on: http://stackoverflow.com/a/21358923
has text: if your agents fit into a in-memory collection of some kind, please ignore my answer. See @dakkaron answer. I'd only improve his solution a little not setting only 4 color, but instead using a wider color palette. But I think he/she said it all.
type: AnswerComment
score: 0

http://stackoverflow.com/a/39803658
type: Answer
downvote count: 0
has body: Here we can see the simple implementation of LinkedList with iterator and foreach syntax class LinkedList implements Iterable&lt;LinkedList.Node&gt;{ private Node node; public void add(Object data){ if(!Optional.ofNullable(node).isPresent()){ node = new Node(); node.setData(data); }else{ Node node = new Node(); node.setData(data); Node lastNode = getLastNode(this.node); lastNode.setNext(node); } } private Node getLastNode(Node node){ if(node.getNext()==null){ return node; }else{ return getLastNode(node.getNext()); } } class Node{ private Object data; private Node next; public Object getData() { return data; } public void setData(Object data) { this.data = data; } public Node getNext() { return next; } public void setNext(Node next) { this.next = next; } } public Iterator&lt;Node&gt; iterator() { return new NodeIterator(); } class NodeIterator implements Iterator&lt;Node&gt;{ private Node current; public boolean hasNext() { if(current == null){ current = node; return Optional.ofNullable(current).isPresent(); }else{ current = current.next; return Optional.ofNullable(current).isPresent(); } } public Node next() { return current; } } } public class LinkedListImpl { public static void main(String[] args) { LinkedList linkedList = new LinkedList(); linkedList.add("data1"); linkedList.add("data2"); linkedList.add("data3"); for(LinkedList.Node node: linkedList){ System.out.println(node.getData()); } } }
answers question: http://stackoverflow.com/q/21512250
score: 10
upvote count: 10

jar
tags question: http://stackoverflow.com/q/21417710
tags question: http://stackoverflow.com/q/21361931
tags question: http://stackoverflow.com/q/21358791
tags question: http://stackoverflow.com/q/21451008
tags question: http://stackoverflow.com/q/21459178
tags question: http://stackoverflow.com/q/21511626
tags question: http://stackoverflow.com/q/21414203
tags question: http://stackoverflow.com/q/21424860
type: Tag
tags question: http://stackoverflow.com/q/21400515
tags question: http://stackoverflow.com/q/21363051
tags question: http://stackoverflow.com/q/21411834
tags question: http://stackoverflow.com/q/21510360
tags question: http://stackoverflow.com/q/21397185
tags question: http://stackoverflow.com/q/21496562
tag name: jar
tags question: http://stackoverflow.com/q/21470120
tags question: http://stackoverflow.com/q/21482377
tags question: http://stackoverflow.com/q/21414522
tags question: http://stackoverflow.com/q/21441928
tags question: http://stackoverflow.com/q/21513384
tags question: http://stackoverflow.com/q/21410506
tags question: http://stackoverflow.com/q/21357057
tags question: http://stackoverflow.com/q/21387077
tags question: http://stackoverflow.com/q/21451454
tags question: http://stackoverflow.com/q/21393448
tags question: http://stackoverflow.com/q/21442425
tags question: http://stackoverflow.com/q/21412757
tags question: http://stackoverflow.com/q/21417419

rest
tags question: http://stackoverflow.com/q/21465629
tags question: http://stackoverflow.com/q/21367855
tags question: http://stackoverflow.com/q/21414522
tags question: http://stackoverflow.com/q/21428061
tags question: http://stackoverflow.com/q/21370135
tags question: http://stackoverflow.com/q/21505807
tags question: http://stackoverflow.com/q/21435906
tags question: http://stackoverflow.com/q/21414869
tags question: http://stackoverflow.com/q/21438069
tags question: http://stackoverflow.com/q/21402950
tags question: http://stackoverflow.com/q/21428122
tags question: http://stackoverflow.com/q/21367158
tags question: http://stackoverflow.com/q/21487643
tags question: http://stackoverflow.com/q/21483141
tags question: http://stackoverflow.com/q/21380084
tags question: http://stackoverflow.com/q/21478625
tags question: http://stackoverflow.com/q/21404836
tags question: http://stackoverflow.com/q/21413738
tags question: http://stackoverflow.com/q/21389103
tags question: http://stackoverflow.com/q/21383440
tags question: http://stackoverflow.com/q/21471993
tags question: http://stackoverflow.com/q/21425951
tags question: http://stackoverflow.com/q/21453439
tags question: http://stackoverflow.com/q/21481693
tags question: http://stackoverflow.com/q/21488724
tags question: http://stackoverflow.com/q/21410317
tags question: http://stackoverflow.com/q/21381305
tags question: http://stackoverflow.com/q/21422155
tags question: http://stackoverflow.com/q/21433146
type: Tag
tags question: http://stackoverflow.com/q/21352392
tags question: http://stackoverflow.com/q/21399454
tags question: http://stackoverflow.com/q/21365741
tag name: rest
tags question: http://stackoverflow.com/q/21385635
tags question: http://stackoverflow.com/q/21425291
tags question: http://stackoverflow.com/q/21371561
tags question: http://stackoverflow.com/q/21453879

http://stackoverflow.com/comment/32197982
type: Comment
type: QuestionComment
has text: What is exactly the behavior you would want to avoid?
comment on: http://stackoverflow.com/q/21351300
score: 0

http://stackoverflow.com/q/21436787
has answer: http://stackoverflow.com/a/21436939
answer count: 2
accepted answer: http://stackoverflow.com/a/21436939
score: 0
possible better answer: http://stackoverflow.com/a/21437109
has body: I am using OpenCV on my Raspberry Pi to track circular objects. Then, I want to send the coordinate and radius values in an array of floats across the LAN to the Java program I can send strings all fine with the code I have, but I'm having trouble trying to send numerical datatypes. What is the correct process for this?
tagged with: sockets
tagged with: python
type: AnsweredQuestion
has title: How to send an array from Python (client) to Java (Server)?
has answer: http://stackoverflow.com/a/21437109
tagged with: java
type: Question

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

http://stackoverflow.com/q/21428961
tagged with: java
has body: Using JDBC driver, how can I use multiple result sets from different queries without continually opening and closing the connections, as it stand im extracting w.e I need and passing it to another method. Each time opening a new conn,statement and resultset public static void OppQuery() { Connection conn = null; Statement stmt = null; ResultSet result_set = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL); stmt = conn.createStatement(); String emailInfoQuery = "FROM WHERE"; } public static void addQuery(String latestRenewalId) { Connection conn = null; Statement stmt = null; ResultSet result_set = null; try { Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL); stmt = conn.createStatement(); String new_AddressLine1, new_AddressLine2; new_AddressLine1=new_AddressLine2=""; int new_ChannelOption= 0; } I tried to use multiple result sets in one method but it kept throwing exceptions saying the result set was closed. I don't have much experience with SqlServver so any guidance would help :-)
accepted answer: http://stackoverflow.com/a/21434205
downvote count: 1
type: Question
answer count: 2
tagged with: sql-server
has comment: http://stackoverflow.com/comment/32334852
has answer: http://stackoverflow.com/a/21451605
has comment: http://stackoverflow.com/comment/32337191
has title: Multiple ResultSets, different queries, same database SQLSERVER
tagged with: jdbc
favorite count: 0
possible better answer: http://stackoverflow.com/a/21451605
upvote count: 2
has answer: http://stackoverflow.com/a/21434205
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/21460581
answers question: http://stackoverflow.com/q/21460324
type: Answer
score: 2
downvote count: 0
has body: Apparently the resources are not getting injected to your class because you run it as a standalone application. Quoting the article you have linked: Before delving into the details of this code, alert readers might have noticed that this class is a standalone Java application as it contains a main method. As this class is standalone, it executes outside the application server. In spite of this, we can see that some resources are injected into it, specifically the connection factory and queue. The reason we can inject resources into this code, even though it runs outside the application server, is because GlassFish includes a utility called appclient. This utility allows us to "wrap" an executable JAR file and allows it to have access to the application server resources. To execute the previous code, assuming it is packaged in an executable JAR file called jmsptpproducer.jar, we would type the following command in the command line: appclient -client jmsptpproducer.jar Try to run the application as stated above.
has comment: http://stackoverflow.com/comment/46162237
upvote count: 2

http://stackoverflow.com/comment/32781795
comment on: http://stackoverflow.com/a/21684150
type: Comment
has text: I know. I forgot to update the question. The people I am working for asked me to make it private unfortunately.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21385548
type: Question
has answer: http://stackoverflow.com/a/21385843
upvote count: 1
tagged with: tomcat7
has title: How to point external directory of images on tomcat servers port number 8888?
has comment: http://stackoverflow.com/comment/32253780
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/21385723
has comment: http://stackoverflow.com/comment/32512604
downvote count: 0
type: UnansweredQuestion
has body: I am new to tomcat administration. I have a some set of images that is located in C: drive of my VPN but outsude the tomcat server. I have web application that is works fine on Tomcats 8080 port. Now I want to port above images folder to 8888 port. So if some one loads url like (localhost:8888/images/) he will get all images here. And load url localhost:8080/MyServerApplication/ will get my web application.
has answer: http://stackoverflow.com/a/21657552
has comment: http://stackoverflow.com/comment/32382557
score: 1
favorite count: 0

http://stackoverflow.com/comment/32234578
type: Comment
comment on: http://stackoverflow.com/a/21369013
type: AnswerComment
has text: Added default implementation
score: 0

http://stackoverflow.com/comment/32275440
has text: Sorry, I had that in must have copied an older version of the expression, just a sec.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21397586
score: 0

http://stackoverflow.com/a/21505416
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21505370
type: Answer
has body: The Thread object does represent a thread, in as much as it gives you a handle by which you can control a thread. Obviously the object is "special" in that it instantiates an actually running thread of execution, but it does represent that thread. The thread's run method (or the runnable it calls) defines the sequence of operations that that thread will execute and determines how long the thread will run for, etc.
score: 2

http://stackoverflow.com/q/21413647
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26522517
tagged with: rom
has answer: http://stackoverflow.com/a/27129751
has body: anybody knows what this method does, anybody has some sample code? Anybody used this before? The method is createVirtualDisplay() inside DisplayManager Thanks
tagged with: android
possible better answer: http://stackoverflow.com/a/27129751
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26522517
type: Question
tagged with: java
has title: Android DisplayManager createVirtualDisplay?

http://stackoverflow.com/comment/32331154
score: 0
has text: Date date1=new date1[2];
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21429810

http://stackoverflow.com/a/21392063
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21391921
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21391921
score: 2
has body: Apparently I was missing some important packages. I found the solution in this website: http://sixarm.com/about/error-unable-to-locate-tools-jar.html

http://stackoverflow.com/comment/32371747
type: Comment
has text: @thankyou you probably need a html parser like jsoup to parse html tags
comment on: http://stackoverflow.com/a/21452226
score: 0
type: AnswerComment

http://stackoverflow.com/a/21457238
type: Answer
answers question: http://stackoverflow.com/q/21447801
has body: When I export application it creates test.exe for windows32 bit architecture (but running on 64bit OS) and then using your second case of open() works fine for me: void mousePressed() { //open second window with test app running open("C:/Users/corbett2/Documents/Processing/test/application.windows32/test.exe"); //this will close first window exit(); } [but this didn't work with export to 64bit architecture (for me) so your problem should be with some settings of platform's launcher] Anyway this approach works fine just you also need to close first window so user will not be confused.
has comment: http://stackoverflow.com/comment/32389347
score: 0
has comment: http://stackoverflow.com/comment/32512808

http://stackoverflow.com/a/21501119
score: 2
answers question: http://stackoverflow.com/q/21500965
downvote count: 0
type: Answer
has body: I think the easiest way is to order the Array (is Log(n)). If you don't want to alter the original array you can do a clone first (int b[]= Arrays.copyOf(a, a.length);). If you want the position in the array instead of the value tell me and I will find another solution. Tell me if this helps: public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter"); int a[] = { 45, 79, 2, 5, 74, 4, 19, 56, 2, 888 }; Arrays.sort(a); System.out.print("ordered array: "); for(int i:a){ System.out.print(i+", "); } System.out.println(); System.out.println("the 4th smallest : " + a[3]); System.out.println("the 4th biggest: " + a[(a.length - 4)]); }
upvote count: 2

http://stackoverflow.com/comment/32415231
score: 0
has text: I'm not saying that you don't have to use them but be aware that you'll have to work a bit more without taking advantage of the Play Services. Most of the time the Play Services algorithms satisfy what you need when you're querying for a location as soon as you start your application. If you need to implement everything from the scratch you have to: getLastKnownLocation > check if it's the one that satisfy your constraints > if not asking to one/more enabled providers the location and manage failures,...
type: AnswerComment
comment on: http://stackoverflow.com/a/21476973
type: Comment

http://stackoverflow.com/q/21493982
possible better answer: http://stackoverflow.com/a/21494056
tagged with: regex
score: 1
has answer: http://stackoverflow.com/a/21494056
favorite count: 0
answer count: 2
has answer: http://stackoverflow.com/a/21494003
upvote count: 1
has body: I have written a program using Pattern and Matcher in Java to produce a string in between a group of characters. My code is currently: String trying = "75px;"; Pattern tryingPattern = Pattern.compile("(?<="+Pattern.quote(trying)+").*?(?=center)", Pattern.MULTILINE); Matcher tryingMatcher = tryingPattern.matcher(pageContentString); while (tryingMatcher.find()) { docketFile.write(tryingMatcher.group().toString()); } I am attempting to obtain the information between the "75px;" and and the word "center". The issue is that any time a sequence comes up as shown below with the information on several lines, it is not recognizing the pattern even though the beginning and ending string exist. I am not sure based off my code why information including line breaks will not allow the pattern to be recognized. Sample data below. 03/04/2013 D6 SR SUMS AMENDED COMPLNT(20967973) SENT BY CERTIFIED MAIL. TO: CUYAHOGA CLERK OF COURTS 1200 ONTARIO CT CLEVELAND, OH 44113-0000
tagged with: java
has comment: http://stackoverflow.com/comment/32445983
accepted answer: http://stackoverflow.com/a/21494003
downvote count: 0
has title: Pattern/Matcher not working with line break
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/21365962
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/21365894
downvote count: 1
has comment: http://stackoverflow.com/comment/32217722
has comment: http://stackoverflow.com/comment/32218107
type: Answer
has body: Thread 5 is not calling .wakeUp(), the main thread is calling .wakeUp()
has comment: http://stackoverflow.com/comment/32217987

http://stackoverflow.com/comment/32219002
type: Comment
comment on: http://stackoverflow.com/a/21357198
has text: I processed search `zipgrep *string libs/*`, but no matches found
score: 0
type: AnswerComment

http://stackoverflow.com/q/21437452
score: 0
has title: IRetryAnalyzer HELP, can't make it work
answer count: 1
tagged with: testng
has comment: http://stackoverflow.com/comment/32435339
has comment: http://stackoverflow.com/comment/32435113
has comment: http://stackoverflow.com/comment/32470912
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32502060
tagged with: java
has comment: http://stackoverflow.com/comment/32501109
has body: I'm new on this so this isn't so obvious for me. I'm trying to implement IRetryAnalyzer from testNG, to re run the test cases that failed. And this is what I've done, but can't make it work. Note all this code I've copied form the internet. public class Retry implements IRetryAnalyzer { private int retryCount = 0; private int maxRetryCount = 2; @Override public boolean retry(ITestResult result) { if (retryCount &lt; maxRetryCount) { System.out.println("Entre"); retryCount++; return true; } return false; } Here is my test method were it should fail and re run the test. @Parameters({ "nombrePlan", "nombreBuild", "nomTL_verificacionUIHomePageIssuer" }) @Test(retryAnalyzer = Retry.class) public void verificacionUIHomePageIssuer(String nombrePlan, String nombreBuild, String nomTL_verificacionUIHomePageIssuer) throws Exception { HomePageIssuer homePage = new HomePageIssuer(driver); //Assert.assertTrue(homePage.validacionLogin(), homePage.getError()); Assert.assertTrue(false); } The thing is that when I run it doesn't work the driver closes and the test never starts again. Any help would be appreciated. Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/32503127
has answer: http://stackoverflow.com/a/21526796
has comment: http://stackoverflow.com/comment/32502672
accepted answer: http://stackoverflow.com/a/21526796
has comment: http://stackoverflow.com/comment/32394592

http://stackoverflow.com/a/21354872
has comment: http://stackoverflow.com/comment/32199565
has body: Using the system scope. ${basedir} is the directory of your pom. .. .. system ${basedir}/my_repo/my.jar
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32198884
type: Answer
has comment: http://stackoverflow.com/comment/32199952
accepted answer of: http://stackoverflow.com/q/21354810
has comment: http://stackoverflow.com/comment/32200010
has comment: http://stackoverflow.com/comment/32199727
answers question: http://stackoverflow.com/q/21354810
downvote count: 0
score: 1

http://stackoverflow.com/q/21441331
has body: I was trying to change the user who runs the tomcat process. In process of changing I have added new user and made tomcat run under him. how now if i ping the tomcat, I get 404 error. I am not sure how to proceed. Can I check if tomcat has loaded all the classes ? Can I check anything else to make sure tomcat loaded the servlets. Is there anything else I can check to resolve this 404 error. Thanks a lot
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32353712
type: UnansweredQuestion
tagged with: spring
has title: Tomcat returns 404 status
tagged with: java
tagged with: tomcat6
has answer: http://stackoverflow.com/a/21441819
type: Question
tagged with: servlets
score: 0
answer count: 1

http://stackoverflow.com/q/21477657
has comment: http://stackoverflow.com/comment/32416203
tagged with: listadapter
type: Question
has title: Android ListAdapter displays correct but then gives NullPointer. Why?
tagged with: android
score: 0
tagged with: java
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21477742
has body: I'm trying to build a simple listadapter in my Android app. I got it to display the list of items correctly, but strangely, after the list displays, I get a Nullpointer and the app crashes. Seeing that the adapter is rather simple, I have no clue what I'm doing wrong here. Below my adapter. The Nullpointer occurs in the getView method at the line saying holder.points.setText("123"); public class QuestionAdapter extends BaseAdapter { private List&lt;Question&gt; data = new ArrayList&lt;Question&gt;(); private Context context; public QuestionAdapter(Context context) { this.context = context; } @Override public int getCount() { return data.size(); } private class ViewHolder { TextView points; TextView title; } public void setList(List&lt;Question&gt; questionList) { this.data = questionList; } @Override public View getView(int position, View convertView, ViewGroup viewGroup) { Question question = getItem(position); ViewHolder holder = new ViewHolder(); if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.list_item_question, null); holder.points = (TextView) convertView.findViewById(R.id.text_question_points); holder.title = (TextView) convertView.findViewById(R.id.text_question_title); } else { holder = (ViewHolder) convertView.getTag(); } holder.points.setText("123"); holder.title.setText(question.title); return convertView; } @Override public long getItemId(int i) { return 0; } @Override public Question getItem(int i) { return data.get(i); } }
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21477705
has answer: http://stackoverflow.com/a/21480907
has answer: http://stackoverflow.com/a/21477701

http://stackoverflow.com/comment/32363846
comment on: http://stackoverflow.com/q/21446851
type: QuestionComment
has text: It adds all the values entered for amount.
score: 0
type: Comment

http://stackoverflow.com/q/21421633
has body: I am developing web application that uses Google Task API. I've a class that use Task Service API. My intention is to unit test my code by mocking the underlying Google API Infrastructure. I attempted to do the following: MockHttpTransport httpTransport = new MockHttpTransport(); MockJsonFactory jsonFactory = new MockJsonFactory(); Credential credential = new Credential.Builder( BearerToken.queryParameterAccessMethod()).setTransport(httpTransport) .setJsonFactory(jsonFactory) .setTokenServerUrl(TOKEN_SERVER_URL) .setClientAuthentication(new BasicAuthentication(CLIENT_ID, CLIENT_SECRET)) .build(); Tasks service = new Tasks.Builder(httpTransport, jsonFactory, credential).build(); But I am not sure how to pass the sample JSON file in these set of mock classes. I am struck with the error java.lang.IllegalArgumentException: no JSON input found. After googling a bit, I found there seems a way in Python world of the same API: http = HttpMock('./data/only_one_task.json', {'status': '200'}) But looking for way to achieve the same in Java. Any help/pointers very much appreciated. Thanks.
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: google-app-engine
upvote count: 2
tagged with: google-api
has title: Unit Testing of Google Task API
answer count: 1
tagged with: unit-testing
has answer: http://stackoverflow.com/a/58400182
tagged with: java
type: UnansweredQuestion
tagged with: mocking

http://stackoverflow.com/q/21368999
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/32223754
has answer: http://stackoverflow.com/a/21369101
has comment: http://stackoverflow.com/comment/32223870
linked to: http://stackoverflow.com/q/13990615
has title: Junit failed tests, how to fix this?
tagged with: junit
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32223748
accepted answer: http://stackoverflow.com/a/21369101
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32223843
score: 1
possible better answer: http://stackoverflow.com/a/21369079
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21369076
has answer: http://stackoverflow.com/a/21369079
has answer: http://stackoverflow.com/a/21369087
has body: So I'm tesing using Junit, quite new to it. I am trying to test methods in a class called SetOfUsers as follows: @Test public void testFindUserByName() { System.out.println("findUserByName"); String name = ""; SetOfUsers instance = new SetOfUsers(); User expResult = null; User result = instance.findUserByName(name); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. } So I wanted to check the name of a user entered in Bob for instance in the name string like this String name = "Bob"; since I have a user called Bob in the setOfUsers class. The output window displays this message Failed: expected:&lt;null&gt; but was:&lt;Staff name:Bob, Staff pass:abc123&gt; What can I do to make this a pass?

http://stackoverflow.com/a/21422329
answers question: http://stackoverflow.com/q/21421790
has comment: http://stackoverflow.com/comment/101795793
has comment: http://stackoverflow.com/comment/93728589
type: Answer
upvote count: 3
has body: If you have Utils static method like this: public static void selectTheDropDownList(WebElement dropDown,String text) { Select select = new Select(dropDown); select.selectByVisibleText(text); } and you can do like this, to select multiple options: Utils.selectTheDropDownList(dropDown,text1); Utils.selectTheDropDownList(dropDown,text2); . . . Utils.selectTheDropDownList(dropDown,textn); This should work.
score: 3
downvote count: 0

http://stackoverflow.com/comment/32463688
has text: Yes I know that... but when i run the code with a test class it works fine.. but when i run the program on the server and give it a jersey request it gives me this error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21495056
score: 0

http://stackoverflow.com/q/21468030
score: -6
downvote count: 6
has comment: http://stackoverflow.com/comment/32399844
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32399826
type: Question
has answer: http://stackoverflow.com/a/21468119
tagged with: java
has comment: http://stackoverflow.com/comment/32399820
has comment: http://stackoverflow.com/comment/32399842
answer count: 2
has title: Getting error str variable cannot be passed
upvote count: 0
has body: public static void main(String[] args) { String st = "10+300"; int result; for(int i=0;i&lt;st.length();i++) { if(st.charAt(i)=='+') { result=Integer.parseInt(st);//getting error in this line System.out.print(result); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/21468123
has comment: http://stackoverflow.com/comment/32401937
has comment: http://stackoverflow.com/comment/32400649

http://stackoverflow.com/a/21455723
downvote count: 0
score: 4
type: Answer
has body: Sure it's allowed. Connection refused just means there's nothing listening on that port, so your program isn't obviously working as it should.
upvote count: 4
answers question: http://stackoverflow.com/q/21455679

http://stackoverflow.com/comment/39983358
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21470520
has text: That is what has been suggested mate
type: AnswerComment

http://stackoverflow.com/comment/32364534
has text: Which exact class the [Processing API](http://processing.org/reference/javadoc/core/) do the apps. extend? For e.g. are they a [`PApplet`](http://processing.org/reference/javadoc/core/processing/core/PApplet.html)?
score: 0
comment on: http://stackoverflow.com/q/21447801
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32261260
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21389721
has text: @Navin: Fixed, thanks. This all comes from copy&paste, as usual.

http://stackoverflow.com/comment/32325774
type: Comment
comment on: http://stackoverflow.com/q/21417112
type: QuestionComment
has text: reading from video file
score: 0

http://stackoverflow.com/q/21438064
answer count: 2
linked to: http://stackoverflow.com/q/1197928
score: -2
tagged with: arrays
has title: How to add seconds to date elements
downvote count: 2
has answer: http://stackoverflow.com/a/21438333
accepted answer: http://stackoverflow.com/a/21438333
possible better answer: http://stackoverflow.com/a/21438368
favorite count: 0
has comment: http://stackoverflow.com/comment/32345974
tagged with: time
has comment: http://stackoverflow.com/comment/32353855
has answer: http://stackoverflow.com/a/21438368
type: AnsweredQuestion
upvote count: 0
has body: I have a date array. I want to add 20 seconds to each of the elements in the array. I tried for(int i=0i&lt;20;i++) { date1[i]=date1[i].gettime()+20; } This gives a long int value. But what i need is time format result.My question is it possible to add seconds using built in functions or manual function should be written for the same.
tagged with: java
has comment: http://stackoverflow.com/comment/32346161
has comment: http://stackoverflow.com/comment/32346009
type: Question
has comment: http://stackoverflow.com/comment/32346097

http://stackoverflow.com/comment/32467503
has text: Tip: 1) Add @MadProgrammer (or whoever - the @ is important) to *notify* them of a new comment. 2) Try testing your 'works fine' null layouts on two or more machines, in 2 or more PLAFs in a resizable GUI. 3) Don't preach to the converted. (Layouts *rule*). 4) For better help sooner, post a [Minimal Complete Tested and Readable Example](http://stackoverflow.com/help/mcve) (MCTRE).
comment on: http://stackoverflow.com/q/21503031
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21511876
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/21511910
has body: public class TestException { int m1() { try { int i = 10, j = 0; System.out.println("s1"); i = i / j; return 11; } catch (Exception e) { System.out.println("s2"); } finally { System.out.println("s3"); } System.out.println("s4"); return 2222; } public static void main(String[] args) { System.out.println(new TestException().m1()); } } O/P:- s1 s2 s3 s4 2222 Why is s3 before s4? Isn't finally called just before the method return? What am I missing here?
has comment: http://stackoverflow.com/comment/32477352
possible better answer: http://stackoverflow.com/a/21511910
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/32477318
has comment: http://stackoverflow.com/comment/32477348
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21511918
has answer: http://stackoverflow.com/a/21511923
type: Question
type: AnsweredQuestion
has title: Java exception with return
score: -2
accepted answer: http://stackoverflow.com/a/21511923

http://stackoverflow.com/a/21491789
has comment: http://stackoverflow.com/comment/32442453
has body: A client-server program like this needs to be symmetric. If you write a line on one end, you must read a line on the other end. If you write 6 bytes, then the other end must read 6 bytes. That's not the case here. The client sends a line: outToServer.writeBytes(command + '\n'); And the server reads it: String clientMsg = readIncoming.readLine(); Everything is fine until now. Then the client sends some bytes (a file name): outToServer.writeBytes(file_name); But the server reads a line: String del_file = readIncoming.readLine(); So, the server will block until the client closes the socket or sends a newline character. I'd strongly advise that you define a clear protocol, on paper, and that you use symmetric classes and methods on both ends.
answers question: http://stackoverflow.com/q/21491699
has comment: http://stackoverflow.com/comment/32442365
accepted answer of: http://stackoverflow.com/q/21491699
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32443335
type: Answer

http://stackoverflow.com/a/21479059
has comment: http://stackoverflow.com/comment/32419120
has comment: http://stackoverflow.com/comment/32418994
type: Answer
has body: You could get a random string from an array: String[] images = new String[]{"image1.png","image2.png","image3.png"}; JLabel MyImage = new JLabel(new ImageIcon( images[(int)Math.floor(Math.random()*images.length)])); Or you could get a random number for imageX.png: int imagecount = 5; JLabel MyImage = new JLabel(new ImageIcon("image" + (int)(Math.floor(Math.random()*imagescount)) + ".png"));
upvote count: 1
answers question: http://stackoverflow.com/q/21478905
score: 1
downvote count: 0

http://stackoverflow.com/q/21481953
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21482887
has body: i'm trying to get the names and IDs from database and add them to combobox. i've added this checkcombobox to my project; http://chianti.ucsd.edu/svn/csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/CheckComboBox.java by the help of this code; https://stackoverflow.com/a/17097767 ResultSet resultSet= "here getting the result set with query having a ORDER BY clause while (resultSet.next()) { int id = resultSet.getInt(1); String name = resultSet.getString(2); System.out.println(name); options.add(new Option&lt;Integer&gt;(name, id)); } system.out.println gives the output sorted by name but the items in checkcombobox are not sorted. how can i add the items sorted in combobox?
tagged with: jcombobox
score: 0
linked to: http://stackoverflow.com/q/17097704
type: Question
has title: sorting java combobox items
tagged with: java
has answer: http://stackoverflow.com/a/21482373

http://stackoverflow.com/comment/32470665
comment on: http://stackoverflow.com/a/21507298
score: 0
type: AnswerComment
type: Comment
has text: @user3234352 as i said there are too many mistakes in your code. Certainly pointed out a few that i could lay me eyes on.

http://stackoverflow.com/a/21483827
has body: If you just want to shorthand System.out.println, then have a method with return type void that accepts a string argument and inside of the method just do: System.out.println(argument)
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21483604
downvote count: 0
score: 1

http://stackoverflow.com/comment/32292094
comment on: http://stackoverflow.com/q/21406091
score: 0
type: QuestionComment
type: Comment
has text: Maybe we're getting closer with this: I don't have any `ContextLoaderListener` defined. Only listener defined is the `@WebListener`. But I think `@Configuration` is the annotation-based replacement for `ContextLoaderListener`?

http://stackoverflow.com/comment/32261185
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21389751
has text: also having this check_word.substring(0); should be this check_word.substring(i).
type: AnswerComment

http://stackoverflow.com/comment/32198720
comment on: http://stackoverflow.com/q/21355188
score: 0
type: Comment
type: QuestionComment
has text: @user2864740 but is he using only arbitrary data?

http://stackoverflow.com/comment/32471435
score: 0
type: Comment
type: AnswerComment
has text: What kind of error are you having? Will you please elaborate?
comment on: http://stackoverflow.com/a/21503203

http://stackoverflow.com/a/21499527
type: Answer
has body: NullPointer Exceptions always come up with missing initializations or wrong view element initialization. In your case you are missing to initialise datasource object (as pointed by earlier answers). A valuable advice will be always cross check your program for everything is initialised, you may also use Exception Handling for cases you are not sure, like for data coming from different source.
score: 0
answers question: http://stackoverflow.com/q/21499424

comparison
tags question: http://stackoverflow.com/q/21351284
tags question: http://stackoverflow.com/q/21372428
tag name: comparison
tags question: http://stackoverflow.com/q/21495773
type: Tag
tags question: http://stackoverflow.com/q/21489908

http://stackoverflow.com/a/21426731
type: Answer
has comment: http://stackoverflow.com/comment/32326180
has comment: http://stackoverflow.com/comment/50460936
has comment: http://stackoverflow.com/comment/32326102
accepted answer of: http://stackoverflow.com/q/21426688
answers question: http://stackoverflow.com/q/21426688
has body: In head recursion, the recursive call, when it happens, comes before other processing in the function (think of it happening at the top, or head, of the function). In tail recursion, it’s the opposite—the processing occurs before the recursive call. Choosing between the two recursive styles may seem arbitrary, but the choice can make all the difference. A function with a path with a single recursive call at the beginning of the path uses what is called head recursion. The factorial function of a previous exhibit uses head recursion. The first thing it does once it determines that recursion is needed is to call itself with the decremented parameter. A function with a single recursive call at the end of a path is using tail recursion. Refer this article Example Recursion : public void tail(int n) | public void head(int n) { | { if(n == 1) | if(n == 0) return; | return; else | else System.out.println(n); | head(n-1); | tail(n-1); | System.out.println(n); } | } If the recursive call occurs at the end of a method, it is called a tail recursion. The tail recursion is similar to a loop. The method executes all the statements before jumping into the next recursive call. If the recursive call occurs at the beginning of a method, it is called a head recursion. The method saves the state before jumping into the next recursive call.
has comment: http://stackoverflow.com/comment/32327733
has comment: http://stackoverflow.com/comment/32327061
downvote count: 3
upvote count: 73
type: AcceptedAnswer
score: 70
has comment: http://stackoverflow.com/comment/32325850

http://stackoverflow.com/comment/32432115
type: QuestionComment
comment on: http://stackoverflow.com/q/21486174
score: 0
has text: You could connect it by giving your Handler class (class names begin with capital letters -- use this) passing a reference into its parameter and using that parameter to set a field.
type: Comment

http://stackoverflow.com/comment/32238380
has text: Nah, I'm pretty sure you're problem is that it can't find the class net/sf/ezmorph/Morpher...
score: 1
comment on: http://stackoverflow.com/q/21377014
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21502062
has comment: http://stackoverflow.com/comment/32697676
score: 3
has comment: http://stackoverflow.com/comment/32698035
has comment: http://stackoverflow.com/comment/32697184
downvote count: 0
has body: "I've been reading about using cell renderer but I'm not sure that it works since I'm not creating a table. " There are different renderers for different components. JList has one and so does a JTabele You need to use a ListCellRender, which is a renderer for a JList cell. The renderer uses a Component to contain its content. With Component you can't use the next line carriage "\n", so you need to use HTML. You can see more here ListCellRenderer Here's an example, where I use a Student Object as the value for the list class Student { String name; int age; public Student(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public int getAge() { return age; } } And here is the part of the render where I set the text @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Student label = (Student) value; String name = label.getName(); int age = label.getAge(); String labelText = "&lt;html&gt;" + name + "&lt;br/&gt;" + age; setText(labelText); return this; } Here's the complete example import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.SwingUtilities; public class Test3 { JList&lt;Student&gt; list; DefaultListModel model; public Test3() { list = new JList(); model = new DefaultListModel(); for (int i = 0; i &lt; 10; i++) { model.addElement(new Student("Paul" + i, i)); } list.setModel(model); list.setCellRenderer(new MyListCellRenderer()); JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(list); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Test3(); } }); } private class MyListCellRender…
has comment: http://stackoverflow.com/comment/32697418
answers question: http://stackoverflow.com/q/21501770
type: Answer
upvote count: 3

http://stackoverflow.com/q/21455754
upvote count: 3
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27281251
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27281251
type: Question
has body: Is it possible to use CGLIB in an Android application? I'm getting a VerifyError, and it seems from Googling that this could be because it was compiled on another JDK.
score: 3
tagged with: cglib
has title: Is CGLIB usable on Android?
accepted answer: http://stackoverflow.com/a/21456359
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/21456359

database-connection
tags question: http://stackoverflow.com/q/21362562
type: Tag
tags question: http://stackoverflow.com/q/21356754
tags question: http://stackoverflow.com/q/21424607
tags question: http://stackoverflow.com/q/21457378
tags question: http://stackoverflow.com/q/21477954
tag name: database-connection

http://stackoverflow.com/comment/32280269
has text: post your current log details
comment on: http://stackoverflow.com/q/21400515
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21364798
has comment: http://stackoverflow.com/comment/32217384
has title: How to display a PNG properly on JFrame
has comment: http://stackoverflow.com/comment/32215784
has comment: http://stackoverflow.com/comment/32216032
has answer: http://stackoverflow.com/a/21365696
answer count: 1
downvote count: 0
favorite count: 0
tagged with: transparency
has comment: http://stackoverflow.com/comment/32216973
upvote count: 1
tagged with: swing
tagged with: http://stackoverflow.com/tag/png
has comment: http://stackoverflow.com/comment/32217461
accepted answer: http://stackoverflow.com/a/21365696
has comment: http://stackoverflow.com/comment/32217161
type: AnsweredQuestion
score: 1
tagged with: java
has body: How would I go about displaying a png with transparent parst on JFrame. I currently have this code and all is good, but it displays the transparent parts grey! private static void createAndShowSplashScreen() throws Exception { Image image = ImageIO.read(TCPServer.class .getResource("images/splash.png")); BufferedImage img = (BufferedImage) image; frame = new JFrame("Splash"); frame.setUndecorated(true); frame.add(new JLabel(new ImageIcon(image)) { { setOpaque(false); } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); frame.setBounds((int) (java.awt.Toolkit.getDefaultToolkit() .getScreenSize().getWidth() / 2 - img.getWidth() / 2), (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize() .getHeight() / 2 - img.getHeight() / 2), img.getWidth(), img.getHeight()); frame.setOpacity(0f); frame.setMinimumSize(frame.getPreferredSize()); frame.setVisible(true); } THX for the help! Sincerely Roberto! EDIT: IMG PROBLEM SOLVED: Image image = ImageIO.read(TCPServer.class .getResource("images/splash.png")); BufferedImage img = (BufferedImage) image; frame = new JFrame("Splash"); frame.setUndecorated(true); frame.add(new JLabel(new ImageIcon(image)) { { setOpaque(false); } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); frame.setBounds((int) (java.awt.Toolkit.getDefaultToolkit() .getScreenSize().getWidth() / 2 - img.getWidth() / 2), (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize() .getHeight() / 2 - img.getHeight() / 2), img.getWidth(), img.getHeight()); RoundRectangle2D r = new RoundRectangle2D.Double(0, 0, img.getWidth(), img.getHeight(), 25, 25); frame.setShape(r); frame.setOpacity(0f); frame.setMinimumSize(frame.getPreferredSize()); frame.setVisible(true);
has comment: http://stackoverflow.com/comment/32216927
type: Question

http://stackoverflow.com/a/21504547
has body: In the actionPerformed for the previousButton and nextButton you need to check what the current bookIndex is before you decrement or increment, respectively. In the case of previousButton, if the current bookIndex == 0, set the bookIndex to inventoryBook.length-1 instead of decrementing. For the nextButton, if the bookIndex == inventoryBook.length-1, set bookIndex to 0 instead of incrementing. So for nextButton: JButton nextButton = new JButton("Next"); buttonPanel.add(nextButton); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(bookIndex == inventoryBook.length - 1) { bookIndex = 0; } else { bookIndex = bookIndex + 1; } prepareDisplay(inventoryBook[bookIndex], textArea); } });
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21504480
type: Answer
answers question: http://stackoverflow.com/q/21504480
upvote count: 1

google-maps-api-3
tags question: http://stackoverflow.com/q/21423359
tag name: google-maps-api-3
type: Tag

http://stackoverflow.com/comment/32302369
has text: @Gem Thanks, that totally slipped past. It works now! Atleast I think it works, we'll see in 2 minutes when it is past 19:00 :)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21412905

http://stackoverflow.com/comment/32405289
has text: i think the thing that owns and initiates the crawler should be writing to the database. you have ui; there's a database. classic layering says there is a controller in the middle. that's what i'm talking about.
type: Comment
comment on: http://stackoverflow.com/a/21470561
score: 0
type: AnswerComment

http://stackoverflow.com/a/21429137
has comment: http://stackoverflow.com/comment/32330178
has body: String.class is a literal that represents the String class which is of type Class&lt;String&gt;. getDeclaredField() is a method defined on the class Class. see also: What is a class literal in Java? The literals are defined in the Java Language Specification 15.8.2
has comment: http://stackoverflow.com/comment/32330042
has comment: http://stackoverflow.com/comment/32329969
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21429085
has comment: http://stackoverflow.com/comment/32330636
answers question: http://stackoverflow.com/q/21429085
type: Answer
score: 1
upvote count: 1

robotium
tags question: http://stackoverflow.com/q/21479646
tags question: http://stackoverflow.com/q/21451222
type: Tag
tags question: http://stackoverflow.com/q/21406751
tags question: http://stackoverflow.com/q/21476144
tag name: robotium
tags question: http://stackoverflow.com/q/21450645

http://stackoverflow.com/a/21406201
has body: List_Of_Array.remove(index); then update it notifyDataSetChanged();
answers question: http://stackoverflow.com/q/21405928
score: 0
type: Answer

http://stackoverflow.com/q/21372724
type: Question
tagged with: freeze
answer count: 1
has comment: http://stackoverflow.com/comment/32230654
score: 0
linked to: http://stackoverflow.com/q/25385173
tagged with: java
accepted answer: http://stackoverflow.com/a/21373100
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32231002
has title: Why does the java program freeze on 113882?
has body: I wrote a java program that finds the length of the chain of a number using the collatz sequence. The collatz sequence goes: if the number is even, divide it by two, if odd, multiply by 3 and add one. The sequence ends when the number reaches 1. Additional Info on Collatz Sequence. My program finds the chain length of the numbers from 1 to 1 million, but it stops at 113382. No error message is displayed, the program just stops printing out numbers. *edit: I have tested it, and it turns out that when the program is on 113383, the chain converges to negative values. Can anyone explain this? I have included the full code, as it is very short. public static void main(String[] args) { int max =0, maxChain=0; for(int i = 2; i &lt;1000000; i++ ) { int c =i; int counter = 0; while(c != 1) { if(c%2 ==0) c/=2; else c= 3*c+1; counter++; } if(counter &gt; maxChain) { maxChain =counter; max = i; } System.out.println(i); } System.out.println(max +" has a chain length of " +maxChain); }
tagged with: collatz
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32231103
has answer: http://stackoverflow.com/a/21373100
favorite count: 0
has comment: http://stackoverflow.com/comment/57875450

http://stackoverflow.com/a/21419100
has comment: http://stackoverflow.com/comment/32313418
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21418760
score: 4
has comment: http://stackoverflow.com/comment/32313161
type: Answer
has body: Don't use String#replaceAll in this case if there is slight chance part you will replace your string contains substring that you will want to replace later, like "distance" contains a and if you will want to replace a later with "velocity" you will end up with "disvelocityance". It can be same problem as if you would like to replace A with B and B with A. For this kind of text manipulation you can use appendReplacement and appendTail from Matcher class. Here is example String input = "((a+b)/(c+(d*e)))"; Map&lt;String, String&gt; replacementsMap = new HashMap&lt;&gt;(); replacementsMap.put("a", "velocity"); replacementsMap.put("b", "distance"); replacementsMap.put("c", "time"); StringBuffer sb = new StringBuffer(); Pattern p = Pattern.compile("\\b(a|b|c)\\b"); Matcher m = p.matcher(input); while (m.find()) m.appendReplacement(sb, replacementsMap.get(m.group())); m.appendTail(sb); System.out.println(sb); Output: ((velocity+distance)/(time+(d*e))) This code will try to find each occurrence of a or b or c which isn't part of some word (it doesn't have any character before or after it - done with help of \b which represents word boundaries). appendReplacement is method which will append to StringBuffer text from last match (or from beginning if it is first match) but will replace found match with new word (I get replacement from Map). appendTail will put to StringBuilder text after last match. Also to make this code more dynamic, regex should be generated automatically based on keys used in Map. You can use this code to do it StringBuilder regexBuilder = new StringBuilder("\\b("); for (String word:replacementsMap.keySet()) regexBuilder.append(Pattern.quote(word)).append('|'); regexBuilder.deleteCharAt(regexBuilder.length()-1);//lets remove last "|" regexBuilder.append(")\\b"); String regex = regexBuilder.toString();
has comment: http://stackoverflow.com/comment/32313321
has comment: http://stackoverflow.com/comment/32312991

http://stackoverflow.com/comment/32306835
type: Comment
has text: <routes> <vType id="Default" accel="2.6" decel="4.5" sigma="0.5" length="5" maxSpeed="70" />
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21415533

http://stackoverflow.com/comment/32276173
has text: Nope, I don't intend to change to Number because it's a rule I have to follow - I have to use both Float and Integer respectively.
comment on: http://stackoverflow.com/a/21397919
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32389235
has text: From the same domain `window.open("","Win2").close()`
score: 0
comment on: http://stackoverflow.com/q/21462385
type: Comment
type: QuestionComment

http://stackoverflow.com/a/63225854
answers question: http://stackoverflow.com/q/21437788
score: 0
has body: Try something like this: Subtracting the ASCII code of the '0' character from your character returns an integer: public class StringRecursion { static int counter = 0; public static void main(String[] args) { System.out.println(convertStringToInt("123456")); } public static int convertStringToInt(String input) { if (input.length() == 1) return input.charAt(0) - '0'; int value = convertStringToInt(input.substring(0, input.length() - 1)); counter++; return value * 10 + input.charAt(counter) - '0'; } }
type: Answer

http://stackoverflow.com/q/21391193
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21391283
tagged with: eclipse
type: Question
tagged with: filenotfoundexception
answer count: 2
has comment: http://stackoverflow.com/comment/32264228
has answer: http://stackoverflow.com/a/21392323
has body: I have learned Java for about a month and am currently learning I/O of Java but I have encountered some problems. Below is a simply toy code to practice with the Inputstream. import java.io.*; public class IOTest{ public static void main(String[] args) throws IOException{ InputStream in; in = new FileInputStream(args[0]); int total = 0; while (in.read() != -1) total++; System.out.println(total + " bytes"); } } The above code compiles Okay. The purpose of this code is to simply calculate how many bytes in the arguments. However, when I run the compiled code with arguments, for example: java IOTest firstTrial The system gives the following Exception message: Exception in thread "main" java.io.FileNotFoundException: firstTrial &lt;The system cannot find the file specified&gt; at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;&lt;Unknown Source&gt; at java.io.FileInputStream.&lt;init&gt;&lt;Unknown Source&gt; at IOTest.main&lt;IOTest.java:8&gt; Please help point out how was the exception thrown? One extra question is I am using Eclipse for java programming. What is the End-of-Input character in Eclipse for Java? Thanks
has title: Unexpected FileNotFoundException
score: 0
has comment: http://stackoverflow.com/comment/32263986
has comment: http://stackoverflow.com/comment/32263900

http://stackoverflow.com/comment/32452588
comment on: http://stackoverflow.com/q/21497056
type: QuestionComment
type: Comment
score: 0
has text: I dont have seperate interface defined but I also dont think it should be an issue. Is this correct?

http://stackoverflow.com/comment/32220511
type: QuestionComment
has text: it is mentioned on their website http://rxtx.qbang.org/wiki/index.php/Installation_for_Windows
comment on: http://stackoverflow.com/q/21366825
score: 0
type: Comment

http://stackoverflow.com/a/21482444
upvote count: 3
has comment: http://stackoverflow.com/comment/32424346
downvote count: 0
answers question: http://stackoverflow.com/q/21482363
has body: If it's about the Java class java.util.HashMap&lt;K,V&gt; you cannot, because boolean is a primitive type. You need to use classes such as Boolean
has comment: http://stackoverflow.com/comment/32424428
has comment: http://stackoverflow.com/comment/32424393
has comment: http://stackoverflow.com/comment/32424303
type: Answer
score: 3

http://stackoverflow.com/a/21499766
accepted answer of: http://stackoverflow.com/q/21499695
answers question: http://stackoverflow.com/q/21499695
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The error message says that it's looking for Hello.jsp. And indeed, your controller returns the following view name: "Hello". But your screenshot shows that your file is naled hello.jsp. The case matters.
score: 7

http://stackoverflow.com/comment/32242665
score: 0
type: Comment
has text: ` System.out.println("Enter The Number you want:<0 - 8> "); number = in.nextInt(); try { number = in.nextInt(); if(number >= 8) { number = 8; } else if (number <= 0) { number = 0; } } catch (InputMismatchException e) { System.out.println("Enter a number please"); }` Ran it again and the command line said "Exception in thread "main" java.util.InputMismatchException" etc.
type: AnswerComment
comment on: http://stackoverflow.com/a/21378949

http://stackoverflow.com/a/21438153
answers question: http://stackoverflow.com/q/21422702
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42946280
score: 1
has body: Yes. I'd start with one of the GDK Sneak Peek sample projects and make sure you can install one of those and launch it. You can even change the voice command from "start to stopwatch" to "release the hounds" or something and check that that works. The way glassware launches is different from conventional Android apps, so your manifest file will need to be different. Here's the official documentation: https://developers.google.com/glass/develop/gdk/input/voice#starting_glassware
accepted answer of: http://stackoverflow.com/q/21422702

http://stackoverflow.com/comment/38195445
type: Comment
score: 1
type: AnswerComment
has text: you are doing something wrong or something is missing. you must follow all these steps or else it does not work. Also when you set shemes, you must separate them by creating new data in intent filter for each sheme. Maybe you created one data in your intent filter for all sms, mms, smsto,mmsto shemes, instead of creating 4 data and setting only one sheme in each of it.
comment on: http://stackoverflow.com/a/21887612

http://stackoverflow.com/comment/32494148
type: AnswerComment
has text: findElements(), method does not throw an exception if no such element exists on page and it returns a list of all matching elements found. So if the size of list returned is > 0, it means your element is present on page. After this you can check whether that element is displayed on page or not. This way you will not get the exception you were getting earlier. size() is method of java List class. Make correct import : import java.util.List;
type: Comment
comment on: http://stackoverflow.com/a/21512125
score: 1

http://stackoverflow.com/q/21369188
score: 0
tagged with: java
type: Question
has title: How to insert the first element in a doubly linked list in Java
answer count: 2
has body: I've been looking at various posts, but I can't seem to figure this out - How do you insert an element into an empty doubly linked list? (I can't visualize an empty DLL.) I want to read things from a file and insert them into a DLL, and I also have a method to add the objects to help with this. public void add(ListNode prev, Object object, ListNode next){ ListNode newNode = new ListNode(prev, object, next); prev.setNext(newNode); newNode.setPrevious(prev); newNode.setNext(next); next.setPrevious(newNode); } In my method where I read the objects and insert them, int currNum = scanner.nextInt(); DoublyLL dll = new DoublyLL(); ListNode curr = dll.getFirst(); //start at beginning of list ListNode prev = null; if(curr == null){ //if the list is empty ListNode first = new ListNode(curr, currNum, null); dll.getFirst().setValue(first); //returns a null-pointer exception } The last line makes a null-pointer exception. So how do you insert the first element? Do you use add()? Thanks for the help.
tagged with: doubly-linked-list
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21369250
has answer: http://stackoverflow.com/a/21369385

http://stackoverflow.com/q/21457355
tagged with: hibernate-batch-updates
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21457692
has answer: http://stackoverflow.com/a/21457483
tagged with: exception
has title: HQL - update query is not woring
has comment: http://stackoverflow.com/comment/32380248
possible better answer: http://stackoverflow.com/a/21457483
has answer: http://stackoverflow.com/a/21463740
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32380516
has body: I have done the Hibernate implementation.Here is a code related to update function. Query updateQuery = session.createQuery(" update User set registered = '1' " + " where user_activation_key = '"+userUUID+"'"); int result = updateQuery.executeUpdate(); session.getTransaction().commit(); I'm getting this exception Exception in thread "main" org.hibernate.QueryException: query must begin with SELECT or FROM: update [ update com.shop.domain.User set registered = '1' where user_activation_key = '04c42f1c-a55d-49cd-8bde-8d340f054d76'] at org.hibernate.QueryException.generateQueryException(QueryException.java:137) at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120) at org.hibernate.hql.internal.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:247) at org.hibernate.hql.internal.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:209) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1796) at com.shop.service.ORMService.isUserAvailable(ORMService.java:56) at com.shop.service.ORMService.activateUserAccount(ORMService.java:39) at com.shop.web.controller.Test.main(Test.java:10) Caused by: org.hibernate.QueryException: query must begin with SELECT or FROM: update at org.hibernate.hql.internal.classic.ClauseParser.token(ClauseParser.java:104) at org.hibernate.hql.internal.classic.PreprocessingParser.token(PreprocessingParser.java:131) at org.hibernate.hql.internal.classic.ParserHelper.parse(ParserHelper.java:61) at org.hibernate.hql.internal.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:…
type: Question
has answer: http://stackoverflow.com/a/21457692

http://stackoverflow.com/a/21505682
answers question: http://stackoverflow.com/q/21505651
score: 0
type: Answer
has body: Have the program search for the first "..", while loop it, save everything until it reaches the second "..".

http://stackoverflow.com/comment/32392099
comment on: http://stackoverflow.com/q/21463777
type: Comment
type: QuestionComment
score: 1
has text: No, `cursor.getCount()` gives you the number of rows.

http://stackoverflow.com/a/21362006
downvote count: 0
has comment: http://stackoverflow.com/comment/32210867
has comment: http://stackoverflow.com/comment/32211560
has comment: http://stackoverflow.com/comment/32210880
type: Answer
has comment: http://stackoverflow.com/comment/32211611
upvote count: 7
has comment: http://stackoverflow.com/comment/32210923
has comment: http://stackoverflow.com/comment/32210910
has body: This is the project structure Try with this Update public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); return; } System.out.println("MySQL JDBC Driver Registered!"); Connection connection = null; try { connection = DriverManager .getConnection("jdbc:mysql://localhost:3306/testspring","root", "password"); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } if (connection != null) { System.out.println("You made it, take control your database now!"); } else { System.out.println("Failed to make connection!"); } } It is working for me I downloaded jar from Java2s.com Refer
score: 7
answers question: http://stackoverflow.com/q/21361781
has comment: http://stackoverflow.com/comment/32211057
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21361781

http://stackoverflow.com/comment/32359175
type: Comment
type: QuestionComment
has text: It doesn't need to, I just expected java to be modern enough to be able to process an array rather than looping/doing multiline replacements. String replacement and substitution is quite a common task, so.
score: 0
comment on: http://stackoverflow.com/q/21445022

http://stackoverflow.com/q/21496854
has title: RuntimeException: Unable to start activity ComponentInfo{}: java.lang.NullPointerException. Android
accepted answer: http://stackoverflow.com/a/21496902
score: 0
answer count: 2
tagged with: sqlite
has answer: http://stackoverflow.com/a/21497275
has comment: http://stackoverflow.com/comment/32450727
tagged with: android
possible better answer: http://stackoverflow.com/a/21497275
has comment: http://stackoverflow.com/comment/32450708
has body: i am trying to read values from a SQLlite database in to a list view. i have done the code, it has no error, but during the run time i get the error saying.... FATAL EXCEPTION: main 02-01 15:40:31.397: E/AndroidRuntime(10663): java.lang.RuntimeException: Unable to start activity ComponentInfo{lk.adspace.jaffnadb/lk.adspace.jaffnadb.MainActivity}: java.lang.NullPointerException can anyone help me to fix this error please. Dbhandler.java file package lk.adspace.jaffnadb; import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class Dbhandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "jaffnatempletest"; // Temple table name private static final String TABLE_TEMPLE = "templ"; // Contacts Table Columns names private static final String KEY_ID = "id"; private static final String KEY_TMPNAME = "temple_name"; private static final String KEY_TMPTYPE = "temple_type"; private static final String KEY_LATITUDE = "latitude"; private static final String KEY_LONGITUDE = "longitude"; private static final String KEY_IMGNAME = "image_name"; private static final String KEY_YEARBUILD = "year_build"; private static final String KEY_ADDRESS = "address"; private static final String KEY_CITY = "city"; private static final String KEY_EMAIL = "email"; private static final String KEY_WEB = "website"; private static final String KEY_TEL1 = "telephone1"; private static final String KEY_TEL2 = "telephone2"; private static final String KEY_DESCRI = "Description"; private final ArrayList&lt;kovil&gt; temple_list = new ArrayList&lt;kovil&gt;(); public Dbhandler (Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { Str…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21496902
has comment: http://stackoverflow.com/comment/32450823
tagged with: java
has comment: http://stackoverflow.com/comment/32450554
type: Question

http://stackoverflow.com/comment/32277717
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21397830
has text: Please update your post with requested information.
score: 0

http://stackoverflow.com/q/21437819
tagged with: eclipse-rcp
score: 2
accepted answer: http://stackoverflow.com/a/21438048
has body: OS X 10.7.5, Eclipse 4.3 Kepler build ID 20130919-0819, Java 1.7.0_51 I'm following along the Vogel tutorial, and I've hit a snag that I can't figure out. I'm in the section covering commands and handlers menu items, etc. I've created the five commands and handlers that he suggests, but one of them, Exit, does not show up on in my menu. I have the two top-level menus, File and Edit, and Edit contains all three of the entries that it's supposed to. The File menu, however, has only the Save entry. AFAICT (and I've looked it over many times) all of my entries are as the tutorial suggests. I looked at the XMI view, and everything there looks ok, by which I mean that there's nothing obviously different with the Exit entries compared to those for Save. If I start with an empty File menu and try to add Exit (leaving out the Save), the entire File menu does not appear on the menu bar. Can you suggest what might be wrong, or what to look for? tia, g
answer count: 1
downvote count: 0
favorite count: 0
tagged with: e4
upvote count: 2
tagged with: menuitem
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21438048
type: Question
has title: Eclipse 4 RCP Vogel tutorial: Exit menu item does not appear

http://stackoverflow.com/q/21457615
answer count: 2
has body: I have two internalframes Operation and showOperation inside one JFrame, I would like to know how to update showOperation after making things of Operation, for example: i have tried this showOperation.repaint(); but doesn' t works, i have tried also showOperation.dispose(); and after showOperation.setVisible(true); but doesn' t works how i can update this internalframe? more details, i have this class public class ShowAssistance { public static JInternalFrame frame = new JInternalFrame(); . . . public ShowAssistance() { showProducts(); } public void showProducts(){ //add the internalframe to the mainframe of the application as explained above mainFrame.getframe().add(frame); } and this class when i use to update the internalframe public class update{ update(){ showMeUpdate(); } public void showMeUpdate(){ //after some operations i do ShowAssistance.frame.repaint(); }
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/32380674
tagged with: java
has title: Update a JInternalFrame
type: AnsweredQuestion
upvote count: 0
tagged with: frame
favorite count: 0
has answer: http://stackoverflow.com/a/21457700
type: Question
accepted answer: http://stackoverflow.com/a/21457700
possible better answer: http://stackoverflow.com/a/21457774
score: -1
has comment: http://stackoverflow.com/comment/32381256
has answer: http://stackoverflow.com/a/21457774

http://stackoverflow.com/q/21403434
answer count: 1
score: 0
has body: Preamble: I was trying to save swt ImageData to a gif file but it was throwing "unsupported color depth". I decided to convert the org.eclipse.swt.graphics.ImageData to java.awt.image.BufferedImage and it works fine until I started using transparency. Issue: Transparent pixels are not being handled correctly instead they are colored with last foreground color used when painting the GC. I noticed this undesired effect was down to this line in my code. ImageIO.write(bufferedImage, "gif", file); After doing some web searches I found out that the issue has been resolved in JDK 7 http://ubuntuforums.org/archive/index.php/t-1060128.html The problem is I have to use Java 6 not 7. Can anyone kindly tell me how this can be achieved?
has answer: http://stackoverflow.com/a/21584307
type: UnansweredQuestion
tagged with: swt
type: Question
has title: Issues with transparency in a GIF file using ImageIO write function
tagged with: java

http://stackoverflow.com/comment/32365474
has text: I found the error, I was acctually getting this as the file string /Users/ossama/Projects/Pi/javafx/prayertime/backgroundgreen-wallpaper.jpg where as it should be /Users/ossama/Projects/Pi/javafx/prayertime/background/green-wallpaper.jpg missing "/"
comment on: http://stackoverflow.com/q/21442452
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32261059
type: Comment
type: QuestionComment
has text: my personList is of type Person
comment on: http://stackoverflow.com/q/21389654
score: 0

http://stackoverflow.com/q/21388255
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
has body: I'm attempting to add 3 JSliders to a java swing application, such that the total value across the three sliders always adds up to 100. Each slider is a probability, slider A is the probability of adding a value to a queue, slider B is the probability of removing a value from a queue, and slider C is the probability of nothing happening. Example: Slider A is set to 40, Slider B is set to 40, and slider C is set to 20 initially. If the user changes Slider A to 50 I want the values of Slider B and C to both decrease by 5. Such that the total is still 100. I understand that there may be some issues when the user changes the value to say, 41, because I'd like the other values to remain as whole integers. Ok, so I've added some code, after reviewing some information concerning BoundedRangeModel. I've managed to get the sliders to change based on the otherse, but I'm still unsure as to how I can implement there initial values. Also, the sliders are only seeming to work in pairs, as opposed to a group of 3. I'll keep working on it and if I come up with a solution that I'm satisfied with using this method I'll post it here. package stackoverflow; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.BoundedRangeModel; import javax.swing.DefaultBoundedRangeModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Controller { public static void main(String[] args) { //GUI up Frame f = new Frame(); f.setSize(600, 600); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } @SuppressWarnings("serial") public static class Frame extends JFrame implements PropertyChangeListener, ChangeListener { //Sliders private JSlider s1; private JSlider s2; private JSlider s3; //Init…
has comment: http://stackoverflow.com/comment/32258868
upvote count: 3
has answer: http://stackoverflow.com/a/21391448
accepted answer: http://stackoverflow.com/a/21391448
has comment: http://stackoverflow.com/comment/32267296
answer count: 1
has comment: http://stackoverflow.com/comment/32259413
has comment: http://stackoverflow.com/comment/32261732
favorite count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/32258751
has title: Multiple JSliders reacting to each other to always equal 100 percent

http://stackoverflow.com/comment/32201392
comment on: http://stackoverflow.com/q/21356676
score: 5
has text: It means what it says.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32367763
type: Comment
type: QuestionComment
has text: Is your problem get solved?
comment on: http://stackoverflow.com/q/21448833
score: 0

http://stackoverflow.com/a/21502834
answers question: http://stackoverflow.com/q/21502382
score: 1
upvote count: 1
downvote count: 0
has body: After more research I don't think is is possible to do it in pure JQL (or more generally in SQL), it needs a first loop to generate the WHERE conditions. So I ended up using Criteria API (just discovered) : Set&lt;Style&gt; releaseStyles = em.find(Release.class, release_id).getStyles(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Release&gt; query = cb.createQuery(Release.class); Root&lt;Release&gt; root = query.from(Release.class); List&lt;Predicate&gt; predicates = new ArrayList&lt;Predicate&gt;(); Expression&lt;Integer&gt; key = root.get("id"); Expression&lt;Set&lt;Style&gt;&gt; field = root.get("styles"); for (Style style : releaseStyles) { predicates.add(cb.isMember(cb.literal(style), field)); } query.select(root).where(cb.and( cb.or(predicates.toArray(new Predicate[0])), cb.notEqual(key, release_id) )); query.distinct(true); query.groupBy(key); return em.createQuery(query).getResultList();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21502382
type: Answer

http://stackoverflow.com/comment/32326452
score: 0
type: AnswerComment
has text: What do you mean by having it locally? The message says you are accessing Maven central. Ok. For a overlay this is a different story which you didn't mentioned.
type: Comment
comment on: http://stackoverflow.com/a/21427031

http://stackoverflow.com/comment/32228921
type: QuestionComment
comment on: http://stackoverflow.com/q/21371516
has text: Why do you have a file that contains both layout code (`FrameLayout`) and menu code (`menu`)? Those are completely different things.
score: 0
type: Comment

http://stackoverflow.com/q/21501651
has comment: http://stackoverflow.com/comment/32459232
tagged with: java
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32459441
tagged with: camera
accepted answer: http://stackoverflow.com/a/21501879
has comment: http://stackoverflow.com/comment/32459300
has comment: http://stackoverflow.com/comment/32459170
has title: Is it possible to extend the Android Camera class?
has comment: http://stackoverflow.com/comment/32459098
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32459249
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32459246
has body: I am struggling to extend the android.hardware.Camera class. My problem is that when I try to call the constructor I am having problems with the visibility. So I am wondering whether it is possible at all to do something like this: import android.hardware.Camera public class MyCamera extends Camera { public MyCamera(Context context) { super(context); } }
tagged with: extends
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21501879

http://stackoverflow.com/comment/32218094
comment on: http://stackoverflow.com/a/21366147
type: AnswerComment
score: 0
type: Comment
has text: Ok so only a few of the, say they woke up because they are notified before they even went to the wait-set?

http://stackoverflow.com/comment/32473865
score: 1
comment on: http://stackoverflow.com/q/21509560
has text: u nee the wakelock permission in you manifest <uses-permission android:name="android.permission.WAKE_LOCK" />
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21426843
answer count: 10
has answer: http://stackoverflow.com/a/61618504
favorite count: 0
has answer: http://stackoverflow.com/a/51152724
upvote count: 172
has answer: http://stackoverflow.com/a/64674044
has answer: http://stackoverflow.com/a/72500570
score: 171
tagged with: java-8
possible better answer: http://stackoverflow.com/a/32986329
accepted answer: http://stackoverflow.com/a/21441634
linked to: http://stackoverflow.com/q/27547519
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32986329
tagged with: list
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/45954796
linked to: http://stackoverflow.com/q/55490332
has answer: http://stackoverflow.com/a/68295391
has answer: http://stackoverflow.com/a/76896422
has comment: http://stackoverflow.com/comment/32606762
downvote count: 1
type: Question
has title: Get last element of Stream/List in a one-liner
has comment: http://stackoverflow.com/comment/46616936
linked to: http://stackoverflow.com/q/49520234
has comment: http://stackoverflow.com/comment/49405615
has answer: http://stackoverflow.com/a/21441634
linked to: http://stackoverflow.com/q/24010109
linked to: http://stackoverflow.com/q/36711845
has body: How can I get the last element of a stream or list in the following code? Where data.careas is a List&lt;CArea&gt;: CArea first = data.careas.stream() .filter(c -&gt; c.bbox.orientationHorizontal).findFirst().get(); CArea last = data.careas.stream() .filter(c -&gt; c.bbox.orientationHorizontal) .collect(Collectors.toList()).; //how to? As you can see getting the first element, with a certain filter, is not hard. However getting the last element in a one-liner is a real pain: It seems I cannot obtain it directly from a Stream. (It would only make sense for finite streams) It also seems that you cannot get things like first() and last() from the List interface, which is really a pain. I do not see any argument for not providing a first() and last() method in the List interface, as the elements in there, are ordered, and moreover the size is known. But as per the original answer: How to get the last element of a finite Stream? Personally, this is the closest I could get: int lastIndex = data.careas.stream() .filter(c -&gt; c.bbox.orientationHorizontal) .mapToInt(c -&gt; data.careas.indexOf(c)).max().getAsInt(); CArea last = data.careas.get(lastIndex); However it does involve, using an indexOf on every element, which is most likely not you generally want as it can impair performance.
has answer: http://stackoverflow.com/a/56028497

http://stackoverflow.com/comment/32466050
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21502044
has text: Does your device have a hardware menu key? If so, I believe this may be your confusion. Normally, the overflow menu appears in the action bar. On devices with a hardware menu key, the overflow menu pops up from the bottom of the screen.

http://stackoverflow.com/comment/32300483
score: 1
comment on: http://stackoverflow.com/q/21412015
type: QuestionComment
type: Comment
has text: You might want to look into implementing a CursorAdapter - or using a SimpleCursorAdapter instead.

http://stackoverflow.com/comment/32718907
comment on: http://stackoverflow.com/a/21514369
has text: You should put a breakpoint inside your calculateClickListener() and step through it. http://developer.android.com/tools/debugging/debugging-projects.html#tools
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32430431
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2088299/what-is-the-difference-between-local-and-instance-variables-in-java
score: 0
comment on: http://stackoverflow.com/q/21485651

http://stackoverflow.com/comment/32471005
has text: It certainly qualifies ... according to the OP's requirements.
comment on: http://stackoverflow.com/a/21507948
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32478100
has text: Sorry my mistake , modified the ques again ... added code for ValidateRule1 ... which has Start , End Messages , Let me know if any doubts
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21511978
score: 0

http://stackoverflow.com/comment/32288030
score: 0
has text: Also, can you call out where line 371 is?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21405134

http://stackoverflow.com/q/21374719
has comment: http://stackoverflow.com/comment/32234431
score: 0
has title: JAVA: Execute external program which are packaged in a jar file
has comment: http://stackoverflow.com/comment/32235551
has body: I have a jar file, in which there is a external program inside it. That means in the jar's implementation, it puts the external program into its resources folder, and there is a function call the program using Process class. I am using the jar and try to call this function which encapsulates the program. But got below error: Exception in thread "main" java.io.IOException: Cannot run program "file:/C:/Data/Work/workspace/keytool/lib/baseutil-1.0.0-SNAPSHOT.jar!/decode.exe": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) Your help are great appreciated. EDIT: the method calling the file in the jar: public String retrive(String dmidecode) throws Exception { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; options.length; i++) { Process process = new ProcessBuilder(dmidecode, "-s", options[i]).start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; sb.append(options[i]); sb.append("="); while ((line = br.readLine()) != null) { sb.append(line); } sb.append("\n"); } return sb.toString(); }
has comment: http://stackoverflow.com/comment/32235215
has comment: http://stackoverflow.com/comment/32234393
has comment: http://stackoverflow.com/comment/32234117
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32234700
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32234515
type: Question
has comment: http://stackoverflow.com/comment/32234949
has comment: http://stackoverflow.com/comment/32234375

http://stackoverflow.com/q/21463135
type: Question
has comment: http://stackoverflow.com/comment/32391361
has answer: http://stackoverflow.com/a/21463221
has title: outOfMemory Exception while re-encoding image
upvote count: 3
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21463359
accepted answer: http://stackoverflow.com/a/21463359
tagged with: android
has comment: http://stackoverflow.com/comment/32392469
has comment: http://stackoverflow.com/comment/32390963
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/21463221
has comment: http://stackoverflow.com/comment/32391868
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32391065
has answer: http://stackoverflow.com/a/21463678
tagged with: filestream
has body: I'm trying to encode an image to 64 base , after choosing the image from gallery and trying to save it I am getting this error: outOfMemory Exception can any one suggest how to to get this image to base 64 without memory error? MotorImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); // ImageView imageView = (ImageView) findViewById(R.id.imageView1); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); String imageString = null; try { Bitmap bm = BitmapFactory.decodeFile(picturePath); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object bm.recycle(); byte[] b = baos.toByteArray(); imageString = Base64.encodeToString(b, Base64.DEFAULT); } catch (Exception e) { e.printStackTrace(); } Toast.makeText(getApplicationContext(), imageString, Toast.LENGTH_SHORT).show();
has comment: http://stackoverflow.com/comment/32392026

http://stackoverflow.com/a/21477978
upvote count: 2
has body: I am assuming that you are getting this input via an EditText widget. So inside the layout of the XML file you can add the following properties by which it will receive only specified characters. : android:digits="abcdefghijklmnopqrstuvwxyz0123456789,.-@_" note that it wont allow any capital letter. just add any digits/keys you want your user to be able to enter. If you are not worried about the patterns and number of occurrence of any character then you don't even need any regex. Hope it helps
answers question: http://stackoverflow.com/q/21477682
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/32311648
type: Comment
type: QuestionComment
has text: @noMad When the program is run and if a file is specified by the client, the file gets uploaded to the server. If there is nothing in the `byte[]` for the `bis` to read how is the file getting uploaded? Thoroughly confused here...
score: 0
comment on: http://stackoverflow.com/q/21417214

http://stackoverflow.com/comment/32444131
comment on: http://stackoverflow.com/q/21493068
type: Comment
type: QuestionComment
has text: Please give us the input that gives you this error.
score: 1

http://stackoverflow.com/a/21439555
type: Answer
accepted answer of: http://stackoverflow.com/q/21439355
upvote count: 7
has body: Now, what is the problem? Well, if the running thread isn't waiting, he won't see any notifications (i.e. notify() calls), therefore he may run into a dead lock and not handle the tasks he received! Right. This is not a case of being "unreliable" but rather a case of language definition. The notify() call does not queue up notifications. If no threads are waiting then the notify() will effectively do nothing. can it be done easier? Yes. I'd look into using BlockingQueue -- a LinkedBlockingQueue should work well for you. One thread call pull from the queue and the other can add to it. It will take care of the locking and signaling for you. You should be be able to remove a large portion of your hand written code once you start using it.
has comment: http://stackoverflow.com/comment/32348692
score: 7
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21439355

http://stackoverflow.com/comment/32477949
has text: @TonyHopkinson I didn't even think that `string` could have been a variable, rather than referring to the class `String`. Maybe this is an entry for code obfuscation?
comment on: http://stackoverflow.com/q/21505969
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21459227
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21458749
has body: IllegalArgumentException can be caught when sanitizing a user input based on criteria known only in the throwing method. It is a more subjective notion, and therefore I sometime catch it. null you can always test yourself.

http://stackoverflow.com/comment/32331486
type: QuestionComment
comment on: http://stackoverflow.com/q/21428588
has text: @maartinus: This is the error I am getting javax.el.PropertyNotFoundException: Property 'firstName' not found on type java.lang.Integer
score: 0
type: Comment

http://stackoverflow.com/comment/32298624
type: QuestionComment
has text: You do not want to use inner classes. Using inner classes has many, many 'gotchas'. I avoid them if at all possible.
comment on: http://stackoverflow.com/q/21410967
score: 0
type: Comment

http://stackoverflow.com/a/21359038
answers question: http://stackoverflow.com/q/21359033
has comment: http://stackoverflow.com/comment/32206007
has body: Change this Random r = new Random(); to r = new Random(); You were previously initializing a different local variable that has a name that shadows your instance field. Your instance field was therefore initialized to a default value of null. When you tried to use it in one of your methods, it was still null and gave you a NullPointException when you tried to dereference it to invoke a method.
score: 1
accepted answer of: http://stackoverflow.com/q/21359033
upvote count: 1
has comment: http://stackoverflow.com/comment/107831592
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32206031
type: Answer

bufferedwriter
tags question: http://stackoverflow.com/q/21397090
tags question: http://stackoverflow.com/q/21412668
tags question: http://stackoverflow.com/q/21437838
tag name: bufferedwriter
tags question: http://stackoverflow.com/q/21511968
tags question: http://stackoverflow.com/q/21442768
type: Tag

http://stackoverflow.com/comment/32212012
has text: You can tell Eclipse about multiple JDKs you have installed and choose which one to use for each project.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21362684

http://stackoverflow.com/a/21403487
has comment: http://stackoverflow.com/comment/32285459
has comment: http://stackoverflow.com/comment/32285244
has comment: http://stackoverflow.com/comment/32285400
accepted answer of: http://stackoverflow.com/q/21402754
score: 0
answers question: http://stackoverflow.com/q/21402754
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32285908
type: Answer
has body: i think your problem solved if you call findViewById() in onCreate() Method like this: private ScrollView scrollView; private TextView tvabove; private TextView tv; .... protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dragpanel); scrollView = (ScrollView)findViewById(R.id.scrollatherosclerosis); tv = (TextView)findViewById(R.id.Signandsymptompsid); tvabove = (TextView)findViewById(R.id.Signandsymptomsparagraph); ... }

http://stackoverflow.com/comment/32235032
type: Comment
comment on: http://stackoverflow.com/a/21374727
type: AnswerComment
has text: sorry stephen,i think that is other logcat.just now i checked once again but it displays the single username and password..
score: 0

http://stackoverflow.com/a/24953165
type: Answer
has body: I have the same problem, I think it caused by Hibernate's proxy. I haven't a perfect solution recently, but you can solved it like this: get the id, then create a new com.test.domain.Client object and set back to parent. then you will get "client": {"id":1,...} Modify your entity, add one more id for just readable to the parent object, for example, clientId. Then you could avoid jackson to serialize the sub object. You will get {..., "clientId":1,...} Hope some one can give more perfect solution.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21472926

http://stackoverflow.com/a/21511454
type: Answer
has comment: http://stackoverflow.com/comment/32476574
has comment: http://stackoverflow.com/comment/32476776
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32476735
accepted answer of: http://stackoverflow.com/q/21511390
has body: you will get the exception if the file is not found, there can be a case that you have not created the file or you have deleted it from that you are reading or there can be other IOException java.io.IOException | | java.io.FileNotFoundException as FileNotFoundException is the child of java.io.IOException
answers question: http://stackoverflow.com/q/21511390

http://stackoverflow.com/a/21422429
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21377027
downvote count: 0
type: Answer
has body: problem solved. what I did is as follow: 1- because i was implementing my application using jdk 1.7 so i have to use suitable postgresql driver for that from this link: http://jdbc.postgresql.org/download.html (it should be JDBC41 Postgresql Driver Version 9.3-1100 not JDBC4 Postgresql Driver Version 9.3-1100) 2- StephaneM pointed me to the right direction to manually configure the jdbc driver in jboss AS-7 but not have to make module.xml in here --> $JBOSS_HOME/modules/org/postgresql/main and instead should have to do the following: 3- Add the jdbc sql jar into: ~\jboss7\modules\org\hibernate\main 4- and modify the module.xml there and change the &lt;resource-root&gt; to be &lt;resource-root path="JDBC41 Postgresql Driver Version 9.3-1100"/&gt; 5- do not forget to copy the JDBC41 Postgresql Driver Version 9.3-1100.jar there. thats it. :)

http://stackoverflow.com/q/21383176
has body: I need to convert all the occurrences of \\r to \r in string. My attempt is following: String test = "\\r New Value"; System.out.println(test); test = test.replaceAll("\\r", "\r"); System.out.println("output: " + test); Output: \r New Value output: \r New Value
has answer: http://stackoverflow.com/a/21383257
upvote count: 1
linked to: http://stackoverflow.com/q/1279779
has comment: http://stackoverflow.com/comment/32249132
tagged with: java
tagged with: replace
answer count: 4
has answer: http://stackoverflow.com/a/21383232
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/21383227
score: 1
tagged with: string
has answer: http://stackoverflow.com/a/21383227
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21383263
accepted answer: http://stackoverflow.com/a/21383263
has title: replace `\\r` with `\r` in string

http://stackoverflow.com/q/21452075
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21452149
answer count: 6
has answer: http://stackoverflow.com/a/21452158
possible better answer: http://stackoverflow.com/a/21452149
has body: Here is an excerpt from JDK7 source code: public String(String original) { this.value = original.value; this.hash = original.hash; } Both value and hash are private field. Why is original.value legal?
has answer: http://stackoverflow.com/a/21456346
downvote count: 0
has title: Access private field without getter method?
has answer: http://stackoverflow.com/a/21452114
has answer: http://stackoverflow.com/a/21452115
favorite count: 0
has answer: http://stackoverflow.com/a/21452147
accepted answer: http://stackoverflow.com/a/21452147
score: 4

http://stackoverflow.com/a/21395147
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21394667
type: Answer
score: 1
has body: Suggest getting away from low-level JDBC APIs and moving towards some kind of useful abstraction for data access--maybe Spring's JdbcTemplate would be appropriate? From the level of detail you gave, all I can guess is that you are wanting to swap in/out various instances of the same database schema (e.g., development, stage, production). If you decide to use Spring, it will be natural to put the various database connection details into Spring configuration files (possibly referencing vanilla properties files) that are external to your application. With Spring, you'll probably want to configure a DataSource rather than a connection, but you will be well-rewarded for the little effort required to learn to use JdbcTemplate. Failing that, you could certainly give yourself a method that returns a connection and in that method you could take care of which connection to return--e.g. public Enum MyDb { DEV, STAGE, PROD } ... con = getConnection(MyDb.PROD) Just a thought..

http://stackoverflow.com/a/21467777
has comment: http://stackoverflow.com/comment/32399472
has comment: http://stackoverflow.com/comment/32399383
type: Answer
has body: My friend in entity class you not have any default constructor by default the compiler sees you code like public class Ship extends Entity{ public Ship(int type){ super(); ------&gt; added by compiler by default } } if u not added call to the super it will added default call to super that's the reason of error, so you have to add super(type); in first line of derived class constructor because you have only parameter constructor.
score: 0
answers question: http://stackoverflow.com/q/21467479

http://stackoverflow.com/comment/32304718
type: QuestionComment
type: Comment
has text: You should show the exact arguments you pass to `exec()`. Do you include the `-open` or `-arg` flag? See also: http://stackoverflow.com/questions/10606183/trying-to-pass-multiple-command-line-parameters-to-javaws-launch-application
comment on: http://stackoverflow.com/q/21412457
score: 0

http://stackoverflow.com/comment/32230019
has text: Umm, don't let the ? at the end of my comment deceive you. I wasn't really asking you. `split` takes a regular expression as an argument. The regular expression to match a backslash is two backslashes together, but you need four to write it in your code. Since OP is using a pair of backslashes as a separator, you need eight to write it.
comment on: http://stackoverflow.com/a/21372383
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21511881
has body: Your client creates new connections that read just 1 line (and then doesn't clean up / close the socket) while( isRunning = true){ socket = new Socket(serverAddr,SERVERPORT); string = readLine(); } Your server on the other hand accepts 1 connection, reads within a loop from that connection and quits. while(IsRunning == true){ scanf("%s",message); } return 0; Your server will not accept the second connection attempt and if it notices that the socket is eventually closed (which may not happen at all) it would just quit. So you should fix 2 things: Your server should have an additional loop to accept new connections once the first is closed. You could also consider creating a thread per accepted connection so it can handle more than just 1 client at a time. Your client should not open a new connection within the loop. You could add a loop to re-connect in case the connection drops though. And you must make sure that you close the connection properly so your server will eventually return from the loop. Roughly this on client side try{ InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr,SERVERPORT); while( isRunning = true){ .. readline } } finally { if (socket != null) { // send "stop_thread", close OutputStream // close socket } }
answers question: http://stackoverflow.com/q/21511598
has comment: http://stackoverflow.com/comment/32728284
has comment: http://stackoverflow.com/comment/32511412
score: 0
has comment: http://stackoverflow.com/comment/32727915
type: Answer
has comment: http://stackoverflow.com/comment/32515801

http://stackoverflow.com/q/21458625
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/21460055
has answer: http://stackoverflow.com/a/21460055
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: final
tagged with: java
has title: When a lock holds a non-final object, can the object's reference still be changed by another thread?
has body: When an object needs to be synchronized, the IDE complains if it's not set non-final (because its reference isn't persistent): private static Object myTable; .... synchronized(myTable){ //IDE complains! //access myTable here... } We all know the IDE complains to prevent another thread from entering the guarded block if the thread holding the lock changes the non-final object's references. But could a synchronized object's reference also be changed by another thread B while thread A holds the lock for the same object?
type: Question
tagged with: locking
has answer: http://stackoverflow.com/a/21458700
tagged with: synchronized
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21458700

http://stackoverflow.com/comment/32411198
type: Comment
has text: @Behe sry to miss the doc path.Please find at http://docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html
comment on: http://stackoverflow.com/a/21473655
type: AnswerComment
score: 0

http://stackoverflow.com/q/21368475
type: Question
has answer: http://stackoverflow.com/a/21376051
downvote count: 0
tagged with: applet
favorite count: 0
tagged with: events
possible better answer: http://stackoverflow.com/a/21370349
answer count: 4
has answer: http://stackoverflow.com/a/21368809
accepted answer: http://stackoverflow.com/a/21376051
has title: KeyListener not working using Applet
has answer: http://stackoverflow.com/a/21370349
upvote count: 1
type: AnsweredQuestion
has body: I have an applet using a keylistener, but the events are not triggered when I press the keys.. I also add the setFocusable(true), but didn't work too.. Here is my code http://pastebin.com/WnFVVps7 I am creating a new KeyListener and adding it to the applet object. Also I am using setFocusable(true) on my init() method. I don't know what to do more, can someone take a look at my code? thanks. Thanks alot in advance ;)
has answer: http://stackoverflow.com/a/21411858
score: 1
tagged with: java
tagged with: keylistener

http://stackoverflow.com/comment/87601392
comment on: http://stackoverflow.com/a/21507718
type: Comment
score: 0
has text: but I am using a proxy
type: AnswerComment

http://stackoverflow.com/comment/32254433
comment on: http://stackoverflow.com/q/21385714
has text: Let's see your context configuration.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21470861
has answer: http://stackoverflow.com/a/21470932
favorite count: 0
has answer: http://stackoverflow.com/a/21470893
has body: I want to read all the elements of stack without popping them. I have looked up online and found that there is a 'peek' operation but that just returns the first element of the stack. How do I read the other elements of the stack? Please suggest the code for it in Java. Thanks in advance :)
accepted answer: http://stackoverflow.com/a/21470893
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32405017
has comment: http://stackoverflow.com/comment/32405145
tagged with: stack
tagged with: java
has title: How to read all elements of stack without popping them?
downvote count: 2
type: Question
score: 3
tagged with: algorithm
upvote count: 5
has comment: http://stackoverflow.com/comment/32405055
answer count: 2
possible better answer: http://stackoverflow.com/a/21470932
has comment: http://stackoverflow.com/comment/32405151
has comment: http://stackoverflow.com/comment/32405013

http://stackoverflow.com/q/21405606
downvote count: 0
has body: I am developing my first sample spring based project. Following is an excerpt from my dispatcher-servlet.xml . &lt;mvc:view-controller path="" view-name="test" /&gt; &lt;!-- location to scan for controllers --&gt; &lt;context:component-scan base-package="com.test.demo.student.controller" /&gt; I try to do a post to the following url, but it never seem to reach the corresponding controller class: url: http://localhost:8080/TestProject/student/retrieveDetails @Controller @RequestMapping("student") public class StudentController { private final Logger logger = Logger.getLogger(StudentController.class); @Autowired public StudentService studentService; public void setStudentService(StudentService studentService) { this.studentService = studentService; } @RequestMapping(value = "/retrieveDetails", method = RequestMethod.POST) public @ResponseBody String retrieveDetails(@RequestBody RetrieveStudentRequestBo retrieveStudentRequestBo,HttpServletRequest req,HttpServletResponse res) { logger.info("Entering StudentController.retrieveDetails()" ); input for post {"testID":"1"} ERROR [400] Bad Request is the response. Why I get the 400 error though everything seem to be in place?
has comment: http://stackoverflow.com/comment/32289058
favorite count: 0
has comment: http://stackoverflow.com/comment/32289382
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32290010
tagged with: spring
tagged with: spring-mvc
tagged with: java
has title: Spring: Post request not reaching controller class
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/32289712
has answer: http://stackoverflow.com/a/21406128
has comment: http://stackoverflow.com/comment/32294859
score: 2
answer count: 1

http://stackoverflow.com/a/33522671
answers question: http://stackoverflow.com/q/21377304
score: 0
type: Answer
has body: It seems to be a bug - but I have another solution for your needs. You can use custom resources which are available in glassfish. You have to declare custom resource in domain.xml then you can use it in the code public class Environment { public String getProperty() { InitialContext ctx = new InitialContext(); properties = (Properties) ctx.lookup("test/properties"); if(properties == null) { return "default value - hello"; } return properties.getProperty("aMessage"); } } The one disadvantage of this approach is that custom resources are global for whole domain. But this solution has advantage you can change resources by using asadmin and admin web console also.

http://stackoverflow.com/comment/32483438
has text: Can you share the JNLP file contents? If you are running 32 bit Java, then it doesn't matter that you have 5GB - your process can only get 2GB at max(but generally only can set max to 1.2G before the VM won't start.
score: 1
comment on: http://stackoverflow.com/q/21499142
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35120108
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21365505
has text: nope sorry. if you found a solution post a link here.
score: 0

http://stackoverflow.com/comment/32238485
comment on: http://stackoverflow.com/q/21377027
has text: yes, I can confirm that postgresql-9.3-1100.jdbc4.jar is in my classpath by checking through this path in jboss development studio: Sysmtem tab>preferences>server>runtime environment>default classpath
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32307801
type: QuestionComment
has text: yeah i've been trying it from the command line, and yep, i've tried it with open from there. do i need brackets [] anywhere? i dont work with the command line much, so i'm not too sure of the syntax.
comment on: http://stackoverflow.com/q/21412457
score: 0
type: Comment

http://stackoverflow.com/comment/32341427
type: Comment
has text: lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) { // TODO Auto-generated method stub Log.i("tvcountdown", "Clicked"); } });
type: QuestionComment
comment on: http://stackoverflow.com/q/21435396
score: 0

http://stackoverflow.com/q/21440669
has body: Assume we have a class FooCollection which contains a somewhat long list of static nested classes*: public class FooCollection { public static class FooA implements Foo { // ... } public static class FooB implements Foo { // ... } // ... } Assume now we have another class using all of these classes. Currently, Eclipse will auto-format this to import each class separately if we reference the class itself import com.me.FooCollection.FooA; import com.me.FooCollection.FooB; import com.me.FooCollection.FooC; import com.me.FooCollection.FooD; // and then later something like callBaz( FooA.class ); What I would prefer to avoid bloating imports and constant commits changing imports due to colleagues using IntelliJ, is having it imported as import static com.me.FooCollection.*; However, I can't seem to find anything to get Eclipse to do this. Is there something I am missing or any way to get Eclipse to do it this way? Edit: I actually just checked and even new FooA() will still cause the imports to switch back to this, despite setting the start imports threshold. *) I realize that this is not exactly a good design, but it's a legacy application and for the sake of it let's assume that the code cannot be changed.
has answer: http://stackoverflow.com/a/21441195
has comment: http://stackoverflow.com/comment/32351134
tagged with: eclipse
answer count: 2
has title: Get Eclipse to prefer static imports of nested classes
downvote count: 0
favorite count: 0
tagged with: eclipse-kepler
has comment: http://stackoverflow.com/comment/32352719
has comment: http://stackoverflow.com/comment/59116397
upvote count: 3
type: UnansweredQuestion
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/21441039

http://stackoverflow.com/q/21477254
tagged with: dynamic-arrays
has title: Deleting Dynamic array in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21477410
has answer: http://stackoverflow.com/a/21477334
score: 2
has comment: http://stackoverflow.com/comment/32415454
downvote count: 0
has comment: http://stackoverflow.com/comment/32415471
favorite count: 0
has comment: http://stackoverflow.com/comment/32416049
type: Question
has comment: http://stackoverflow.com/comment/32415667
has body: In C++, dynamically allocated array has to be deleted unless it is lost in the memory. In java, do we have to do the same, and if so. How do you do that
has comment: http://stackoverflow.com/comment/32415513
upvote count: 2
linked to: http://stackoverflow.com/q/17647194
has comment: http://stackoverflow.com/comment/32415596
has comment: http://stackoverflow.com/comment/32415941
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/21477426

http://stackoverflow.com/comment/32302081
comment on: http://stackoverflow.com/a/21412329
has text: error :The method CustomAdapter(MainActivity, ArrayList<GS>) is undefined for the type MainActivity
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21481268
has comment: http://stackoverflow.com/comment/32422500
has comment: http://stackoverflow.com/comment/32422517
has comment: http://stackoverflow.com/comment/32422416
upvote count: 1
has comment: http://stackoverflow.com/comment/32422317
type: Answer
has comment: http://stackoverflow.com/comment/32423312
answers question: http://stackoverflow.com/q/21481208
has comment: http://stackoverflow.com/comment/32422977
has comment: http://stackoverflow.com/comment/32422567
has body: try this java -cp "SeleniumTest\lib\junit-4.10.jar;SeleniumTest\lib\selenium-java-2.39.0.jar;SeleniumTest\lib\selenium-server-standalone-2.39.0.jar;SeleniumTest\bin" com.src.test.First
downvote count: 0
score: 1

http://stackoverflow.com/q/21410930
has title: Correct way to run Unit Tests with different beans
answer count: 2
tagged with: spring
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21411938
tagged with: testing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21411789
tagged with: tdd
tagged with: junit
has body: I am curious what is the best setup for the following situation: I have a test class: MyTests with JUnit4 tests. Each of them I want to run with every type of car I specify, for example: &lt;bean id="myBean" class="com.stuff.Cars" factory-method="Toyota"/&gt; &lt;bean id="myBean" class="com.stuff.Cars" factory-method="Chevrolet"/&gt; I want all the tests to run using both the Chevrolet and the Toyota; what would be the correct way to do this? The naive way would be to just double all the test classes and use Chevrolet instead of Toyota. I am still very new to spring, so any help is appreciated. Thanks.
type: Question

http://stackoverflow.com/comment/32415149
comment on: http://stackoverflow.com/a/21476564
type: Comment
has text: Thanks for reference that current package is imported by default, but still wondering why compiler is not complaining about ambiguous class name...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32354781
comment on: http://stackoverflow.com/a/21442719
has text: @ron Try it [here](http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_form_onsubmit). Check the value of the expression before you return it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21368723
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21370921
has body: I am making listview with timers, each with different deadline depending on the database(similar to auction) Time now = new Time(); now.setToNow(); now.normalize(true); nowMillis = now.toMillis(true); . . String endtime = a.get(position).get(TAG_ENDTIME); Integer timeSecond = Integer.parseInt(endtime.substring(17, 19)); Integer timeMinute = Integer.parseInt(endtime.substring(14, 16)); Integer timeHour = Integer.parseInt(endtime.substring(11, 13)); Integer timeDay = Integer.parseInt(endtime.substring(0, 2)); Integer timeMonth = Integer.parseInt(endtime.substring(3, 5)) - 1; Integer timeYear = Integer.parseInt(endtime.substring(6, 10)); Time future = new Time(); future.set(timeSecond, timeMinute, timeHour, timeDay, timeMonth, timeYear); future.normalize(true); long futureMillis = future.toMillis(true); long interval = futureMillis - nowMillis; new CountDownTimer(interval,1000) { @Override public void onTick(long millisUntilFinished) { Long interval = millisUntilFinished; int days = (int) ((millisUntilFinished / 1000) / 86400); int hours = (int) (((millisUntilFinished / 1000) - (days * 86400)) / 3600); int minutes = (int) (((millisUntilFinished / 1000) - (days * 86400) - (hours * 3600)) / 60); int seconds = (int) ((millisUntilFinished / 1000) % 60); String countdown = String.format("%dd %dh %dm %ds", days, hours, minutes, seconds); holder.duration.setText(countdown); } @Override public void onFinish() { // TODO Auto-generated method stub holder.duration.setText(TimeUp); } }.start(); That code works almost perfectly when there is only one instance. However the problem arise when there is several instance, around 4-5 timer running at the same time Several/all the countdown will start to flicker, be it seconds, minutes, hours, or days. e.g. one of my timer flicker between 27d 11h 54m 50s and 0d 23h 47m 0s Since this occur on both on emulator and on my device, it seems to be my code's flaw, but I don't have a clue what could cause this. I tried to change holder.duration.se…
type: Question
tagged with: java
tagged with: listview
accepted answer: http://stackoverflow.com/a/21370921
score: 0
has title: Android - CountDownTimer in ListView flickers randomly
answer count: 1
tagged with: android

http://stackoverflow.com/q/21368324
score: 0
has comment: http://stackoverflow.com/comment/32222679
tagged with: device
has comment: http://stackoverflow.com/comment/32222656
has title: Android application work on virtual device but not on real device
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/32222828
has comment: http://stackoverflow.com/comment/32222577
accepted answer: http://stackoverflow.com/a/21368673
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32222687
tagged with: java
has comment: http://stackoverflow.com/comment/32222812
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32222534
has body: i need your assistance for my problem. I created an Android application that work perfectly on virtual devices But when i try to run it on my Samsung Galaxy s2 it just stop working without showing no errors on the LogCat N.B : this application need internet to work Here is the AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10" /> <uses-permission android:name="android.permission.INTERNET" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> I just found the relevant error, which is => 01-26 20:12:25.285: E/AccuWeather - UALib(8131): IOException when executing request. Do you have permission to access the internet? (device-api.urbanairship.com) but i dont understand why, at my manifest.xml i activated the access to the internet
has answer: http://stackoverflow.com/a/21368673

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

http://stackoverflow.com/q/21386638
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32255560
has comment: http://stackoverflow.com/comment/32255535
has answer: http://stackoverflow.com/a/21386838
tagged with: string
has comment: http://stackoverflow.com/comment/32352976
type: Question
has body: I am scraping strings from a web page in the format of $xx.xx/mo (e.g. $54.89/mo ) and would like to extract just the numbers in the format of xx.xx (e.g. 54.89 ) also as a string. Currently I've written the following method that works fine: public static String extractPriceString(String Price){ if (Price == null) return null; return Price.split("/")[0].substring(1).replace(" ", ""); } Is there a more efficient way to do this? Would .replaceAll("$","").replaceAll("/mo","").replace(" ", "") be better?
has comment: http://stackoverflow.com/comment/32255542
has title: Most efficient way in Java to scrub a string "$xx.xx/mo" and return in format of "xx.xx"
has comment: http://stackoverflow.com/comment/32255624
has comment: http://stackoverflow.com/comment/32255717

http://stackoverflow.com/a/21444077
answers question: http://stackoverflow.com/q/21439889
has body: I prefer using of For loop, you can do this with some fun .. // number is the user input and you must validate it before for (int i = number; i &gt;= 1; i--) { if (i == 1) { System.out.print(i); sum = sum + 1; } else { System.out.print(i + " + "); sum = sum + i; } } System.out.print(" = " + sum);
type: Answer
score: 0

http://stackoverflow.com/q/21498983
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/21499010
has comment: http://stackoverflow.com/comment/32454285
has body: I am a newbie on Java and writing a code of Try-with-Resources. I am using JRE_1.7.0_51. The code is... import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; public class app2 { public static void main(String[] args) { File file=new File("test.txt"); FileReader fr=new FileReader(file); try(BufferedReader br=new BufferedReader(fr)){ } } } However post execution I get the following eror-- Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error on token "(", { expected Syntax error on token ")", delete this token Syntax error, insert ";" to complete LocalVariableDeclarationStatement Syntax error, insert "}" to complete Block at App.main(App.java:13) Not sure what I am doing wrong. Need help. Thanks in advance.
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32454318
has title: Error in compilation when using Try-with-Resources
type: Question

http://stackoverflow.com/q/21366534
tagged with: java
has comment: http://stackoverflow.com/comment/32221020
type: Question
has title: java set time based on input
has body: In my code I have a couple of objects: An ArrayList with an object. The object has a value (timeNeeded) which is the time as an int. the arraylist is in the model and can be checked to see if it contains an object with : model.isWaiting() and the value of that object can be returned with model.getdelay() A Timer (Swing), that needs to run the values in the ArrayList, which is filled from another class. Logic involved includes the following: If the ArrayList is empty it needs to check every 1 millisecond, if there is a new value. If there is a new value set the timer to the first value from the array, after the timer finishes the given time (from the first object in the ArrayList) it needs to delete the first object and set timer to 1 millisecond until there is another object added. Here's my code: Timer myTimer; Model model; public className(Model modelInput) implements ActionListener { model = modelInput; myTimer = new Timer(1, this); myTimer.start(); } @Override public void actionPerformed(ActionEvent arg0) { //see if there is an object in the arraylist. if (model.isWaiting()) { // if the delay is currently not equal to the delay given in the object waiting. set the delay to the time given by the object if ( myTimer.getDelay() != model.getdelay()) { myTimer.setDelay(model.getdelay()); } // if the time waited is equal to the time given by the object waiting remove the object and set the timer to check again every 1 milisecond. else { System.out.println("runned after "+myTimer.getDelay()); model.removeFirst(); myTimer.setDelay(1); } } } So it should only delete from the model via removeFirst(), if there is an object waiting (myTimer.setDelay(model.getdelay());) and the delay is set to the delay required by the object. But for some reason the timer goes off too early. If I print the delay, it is the right delay. But if I look at real time, it runs the else statement almost 6 times too fast: it is not the same as printed. Is there a mistake in my code that makes the t…
has comment: http://stackoverflow.com/comment/32221083
score: 0
tagged with: timer
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/q/21502819
has title: Error when starting Apache OFBiz: "java.net.BindException: Address already in use"
downvote count: 0
accepted answer: http://stackoverflow.com/a/21538019
favorite count: 0
has answer: http://stackoverflow.com/a/21509188
tagged with: ofbiz
possible better answer: http://stackoverflow.com/a/21509188
type: AnsweredQuestion
score: 3
has body: I get the following error when running the "ant start" command on my LAMP server. It worked just fine when using the default derby database BUT I did have to change the HTTP and HTTPS ports (they were in use) in the following files: framework/base/config/ofbiz-containers.xml framework/webapps/config/urlproperties So now that I'm trying to use PostgreSQL I'm getting the following error when trying to start Ofbiz. My best guess is that I also have to change the port for the PostgreSQL JDBC connector too? Where can I do that, or what am I missing? //START TERMINAL OUTPUT root@server.domain.com [erp]# ./ant start Buildfile: /home/username/public_html/erp/build.xml start: [java] Start.java using configuration file org/ofbiz/base/start/start.properties [java] Set OFBIZ_HOME to - /home/username/public_html/erp [java] Exception in thread "main" org.ofbiz.base.start.StartupException: Couldn't create server socket(/127.0.0.1:10523) [java] at org.ofbiz.base.start.Start$AdminPortThread.&lt;init&gt;(Start.java:405) [java] at org.ofbiz.base.start.Start.createListenerThread(Start.java:163) [java] at org.ofbiz.base.start.Start.init(Start.java:222) [java] at org.ofbiz.base.start.Start.main(Start.java:131) [java] Caused by: java.net.BindException: Address already in use [java] at java.net.PlainSocketImpl.socketBind(Native Method) [java] at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) [java] at java.net.ServerSocket.bind(ServerSocket.java:376) [java] at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:237) [java] at org.ofbiz.base.start.Start$AdminPortThread.&lt;init&gt;(Start.java:403) [java] ... 3 more [java] Java Result: 1 BUILD SUCCESSFUL Total time: 2 seconds root@server.domain.com [erp]#
upvote count: 3
has answer: http://stackoverflow.com/a/21538019
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/21505561
has comment: http://stackoverflow.com/comment/32466744
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21505534
answers question: http://stackoverflow.com/q/21505534
score: 2
has comment: http://stackoverflow.com/comment/32466535
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32466546
has body: Because that's what happens when you use the String concatenation operator (+). It calls the toString() method of the object being added (which is guanateed to be there since it's defined in Object). In your case, that's the current object (this) so you get this.toString() called. And because you've overriden toString() in your class, you get the result of that. Edit to add: Note that there's no difference between + this and + this.toString(); you'll end up with the same result. Specifically, this is covered by section 15.18.1 of the JLS If only one operand expression is of type String, then string conversion (§5.1.11) is performed on the other operand to produce a string at run time. And §5.1.11 states: ... Now only reference values need to be considered: If the reference is null, it is converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the conversion is performed as if by an invocation of the toString method of the referenced object with no arguments; but if the result of invoking the toString method is null, then the string "null" is used instead.

http://stackoverflow.com/a/21596480
answers question: http://stackoverflow.com/q/21455401
type: Answer
downvote count: 0
score: 1
has body: Thanks all for their help. I have done all, but was getting the same issue. I guess the issue was that each time java was getting installed, but could not determine which to execute as default. Finally after doing as told in @Girish's answer, I got this from ubuntu help pages: sudo update-alternatives --config java this will give you the java version u want to set and u can choose from 0,1,2 etc. Hope this helps.
upvote count: 1

http://stackoverflow.com/comment/32224672
score: 0
type: AnswerComment
type: Comment
has text: You do not set the Value of header,you just point it to a node. so what you need to do is .getFirst()=new Node(null,currNum,null);
comment on: http://stackoverflow.com/a/21369385

http://stackoverflow.com/comment/32315640
has text: Is this your own app., or is it supplied by others?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21404830

http://stackoverflow.com/q/21421465
tagged with: classpath
tagged with: src
has answer: http://stackoverflow.com/a/21421485
tagged with: web
has comment: http://stackoverflow.com/comment/32317021
type: Question
has title: Access File in bin folder of Java web application
has body: I want to read a text file from src folder of class activitydata. In order to do that, I wrote following code ActivityData c = new ActivityData(); Class&lt;? extends ActivityData&gt; cls = c.getClass(); URL url = cls.getResource("file.txt"); System.out.println("Value = " + url); Although I get the url in console, when I write following code I get exception: Gson gson = new Gson(); JsonReader reader = new JsonReader(new FileReader(url.toString())); Exception: java.io.FileNotFoundException: file:\G:\Study%20Folder.......\file.txt (The filename, directory name, or volume label syntax is incorrect)
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/21447526
linked to: http://stackoverflow.com/q/362384
has comment: http://stackoverflow.com/comment/32363984
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21447727
has body: I've reed this code which is in C format but i didn't understand what's the process exactly. can anyone explain it for me in java or if there is a better way in java could you please write it here? thank you bool endianess(){ int testNum; char *ptr; testNum=1; ptr=(char*) &amp;testNum; return (*ptr); //* return the byte at the lowest address }
tagged with: java
has title: write a function that determines whether a computer is big endian or little endian in java
type: Question
linked to: http://stackoverflow.com/q/21341325
has comment: http://stackoverflow.com/comment/32363902
has comment: http://stackoverflow.com/comment/32364077
has answer: http://stackoverflow.com/a/21447607
tagged with: endianness
duplicate of: http://stackoverflow.com/q/21341325
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21447607
has comment: http://stackoverflow.com/comment/32364023
has comment: http://stackoverflow.com/comment/32364035
has answer: http://stackoverflow.com/a/21447727

http://stackoverflow.com/comment/32221002
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21367493
has text: It is an intellij project
score: 0

http://stackoverflow.com/q/21360451
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21360469
has title: how to access my bean class defined in netbeans using libraries can be used in main method of new project
type: UnansweredQuestion
tagged with: java
type: Question
has body: public class BeanClass { public BeanClass (){} public void setName (String name){ this.name =name; } public String getName () { return this.name; } } I want to retrieve above methods in main metod of other new project using net beans. I have defied above class in library class and was added under bean tree of pallet
tagged with: javabeans

http://stackoverflow.com/q/21362616
has comment: http://stackoverflow.com/comment/32212528
has comment: http://stackoverflow.com/comment/32212394
has comment: http://stackoverflow.com/comment/32212135
has comment: http://stackoverflow.com/comment/32212357
upvote count: 8
has answer: http://stackoverflow.com/a/21362884
has comment: http://stackoverflow.com/comment/32212384
has comment: http://stackoverflow.com/comment/122500007
downvote count: 1
accepted answer: http://stackoverflow.com/a/21362884
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32216019
score: 7
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21362822
has title: Why can't custom comparator be used with hashSet to check duplicate objects
has answer: http://stackoverflow.com/a/21362822
has comment: http://stackoverflow.com/comment/32212859
tagged with: hashset
has body: I want to use a custom comparator to filter duplicate objects from a HashSet. In the Mobile class, I have defined a non-static nested Comparator class for comparing. The criterium which is used by this comparator is the id field of the Mobile object. Set&lt;Mobile&gt; treeSet = new TreeSet&lt;&gt;(new Mobile().new Comparator()); // works Set&lt;Mobile&gt; hashSet = new HashSet&lt;&gt;(new Mobile().new Comparator()); // does not work Even though it works perfectly for a TreeSet, Eclipse shows a syntax error when I try this with a HashSet, It appears that I need to override the equals and hashcode methods in the Mobile class if I want to use a HashSet. However, I would prefer to use a comparator instead. Why is this the case?
favorite count: 0

http://stackoverflow.com/comment/32395559
comment on: http://stackoverflow.com/a/21443837
type: Comment
has text: +1 for "I usually advise my devs to not have keys beyond 32 bytes if they can." That's good advice.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21397170
favorite count: 0
has comment: http://stackoverflow.com/comment/32275041
has answer: http://stackoverflow.com/a/22147889
linked to: http://stackoverflow.com/q/21358548
tagged with: enide
accepted answer: http://stackoverflow.com/a/22147889
tagged with: nodeclipse
has title: Java - process launched with Runtime.getRuntime().exec( cannot create temp file
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/21260657
has comment: http://stackoverflow.com/comment/32287882
upvote count: 1
type: Question
answer count: 1
downvote count: 0
tagged with: exec
has body: process launched with Runtime.getRuntime().exec(cmdLine, envp, workingDirectory); cannot create temp file. It is used inside Maven plugin for Eclipse Quote from mvn launched: Caused by: java.io.IOException: �ܾ���ʡ� at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(File.java:1879) Full log This is not Maven related as Gradle has the same issue Demo piece of code runs into the same error. String mavenPath = "D:\\Progs\\springsource\\apache-maven-3.0.4\\bin\\mvn.bat"; String mavenOptions = "-X compile exec:java -Dexec.mainClass=runclass.Runme"; String[] cmdLine = new String[2]; cmdLine[0] = mavenPath; //cmdLine.add(mavenPath); cmdLine[1] = mavenOptions; //cmdLine.add(mavenOptions+" compile exec:java -Dexec.mainClass="+packageClass); String[] envp = new String[2]; //Map&lt;String, String&gt; envm = new HashMap&lt;String, String&gt;(); envp[0] = "JAVA_HOME=" + System.getProperty("java.home"); //System.getenv("JAVA_HOME"); envp[1] = "M2_HOME=" + System.getenv("MAVEN_HOME"); File workingDirectory = null; String currentDir = new File(".").getAbsolutePath(); log(currentDir); String userDir = System.getProperty("user.dir"); //User working directory ; "user.home" User home directory workingDirectory = new File(userDir); log(workingDirectory.toString()); // Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(cmdLine, envp, workingDirectory); InputStream stdout = proc.getInputStream(); InputStream stderr = proc.getErrorStream(); InputStreamReader isr = new InputStreamReader(stdout); InputStreamReader isr2 = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); BufferedReader br2 = new BufferedReader(isr2); Update: Passing TMP and TEMP environment variables does not help. Passing null instead of envp also does not help. If envp is null, the subprocess inherits the environment settings of the current process.

http://stackoverflow.com/q/21512659
tagged with: shared-primary-key
has answer: http://stackoverflow.com/a/34310555
score: 1
tagged with: primary-key
tagged with: java
tagged with: hibernate
has body: I'm having problems with generating primary keys with one-to-one relations that use shared primary key. Here's code: @Entity @Table(name = "osoba") public class Osoba implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "osoba_id") private Integer osobaId; @PrimaryKeyJoinColumn @OneToOne(cascade = CascadeType.PERSIST) public Pracownik pracownik; ... and second class: @Entity @Table(name = "pracownik") public class Pracownik { @OneToOne @JoinColumn(name = "osoba_id") @MapsId("osobaId") private Osoba osoba; @Id @Column(name = "osoba_id") private Integer osobaId; ... I've been similar issues and I thought that i've done everything correctly but i still get org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): entity.Pracownik when trying to persist Pracownik objects.
type: Question
has title: Shared primary key generation. Hibernate
has answer: http://stackoverflow.com/a/21512767
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: generator

pipeline
type: Tag
tag name: pipeline
tags question: http://stackoverflow.com/q/21375118

http://stackoverflow.com/q/21358466
accepted answer: http://stackoverflow.com/a/21360609
linked to: http://stackoverflow.com/q/16350757
tagged with: execution
upvote count: 138
has answer: http://stackoverflow.com/a/42259553
possible better answer: http://stackoverflow.com/a/21358586
has answer: http://stackoverflow.com/a/77742068
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/32204906
linked to: http://stackoverflow.com/q/27604283
has title: Gradle to execute Java class (without modifying build.gradle)
type: AnsweredQuestion
score: 138
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/59197960
has answer: http://stackoverflow.com/a/21358586
has comment: http://stackoverflow.com/comment/97579474
tagged with: gradle
type: Question
has body: There is simple Eclipse plugin to run Gradle, that just uses command line way to launch gradle. What is gradle analog for maven compile and run mvn compile exec:java -Dexec.mainClass=example.Example This way any project with gradle.build could be run. UPDATE: There was similar question What is the gradle equivalent of maven&#39;s exec plugin for running Java apps? asked before, but solution suggested altering every project build.gradle package runclass; public class RunClass { public static void main(String[] args) { System.out.println("app is running!"); } } Then executing gradle run -DmainClass=runclass.RunClass :run FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':run'. &gt; No main class specified
has answer: http://stackoverflow.com/a/21360609

http://stackoverflow.com/q/21354828
favorite count: 0
has body: I followed this youtube tutorial to create a basic calculating app. I was able to debug it on my phone and it ran fine. However when I plug in the number and press calculate, the app freezes and crashes. This is my layout: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/lblTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="66dp" android:text="Basic Calculate" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/display" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/btnCalculate" android:layout_below="@+id/btnCalculate" android:layout_marginTop="23dp" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/num" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/btnCalculate" android:layout_alignLeft="@+id/btnCalculate" android:layout_marginBottom="20dp" android:ems="5" android:inputType="numberDecimal|numberSigned" /&gt; &lt;Button android:id="@+id/btnCalculate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Calculate" /&gt; &lt;/RelativeLayout&gt; This is my Activity class: package com.danielkim.danielkimcalculator; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android…
tagged with: android
downvote count: 0
linked to: http://stackoverflow.com/q/7633482
has comment: http://stackoverflow.com/comment/32198118
linked to: http://stackoverflow.com/q/13674627
has answer: http://stackoverflow.com/a/21354978
accepted answer: http://stackoverflow.com/a/21354978
has comment: http://stackoverflow.com/comment/32198388
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32198693
score: 1
tagged with: java
tagged with: eclipse
has title: Basic calculating app crash
type: Question
linked to: http://stackoverflow.com/q/16304467
upvote count: 1
linked to: http://stackoverflow.com/q/20215522
answer count: 1

http://stackoverflow.com/q/21412933
type: Question
accepted answer: http://stackoverflow.com/a/21412978
type: AnsweredQuestion
tagged with: java
upvote count: 2
tagged with: string
tagged with: type-conversion
tagged with: arraylist
answer count: 3
has body: I'm trying to convert the numbers of my Array list into Strings at point i. How do I do this so I can create substrings of my numbers? ArrayList&lt;Integer&gt; numbers= new ArrayList&lt;Integer&gt;(); for( int i=0; i&lt;=10; i++){ String numbersString[i] = String.valueOf(numbers[i]); }
has title: Conversion of Integer Arraylist to string
has answer: http://stackoverflow.com/a/21413317
favorite count: 0
tagged with: integer
possible better answer: http://stackoverflow.com/a/21413074
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21413074
has answer: http://stackoverflow.com/a/21412978

http://stackoverflow.com/comment/32365028
comment on: http://stackoverflow.com/a/21448159
has text: Thanks for the reply! I was actually trying to use an array earlier the same way you have it but i typed it in the if statement under parsed, which is what could have messed it up.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/35194594
has body: use this in your menu.xml :- &lt;item android:id="@+id/action_search" app:showAsAction="collapseActionView|always" android:title="@string/action_search" app:actionViewClass="android.support.v7.widget.SearchView"/&gt; So you need to use app namespace instead of android in the menu item tag : app:actionViewClass="android.support.v7.widget.SearchView"
downvote count: 0
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21464033

http://stackoverflow.com/a/21468231
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Have a look at Memcached. It may offer a solution to your distributed cache needs. Also, as @Guy Bouallet mentioned, ehcache is also a viable solution.
answers question: http://stackoverflow.com/q/21468202
score: 4
accepted answer of: http://stackoverflow.com/q/21468202

http://stackoverflow.com/comment/32361317
type: QuestionComment
comment on: http://stackoverflow.com/q/21444612
score: 0
has text: Can you post the code for `ClinicService.findProviders()`?
type: Comment

http://stackoverflow.com/comment/32337390
score: 1
has text: Simply use `getClickCount()`. If it's bigger than 2, disable the clicking. I don't understand why you need an *exception* here.
comment on: http://stackoverflow.com/q/21433374
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32232449
has text: This [link][1] will help you . [1]:http://stackoverflow.com/a/18502670/2011291
comment on: http://stackoverflow.com/q/21373677
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/103405890
type: AnswerComment
has text: How are you populating it?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/39145347

http://stackoverflow.com/comment/32381837
comment on: http://stackoverflow.com/a/21411245
type: AnswerComment
has text: @MartinJames You were correct (see comments on question and accepted answer) basically my profiler was getting upset (still not sure why) and wildly overreporting the secondary thread times. Without the profiler my tasks were approximately 0.2ms and were still worth multithreading (by a small margin)
score: 0
type: Comment

http://stackoverflow.com/a/21426581
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/69991177
accepted answer of: http://stackoverflow.com/q/21426382
answers question: http://stackoverflow.com/q/21426382
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32325957
has comment: http://stackoverflow.com/comment/32325623
type: Answer
has body: what protocol you use? JSON, XML, something else? You need parse InputStream from HttpURLConnection (http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html) By the way, i suggest you this libraries: for JSON — Gson (http://code.google.com/p/google-gson/). for XML — SimpleXML (http://simple.sourceforge.net/). Also may be helpful: — Read/convert an InputStream to a String

http://stackoverflow.com/a/21496234
downvote count: 0
has body: You should refactor your code to isolate the internal methods that assume the data is good from the exposed public methods that execute the validation on the external inputs. Of course, if you screw up your data in the internal methods then it is your problem public void method1(){ String s1=""; String s1=getText(); if(MyValidation.isOk(s1)){ RunSomethingInternalForMethod1(s1); // or // if(RunSomethingInternalForMethod1(s1)) // RunSomethingInternalForMethod2(s1); } } public void method2(String s1){ if(MyValidation.isOk(s1)){ RunSomethingInternalForMethod2(s1); } } // PRIVATE HERE ... NO WAY TO CALL THIS FROM CODE EXTERNAL TO THIS CLASS private void RunSomethingInternalForMethod1(string s1){ ..... // You could call the additional internal code here, or add this // call after the public method1, you could even change the return value // of this method and call the second one only if this one is successful RunSomethingInternalForMethod2(s1); } private void RunSomethingInternalForMethod2(string s1){ } Another approach, but I really cannot recommend it because it leads to complex state is through the use of a global class level boolean variable that contains the result of the validation. I repeat myself, just in case your validations are complex and expensive to repeat (a simple null check is not an expensive operation) public Class Test { private bool _validatedOK = false; public void method1() { if(!_validatedOK) _validatedOK = MyValidation.isOk(s1); if{_validatedOK) { ...... method2(); } } public void method2() { if(!_validatedOK) _validatedOK = MyValidation.isOk(s1); if{_validatedOK) { ..... } } } As you can see this approach doesn't repeat the validation for the same instance of the class.
score: 2
has comment: http://stackoverflow.com/comment/32449760
has comment: http://stackoverflow.com/comment/32449719
upvote count: 2
has comment: http://stackoverflow.com/comment/32450110
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21496151
has comment: http://stackoverflow.com/comment/32449793
answers question: http://stackoverflow.com/q/21496151
type: Answer
has comment: http://stackoverflow.com/comment/32449855
has comment: http://stackoverflow.com/comment/32449920

validation
tags question: http://stackoverflow.com/q/21489908
tags question: http://stackoverflow.com/q/21377776
tags question: http://stackoverflow.com/q/21366463
tags question: http://stackoverflow.com/q/21387686
tags question: http://stackoverflow.com/q/21444856
tags question: http://stackoverflow.com/q/21506072
tags question: http://stackoverflow.com/q/21496151
tags question: http://stackoverflow.com/q/21461504
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/21456532
tags question: http://stackoverflow.com/q/21372160
tags question: http://stackoverflow.com/q/21417360
tags question: http://stackoverflow.com/q/21468220
tags question: http://stackoverflow.com/q/21422464
tags question: http://stackoverflow.com/q/21412895
tags question: http://stackoverflow.com/q/21364414
tags question: http://stackoverflow.com/q/21486930
tags question: http://stackoverflow.com/q/21401839
tags question: http://stackoverflow.com/q/21363481
tags question: http://stackoverflow.com/q/21407840
tags question: http://stackoverflow.com/q/21384895
tags question: http://stackoverflow.com/q/21501706
tags question: http://stackoverflow.com/q/21447308
tags question: http://stackoverflow.com/q/21416815

http://stackoverflow.com/q/21497236
answer count: 1
has comment: http://stackoverflow.com/comment/32451308
type: UnansweredQuestion
tagged with: android
has body: FIXED THAT ALONE there were lots of problems, i noticed them step by step with debugging, thanks anyway (: i have some weird error, the application just crashes. The problem is in this code: File sdcard = Environment.getExternalStorageDirectory(); File file = new File(sdcard,"Potato/Users.txt"); ////////// ------ CHECK IF USER EXISTS BEFORE REGISTER ----------- //Get the text file //Read text from file StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { text.append(line); text.append('\n'); int start = text.indexOf("{"); int end = text.indexOf("}"); login50 = text.substring(start + 1, end - start - 1); int start2 = text.indexOf("["); int end2 = text.indexOf("]"); password50 = text.substring(start + 1, end - start - 1); text=null; if(login50.equals(user)) { annoying=false; } } } catch (IOException e) { //You'll need to add proper error handling here } /////////////////////////// ----- DONE -------------- I did in my application simple register, 2 fields: login and password. The txt file looks like that: Login {example} ; Password [example] The code is taking string between {} as login and checking if what you wrote on textfield equals this string.. if yes, don't let create new account(annoying=false) All this on a loop for whole txt file, to check if what you wrote on textfield, is existing user or not. The application working to create new user, but if you write name as existing user, application crashes. And yes i have all the permissions on manifest file (: Help? ):
has comment: http://stackoverflow.com/comment/32451558
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21497296
has title: Android Reading file, error
score: 0

http://stackoverflow.com/comment/79111497
type: Comment
has text: Thank you so much , extremely useful and clearly explained.
comment on: http://stackoverflow.com/a/21391918
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32265945
has text: @Pshemo What's that got to do with it? The question is asking how to pass an array obtained from ArrayCreator.Create() to ArrayCreator.Sort().
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21392101

http://stackoverflow.com/a/21404398
answers question: http://stackoverflow.com/q/21403782
upvote count: 3
downvote count: 0
has body: This avoids any copying. The functions isBlank and toLowerCase are rather unspecified in your question, so define them the way you want. Just an example: boolean isBlank(char c) { return c == ' ' || c == ','; } char toLowerCase(char c) { return Character.toLowerCase(c); } Don't worry about the costs of method calls, that's what the JVM excels at. for (int i = 0, j = s.length() - 1; i &lt; j; ++i, --j) { while (isBlank(s.charAt(i))) { i++; if (i &gt;= j) return true; } while (isBlank(s.charAt(j))) { j--; if (i &gt;= j) return true; } if (toLowerCase(s.charAt(i)) != toLowerCase(s.charAt(j))) return false; } return true; Try to benchmark this... I'm hoping mu solution could be the fastest, but without measuring you never know.
has comment: http://stackoverflow.com/comment/32288172
type: Answer
score: 3

http://stackoverflow.com/comment/32272925
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21395992
has text: `String` costructor actually calls the `StringBuffer` constructor.
score: 1

http://stackoverflow.com/comment/32294678
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/21408788
has text: "At compile time when compiler comes into this line when 'row' and 'this' shows same object" - at compile-time, `row` doesn't have a value; it's just a variable. Your question is hard to understand because of this. Could you post a short but complete program demonstrating the problem? (Get rid of anything irrelevant, and make sure we can compile and run it without anything else.)
type: Comment

http://stackoverflow.com/comment/32342224
has text: `volatile` only guarantees visibility between threads and not synchronization.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21435982

http://stackoverflow.com/comment/32363959
type: Comment
comment on: http://stackoverflow.com/a/21447367
score: 0
type: AnswerComment
has text: @user3241911 I have added a new answer please go through it

http://stackoverflow.com/comment/32396138
has text: Having both `@Controller("PollService")` and @Service on one class makes no sense, you should use `@Controller` only for the classes in dispatcher servlet that directly process web requests. Btw Paul Hicks is right - it's not possible to inject anything before object is constructed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21465388
score: 0

http://stackoverflow.com/comment/32621838
has text: no, I ignored the Android Tab Layout with Swipeable Views and I use simple activity . thx ;)
type: Comment
comment on: http://stackoverflow.com/a/21492752
score: 0
type: AnswerComment

http://stackoverflow.com/a/21510654
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/21510177
answers question: http://stackoverflow.com/q/21510177
has body: Error message clearly indicates that you have wrong version of Servlet API in your classpath. Check your dependencies, you probably have pre-3.0 Servlet API somewhere, it should be removed.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32475467
score: 8

http://stackoverflow.com/comment/32302264
type: Comment
comment on: http://stackoverflow.com/a/21412921
score: 1
has text: Session is flushed implicitly during commit and managed declaratively by Spring so there's no point in managing sessions, transactions and flushing. Even if I explicitly make my function call flush after saveOrUpdate statement - it doesn't fix the problem. The solution was to call existing session instead of creating a new one. Still, thank you for your contribution.
type: AnswerComment

http://stackoverflow.com/a/21448852
has body: The reflect.Array.newInstance method uses native code because it must use native code. This has nothing inherently to do with performance but is a result of the fact that the Java language cannot express this operation. To show that it's a language limitation and not strictly related to performance, here is some valid code which creates a new array without directly invoking any native method. Object x = new String[0]; However, newInstance takes an arbitrary value of Class&lt;?&gt; and then creates the corresponding array with the represented type. However, this construct is not possible in plain Java and it cannot be expressed by the type-system or corresponding normal "new array" syntax. // This production is NOT VALID in Java, as T is not a type // (T is variable that evaluates to an object representing a type) Class&lt;?&gt; T = String.class; Object x = new T[0]; // -&gt; error: cannot find symbol T Because such a production is not allowed, a native method (which has access to the JVM internals) is used to create the new array instance of the corresponding type. While the above argues for the case of newInstance needing to be native, I believe many of the other reflect.Array methods (which are get/set methods) could be handled in plain Java with the use of specialized casting; in these cases the argument for performance holds sway. However, most code does not use the Array reflection (this includes "multi-valued data structures" such as ArrayList), but simply uses normal Java array access which is directly translated to the appropriate Java bytecode without going through reflect.Array or the native methods it uses. Conclusion: Java already provides fast array access through the JVM's execution of the bytecode. HotSpot, the "official" JVM, is written in C++ which is "native" code - but this execution of array-related bytecode is independent of reflect.Array and the use native methods. newInstance uses a native method because it must use a native method or otherwis…
score: 4
answers question: http://stackoverflow.com/q/21448328
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32395175
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik define "guarantees" ? The behavior is well defined in the JLS 17.4.
comment on: http://stackoverflow.com/q/21465364

http://stackoverflow.com/comment/32470236
score: 0
type: Comment
type: QuestionComment
has text: Use a `Clip` for playing sound!
comment on: http://stackoverflow.com/q/21507646

http://stackoverflow.com/comment/32458218
score: 0
type: Comment
type: QuestionComment
has text: I have to no clue how to refer to each textfield or label. say for example I want to get the value of the first field, how would I do that or I want to disable my second label, how would I do that?
comment on: http://stackoverflow.com/q/21501142

http://stackoverflow.com/q/21473299
has comment: http://stackoverflow.com/comment/32757922
tagged with: visualvm
has comment: http://stackoverflow.com/comment/32412279
upvote count: 4
tagged with: netbeans
downvote count: 0
type: UnansweredQuestion
has body: When I run an application on netbeans, it wont be detected by VisualVM. In local section it just shows VisualVM, GlassFish (pid 798) and Netbeans 6.9+ (pid 787). I created two applications one on JSK 6 and the other on SDK 7 but neither one will be detected by VisualVm! I am wondering why it does not detect either of applications. The details of my visualvm are as following, Version: 1.6.0_65 (Build 110613); platform 110613-unknown-revn System: Mac OS X (10.7.5) , x86_64 64bit Java: 1.6.0_65; Java HotSpot(TM) 64-Bit Server VM (20.65-b04-462, mixed mode) Vendor: Apple Inc., http://www.apple.com/ Environment: MacRoman; en_US (visualvm) Userdir: /Users/jack/Library/visualvm/6u23 Clusters: /System/Library/Java/Support/VisualVM.bundle/Contents/Home/platform /System/Library/Java/Support/VisualVM.bundle/Contents/Home/visualvm /System/Library/Java/Support/VisualVM.bundle/Contents/Home/profiler
has comment: http://stackoverflow.com/comment/32756064
has comment: http://stackoverflow.com/comment/32737591
tagged with: java
has title: Visualvm does not detect applications on Mac
score: 4
tagged with: glassfish
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/100666637
has answer: http://stackoverflow.com/a/21703325
has comment: http://stackoverflow.com/comment/32443422
favorite count: 0

http://stackoverflow.com/comment/32391906
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21462653
has text: @Lacrymae: I solve your static/nonstatic problem by creating an instance of my InputForm, and getting Strings and char[]'s out of it by calling methods on it. Again, please have a look at my comment above and my code example.

http://stackoverflow.com/comment/32258097
type: AnswerComment
has text: Do you not also have to check that it's connected?
type: Comment
comment on: http://stackoverflow.com/a/21388030
score: 0

http://stackoverflow.com/q/21399975
has answer: http://stackoverflow.com/a/21402911
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21402911
has comment: http://stackoverflow.com/comment/32280729
has body: When I try to mock class Event with mock(Event.class) I've got: java.lang.IllegalArgumentException: Object: Mock for Event, hashCode: 640142691 is not a known entity type. This is Event class: @Entity @Table(name = "event") @XmlRootElement public class Event implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Basic(optional = false) @Column(unique = true, name = "id") private Integer eventId; @Basic(optional = false) @NotNull @Size(min=1, max=255) @Column(name = "title") private String eventTitle; @Basic(optional = false) @JoinColumn(name = "created_by", referencedColumnName = "id") @ManyToOne private User eventCreatedBy; @Basic(optional = false) @Column(name = "created") @Temporal(TemporalType.TIMESTAMP) private Date eventCreated; public Event() { } // getters and setters for all database fields @Override public int hashCode() { int hash = 0; hash += (eventId != null ? eventId.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof Event)) { return false; } Event other = (Event) object; if ((this.eventId == null &amp;&amp; other.eventId != null) || (this.eventId != null &amp;&amp; !this.eventId.equals(other.eventId))) { return false; } return true; } @Override public String toString() { return "Event[ eventId=" + eventId + " ]"; } This is testing class: public class EventTest { private static final Integer EVENT_ID = 1; private static final String EVENT_TITLE = "title"; private EntityManager em; private EntityTransaction et; private EventServiceImpl eventService; @Before public void setUp() throws Exception { em = Persistence.createEntityManagerFactory("test").createEntityManager(); et = em.getTransaction(); eventService = new EventServiceImpl(); eventService.em = em; Event event = mock(Event.class); et.begin(); em.persist(event); } @After public void tearDown() throws Exception { em.close(); } @Test public void getList() { List list = eventS…
type: Question
tagged with: mocking
tagged with: mockito
tagged with: jpa
has title: Mock persistance class returns IllegalArgumentException
answer count: 1
tagged with: junit
downvote count: 0

http://stackoverflow.com/a/21460554
upvote count: 3
has comment: http://stackoverflow.com/comment/32386067
accepted answer of: http://stackoverflow.com/q/21460491
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21460491
has body: When you deserialize an object, then for all the classes up in the hierarchy, which doesn't implement Serializable interface, the constructor is invoked to initialize the state in that class. So, when your class B doesn't implement Serializable, the constructor runs, and assigns 7 to x, and hence you get 745. However, when it implements Serializable, that doesn't happen, and the value for x would be the one that it has while the object was serialized, i.e, 3 in this case.
has comment: http://stackoverflow.com/comment/32386097
type: Answer
has comment: http://stackoverflow.com/comment/32452562
has comment: http://stackoverflow.com/comment/32385905
score: 3

http://stackoverflow.com/a/21369835
answers question: http://stackoverflow.com/q/21369734
has comment: http://stackoverflow.com/comment/32225330
has comment: http://stackoverflow.com/comment/32225418
upvote count: 3
has comment: http://stackoverflow.com/comment/32226727
has comment: http://stackoverflow.com/comment/32225974
has comment: http://stackoverflow.com/comment/32225753
has comment: http://stackoverflow.com/comment/32225386
has body: change result != "Equal" to !result.equals("Equal") and result == "Higher" to result.equals("Higher") when you are using == on non primitives it just compares the adresses in the memory and not the object. in strings in java, sometimes it can be "smart" and put 2 same strings in the same address but thats not always, so sometimes "hello"=="hello" will return true and sometimes false
type: Answer
has comment: http://stackoverflow.com/comment/32226832
downvote count: 1
has comment: http://stackoverflow.com/comment/32225345
score: 2

http://stackoverflow.com/comment/32522626
type: AnswerComment
comment on: http://stackoverflow.com/a/21488807
type: Comment
has text: @user1857654 you're welcome, yes this is a way better approach.
score: 0

concurrency
tags question: http://stackoverflow.com/q/21446976
tag name: concurrency
tags question: http://stackoverflow.com/q/21354409
tags question: http://stackoverflow.com/q/21399270
tags question: http://stackoverflow.com/q/21491215
tags question: http://stackoverflow.com/q/21489300
tags question: http://stackoverflow.com/q/21428512
tags question: http://stackoverflow.com/q/21512550
tags question: http://stackoverflow.com/q/21369365
tags question: http://stackoverflow.com/q/21375940
tags question: http://stackoverflow.com/q/21455699
tags question: http://stackoverflow.com/q/21476104
tags question: http://stackoverflow.com/q/21455646
tags question: http://stackoverflow.com/q/21503188
tags question: http://stackoverflow.com/q/21504736
tags question: http://stackoverflow.com/q/21368971
tags question: http://stackoverflow.com/q/21486915
tags question: http://stackoverflow.com/q/21439275
type: Tag
tags question: http://stackoverflow.com/q/21487137
tags question: http://stackoverflow.com/q/21466171

http://stackoverflow.com/a/21491966
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21491920
has body: If it's an ArrayList you can simply iterate it without using counts etc: for( int i : myList ){ if( i &gt; 50 ){ } }
downvote count: 0

http://stackoverflow.com/comment/32437572
type: QuestionComment
comment on: http://stackoverflow.com/q/21488441
score: 0
has text: Thanks I got my solution
type: Comment

http://stackoverflow.com/comment/32243483
comment on: http://stackoverflow.com/q/21378128
type: Comment
has text: I get the same results when I choose to run (vs debug) my encapsulating junit project. It has the same error. Do you mean actually build it to jar and run via command line?
score: 0
type: QuestionComment

http://stackoverflow.com/a/21459646
accepted answer of: http://stackoverflow.com/q/21458468
type: Answer
answers question: http://stackoverflow.com/q/21458468
score: 2
downvote count: 0
has body: Gson works with (default and custom) TypeAdapterFactory instances and the TypeAdapter objects they create to serialize/deserialize your objects. It goes through the list of registered TypeAdapterFactory objects and picks the first one that can create an appropriate TypeAdapter for the type of the object your are providing. One of these TypeAdapterFactory objects, is one of type MapTypeAdapterFactory which creates a TypeAdapter (of type MapTypeAdapterFactory$Adapter) that serializes/deserializes based on the java.util.Map interface (keys/values). It does nothing about your custom sub type's fields. If you want Gson to serialize your type as both a Map and a custom type, you will need to register either a custom TypeAdapter directly or a custom TypeAdapterFactory that creates TypeAdapter objects.
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/21456907
has comment: http://stackoverflow.com/comment/41603284
has comment: http://stackoverflow.com/comment/109083265
type: Answer
has comment: http://stackoverflow.com/comment/41595020
upvote count: 7
has comment: http://stackoverflow.com/comment/32388193
score: 7
has body: The current API does not allow this combination of criteria. There's a patch attached to DATASOLR-105 which could help though it does not solve the problem fully. Usage of SimpleStringCriteria might help for now. Please be aware of the fact, that values have to be converted to a Solr readable format. new SimpleQuery(new SimpleStringCriteria("(x or y) and z")); Update Version 1.2 will have this issue fixed, so that its possible to create the query as follows. Criteria orPart = Criteria.where("x").is("foo").or("y").is("bar"); Criteria andPart = Criteria.where("z").is("roo"); Query query = new SimpleQuery(orPart.and(andPart));
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21431199
accepted answer of: http://stackoverflow.com/q/21431199
has comment: http://stackoverflow.com/comment/41581728

http://stackoverflow.com/comment/32411814
type: Comment
comment on: http://stackoverflow.com/a/21475046
score: 0
type: AnswerComment
has text: So the `<...>` is to be filled with any object? I'm confused on why `Rectangle` works here.

http://stackoverflow.com/q/21355028
has answer: http://stackoverflow.com/a/21355304
score: 1
tagged with: java
has title: connect to server socket running in eclipse
type: Question
tagged with: eclipse
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21355304
tagged with: sockets
has body: I want to connect a Client written in Perl and running via command line to a server written in java and running in Eclipse. It don't work, it's because the server is running in Eclipse ? when I try to run the server via command line I got an error, but in eclipse it work fine java MultiThreadServer Exception in thread "main" java.lang.NoClassDefFoundError: MultiThreadServer (wrong name: inet/MultiThreadServer) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
type: AnsweredQuestion

http://stackoverflow.com/q/21480009
tagged with: java
upvote count: 1
type: Question
has body: I am using Spring3. I have below property in one of the bean. private Properties properties; Here properties is util package property ${id} ${protocol} ${username} ${password} classpath:conf/test.properties Now how can I inject properties directly from spring configuration? Thanks!
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32420054
has title: autowiring properties directly into bean using spring?
has answer: http://stackoverflow.com/a/21480897
has answer: http://stackoverflow.com/a/21480927
tagged with: spring
linked to: http://stackoverflow.com/q/317687
tagged with: spring-mvc
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/21430282
has comment: http://stackoverflow.com/comment/32370801
type: Question
has comment: http://stackoverflow.com/comment/32372408
tagged with: sql
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/21431078
tagged with: jpql
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/32370436
type: UnansweredQuestion
has title: How to write this SQL select in JPA JPQL?
upvote count: 1
downvote count: 1
tagged with: java
has body: I have a Table, call it REI_BODY, and I have an another, call it REI_AMT_INFO. I have a select in oracle pl/sql: SELECT *, (SELECT AMT FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '01') AMT_01, (SELECT AMT FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '02') AMT_02, (SELECT SGN_CD FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '01') SGN_01, (SELECT SGN_CD FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '02') SGN_02, FROM REI_BODY T This is the REI_AMT_INFO table, no foreign key!: REI_ID (Number); AMT_TYPE_CD (Varchar); AMT (Number); SGN_CD (Varchar); I have to create this select in JPA JPQL language. How could I do this?

http://stackoverflow.com/comment/32317196
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21421551
has text: Ahh, their we go! What does volatile mean?
type: AnswerComment

http://stackoverflow.com/comment/32683782
has text: Thanks for the reply and sorry for replying so late =D I also just found out about this not too long ago after reading the developer's documentation for android so thanks for your help =D
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21439575
type: Comment

http://stackoverflow.com/a/21418444
answers question: http://stackoverflow.com/q/21418396
type: Answer
upvote count: 2
has body: Two things come to mind... Rather than using append, you should use setText. Append does exactly what it sounds like, it appends the text to the end of the underlying Document of the JTextArea, where as setText will replace the contents of the Document with the new value. And/or JTextAreaResult is null
score: 2
downvote count: 0

http://stackoverflow.com/comment/32223843
type: QuestionComment
comment on: http://stackoverflow.com/q/21368999
has text: In another class called setOfUsers
score: 0
type: Comment

http://stackoverflow.com/comment/32390286
type: AnswerComment
type: Comment
has text: @MayNotBe Both of those are equivalent. They give me the same result, as expected.
comment on: http://stackoverflow.com/a/21462320
score: 0

http://stackoverflow.com/comment/32203606
type: QuestionComment
comment on: http://stackoverflow.com/q/21357608
has text: What kind of workflow are you looking for? Finding the size is easy, but if you want to do it programatically, you're best off with ASM.
score: 0
type: Comment

http://stackoverflow.com/comment/32393089
comment on: http://stackoverflow.com/q/21463777
type: QuestionComment
has text: You be opening your database too. You declare it but never call `db.open()`. Running the `cursor.getCount()` will show you zero because its not writing in the database.
type: Comment
score: 0

http://stackoverflow.com/q/21371968
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5818101
has body: My bean is called Zone, i got all Zones from sql Server with Hibernate. in DAO.Class: List zones = session.createQuery("FROM Zone").list(); i want to send this List from a servlet to a jsp. In servlet.class List result = dao.getListZone(); request.setAttribute("userList",result); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/home.jsp"); dispatcher.forward(request,response); in my jsp: List viewList = new ArrayList(); if(request.getAttribute("userList")!=null &amp;&amp; request.getAttribute("userList")!="") List&lt;Zone&gt; userList = (List)request.getSession().getAttribute("userList"); itr = userList.iterator(); while(itr.hasNext()) { if(count%2==0) { bgcolor = "#C8E2D1"; } else { bgcolor = "#EAF8EF"; } viewList = (ArrayList)itr.next(); int id = Integer.parseInt(viewList.get(0).toString()); viewItr = viewList.iterator(); %&gt; &lt;tr style="background-color:&lt;%=bgcolor%&gt;;"&gt; &lt;% while(viewItr.hasNext()) { %&gt; &lt;td&gt;&lt;%=viewItr.next()%&gt;&lt;/td&gt; it says that it cannot cast my bean Zone to arrayList. and it says that the line itr = userList.iterator(); make the error. Thank you for your help. I got this error: java.lang.ClassCastException: bean.Zone cannot be cast to java.util.ArrayList in the first line of the code below viewList = (ArrayList&lt;Zone&gt;)itr.next(); int id = Integer.parseInt(viewList.get(0).toString()); viewItr = viewList.iterator();
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/21371994
tagged with: servlets
downvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
tagged with: arraylist
has title: cannot display an arrayList in JSP
upvote count: 3

http://stackoverflow.com/comment/32328086
type: AnswerComment
comment on: http://stackoverflow.com/a/21427910
has text: @sanbhat Ahh.. Thanks. That's a blunder.
type: Comment
score: 1

http://stackoverflow.com/a/21458700
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32384012
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/32383670
has comment: http://stackoverflow.com/comment/32383890
accepted answer of: http://stackoverflow.com/q/21458625
has comment: http://stackoverflow.com/comment/32383493
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21458625
has body: But could a synchronized object's reference also be changed by another thread B while thread A holds the lock for the same object? If you mean "could another thread change the value of the myTable variable, the answer is "absolutely"... assuming there's a code path that would allow that. It's a private variable, so you should be able to find all the code that can change the value. Holding a lock just stops another thread from acquiring the same lock. It doesn't have any effect on what code can access which variables, in itself. As a side-note, it's important to differentiate between an object, a variable, and the value of the variable (which is a reference, not an object). So there's no such thing as a "final object" - only variables (and classes and methods) can be final. Likewise there's no such thing as a "synchronized object", and you can't change an "object's reference" - you can change the value of a variable so that it's a reference to a different object. Making these distinctions clear in your mind may help you when thinking about what's going on here.

http://stackoverflow.com/a/21430796
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32332830
has body: MySQL is telling you that the number of columns in your query do not match the number of columns in the table. That should be a fairly easy fix but after you fix that you're still going to have a potentially nasty bug in this code. What that bug is will depend on exactly how you have defined the tbl_addcharityroom1 table. I would assume by looking at this that you have multiple charity wards and those have a many to one relation with the categories table. This means that the select inside your insert statement may have multiple returned values. When this happens the query will fail. You are going to want to modify this code to handle that case. You can either look them all up ahead of time and perform an insert for each or you can use the CONCAT MySql command to put them all into a string which can be save as a discrete value.
answers question: http://stackoverflow.com/q/21430527

http://stackoverflow.com/comment/32402976
type: Comment
has text: Absolutely. Here's proof that I'm using jUnit4: http://imageshack.com/a/img28/9131/yzhz.png
comment on: http://stackoverflow.com/q/21465873
score: 0
type: QuestionComment

http://stackoverflow.com/q/21388110
tagged with: eclipse
type: Question
score: 5
upvote count: 5
downvote count: 0
answer count: 1
has body: I am debugging my Android app by having it stop at a breakpoint. Indeed, execution stops at the breakpoint, but once I step over one step, then step into, the problems start: Instead of stepping into the function, the debugger seems to perform a step over, just highlighting the next line. When I then press step over, a message box pops up with one of the following messages: com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine occurred creating step request. or org.eclipse.jdi.TimeoutException: Timeout occurred while waiting for packet xxx occurred creating step request. This happens whenever I perform the steps above (Always on the same breakpoint), which is preventing me from debugging my app. I am debugging on a real device, using Eclipse on Windows. I already tried: Restarting Eclipse Increasing the Debugging Timeout in Eclipse, which just leads to the first error to appear more often in comparison Now here are my questions: Has anyone else come across this problem? What could I do to solve the problem?
favorite count: 0
tagged with: vmdisconnectedexception
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23960605
tagged with: java
has title: VMDisconnectedException while debugging Android App

http://stackoverflow.com/q/21403095
answer count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: broadcastreceiver
has title: Custom notification Android
tagged with: alarmmanager
has body: I've got a question. I want to use a notification service through BroadcastReceiver and AlarmManager. I set the alarm manager with a list of times from my db. I use this method that I call in my MainActivity onCreate(), but it doesn't work private void restartNotify() { AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); am.cancel(pendingIntent); ArrayList&lt;String&gt; item = new ArrayList&lt;String&gt;(); item = GetLists.GetTimesListForNotification(this); for (int i = 0; i &lt; item.size(); ++i) { String time = item.get(i); int Position = time.indexOf(":"); int hour = Integer.parseInt(time.substring(0, Position)); int min = Integer.parseInt(time.substring(Position + 1)); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, min); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); am.set(AlarmManager.RTC, cal.getTimeInMillis(), pendingIntent); } This is my broadcast receiver public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { NotificationManager mManager; mManager = (NotificationManager) context.getApplicationContext().getSystemService(context.getApplicationContext().NOTIFICATION_SERVICE); Intent intent1 = new Intent(context.getApplicationContext(), MainActivity.class); Notification notification = new Notification(R.drawable.ic_launcher, "New message to read", System.currentTimeMillis()); intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingNotificationIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, intent1, PendingIntent.FLAG_UPDATE_CURRENT); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.setLatestEventInfo(context.getApplicationContext(), "notification are work"…
tagged with: notifications
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32451024
comment on: http://stackoverflow.com/a/21496902
type: Comment
score: 0
type: AnswerComment
has text: Have you find id for ListView?

http://stackoverflow.com/a/21411959
answers question: http://stackoverflow.com/q/21411930
has comment: http://stackoverflow.com/comment/32300309
has body: Use a semi-colon classpath separator for Windows java -cp .;jdbc.jar Seb ^ Read: PATH and CLASSPATH
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21411930
has comment: http://stackoverflow.com/comment/32300278

http://stackoverflow.com/q/21478989
type: UnansweredQuestion
has title: Set jInternalFrame background to transparent
downvote count: 0
score: 1
tagged with: java
tagged with: background
has answer: http://stackoverflow.com/a/21479164
type: Question
upvote count: 1
answer count: 1
tagged with: jinternalframe
has body: I am having trouble setting the background of my jInternalFrame to transparent. I have tried setting jInternalFrameVarName.Opacity(false), but it doesn't do the trick. Any suggestions?
favorite count: 0
tagged with: transparency

http://stackoverflow.com/comment/32270005
type: Comment
type: QuestionComment
score: 0
has text: How about `ConnectException`?
comment on: http://stackoverflow.com/q/21394399

http://stackoverflow.com/q/21486836
has answer: http://stackoverflow.com/a/21486968
favorite count: 0
has answer: http://stackoverflow.com/a/21487757
has body: I want to convert binary to decimals and characters like this: 11010 --&gt; 1101 + 0(parity bit) --&gt;decimals= 11 --&gt; char ";" 10101 --&gt; 1010 + 1 --&gt;decimals= 5 --&gt; char "5" . . public class stringek { String bitek = "1101010101001000001000001"; String[] bits; String four; char par; int parity; String digits; int n = 0; int b; int kurens; int decimalis; int digit; public stringek() { this.kurens = 0; bits = new String[200]; for (int i = 0; i &lt; 25; i += 5) { bits[n] = bitek.substring(i, i + 5); n++; } for (int i = 0; i &lt; n; ++i) { int j = 0; four = bits[i].substring(j, j + 4); for (int p = 0; p &lt; 4; ++p) { b = Integer.parseInt(four.substring(p)); kurens += b; } par = bits[i].charAt(j+4); //System.out.print(par); parity = par-'0'; decimalis = Integer.parseInt(four, 2); digit = decimalis + 48; if ((kurens + parity) % 2 == 0) { System.out.println("Binarys: "+four+"-"+par+" = "+"'"+(char)digit+"'"+" Decimalis:"+decimalis+" Parity &lt;INVALID&gt; "); } else{ System.out.println("Binarys: "+four+"-"+par+" = "+"'"+(char)digit+"'"+" Decimalis:"+decimalis+" Parity &lt;VALID&gt; "); } } } } but my program results this: Binarys: 1101-0 = '=' Decimalis:13 Parity &lt;INVALID&gt; Binarys: 1010-1 = ':' Decimalis:10 Parity &lt;VALID&gt; Binarys: 0010-0 = '2' Decimalis:2 Parity &lt;INVALID&gt; Binarys: 0001-0 = '1' Decimalis:1 Parity &lt;INVALID&gt; Binarys: 0000-1 = '0' Decimalis:0 Parity &lt;VALID&gt; Can anyone help me to resolve? I have to say cause in my case all Parity is VALID, but I don't know why here some Parity is Invalid (I know cause the results from if give me this results, but I want to know how to resolve to be VALID when is valid and INVALID when is really invalid). thanks
has comment: http://stackoverflow.com/comment/32432111
has title: Converting binary to decimals and characters
has answer: http://stackoverflow.com/a/21487162
has comment: http://stackoverflow.com/comment/32432279
score: -3
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32432206
type: Question
accepted answer: http://stackoverflow.com/a/21487162
answer count: 3
has comment: http://stackoverflow.com/comment/32432202
upvote count: 0
possible better answer: http://stackoverflow.com/a/21486968

http://stackoverflow.com/comment/32292384
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21407409
has text: Why did you think that would work? Again, have you read the concurrency tutorials? You have to call wait() and notify() on the same instance for them to work together. Calling them on two separate instances doesn't do anything.

http://stackoverflow.com/comment/32229870
has text: Would you consider replacing those seven fields with an array?
score: 0
comment on: http://stackoverflow.com/q/21372327
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21499197
upvote count: 0
score: -2
has body: Hi I have a 2 tables in hive. I want to insert a result of a query on the first table1 into they array string attribute in the second table2. CREATE TABLE t1 ( id STRING ); CREATE TABLE t2 ( ids ARRAY&lt;STRING&gt; ); For example I can do a simple Select id from table1 ...and some code to insert into table2.ids Is it possible?
tagged with: sql
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32454661
has comment: http://stackoverflow.com/comment/32457327
has answer: http://stackoverflow.com/a/21500864
tagged with: hive
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21500864
tagged with: java
has title: Result of select into array
downvote count: 2
type: Question

http://stackoverflow.com/q/21378773
accepted answer: http://stackoverflow.com/a/21400955
tagged with: download
linked to: http://stackoverflow.com/q/16078544
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25319323
tagged with: java
tagged with: servlets
score: 12
type: Question
possible better answer: http://stackoverflow.com/a/21379942
linked to: http://stackoverflow.com/q/3190303
upvote count: 12
has answer: http://stackoverflow.com/a/21379942
downvote count: 0
has body: I am working on Java ExtJS application in which I need to create and download a CSV file. On clicking a button I want a CSV file to be downloaded to a client's machine. On buttons listener I am calling a servlet using AJAX. There I am creating a CSV file. I don't want the CSV file to be saved in the server. I want the file should be created dynamically with a download option. I want the contents of a file to be created as a string and then I will serve the content as file in which it will open as download mode in browser (this I have achieved in other language, but not sure how to achieve it in Java). Here is my code only to create a CSV file, but I really don't want to create or save CSV file if I can only download the file as CSV. public String createCSV() { try { String filename = "c:\\test.csv"; FileWriter fw = new FileWriter(filename); fw.append("XXXX"); fw.append(','); fw.append("YYYY"); fw.append(','); fw.append("ZZZZ"); fw.append(','); fw.append("AAAA"); fw.append(','); fw.append("BBBB"); fw.append('\n'); CSVResult.close(); return "Csv file Successfully created"; } catch(Exception e) { return e.toString(); } } Can any one help me on this. Thanks
has comment: http://stackoverflow.com/comment/32242398
favorite count: 0
has answer: http://stackoverflow.com/a/21400955
has title: Create and download CSV file in a Java servlet
answer count: 3
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/comment/32494904
has text: @hakank updated answer accordingly (feel free to edit further if desired :)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21496625
type: Comment

http://stackoverflow.com/q/21470539
has answer: http://stackoverflow.com/a/25579396
tagged with: string
has comment: http://stackoverflow.com/comment/32405071
favorite count: 0
has answer: http://stackoverflow.com/a/21470949
tagged with: count
has body: I have made a program to count the number of vowels and consonants in an inputted string: Scanner in = new Scanner(System.in); System.out.print("Enter a string "); String phrase = in.nextLine(); int i, length, vowels = 0; int consonants = 0; boolean y = false; String j; length = phrase.length(); for (i = 0; i &lt; length; i++) { j = "" + phrase.charAt(i); boolean isAVowel = "aeiou".contains(j.toLowerCase()); boolean y = "y".contains(j.toLowerCase()); if(isAVowel){ vowels++; }else if(isAVowel &amp;&amp; y){ vowels++; consonants++; //}else if(y &amp;&amp; !(isAVowel)){ // vowels++; }else{ consonants++; } System.out.println("The number of vowels in \"" +phrase+"\" is "+ vowels+".\n\nThe number of consonants is "+consonants+".\n\n"); When "y" is by itself it says its a consonant, it should be a vowel. Where do I state this?
accepted answer: http://stackoverflow.com/a/21470587
answer count: 4
has comment: http://stackoverflow.com/comment/32404919
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21470949
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21477290
has title: Counting vowels with consonants
type: Question
has comment: http://stackoverflow.com/comment/32404991
has answer: http://stackoverflow.com/a/21470587
downvote count: 0

http://stackoverflow.com/q/21365290
tagged with: shrink
has answer: http://stackoverflow.com/a/21365427
has answer: http://stackoverflow.com/a/21365428
accepted answer: http://stackoverflow.com/a/21365428
has title: Delete some items from an array and shrink array in Java
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21365427
has comment: http://stackoverflow.com/comment/32216760
has body: I have an array like this: double[] my_input_array = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; and some known positions which represent where to remove items from the array. For example if positions are 3 and 7 I would like to get a my_output_array = { 0, 1, 2, 4, 5, 6, 8 }; So I would like to have a function like this: public double[] getShinkedArray(double[] my_input_array, int... positions){ /* SOME CODE */ return my_output_array; } I noticed this question Delete item from array and shrink array but these answers remove only one element at time from an array.
tagged with: arrays
tagged with: resize
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/4870188

http://stackoverflow.com/q/21372559
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/21372588
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/21372571
score: 1
has body: I can't believe I'm having so much trouble on something so trivial. For whatever reason, these lines of code are causing a nullpointerexception Card[] arr = new Card[2]; System.out.print(arr[0].val + "\n"); //this is the line throwing the error Card is defined as public class Card { public int val; public char suit; } Compilation is successful, I made sure it's referencing the right class. I feel like I'm overlooking some small detail. I also noticed that Card a = new Card(); Card b = new Card(); Card[] arr = {a, b}; System.out.print(arr[0].val + "\n"); works perfectly fine.
tagged with: java
has title: Getting java.lang.NullPointerException
possible better answer: http://stackoverflow.com/a/21372583
downvote count: 1
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/21372583
has comment: http://stackoverflow.com/comment/32230248
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/14258058
has answer: http://stackoverflow.com/a/21372571
has answer: http://stackoverflow.com/a/21376302

http://stackoverflow.com/a/21499214
score: 1
upvote count: 1
has body: I need a way to respond only one time when the same broadcast is sent out multiple times If you receive two, three, or a million broadcasts in succession, where the state value has not changed from the previous broadcast, the state has not changed. Only perform your "the state has changed" logic when state changes, not just because you received the broadcast. Whether you need a dedicated boolean lastHeadsetState data member to detect the change in state, or can infer the last state from other things in your app, I cannot say. Now, ideally, you would not need this logic, as ideally the broadcast would only go out once, upon a change in state. The closer you get to hardware, the more device quirks pop up. Hence, the robustness principle is all the more important the closer you get to hardware.
downvote count: 0
has comment: http://stackoverflow.com/comment/32455581
type: Answer
has comment: http://stackoverflow.com/comment/32455221
answers question: http://stackoverflow.com/q/21498381
has comment: http://stackoverflow.com/comment/32680065

http://stackoverflow.com/comment/32310939
type: Comment
score: 1
type: AnswerComment
has text: If you use "@Named @ApplicationScoped @Eager" it should be called at application startup. If you let only "@Named @ApplicationScoped", it will be executed at first bean access.
comment on: http://stackoverflow.com/a/21417202

http://stackoverflow.com/q/21390342
answer count: 2
has answer: http://stackoverflow.com/a/21390976
downvote count: 0
tagged with: critical-section
has answer: http://stackoverflow.com/a/21390416
has body: Hello guys I'd like to ask, if is there any type of implementation ,that can be used to set method/part of code as atomic operation in Java, so it can't be stopped/paused (must be executed to the end). I need that for ensure that while I am buffering MP3 file to buffer, represented as front of frames that has size of bit rate of that file, the thread will read the whole frame, or the operation will fail to be done, but to avoid that buffer will read only a part of frame, to avoid tears in playing, and errors in data consistence. I am asking because there will be multiple threads working with that file (BufferClass, PlayerClass, FileInfoClass, etc..) and the file will be implemented as typical example of Critical Part of data, so there will be synchronization through a monitor. Maybe that can be served by some avoid of call Thread.wait() / Thread.notify() but I am not that advanced in Java.
tagged with: atomic
favorite count: 0
possible better answer: http://stackoverflow.com/a/21390976
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32267422
has comment: http://stackoverflow.com/comment/32262402
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21390416
type: Question
has title: Is there any implementation of atomic methods in Java?

http://stackoverflow.com/a/21481473
answers question: http://stackoverflow.com/q/21479580
accepted answer of: http://stackoverflow.com/q/21479580
downvote count: 0
score: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/77403829
upvote count: 7
type: Answer
has body: I'm an idiot. I've already clashed with this problem in the past but I forgot. To everyone that steps here with the same problem here is the solution. Container Managed Transactions only works if the container is an EJB. It does NOT works if the container is JSF! It doesn't matters how you inject your entity managers, injections succeed but the created object will not works. The way of solving it, is creating an EJB DAO object that deal with the database for you. Something like @Named @Stateless public class MyDAO { @PersistenceContext(unitName = "SRA") private EntityManager em; public void save(Object o) { em.persist(o); em.flush(); } } and then injecting those object inside your managed bean like this: @ManagedBean @SessionScoped public class MyManagedBean { @EJB private MyDAO dao; public void action() { .... dao.save(o); } } injecting directly an EntityManager into a Managed Bean will give you a Transaction Required Exception. I'm still unsure about injecting something like that into a broader scoped bean. I will look into this later.

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

http://stackoverflow.com/a/21427030
downvote count: 0
has body: Another option is to have an object with the references to node and priv inside it, modify that object from the called method and the calling method will see the change.
answers question: http://stackoverflow.com/q/21426901
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/32504739
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21527344
has text: To implement the second one (for a different test) would that just be creating a setter method for `passwordhash`?

http://stackoverflow.com/comment/32230702
has text: You can call any constructor. Do you want to do something like `public Student(String name, String dateOfBirth) { super(name.split(" ")[0], "", name.split(" ")[1]); this.dateOfBirth = dateOfBirth; }`? (Note: my code is hacky, you should separate string parsing into a smarter method)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21372704

http://stackoverflow.com/a/21353820
type: AcceptedAnswer
downvote count: 0
has body: PrintWriter output = new PrintWriter(theFile); It erases your file.
upvote count: 9
type: Answer
score: 9
accepted answer of: http://stackoverflow.com/q/21353809
answers question: http://stackoverflow.com/q/21353809

http://stackoverflow.com/q/21499249
upvote count: 0
answer count: 1
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/32458659
type: UnansweredQuestion
tagged with: spring
score: -1
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
has body: I know that this problem here very popular. But anyone didn't help me. The problem is that I can't configure my spring-security.xml config file. I'm also have 404 error on / page. web.xml <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/spring-context.xml /WEB-INF/spring-data.xml /WEB-INF/spring-security.xml /WEB-INF/mvc-dispatcher-servlet.xml mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / org.springframework.web.context.ContextLoaderListener charsetFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true charsetFilter /* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* spring-security.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <intercept-url pattern="/*" access="permitAll" /> <intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> <form-login login-page="/" default-target-url="/home" authentication-failure-url="/?error=true"/> <logout logout-success-url="/" /> <authentication-manager> <authentication-provider user-service-ref="userDetailsService" /> </authentication-manager> </beans:beans> Please, help me with my problem. Thanks! ===UPDATE=== mvc-dispatcher-servlet.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:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans…
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/33664712
has title: Spring Security 3.2 XML configuration
has comment: http://stackoverflow.com/comment/32460093
has comment: http://stackoverflow.com/comment/32462521

http://stackoverflow.com/comment/32452623
type: QuestionComment
comment on: http://stackoverflow.com/q/21497856
score: 0
has text: any other better solution to get data from above json string ?
type: Comment

http://stackoverflow.com/q/21458479
tagged with: cmd
possible better answer: http://stackoverflow.com/a/21459283
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/33181473
has comment: http://stackoverflow.com/comment/32382219
downvote count: 2
has comment: http://stackoverflow.com/comment/32382167
has answer: http://stackoverflow.com/a/22053099
tagged with: war
has answer: http://stackoverflow.com/a/22026361
tagged with: eclipse-kepler
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22046981
has body: I'm developing an Installer for a project team to reduce the amount of work they have to do installing it manually. We are using: Windows 7 x64, Eclipse Kepler Right now I'm looking for a way to import a .war file using the commandline. Is there any way to do this via cmd?
type: Question
has comment: http://stackoverflow.com/comment/33181839
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/32382163
has answer: http://stackoverflow.com/a/21459283
has comment: http://stackoverflow.com/comment/33184995
has title: Importing .war file using cmd
accepted answer: http://stackoverflow.com/a/22046981

http://stackoverflow.com/q/21387170
has comment: http://stackoverflow.com/comment/35167007
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35294087
has title: java, xsd & marshalling: jre bug, my fault or xsd issues?
tagged with: xsd
has answer: http://stackoverflow.com/a/23093089
has comment: http://stackoverflow.com/comment/35297908
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/9131730
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32258537
tagged with: java
score: 10
tagged with: jaxb
upvote count: 10
has body: I am running into a problem while marshalling a JAXB model tree to a xml file. I created those model classes using xjc. I cannot modify these xml schemas - they are defined externally (similar to this question which lacks for answers). The xml schema files seems to be valid according xjc (and other xml tools). I am asking whether this is a java/jre bug or I am doing something wrong or if the schema files are somewhat errornous and how to resolve this issue. The exception which I get is: com.sun.istack.internal.SAXException2: "com.mypackage.A" is substituting "com.mypackage.BaseType", but "com.mypackage.A" is bound to an anonymous type. at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:237) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:652) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:143) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:343) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:685) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:54) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:157) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:144) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:343) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:335) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:685) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:143) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.j…
has comment: http://stackoverflow.com/comment/32258275
type: Question

http://stackoverflow.com/a/24829197
answers question: http://stackoverflow.com/q/21386371
type: Answer
upvote count: 4
downvote count: 0
has body: I would suggest not creating the project from inside Intellij. Since Intellij imports Gradle projects quite nicely you can just import one of the pre-made Groovy Gradle Quick Starts you can find at the root of your Gradle installation. For example $GRADLE_HOME/samples/groovy/mixedJavaAndGroovy has the exact Java/Groovy layout you describe with the HelloWorld Classes and Tests in place. Just copy it, rename the root folder, import it into Intellij and code!
score: 4

akka
tags question: http://stackoverflow.com/q/21499758
type: Tag
tag name: akka
tags question: http://stackoverflow.com/q/21350078
tags question: http://stackoverflow.com/q/21455020

http://stackoverflow.com/comment/32461596
type: Comment
has text: @ThomasMueller: I completely rewrote my answer. Are you sure you need Fletcher? It's fast but it's not much faster than e.g. murmurhash and it's a crap.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21498866

http://stackoverflow.com/q/21356658
has title: Why does one IDE not let me add parameters for JComboBox?
tagged with: swing
tagged with: parameters
tagged with: jcombobox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21367075
tagged with: java
type: Question
answer count: 2
has body: I have two Java IDEs that I alternate between. jGRASP is for simpler tests and miscellaneous files, and Netbeans I use for more complex projects. I'm currently using jGRASP and I'm trying to declare a JComboBox&lt;String&gt; object, but when I try to compile it, it gives me the message: type javax.swing.JComboBox does not take parameters But when I use JComboBox in Netbeans and set its parameter type to String, it doesn't give me that error. Does anyone know why this is?
score: 0
possible better answer: http://stackoverflow.com/a/21367075
tagged with: string
has answer: http://stackoverflow.com/a/21356683
accepted answer: http://stackoverflow.com/a/21356683

http://stackoverflow.com/comment/32272847
score: 0
type: Comment
has text: Thanks. Got it. So, I have to upload all my files to hdfs before processing them. I have a another question that, I am able to browse and see my outputs through: http://localhost:50075/browseDirectory.jsp?namenodeInfoPort=50070&dir=/&nnaddr=127.0.0.1:9000 But, is it possible for me to see them in the hadoop directory ? If yes, then which directory is the directory 'out' created is stored ? thanks
comment on: http://stackoverflow.com/a/21371787
type: AnswerComment

http://stackoverflow.com/a/21447553
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32363972
has body: Is the problem to figure out what's wrong with your professor's code or to write your own method? If it's the former, I'd also point out the intent of the error message should be "You must enter a decimal value".
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21447308
has comment: http://stackoverflow.com/comment/32363862

http://stackoverflow.com/comment/32220007
score: 0
type: Comment
has text: this library is used for serial communication `rxtx` name of dll is `rxtxSerial.dll`
comment on: http://stackoverflow.com/q/21366825
type: QuestionComment

http://stackoverflow.com/q/21372232
tagged with: class
score: 3
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32234912
has comment: http://stackoverflow.com/comment/32231818
has answer: http://stackoverflow.com/a/67881296
has comment: http://stackoverflow.com/comment/32234971
has title: Eclipse is creating two class files
has comment: http://stackoverflow.com/comment/32230375
has answer: http://stackoverflow.com/a/22673848
tagged with: refresh
has comment: http://stackoverflow.com/comment/32234820
has comment: http://stackoverflow.com/comment/32231708
upvote count: 3
tagged with: java
answer count: 3
has body: When I create a new class inside a package for some reason it creates two class files: one inside of the package and one out of it. I wanted to know why this is happening? Also, at times, Eclipse are kind of "hiding" some of my classes, so that they do not appear in the project explorer, although when you create a new class file with the same name of the class that disappeared, it says the class already exists... When I refresh (F5) the package, these problems are sort of solved. But they happen again when I create a new class or when I restart Eclipse. So I wanted a different solution from keep pressing F5 everytime...
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58406099
tagged with: eclipse

http://stackoverflow.com/comment/32210739
comment on: http://stackoverflow.com/a/21353060
type: AnswerComment
score: 0
type: Comment
has text: But why are there org.apache.openjpa in the stacktrace? I guess that OpenJPA is the default JPA Provider of your JEE container and that the configuration has to be fixed.

http://stackoverflow.com/comment/32252942
has text: Hm, I am not used to Collections. And actually, i only want to get the newest Version thats all. i am trying to run this in my method "public static String getNewestVersion()"
score: 0
comment on: http://stackoverflow.com/a/21385052
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32390570
score: 0
type: QuestionComment
has text: Did you give input other than a number?
type: Comment
comment on: http://stackoverflow.com/q/21463105

http://stackoverflow.com/comment/32283116
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21401182
has text: Quite right, you need to try the subtrees of all nodes on the path from the tree root down to the given node. Thanks for pointing at this.

http://stackoverflow.com/q/21472660
has comment: http://stackoverflow.com/comment/32408150
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21473213
type: Question
has answer: http://stackoverflow.com/a/21472739
has comment: http://stackoverflow.com/comment/32408215
downvote count: 0
has answer: http://stackoverflow.com/a/21472747
possible better answer: http://stackoverflow.com/a/21472739
has comment: http://stackoverflow.com/comment/32408208
tagged with: android
accepted answer: http://stackoverflow.com/a/21472747
has body: I am trying to implement simple internal data storage code.In it I want to show ProgressDialog for some background process which will increment by 5 while calling publishProgress(). But it gives me error like the following, The method publishProgress(R.integer...) in the type AsyncTask&lt;String,R.integer,String&gt; is not applicable for the arguments (int) following is the code. public class loadSomeStuff extends AsyncTask&lt;String, integer, String&gt; { ProgressDialog dailog; protected void onPreExecute() { //example of setting up something dailog=new ProgressDialog(MainActivity.this); dailog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dailog.setMax(100); dailog.show(); } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String collected=null; FileInputStream fis=null; for(int i=1; i&lt;=20; i++) { publishProgress(5); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } dailog.dismiss(); try { fis=openFileInput(FileName); byte[] dataArray = new byte[fis.available()]; while(fis.read(dataArray)!= -1) { collected=new String(dataArray); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { fis.close(); return collected; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; } protected void onProgressUpdate(Integer...progress) { dailog.incrementProgressBy(5); } protected void onPostExecute(String result) { DataResults.setText(result); } }
has answer: http://stackoverflow.com/a/21473288
favorite count: 0
has comment: http://stackoverflow.com/comment/32408555
tagged with: android-asynctask
answer count: 5
has title: messed up with publishProgress method while using it in AsyncTask
upvote count: 1
has answer: http://stackoverflow.com/a/29714547
type: AnsweredQuestion

http://stackoverflow.com/comment/32362886
type: QuestionComment
has text: see http://stackoverflow.com/questions/8907626/is-this-a-prefect-way-to-stop-handlerthread/8907981#8907981
comment on: http://stackoverflow.com/q/21446976
score: 0
type: Comment

http://stackoverflow.com/q/21393373
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/17480639
has comment: http://stackoverflow.com/comment/32268360
favorite count: 0
has title: Java memory leak caused by MySQL libraries
tagged with: memory-leaks
tagged with: jdbc
has body: I have a thread that executes and updates a database with some values. I commented out all the operations done to the data and just left the lines you can see below. While running the program with the lines you see bellow I get a memory leak. This is what it looks like in VisualVM Mysql Class public ResultSet executeQuery(String Query) throws SQLException { statement = this.connection.createStatement(); resultSet = statement.executeQuery(Query); return resultSet; } public void executeUpdate(String Query) throws SQLException { Statement tmpStatement = this.connection.createStatement(); tmpStatement.executeUpdate(Query); tmpStatement.close(); tmpStatement=null; } Thread file public void run() { ResultSet results; String query; int id; String IP; int port; String SearchTerm; int sleepTime; while (true) { try { query = "SELECT * FROM example WHERE a='0'"; results = this.database.executeQuery(query); while (results.next()) { id = results.getInt("id"); query = "UPDATE example SET a='1' WHERE id='" + id + "'"; SearchTerm=null; this.database.executeUpdate(query); } results.close(); results = null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } The problem has happened with many other people after researching the web, https://forum.hibernate.org/viewtopic.php?f=1&t=987128 Is bone cp or mysql.jdbc.JDBC4Connection known for leaking? and a few more if you google "jdbc4resultset memory leak"
has answer: http://stackoverflow.com/a/21393555
has comment: http://stackoverflow.com/comment/32268366
has comment: http://stackoverflow.com/comment/32268476
upvote count: 2
has answer: http://stackoverflow.com/a/21393421
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21393421
tagged with: java
accepted answer: http://stackoverflow.com/a/21393555
tagged with: mysql
has comment: http://stackoverflow.com/comment/32268395

http://stackoverflow.com/comment/32392089
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21437336
score: 0
has text: @user2916314 Yes, when you add a new Component to your layout, you have to revalidate. EDIT: For this reason, I advise against changing your GUI unless necessary. Updating a Component rather than adding a new one is more Model-View-Controller-y.

nodelist
type: Tag
tag name: nodelist
tags question: http://stackoverflow.com/q/21467403

http://stackoverflow.com/comment/32433042
has text: What's the problem? What happens when you do `System.out.println(names)`? Do you know why it prints what it prints?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21487325

http://stackoverflow.com/q/21488682
tagged with: selenium-chromedriver
answer count: 0
type: UnansweredQuestion
score: 5
tagged with: google-chrome
tagged with: selenium-webdriver
has title: Is there a way to check the browser's ram usage with selenium (java) /web driver (chrome)
upvote count: 5
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has body: Is there a way to find/monitor the browser's ram usage while running selenium test cases? (in Java). It only has to work with the chrome/chrome's selenium driver. It sounded like there was potential for this capability (1 1/2 years ago), but I didn't find much else.

http://stackoverflow.com/comment/32462342
score: 0
type: AnswerComment
type: Comment
has text: So my option here is maybe regular expression right?
comment on: http://stackoverflow.com/a/21503247

http://stackoverflow.com/a/21403703
score: 0
answers question: http://stackoverflow.com/q/21403587
type: Answer
has body: This question should go on forums.bukkit.org That is where minecraft bukkit questions are hosted. You would use an Entity for loop in onEnable. However things in non loaded chunks will not be touched.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21403587

http://stackoverflow.com/comment/32357130
type: AnswerComment
type: Comment
has text: Thanks, I will look into that. Any idea how I apply the MongoOptions to the Spring MongoTemplate?
score: 0
comment on: http://stackoverflow.com/a/21443868

http://stackoverflow.com/a/21616336
has body: Call Texture.bind(GL) or glBindTexture.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21452053

http://stackoverflow.com/q/21375379
has comment: http://stackoverflow.com/comment/32236314
tagged with: android
has answer: http://stackoverflow.com/a/21376116
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21375425
accepted answer: http://stackoverflow.com/a/21376116
tagged with: java
has body: i am initializing loader in insideOnclick method of button but failed to do so and getting error becuase of third last parameter when passing "null" it gives me error while passing "this" also failed to do work. loginBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { if(userName.getText().length() == 0 || password.getText().length() == 0) { Toast.makeText(context,"UserName Or Password Should be Filled",Toast.LENGTH_SHORT).show(); } else{ userName.setText(""); password.setText(""); **getLoaderManager().initLoader(1,null,null);** //here is the error } } }); } @Override public Loader&lt;User&gt; onCreateLoader(int id,Bundle args) { loginLoader = new LoginLoader(context,userName.getText().toString(),password.getText().toString(),"2013-07-10 01:18:26"); Log.i("login loader",""+loginLoader); return loginLoader; } @Override public void onLoadFinished(Loader&lt;User&gt; arg0,User proposals) { Log.i("User",""+proposals.getUsername()); } Here is the error List: 01-27 23:27:33.480: E/AndroidRuntime(7777): FATAL EXCEPTION: main 01-27 23:27:33.480: E/AndroidRuntime(7777): java.lang.NullPointerException 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.app.LoaderManagerImpl.createLoader(LoaderManager.java:544) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.app.LoaderManagerImpl.createAndInstallLoader(LoaderManager.java:553) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.app.LoaderManagerImpl.initLoader(LoaderManager.java:607) 01-27 23:27:33.480: E/AndroidRuntime(7777): at com.mrfs.android.surveyapp.activities.LoginActivityService$1.onClick(LoginActivityService.java:58) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.view.View.performClick(View.java:4211) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.view.View$PerformClick.run(View.java:17267) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.os.Handler.handleCallback(Handler.java:615) 01-27 23:27:33.480: E/AndroidRuntime(7777): at android.os.Han…
has title: Error on start of "getLoadingManager.init" inside of button click in Android?
possible better answer: http://stackoverflow.com/a/21375425
type: Question
tagged with: asynctaskloader
has comment: http://stackoverflow.com/comment/32235548
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32235357
has comment: http://stackoverflow.com/comment/32235988

http://stackoverflow.com/comment/45124397
comment on: http://stackoverflow.com/q/21449550
has text: @Anzeo Link you provided is unreachable
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32252142
has text: You need me to find 80 in a file? I think you need to write some code yourself to find it. Show some effort and you will receive help.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21384806

http://stackoverflow.com/q/21403045
has title: Serialize/Deserialize an ArrayList
has answer: http://stackoverflow.com/a/21403502
has answer: http://stackoverflow.com/a/21403246
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21403365
tagged with: arraylist
score: 0
answer count: 3
tagged with: serialization
has body: i'm building a Java project and I need to serialize and deserialize an ArrayList of items, I cant' do it with the arraylist but i have to do it with each element of the ArrayList. Somehow, i managed to serialize it, but whenever i try to deserialize it i get this : java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 Here's the code : File f = new File("testo2.txt"); int i = 0; ArrayList&lt;DispositivoSelezioneProgrammi&gt; list = new ArrayList&lt;DispositivoSelezioneProgrammi&gt;(); if(f.exists()) { ObjectInputStream in = new ObjectInputStream(new FileInputStream(f)); while(in.read() != -1) { list.add((DispositivoSelezioneProgrammi)in.readObject()); } } else { ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(f)); Programma prog1 = new Programma("Lana"); Programma prog2 = new Programma("Seta"); Programma prog3 = new Programma("Rapido"); ArrayList&lt;Programma&gt; lista = new ArrayList&lt;Programma&gt;(); lista.add(0,prog1); lista.add(1,prog2); lista.add(2,prog3); Lavatrice lav1 = new Lavatrice("Asd","lol",lista); Lavatrice lav2 = new Lavatrice("Fgh","kok",lista); Lavatrice lav3 = new Lavatrice("Jkl","pop",lista); Canzone canz1 = new Canzone("Bella"); Canzone canz2 = new Canzone("Brutta"); Canzone canz3 = new Canzone("Qwerty"); ArrayList&lt;Canzone&gt; canz = new ArrayList&lt;Canzone&gt;(); canz.add(0,canz1); canz.add(1,canz2); canz.add(2,canz3); LettoreMP3 lett1 = new LettoreMP3("Lett1"); lett1.load(canz); LettoreMP3 lett2 = new LettoreMP3("Lett2"); lett2.load(canz); LettoreMP3 lett3 = new LettoreMP3("Lett3"); lett3.load(canz); list.add(0,lav1); list.add(1,lav2); list.add(2,lav3); list.add(3,lett1); list.add(4,lett2); list.add(5,lett3); for(DispositivoSelezioneProgrammi disp : list) { out.writeObject(disp); } out.close(); } Could you please help me? I don't understand what happens! I almost forgot, Lavatrice and LettoreMP3 implements the DispositvoSelezioneProgrammi interface, that's why I use it as a super type to serialize them!
type: UnansweredQuestion

http://stackoverflow.com/comment/32455067
score: 0
has text: Is it better to use a bundle, parceable or?
comment on: http://stackoverflow.com/a/21371675
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32241372
type: AnswerComment
has text: I am not sure I understand the question.
comment on: http://stackoverflow.com/a/21378624
type: Comment
score: 0

http://stackoverflow.com/comment/32297878
type: Comment
has text: This is no possible with existing Maven plugins
type: AnswerComment
comment on: http://stackoverflow.com/a/21406254
score: 0

http://stackoverflow.com/comment/61910269
has text: @AshokFelix Hi ashok am also using the code but am getting error shown below Exception in thread "main" java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://abc12:***@148.171.37//axphome/abc12/important.txt". at SFTPUtility.upload(SFTPUtility.java:70) at SFTPUtility.main(SFTPUtility.java:21)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21399562

http://stackoverflow.com/a/21389675
score: 1
accepted answer of: http://stackoverflow.com/q/21386131
answers question: http://stackoverflow.com/q/21386131
type: AcceptedAnswer
downvote count: 0
has body: What you need is addressed by Java Transaction API (JTA). From the JEE6 Tutorial (Part VIII - Chapter 42): The Java Transaction API (JTA) allows applications to access transactions in amanner that is independent of speciic implementations. JTA speciies standard Java interfaces between a transactionmanager and the parties involved in a distributed transaction system: the transactional application, the Java EE server, and themanager that controls access to the shared resources afected by the transactions. You want to use the Container-Managed Transaction. In this strategy you just need decorate the beans/methods with the appropriate transaction attribute i.e.: @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void myMethod() { ... } The design of your service layer must carefully address the transaction life cycle in case your have services of services (nested service calls).
type: Answer
upvote count: 1

http://stackoverflow.com/q/21428295
type: Question
tagged with: scrolledcomposite
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32330633
has body: I am building an java SWT standalone application with an expandbar inside a scrolledcomposite. At some point i will add a field to one of the components. Hence the size of the item will grow. First i destroy all the current items inside the expandbar: public void closeAll(){ for(int a = bar.getItemCount()-1; a&gt;=0; a--){ bar.getItem(a).getControl().dispose(); bar.getItem(a).dispose(); } } Then i will readd them all again ( i have the composites stored somewhere else). And i recompute the height of each item: for(int a = 0; a&lt;bar.getItemCount(); a++){ bar.getItem(a).setHeight(bar.getItem(a).getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y); } And when i do this all, the scrolled composite will not scroll further down (a part of the expandbar is now outside the client area of the ScrolledComposite). When i resize the window itself all the problems are solved. So how can i force this update normally assosiated with resizing of windows from without the code? Thank you all in advance! //edit I have added the class i am talking about: public class InputPanel extends Panel implements Refresh{ private Editor parent; private ExpandBar expandBar; private ArrayList&lt;InputBlock&gt; blocks; public ScrolledComposite scroll; public InputPanel(Editor parent, Composite panel) { super(panel); this.parent = parent; setGridLayout(0,0,1); blocks = new ArrayList&lt;InputBlock&gt;(); init(); } private void init(){ //two pannels first button pannel Panel buttonPanel = new Panel(new Composite(panel, SWT.BORDER)); buttonPanel.setGridLayout(0, 0, 3); buttonPanel.fillGridData(); Composite barComp = new Composite(panel, SWT.BORDER); barComp.setLayout(new FillLayout()); GridData data1 = new GridData(); data1.grabExcessHorizontalSpace = true; data1.horizontalAlignment = SWT.FILL; data1.verticalAlignment = SWT.FILL; barComp.setLayoutData(data1); scroll = new ScrolledComposite(barComp, SWT.V_SCROLL); expandBar = new ExpandBar(scroll, SWT.None); GridData data = new GridData(); data.grabEx…
answer count: 2
has answer: http://stackoverflow.com/a/21464196
accepted answer: http://stackoverflow.com/a/21464196
downvote count: 0
has comment: http://stackoverflow.com/comment/32328855
has answer: http://stackoverflow.com/a/22473923
favorite count: 0
has comment: http://stackoverflow.com/comment/32329906
has comment: http://stackoverflow.com/comment/32373722
has title: Resize expandbar SWT in ScrolledComposite
has comment: http://stackoverflow.com/comment/32372803
has comment: http://stackoverflow.com/comment/32373225
has comment: http://stackoverflow.com/comment/32375828
has comment: http://stackoverflow.com/comment/32373446
has comment: http://stackoverflow.com/comment/32372739
score: 1
tagged with: swt
upvote count: 1
has comment: http://stackoverflow.com/comment/32328608
possible better answer: http://stackoverflow.com/a/22473923

storage
tag name: storage
tags question: http://stackoverflow.com/q/21366983
tags question: http://stackoverflow.com/q/21392155
tags question: http://stackoverflow.com/q/21356973
type: Tag
tags question: http://stackoverflow.com/q/21387920

http://stackoverflow.com/a/21492113
has body: The best way to answer a question like this to to visualize the state of your list as it progresses thru the iteration. I have implemented the code with a println to help with that. The other choice is to include variable names that are easier to keep track of, while temp and dummy will not prevent you from achieving correctness they are more difficult to follow. This is the function public ListNode switchPairs(){ if (this==null || this.next==null) return this; ListNode top = this.next; ListNode first = this; ListNode second = first.next; do { ListNode third = second.next; second.next = first; first.next = third; first = third; System.out.println("@@@ " + top.toString()); if (first != null) { // remember second now is really the first element on the list // at this point. second.next.next = first.next; second = first.next; } } while(first != null &amp;&amp; second != null); return top; } And this is the entire code public class ListNode { private ListNode next = null; private final int i; ListNode(int i) { this.i = i; } ListNode(int i, ListNode parent) { this(i); parent.next = this; } @Override public String toString() { StringBuilder sb = new StringBuilder("[" + this.i + "]"); if (this.next != null) { sb.append("-&gt;"); sb.append(this.next.toString()); } return sb.toString(); } public static void main(String[] args) { ListNode top = null; ListNode curr = null; for(String arg : args) { int i = Integer.parseInt(arg); if(curr == null) curr = new ListNode(i); else curr = new ListNode(i, curr); if( top == null) top = curr; } System.out.println(top.toString()); top = top.switchPairs(); System.out.println(top.toString()); } public ListNode switchPairs(){ if (this==null || this.next==null) return this; ListNode top = this.next; ListNode first = this; ListNode second = first.next; do { ListNode third = second.next; second.next = first; first.next = third; first = third; System.out.println("@@@ " + this.toString()); if (first != null) { second.next.next = first.next; second…
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/63476882
answers question: http://stackoverflow.com/q/21491635
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32391065
score: 0
has text: i want to save it as string cuz i will store it in sql server database , what should i use ?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21463135

http://stackoverflow.com/q/21472947
accepted answer: http://stackoverflow.com/a/21473008
tagged with: arraylist
answer count: 3
has comment: http://stackoverflow.com/comment/32408794
has answer: http://stackoverflow.com/a/21473149
possible better answer: http://stackoverflow.com/a/21473149
has answer: http://stackoverflow.com/a/21473198
has body: I am trying to do this problem but can't get around with it. Please tell me what i did wrong and any tips on how to solving it? Thanks. here is the problem: Write a method stutter that takes an ArrayList of Strings and an integer k as parameters and that replaces every string with k copies of that string. For example, if the list stores the values ["how", "are", "you?"] before the method is called and k is 4, it should store the values ["how", "how", "how", "how", "are", "are", "are", "are", "you?", "you?", "you?", "you?"] after the method finishes executing. If k is 0 or negative, the list should be empty after the call. my code: public static void stutter(ArrayList&lt;String&gt; list,int k) { String s = ""; for(int i = 0; i&lt;list.size(); i++) { s = list.get(i); } for(int j = 0; j &lt; k; j++) { list.add(j,s); } }
type: AnsweredQuestion
score: 0
tagged with: java
has title: Array list in java
type: Question
has answer: http://stackoverflow.com/a/21473008

http://stackoverflow.com/q/21440646
accepted answer: http://stackoverflow.com/a/21440715
has title: Add values of JSON field together
answer count: 1
tagged with: android
tagged with: count
has answer: http://stackoverflow.com/a/21440715
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I am trying to add the values of the number field. I should be getting 8, but with the code below I am getting 2 as the result. How would you recommend that I do this? "Information": [ { "name": One, "number": 2 }, { "name": Two, "number": 2 }, { "name": Three, "number": 2 }, { "name": Four, "number": 2 } ], I'm setting up the counter as... private int number; public int getNumber() { return num; } public int[] getInformationNumber() { return new int[]{number}; } for(int i = 0; i &lt; contest.getInformation().get(i).getInformationNumber().length; i++) { int[] values = contest.getInformation().get(i).getInformationNumber(); int result = 0; for(int value : values) { result += value; } } Is there a way that I can set private int[] number under a different name and still return the same integer? If I set private int number to private int[] number right now I cannot use getNumber(). When I Log result it reads as 2 instead of 8. Let me know if you need me to clarify. ANSWER int result = 0; for(int i = 0; i &lt; contest.getInformation().size(); i++) { int[] values = contest.getInformation().get(i).getInformationNumber(); for(int value : values) { result += value; } }
tagged with: arrays

http://stackoverflow.com/comment/32372130
type: QuestionComment
comment on: http://stackoverflow.com/q/21452282
has text: I am thinking of preprocessing, by replacing `\ ` with something unlikely to occur in a real file path like `:#.!!:`, just something random then after I do the matching stuff, I replace instances of this with space. There appears to be no real invalid character in a linux filename? http://stackoverflow.com/questions/1311037/are-there-any-invalid-linux-filenames
score: 0
type: Comment

http://stackoverflow.com/q/21418508
favorite count: 0
has body: it seems like I've been getting the concurrent modification exception no matter what I do. I did some research and from what I understand this exception occurs when you try to edit a list while iterating through it at the same time. But I still can't figure out exactly whats causing it. So I was hoping some more experienced people could help me figure out where I went wrong here. Here's my code. package com.gametest; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Bundle; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; public class GameSurfaceView extends Activity implements OnTouchListener { double ran; int touchX, touchY, screenWidth, screenHeight, objX, objY; static boolean canUpdate; static int enemyCount; static MyView v; static Bitmap orb, explosion; static List&lt;Sprite&gt; enemiesList = new ArrayList&lt;Sprite&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); v = new MyView(this); v.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent me) { touchX = (int) me.getX(); touchY = (int) me.getY(); for (Sprite sprite : enemiesList) { sprite.checkTouch(touchX, touchY); } return true; } }); canUpdate = true; ran = 0; orb = BitmapFactory.decodeResource(getResources(), R.drawable.blue_orb); explosion = BitmapFactory.decodeResource(getResources(), R.drawable.explosion); createEnemies(); setContentView(v); } private synchronized void createEnemies() { if (enemyCount &lt; 5) { screenWidth = v.getWidth(); screenHeight = v.getHeight(); int listLength = enemi…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21418542
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21418704
has answer: http://stackoverflow.com/a/21418612
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32311949
has title: concurrent modification exception, cant figure it out
has comment: http://stackoverflow.com/comment/32311915
answer count: 3

http://stackoverflow.com/comment/32285057
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21401005
has text: actually it works just fine with jetty ... if you have any idea why it is not working with tomcat though and you post an answer to my question i will accept it. Thank you :-)

http://stackoverflow.com/comment/32361733
type: Comment
comment on: http://stackoverflow.com/q/21446445
score: 0
type: QuestionComment
has text: Don't know how to flip the top.

http://stackoverflow.com/comment/33555130
has text: The reason that I needed this to work in the first place was because my COMSOL GUI was not opening the class files. The resulting error said something like "Error running java class". I later found out that, it seems, the COMSOL GUI responds only one way to java runtime errors: with that message "Error running java class". I hope this helps others.
comment on: http://stackoverflow.com/a/21504462
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21464450
has answer: http://stackoverflow.com/a/21464779
accepted answer: http://stackoverflow.com/a/21464636
has body: I have an entity of type A with a referenced member entity of type B. I want to insert a relationship between an instance of A to an existing instance of B without having to fetch B. Is there a way to do it simply by ID? Something like: B mockB = new B(); mockB.id = "id_persisted_b"; instanceA.setB(mockB); Thanks.
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
has answer: http://stackoverflow.com/a/21464522
has answer: http://stackoverflow.com/a/21464636
has title: Hibernate - Add member entity instance by ID
tagged with: persistence
score: 0
possible better answer: http://stackoverflow.com/a/21464522
answer count: 3

http://stackoverflow.com/a/21395060
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/21394968
answers question: http://stackoverflow.com/q/21394968
has body: package com.sandbox; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; public class Sandbox { public static void main(String argv[]) throws IOException, SAXException, ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(Sandbox.class.getResourceAsStream("/foo.xml")); NodeList nodeNodeList = document.getElementsByTagName("node"); for (int i = 0; i &lt; nodeNodeList.getLength(); i++) { Node nNode = nodeNodeList.item(i); System.out.println(nNode.getAttributes().getNamedItem("lat").getNodeValue()); System.out.println(nNode.getAttributes().getNamedItem("lon").getNodeValue()); } } } This printed out: 50.9051565 6.963755 51.6020306 -0.1935029
upvote count: 5

http://stackoverflow.com/q/21463498
has answer: http://stackoverflow.com/a/21464012
tagged with: insert
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32391440
accepted answer: http://stackoverflow.com/a/21463647
has title: Why I can't insert a String in the JTextArea?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21464012
tagged with: java
has answer: http://stackoverflow.com/a/21463647
downvote count: 1
type: Question
tagged with: jtextarea
upvote count: 0
has body: So I made this very simple program that places the string "50" after 50 words the app works perfectly. The problem is just here: if(words == 50){ text.insert("50", words * charsa); } here is the testing code: package wordscount; 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.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; /** * * @author Shady Kamal * */ public class WordsCount { boolean working; int words = 0; int wordneed = 50; int charsa; JTextArea text = new JTextArea(600, 600); JFrame frame = new JFrame("Counter for fast reading"); JButton launch = new JButton("Start"); String atext; boolean isword; public WordsCount(){ frame.setSize(700, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); launch.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { words = 0; atext = text.getText(); charsa = atext.length(); for (int i = 0; i &lt; charsa; i++) { if ( Character.isLetter(atext.charAt(i)) == false ){ isword = false; }else if (i == 0){ isword = true; }else if ( Character.isLetter(atext.charAt(i-1)) ){ isword = false; }else if ( atext.charAt(i-1) == '\'' &amp;&amp; i &gt; 1 &amp;&amp; Character.isLetter(atext.charAt(i-2)) ){ isword = false; }else{ isword = true; } if (isword){ words++; if(words == 50){ text.insert("50", words * charsa); } } } System.out.println("Chars:" + charsa); System.out.println("Words:" + words); } }); frame.add(text, BorderLayout.CENTER); frame.getContentPane().add(new JScrollPane(text),BorderLayout.CENTER); frame.add(launch, BorderLayout.SOUTH); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { JOptionPane.showMessageDialog(null, "" + "Instructions: \n" + "_________________________________________\n" + "Just paste text right here in the TextBox\n" + "and click the \"Start\" button when you…
score: -1
tagged with: illegalargumentexception
answer count: 2

http://stackoverflow.com/comment/32471468
comment on: http://stackoverflow.com/q/21508552
score: 0
has text: What code do you have currently?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/36929520
answers question: http://stackoverflow.com/q/21455403
type: Answer
upvote count: 7
score: 7
has body: You can use Paranamer lib (https://github.com/paul-hammant/paranamer) Sample code that works for me: import com.thoughtworks.paranamer.AnnotationParanamer; import com.thoughtworks.paranamer.BytecodeReadingParanamer; import com.thoughtworks.paranamer.CachingParanamer; import com.thoughtworks.paranamer.Paranamer; Paranamer info = new CachingParanamer(new AnnotationParanamer(new BytecodeReadingParanamer())); Method method = Foo.class.getMethod(...); String[] parameterNames = info.lookupParameterNames(method); If you use Maven then put this dependency in your pom.xml: com.thoughtworks.paranamer paranamer 2.8
downvote count: 0

http://stackoverflow.com/comment/32197624
score: 2
has text: [How do I ask and answer homework questions?](http://meta.stackexchange.com/questions/10811/how-do-i-ask-and-answer-homework-questions)
comment on: http://stackoverflow.com/q/21354406
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32494739
type: QuestionComment
comment on: http://stackoverflow.com/q/21480546
score: 0
has text: ok.. then how to do it ?
type: Comment

http://stackoverflow.com/comment/32467379
type: Comment
comment on: http://stackoverflow.com/a/21505961
has text: I am probably just confusing myself too much at this point - when I set append to false, it replaces what was in the file in the last run of my loop, so I end up with just the last line - well I want to feed the data in line by line while the program runs, when it finishes I want the file to be left there, until the next run - when I next run I want to clear the contents..
type: AnswerComment
score: 0

http://stackoverflow.com/q/21491215
has title: Producer-Consumer with Predicate
favorite count: 0
tagged with: producer-consumer
type: Question
has answer: http://stackoverflow.com/a/21498377
linked to: http://stackoverflow.com/q/8178399
upvote count: 2
answer count: 2
tagged with: multithreading
has body: I'm looking for a java collection that supports blocking read()s on a predicate. I wrote a simple version but it seems like this must have been invented already? For example: interface PredicateConsumerCollection&lt;T&gt; { public void put(T t); @Nullable public T get(Predicate&lt;T&gt; p, long millis) throws InterruptedException; } put() delivers its argument to a waiting consumer with a matching predicate, or stashes it in a store. A get() returns immediately if a suitable T is already in the store, or blocks till a suitable value is put(), or times out. Consumers compete but fairness isn't critical in my case. Anyone aware of a such a collection?
has answer: http://stackoverflow.com/a/22321690
tagged with: java
type: UnansweredQuestion
tagged with: concurrency
score: 2
downvote count: 0

http://stackoverflow.com/a/21494003
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32519648
has comment: http://stackoverflow.com/comment/32446090
type: Answer
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/21493982
score: 2
has body: Pattern.MULTILINE affects the behavior of ^ and $ (to match the beginning and the end of the line), which you don't use at all in your pattern. For your use case, use DOTALL as you want all the content to be treated in the single line. This will work! String trying = "75px;"; Pattern tryingPattern = Pattern.compile("(?&lt;="+Pattern.quote(trying)+").*?(?=center)", Pattern.DOTALL); Matcher matcher = tryingPattern.matcher(str); // check all instances while (matcher.find()) { System.out.println(matcher.group()); }
accepted answer of: http://stackoverflow.com/q/21493982
has comment: http://stackoverflow.com/comment/32445995

http://stackoverflow.com/comment/32444152
comment on: http://stackoverflow.com/q/21493068
has text: it would be nicer if you provide the line in your code that corresponds to 25 too
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21480404
tagged with: javascript
tagged with: jquery
type: Question
linked to: http://stackoverflow.com/q/2067472
has answer: http://stackoverflow.com/a/21522836
has comment: http://stackoverflow.com/comment/32420862
linked to: http://stackoverflow.com/q/6587221
accepted answer: http://stackoverflow.com/a/21522836
has comment: http://stackoverflow.com/comment/32421102
answer count: 3
has comment: http://stackoverflow.com/comment/32420806
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32421015
has title: Spring and jQuery POST crossdomain
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21480661
has comment: http://stackoverflow.com/comment/32420979
possible better answer: http://stackoverflow.com/a/21480543
has answer: http://stackoverflow.com/a/21480543
has body: I'm using Spring 3.2.2 and jQuery. Everything works fine in local. I made a CORS filter which also works fine. Every service methods called from another host are working except one. Actually, this is the only method which use @RequestBody and $.toJSON / contentType at client side. Spring side : @RequestMapping(value = "/requestOrder", method = RequestMethod.POST) @ResponseBody public Object requestOrder(@RequestBody OrderViewModel order) throws NamingException { ... } jQuery side : $.ajax({ type : 'POST', url : serviceUrl + 'requestOrder', crossDomain : true, data : $.toJSON({ ...orderdata... }), contentType : 'application/json; charset=UTF-8' }); Chrome's console log : XMLHttpRequest cannot load https://REMOTE_HOST/project/service/requestOrder. The request was redirected to 'https://REMOTE_HOST/project/;jsessionid=84781b083f5305ffa22a0adae0a6', which is disallowed for cross-origin requests that require preflight. HTTP headers : Request URL:https://.../requestOrder Request Method:OPTIONS Status Code:302 Moved Temporarily Request Headersview source Accept:*/* Accept-Encoding:gzip,deflate,sdch Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 Access-Control-Request-Headers:accept, content-type Access-Control-Request-Method:POST Cache-Control:no-cache Connection:keep-alive Host:... Origin:http://... Pragma:no-cache Referer:http://... User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36 I don't see Content-Type which should be set... Request method is OPTIONS ?! This let me think that the issue is coming from Spring but this is actually working in local... I would be pleased to get some help.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32421530

http://stackoverflow.com/comment/36591928
type: AnswerComment
has text: Ulan yine ne varsa şu Türklerde var he :D Bende aranıyodum, bende servis yok, nasıl tanımlicam diye :)
comment on: http://stackoverflow.com/a/21887612
type: Comment
score: 1

http://stackoverflow.com/comment/32312961
comment on: http://stackoverflow.com/q/21417597
type: Comment
type: QuestionComment
has text: from the main function
score: 0

http://stackoverflow.com/a/21410102
answers question: http://stackoverflow.com/q/21384149
has body: I was working on this yesterday, when you first posted your question. I got tired and stopped messing with it. Basically what I did was use JPanel, and set their locations with each timer tick. I doubt it's the most optimal way, and I got really tired of trying to fix some of the problem, so I just stopped. You're free to play around with it, see if you can get any better results from it. The most frustrating part is when you click the panel, everything shifts for a quick second. Hopefully you can do something with it, or at least get some ideas. I just didn't want to scrap it, in case maybe you could make something of it. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.LinkedList; import java.util.List; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; public class TestLabelMove { List&lt;MovingLabel&gt; labels; private int count = 1; private JLabel statusLabel; private final int SEPARATION = 100; private final int SCREEN_W = 800; int XLOC = SCREEN_W; public TestLabelMove() { statusLabel = new JLabel("Status"); statusLabel.setHorizontalAlignment(JLabel.CENTER); JFrame frame = new JFrame("Test Labels"); frame.add(statusLabel, BorderLayout.CENTER); frame.add(new LabelPanel(), BorderLayout.SOUTH); frame.setSize(800, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } private class LabelPanel extends JPanel { private static final int INC = 5; public LabelPanel() { labels = new LinkedList&lt;&gt;(); for (int i = 0; i &lt; 8; i++) { MovingLabel label = new MovingLabel(XLOC); labels.add(label); XLOC -= SEPARATION; add(label); } Timer timer = new Timer(100, new ActionListen…
score: 0
type: Answer

http://stackoverflow.com/comment/32195400
comment on: http://stackoverflow.com/a/21353329
score: 0
has text: ... Where EPSILON is some very small floating point value _reflecting the necessary precision in the comparison but not less than this_
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32203791
type: QuestionComment
score: 0
has text: How is `featureV` declared?
type: Comment
comment on: http://stackoverflow.com/q/21357941

http://stackoverflow.com/q/21431554
answer count: 0
score: 0
tagged with: java
type: Question
has title: Conditional replaceing with regular expressions
has body: I wish to run a regular expression on a list of HTML links, and remove all the target attributes. Then, if the href points to a PDF document, I want to add a target attribute with a value of "_blank" Here is a link to my attempt so far http://regexr.com/?385g4 (for some reason the opening brackets keep changing to '&amp;lt ;' when I save. You may need to change these for my attempt to work As you can see, the target attributes have been removed, and i have added new target attributes to all results. What I can't do is only add the target attribute to links to PDFs. I suspect the solution has something to do with lookarounds, but my knowledge of regular expressions is not that great. Can anyone assist?
has comment: http://stackoverflow.com/comment/32334347
tagged with: replace
has comment: http://stackoverflow.com/comment/32334154
has comment: http://stackoverflow.com/comment/32334477
has comment: http://stackoverflow.com/comment/32335482
type: UnansweredQuestion
tagged with: regex

http://stackoverflow.com/a/21372508
has body: Command line arguments is nothing but a String array. So you can work on them just like any other String object. Have a look at the String API for the functionality you are trying to implement, the replace() method should suffice for you.
score: 0
answers question: http://stackoverflow.com/q/21372450
type: Answer

http://stackoverflow.com/comment/32458327
has text: @Joe Happy I could help. On SO when an answer solves your problem, you can "accept" it as the person who made the question. This makes it easier for people who come here with the same problem to find the answer quickly.
comment on: http://stackoverflow.com/a/21501248
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21441527
has body: == compares 2 objects to check if they refer the same place in the memory .equals() compares the values of the object. In your case, you need to use .equals to compare
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21441427

http://stackoverflow.com/comment/32299613
type: AnswerComment
has text: If you want youi pool to run effectively, stop copying bulk stuff into and out of queues, like M J Grey says.
type: Comment
comment on: http://stackoverflow.com/a/21411245
score: 0

http://stackoverflow.com/a/37747277
answers question: http://stackoverflow.com/q/21417419
type: Answer
upvote count: 17
has body: As many other people have pointed out, just extracting the .jar from the .aar file doesn't quite cut it as resources may be missing. Here are the steps that worked for me (context of Android, your mileage may vary if you have other purposes): Rename the .aar file to .zip and extract. The extracted folder is an ADT project that you can import in Eclipse with some minor modifications (see below)! In the extracted folder rename the contained file classes.jar to whatever you like (in this example myProjectLib.jar) and move it to the lib folder within the extracted folder. Now in order for Eclipse to accept it you need to put two files into the extracted folder root: .project .classpath To do that, create a new Android dummy project in Eclipse and copy over the files, or copy over from an existing Android project. Open the .project file and look for the XML name tag and replace the contents of it with myProjectLib (or whatever you called your jar file above) and save. Now in Eclipse you can File -> New -> Project -> Android Project from existing source.. and point to the extracted folder content. After import right click on the newly created project, select Properties -> Android, and check Is Library. In your main project that you want to use the library for, also go to Properties -> Android and add the newly added myProjectLib to the list of dependencies.
score: 17
downvote count: 0
has comment: http://stackoverflow.com/comment/131889409
has comment: http://stackoverflow.com/comment/83525457

http://stackoverflow.com/comment/32270940
comment on: http://stackoverflow.com/q/21394436
type: Comment
type: QuestionComment
has text: Now it's a bit annoying, but Swing was among the first (that I know of) GUI API's to support HTML rendering as part of it's core API (you can use HTML within `JLabel` for example). Do wish they would update it...
score: 0

http://stackoverflow.com/q/21392523
tagged with: equals
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21392579
has body: Consider this theoretical scenario: I have a Person class. I will NOT be doing any look-up operations with this object. I will use them in Arrays, List but not Sets and Maps. But I would like to check if two list of person Object are equal or not. for example: List&lt;Person&gt; list1 = new ArrayList&lt;&gt;(); List&lt;Person&gt; list2 = new ArrayList&lt;&gt;(); If I want to check if these lists are equal, System.out.println(list1.equals(list2)) I will have to implement equals method in my Person class. Do I still need to implement Hashcode(). I am not hashing my Person objects into buckets (only for this I require Hashcode()) and so I think it may not be necessary
linked to: http://stackoverflow.com/q/27581
tagged with: hashcode
tagged with: java
has comment: http://stackoverflow.com/comment/32266772
type: AnsweredQuestion
has title: do I need to have hashcode() implemented if I dont use hashtables or hashset with my objects in java
has comment: http://stackoverflow.com/comment/32266827
accepted answer: http://stackoverflow.com/a/21392579
favorite count: 0
has comment: http://stackoverflow.com/comment/32266524
tagged with: hash
type: Question
tagged with: hashtable

http://stackoverflow.com/q/21460745
score: 1
tagged with: macos
has body: I have to execute a command on Mac OS: killall -KILL "Google Chrome" When I execute it in terminal or run a .command file with this command it works. I tried this all in Java code Runtime.getRuntime().exec("/usr/bin/killall -KILL \"Google Chrome\""); Runtime.getRuntime().exec("killall -KILL \"Google Chrome\""); Runtime.getRuntime().exec("/bin/bash -c \"killall -KILL \\\"Google Chrome\\\"\""); Runtime.getRuntime().exec("bash -c \"killall -KILL \\\"Google Chrome\\\"\""); Runtime.getRuntime().exec("/usr/bin/killall", new String[]{"-KILL", "Google Chrome"}); Runtime.getRuntime().exec("killall", new String[]{"-KILL", "Google Chrome"}); Runtime.getRuntime().exec("/bin/bash", new String[]{"-c", "killall -KILL \"Google Chrome\""}); Runtime.getRuntime().exec("bash", new String[]{"-c", "killall -KILL \"Google Chrome\""}); And it doesn't work. What may be the problem?
has answer: http://stackoverflow.com/a/21460959
favorite count: 0
type: UnansweredQuestion
tagged with: java
has title: Executing killall command from Java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21460938
tagged with: kill-process
answer count: 2
downvote count: 0

http://stackoverflow.com/q/21470012
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32403599
tagged with: java
has answer: http://stackoverflow.com/a/21470502
has body: I have seen similar questions similar to this one on this website but my question is a little different. The code I am using to capture the audio is this. I would like to simply take the captured audio and apply an FFT to it with 256 points. I realized that this line count = line.read(buffer, 0, buffer.length); breaks up the audio into "chunks". Also the FFT I am using can be found here. My questions are: I would like to know if there is a way to apply the FFT to the whole audio recording not just a buffered amount. I see that the code for the FFT requires a real and imaginary part, how would I get the real and imaginary parts from the code with the audio file.
tagged with: signal-processing
type: Question
linked to: http://stackoverflow.com/q/20218634
linked to: http://stackoverflow.com/q/26824663
accepted answer: http://stackoverflow.com/a/21470502
has comment: http://stackoverflow.com/comment/32403899
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32404406
favorite count: 0
tagged with: fft
has comment: http://stackoverflow.com/comment/32403831
upvote count: 2
has title: Apply FFT to audio recording in java
has comment: http://stackoverflow.com/comment/32404086
score: 2
tagged with: audio

http://stackoverflow.com/q/21474710
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/32411931
tagged with: java
has title: Handle 2nd level child window in Selenium
type: Question
has answer: http://stackoverflow.com/a/21475278
score: 0
answer count: 1
type: UnansweredQuestion
has body: I have an application which contains multiple popups. I click on a button and a popup window opens(say title="Child1"). I am able to work on this popup window. When i click on a button in the child1 window, a third popup opens(say grandchild1). So it is something like: MainWindow&lt;----Child1&lt;---Grandchild1 Selenium is not able to recognize the grandchild window. win=driver.getWindowHandles().toArray(); this code also shows only 2 windows. selenium.selectWindow("Grandchild1"); This code also throws an error. Any help on this?

http://stackoverflow.com/q/21456734
tagged with: java
has title: How to Compare huge volume of pdf files and get the unique set of files using java?
tagged with: pdfbox
type: Question
has comment: http://stackoverflow.com/comment/32379679
answer count: 1
has comment: http://stackoverflow.com/comment/32378854
has comment: http://stackoverflow.com/comment/32379386
score: 0
has answer: http://stackoverflow.com/a/30452310
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/32379098
has body: I need an API which helps to process huge volume of pdf files, say some 100's to 1000's and then the pdf files needs to grouped in a manner such that unique type of files should be grouped in separate folders. I have knowledge with pdflib. Could any body help me?
has comment: http://stackoverflow.com/comment/32378984
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32379190
linked to: http://stackoverflow.com/q/10011432

http://stackoverflow.com/q/21438078
type: Question
has answer: http://stackoverflow.com/a/21438443
accepted answer: http://stackoverflow.com/a/21438443
tagged with: java
has comment: http://stackoverflow.com/comment/32346085
upvote count: 3
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21438476
favorite count: 0
has title: How to read char from standard input in Java
has body: I have to read char(one at a time) from the standard input in Java.The input will consist of numerous lines (each of about 10000 chars). I do not need to store the chars , they are processed when read.Also I need to skip the newline char .Can someone suggest me an efficient way to do this ?
has comment: http://stackoverflow.com/comment/32345980
downvote count: 3
has comment: http://stackoverflow.com/comment/59323230
tagged with: io
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21438476

http://stackoverflow.com/comment/32358423
has text: What do you want do display in those squares? I would suggest taking a look at the JavaFX GridPane
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21444474

http://stackoverflow.com/comment/32297907
type: QuestionComment
has text: link might help : http://stackoverflow.com/questions/19512088/how-to-generate-apk-file-programmatically-through-java-code
score: 0
comment on: http://stackoverflow.com/q/21410695
type: Comment

http://stackoverflow.com/q/21507520
has answer: http://stackoverflow.com/a/21507582
score: 0
answer count: 2
has title: Regular expression to substring a string with double quote
has body: This may sound a direct question but I am new to Regex in Java. All I want is like, I have a String like below(It's a whole String). [["name1", "link whaterevercom"], ["name2", "link whatevercom2"]] I want is an array of String containing {name1,link whatevercom, name2, link whatevercom2} I can achieve this by substring and loop and that boring way. I know split() method supports Regex. Can anyone help me achieve this by Regex? Any help will be very appreciated. Thank you in advance.
type: UnansweredQuestion
tagged with: regex
tagged with: java
has answer: http://stackoverflow.com/a/21507531
type: Question

http://stackoverflow.com/comment/32206068
score: 1
has text: Why don't just `object instanceof PacketMessage`?
comment on: http://stackoverflow.com/q/21359107
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21409802
has answer: http://stackoverflow.com/a/21410156
downvote count: 0
has title: How to write a method which accepts any collection of classes which extend Throwable?
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/20543966
type: Question
has body: I want to pass a collection of classes which extend Throwable to a method. However, my attempt fails to compile in Netbeans with jdk1.6.0_39: package com.memex.sessionmanager; import java.util.Collection; import java.util.Collections; public class GenericsDemo { public void foo(Collection&lt;Class&lt;? extends Throwable&gt;&gt; c) { } public void bar() { foo(Collections.singleton(RuntimeException.class)); } } The compiler says foo(java.util.Collection&lt;java.lang.Class&lt;? extends java.lang.Throwable&gt;&gt;) in com.memex.sessionmanager.GenericsDemo cannot be applied to (java.util.Set&lt;java.lang.Class&lt;java.lang.RuntimeException&gt;&gt;). I can make it compile by changing the calling code to: foo(Collections.&lt;Class&lt;? extends Throwable&gt;&gt;singleton(RuntimeException.class)); but I'd rather not force clients to write this obtuse generic type. Is it possible to write a method which will take any collection of classes which subtype Throwable? EDIT: Someone fixed the above example with the method signature: public &lt;T extends Throwable&gt; void foo(Collection&lt;Class&lt;T&gt;&gt; c) {} But I'm now having problems using the parameter. Specifically, I want to assign it to a field, like this: package com.memex.sessionmanager; import java.util.Collection; import java.util.Collections; public class GenericsDemo { private Collection&lt;Class&lt;? extends Throwable&gt;&gt; throwables; public &lt;T extends Throwable&gt; void foo(Collection&lt;Class&lt;T&gt;&gt; c) { throwables = c; } public void bar() { foo(Collections.singleton(RuntimeException.class)); } } But the compiler says: incompatible types found : java.util.Collection&lt;java.lang.Class&lt;T&gt;&gt; required: java.util.Set&lt;java.lang.Class&lt;? extends java.lang.Throwable&gt;&gt;
answer count: 2
score: 4
accepted answer: http://stackoverflow.com/a/21410156
has comment: http://stackoverflow.com/comment/32301108
tagged with: java
upvote count: 4
possible better answer: http://stackoverflow.com/a/21409883
has answer: http://stackoverflow.com/a/21409883
type: AnsweredQuestion

http://stackoverflow.com/a/21404596
type: Answer
downvote count: 0
score: 3
has body: The logically correct answer is: no. Both results run on the same JVM, so both implementations can be exactly the same in terms of processing efficiency. That Scala offers different language features doesn't change that.
upvote count: 3
answers question: http://stackoverflow.com/q/21404209

http://stackoverflow.com/comment/32485637
comment on: http://stackoverflow.com/a/21513915
has text: That's a very different concern than the one you posted! The code you posted isn't working because you're trying to treat an `int[]` like an `Integer[]`. If you need to know how to create an `Object[]` or an `Integer` in JNI, you may find [this question](http://stackoverflow.com/questions/7260376/how-to-create-an-object-with-jni) useful. However, you'd probably be better off returning a custom object that contains a `String` and an `int` rather than an `Object[]`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21498331
score: 0
has body: Your INSERT statement is missing the "T"...
type: Answer
answers question: http://stackoverflow.com/q/21498293

http://stackoverflow.com/comment/32376703
type: QuestionComment
score: 1
has text: Possible duplicate of http://stackoverflow.com/questions/19337638/c3p0-says-java-lang-exception-debug-only-overdue-resource-check-out-stack-t
comment on: http://stackoverflow.com/q/21455376
type: Comment

http://stackoverflow.com/q/21374545
has comment: http://stackoverflow.com/comment/32234193
tagged with: java
type: Question
tagged with: progressdialog
has body: I'm using gameView in my app, the load time of gameview class takes more time(10secs) to display the screen after clicking "play" button. after lot of research found that this is due to heavy data and images in my gameview class. So i have used this piece of code to display some progress dialogue until the gamelayer is displayed. Button btnplay = (Button) findViewById(R.id.resumeGameButton); btnplay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // thread for displaying the SplashScreen Thread splashTread = new Thread() { @Override public void run() { try { int waited = 0; while(_active &amp;&amp; (waited &lt; _splashTime)) { sleep(100); if(_active) { waited += 100; } System.out.println("handler code..........."); } } catch(InterruptedException e) { } finally { startActivity(new Intent(Menu.this, FrozenBubble.class)); finish(); //stop(); } } }; splashTread.start(); } }); but the problem remains the same... loading time for gamelayer is more than 10sec.. during this load time blank page is displayed. please help me to solve this.
score: 0
has comment: http://stackoverflow.com/comment/32236656
tagged with: android
tagged with: android-activity
answer count: 0
type: UnansweredQuestion
has title: How to display Dialogue bar between the Loading Time of Activity in android

http://stackoverflow.com/q/21380891
has comment: http://stackoverflow.com/comment/32245245
type: Question
has title: Regex parser step by step Java
tagged with: java
has answer: http://stackoverflow.com/a/21409765
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21407285
has comment: http://stackoverflow.com/comment/32244693
type: UnansweredQuestion
tagged with: regex
has body: This is my data and its pattern: // _23.02_ANTALYA____________FRANKFURT___________DE_7461_18:20-21:00________________ public static final String FLIGHT_DEFAULT_PATTERN = "\\s+\\d{2}.\\d{2}\\s[A-Z]+\\s+[A-Z]+\\s+[A-Z\\s]{3}[\\d\\s]{5}\\d{2}:\\d{2}-\\d{2}:\\d{2}\\s+"; Underscores are space character. Now I need a class that divides every regex term to data. For example \\s+ = " " \\d{2} = "23" . = "." \\d{2} = "02" \\s = " " [A-Z]+ = "ANTALYA" etc... That must be ordered by pattern. How can I do this or is there a library for this?

http://stackoverflow.com/comment/32211738
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21362014
has text: You're concerned about a password to be stored in an xml file and thus be readable by anyone. So your solution is to encrypt it, and store the key in another properties file, still readable by anyone. So it doesn't add any security: anyone can still read the properties file, get the key, and decrypt the encrypted password. What you're doing is basically locking your house but leave the key under the doormat.
type: Comment

http://stackoverflow.com/a/50255801
has comment: http://stackoverflow.com/comment/93229795
has body: Use Apache's DateUtils: import org.apache.commons.lang.time.DateUtils; ... DateUtils.truncate(new Date(), Calendar.SECOND)
answers question: http://stackoverflow.com/q/21448500
score: 5
has comment: http://stackoverflow.com/comment/88228308
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/88180661
downvote count: 0

http://stackoverflow.com/q/21470534
linked to: http://stackoverflow.com/q/14154127
has comment: http://stackoverflow.com/comment/32404421
has comment: http://stackoverflow.com/comment/32404743
has comment: http://stackoverflow.com/comment/32404621
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21471578
has comment: http://stackoverflow.com/comment/32404797
has answer: http://stackoverflow.com/a/21471070
has comment: http://stackoverflow.com/comment/32404696
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/21470574
has title: Sorting values in ArrayList in specific order
has body: Let me explain the scenario first: List&lt;Row&gt; rowValues = new ArrayList&lt;&gt;(); // After adding values into list At location 0 = [Johnson, 10000] At location 1 = [Adam, 12000] At location 2 = [Mike, 11000] At location 3 = [Johnson, 17000] At location 4 = [Tony, 10000] I want to sort elements of column1 in ascending order and elements of column2 in descending order. Like: At location 0 = [Adam, 12000] At location 1 = [Johnson, 17000] At location 2 = [Johnson, 10000] At location 3 = [Mike, 11000] At location 4 = [Tony, 10000] I am not sure whether this can achieve this by using: Collections.sort(rowValues); //or Collections.sort(rowValues, Collections.reverseOrder()); Row class, if that makes any sense: final class Row extends ArrayList&lt;Object&gt; implements Comparable&lt;Row&gt; { private int index; private Order order; Row(int initialCapacity) { super(initialCapacity); this.index = -1; //-1 indicates that the index has not been set } Object getSortingValue() { if (index == -1) { throw new IllegalStateException("Sorting column is unknown"); } else if (isEmpty()) { throw new IllegalStateException("Row is empty"); } return get(index); } void setSortingColumn(int index) throws IllegalArgumentException { if (index &lt; 0) { throw new IllegalArgumentException("Invalid sorting index: " + index); } this.index = index; } Order getOrder() { return order; } void setOrder(Order order) { this.order = order; } @Override public int compareTo(Row row) { if (row == null) { throw new NullPointerException(); } Object sortValue = getSortingValue(); if (sortValue instanceof Comparable) { return ((Comparable) sortValue).compareTo(row.getSortingValue()); } else { throw new IllegalArgumentException(sortValue + " not type of Comparable"); } } @Override public boolean equals(Object obj) { if (obj instanceof Row) { Row row = (Row) obj; return getSortingValue().equals(row.getSortingValue()); } return false; } @Override public int hashCode() { return getSortingValue().hashCode(); } }
downvote count: 0
tagged with: sorting
answer count: 3
has comment: http://stackoverflow.com/comment/32404573
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/21498069
tagged with: android
accepted answer: http://stackoverflow.com/a/21498226
possible better answer: http://stackoverflow.com/a/21498344
has answer: http://stackoverflow.com/a/21498226
has title: Android Record Video With Code In Background
tagged with: audio-recording
has answer: http://stackoverflow.com/a/21498344
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I was wondering what the best way to do this is. What I'm hoping to do is have a user push a button and automatically take a 10 second video, then save it to the SD card. I've seen how to do it through creating a new Intent, but the user then has to do the extra step of pushing record after selecting that they want to go to video. My goal is for them to push one button--one in my app that says "record", have it start recording for 10 seconds, then stop and save. In addition, I'd like to have some code executing in the background without being interrupted during said recording. What is the best way to do this?
type: Question
answer count: 2
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/21457538
tagged with: jar-signing
answer count: 3
upvote count: 23
favorite count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 0
tagged with: jarsigner
tagged with: java
tagged with: signing
score: 23
type: Question
has answer: http://stackoverflow.com/a/21457585
has answer: http://stackoverflow.com/a/21458940
has body: I have very little programming knowledge.I am able to open jar signer through the command prompt then I get various jar signer options,which i do not know how to use them.Can anyone explain me what should i type in the command prompt in order to sign the app?
has title: How to use jarsigner for signing an apk?
has answer: http://stackoverflow.com/a/32767818

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/21467204
type: Tag
tags question: http://stackoverflow.com/q/21486298
tags question: http://stackoverflow.com/q/21355307

http://stackoverflow.com/a/21448308
has body: Open the Java > Installed JREs preference page. Check the box on the line for the JRE that you want to assign as the default JRE in your workbench. If the JRE you want to assign as the default does not appear in the list, you must add it. Click OK. and then if you find the right jre at place,then close the eclipse welcome page. Then go the File option at top left corner then new and then select Java Project and it should work. File&gt;&gt;New&gt;&gt;Java Project
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32546939
answers question: http://stackoverflow.com/q/21448248

http://stackoverflow.com/comment/32427774
type: AnswerComment
type: Comment
has text: After modifying the pattern as (?<=(version=)) what I get after making the call getResourceVersion("vnd.example-com.foo+json; version=1.1") is `vversion=` not `v1.1`. I want to extract the version number and add `v` as a prefix to it. Is my pattern correct?
score: 0
comment on: http://stackoverflow.com/a/21484213

http://stackoverflow.com/comment/32295131
score: 0
has text: Please don't create 20 lines of almost equal code, but use a loop: `int[][] table = new int[1][20]; for (int i = 0; i < table[0].length; i++) {table[0][i] = generator.nextInt(11);}`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21409012

http://stackoverflow.com/comment/57584295
comment on: http://stackoverflow.com/a/21427144
score: 3
type: AnswerComment
has text: what is the best option to specify many exclusions as the string is getting pretty long very quickly?
type: Comment

http://stackoverflow.com/q/21452674
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32372518
has title: Mongo's distinct value count for two fields in Java
tagged with: java
has answer: http://stackoverflow.com/a/21453992
tagged with: mongodb
type: AnsweredQuestion
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/21453160
favorite count: 0
has body: I am using java to connect to MongoDB. I want to fetch and count distinct values of two fields i.e requestId and telNum. I googled but didn't find how to fetch distinct values for two fields.
has answer: http://stackoverflow.com/a/21453160
type: Question
tagged with: aggregation-framework
accepted answer: http://stackoverflow.com/a/21453992
has answer: http://stackoverflow.com/a/21453208
has comment: http://stackoverflow.com/comment/32372816
linked to: http://stackoverflow.com/q/5089162

http://stackoverflow.com/a/21365998
answers question: http://stackoverflow.com/q/21365456
has comment: http://stackoverflow.com/comment/32235145
type: Answer
has comment: http://stackoverflow.com/comment/32239965
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/21365456
type: AcceptedAnswer
downvote count: 0
has body: In case you want to use Tomcat your only option to share Spring context is to setup just one WebApplicaiton (initialized by WebApplicationInitializer). Of course you can still have separate modules (aka jars) with own @Configuration classes, but these configurations have to be merged in web application. It would be more flexible if you decide to use EAR packaging. Then you can have still two separate WAR's depending on core and backend services. Then core and backend services can be shared as a parent Spring context (by using beanRefContext) and two war's (frontend A and frontend B) will extend this context

http://stackoverflow.com/comment/32206185
type: Comment
type: QuestionComment
has text: Tip: Please use code formatting for code, **input/output** & structured documents like HTML or XML.
comment on: http://stackoverflow.com/q/21358791
score: 0

http://stackoverflow.com/comment/36678630
type: QuestionComment
has text: If (and only if) CF talks to printers "The Java Way", then this might be related: http://bugs.java.com/view_bug.do?bug_id=4744405. It says that it's fixed in "Java 6, build 33", which I suppose includes Java 6 after update 1 (not sure about this). Furthermore, it's clear that even with the appropriate java version, the application (CF) is going to have to call [javax.print.PrintServiceLookup.lookupDefaultPrintService()](http://docs.oracle.com/javase/7/docs/api/javax/print/PrintServiceLookup.html#lookupDefaultPrintService()) in order to get a refreshed list.
score: 6
type: Comment
comment on: http://stackoverflow.com/q/21383853

selenium
tags question: http://stackoverflow.com/q/21481941
tags question: http://stackoverflow.com/q/21487548
tags question: http://stackoverflow.com/q/21442898
tags question: http://stackoverflow.com/q/21502978
tags question: http://stackoverflow.com/q/21392079
tags question: http://stackoverflow.com/q/21484308
tags question: http://stackoverflow.com/q/21422548
tags question: http://stackoverflow.com/q/21447152
tags question: http://stackoverflow.com/q/21478455
tags question: http://stackoverflow.com/q/21425668
tags question: http://stackoverflow.com/q/21423547
tags question: http://stackoverflow.com/q/21422466
tags question: http://stackoverflow.com/q/21451522
tags question: http://stackoverflow.com/q/21414946
tags question: http://stackoverflow.com/q/21385223
tags question: http://stackoverflow.com/q/21394399
tags question: http://stackoverflow.com/q/21459331
tag name: selenium
tags question: http://stackoverflow.com/q/21453634
tags question: http://stackoverflow.com/q/21384220
tags question: http://stackoverflow.com/q/21441098
tags question: http://stackoverflow.com/q/21485744
tags question: http://stackoverflow.com/q/21450456
tags question: http://stackoverflow.com/q/21421790
tags question: http://stackoverflow.com/q/21413065
tags question: http://stackoverflow.com/q/21511901
tags question: http://stackoverflow.com/q/21398965
tags question: http://stackoverflow.com/q/21457105
tags question: http://stackoverflow.com/q/21414237
tags question: http://stackoverflow.com/q/21479198
tags question: http://stackoverflow.com/q/21479448
type: Tag
tags question: http://stackoverflow.com/q/21368578
tags question: http://stackoverflow.com/q/21432576
tags question: http://stackoverflow.com/q/21503019
tags question: http://stackoverflow.com/q/21482920
tags question: http://stackoverflow.com/q/21427588
tags question: http://stackoverflow.com/q/21364127

http://stackoverflow.com/q/21391136
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/21391330
answer count: 1
downvote count: 1
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/21391524
tagged with: solr
tagged with: jetty
has answer: http://stackoverflow.com/a/21391524
type: AnsweredQuestion
score: 1
tagged with: java
has title: Solr in production
has body: Can Solr(version 4.6) with its default Jetty be used in Production? or Should I deploy it to Tomcat? I found this information but not sure if it really meant for production environment? Solr ships with a working Jetty server, with optimized settings for Solr, inside the example directory. It is recommended that you use the provided Jetty server for optimal performance. If you absolutely must use a different servlet container then continue to the next section on how to install Solr.

http://stackoverflow.com/comment/32394889
has text: one more question, I think i got it now though. When recursion breaks and we move down the previous callers, are they PAUSED or STUCK until they get a value for r, so when they get that r = 11, they can continue with the PRINT and RETURN which is 11 for all cases?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21464556
type: AnswerComment

http://stackoverflow.com/a/21400166
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32279584
answers question: http://stackoverflow.com/q/21400067
score: 3
has comment: http://stackoverflow.com/comment/32279769
upvote count: 3
has comment: http://stackoverflow.com/comment/32279652
has body: Inside the hasNext you call twice keys.next() So, instead of nids.add(String.valueOf(keys.next())); JSONObject jsonObj = jObj.getJSONObject(String.valueOf(keys.next())); you have to do String currentKey = String.valueOf(keys.next()); nids.add(currentKey); JSONObject jsonObj = jObj.getJSONObject(currentKey);
accepted answer of: http://stackoverflow.com/q/21400067
has comment: http://stackoverflow.com/comment/32279807

http://stackoverflow.com/q/21477759
answer count: 1
downvote count: 0
tagged with: jsvc
tagged with: tomcat
has answer: http://stackoverflow.com/a/38346748
favorite count: 0
has body: I started tomcat through jsvc as daemon. But after jsvc started, I see double jsvc process. Process had started by daemon.sh with option start: start ) "$JSVC" $JSVC_OPTS \ -java-home "$JAVA_HOME" \ -java-home /usr/lib/jvm/jre1.7.0_11 \ -user $TOMCAT_USER \ -pidfile "$CATALINA_PID" \ -wait 10 \ -outfile "$CATALINA_OUT" \ -errfile "&amp;1" \ -classpath "$CLASSPATH" \ "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ -Djava.io.tmpdir="$CATALINA_TMP" \ $CATALINA_MAIN exit $?
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32416943
has title: Double jsvc process
upvote count: 1

http://stackoverflow.com/q/21390864
tagged with: android
has body: I am developing an app where I have an OnClickListener for a specific button. When i hit the button a certain method should be executed. When i program the onclicklistener within the onCreate block everything works fine. When I define the action outside of the oncreate method with a custom OnClickListener my app crashs if i hit the Button! Heres the code for inLine Version: public class OrcStopWatchActivity extends Activity { public String[] names; public String[][] gphArray; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_orc_stop_watch); //set up the tabhost TabHost th = (TabHost) findViewById (R.id.tabhost); th.setup(); TabSpec specs = th.newTabSpec("tag1"); specs.setContent(R.id.tab1); specs.setIndicator("Start"); th.addTab(specs); specs = th.newTabSpec("tag2"); specs.setContent(R.id.tab2); specs.setIndicator("Race"); th.addTab(specs); specs = th.newTabSpec("tag3"); specs.setContent(R.id.tab3); specs.setIndicator("Results"); th.addTab(specs); stopBoat5Button = (Button)findViewById(R.id.btnStopBoat5); textResult = (TextView)findViewById(R.id.textResult); //////////////////////////////////////////////////////////////////////////////////////////////// String[][] gesamtArray = SvenMethods.makeArray(werteRow.txt); //erstelle Vektor names names = SvenMethods.extractColumn(gesamtArray,0); // displayStringArray(names); //erstelle Array mit den gph Werten als double Werte ohne Namen gphArray = SvenMethods.deleteColumn(gesamtArray, 0); // display2dStringArray(gphArray); //on click action of the stop buttons stopBoat5Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0){ stopBoat5Button.setEnabled(false); String resultString=SvenMethods.calcCorrectedTimesTest(names, gphArray); Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)", Toast.LENGTH_LONG).show(); textResult.setText(resultString); } } ); } } This one works fine, only if i change i…
has answer: http://stackoverflow.com/a/21391198
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32285088
score: 0
has comment: http://stackoverflow.com/comment/32263757
has comment: http://stackoverflow.com/comment/32284412
answer count: 1
has title: Trouble with custom OnClickListener vs. in inLine OnClickListener
has comment: http://stackoverflow.com/comment/32263436
has comment: http://stackoverflow.com/comment/32263450
type: UnansweredQuestion

http://stackoverflow.com/comment/32470275
type: Comment
score: 0
has text: Don't forget to deal with `/-` too.
comment on: http://stackoverflow.com/a/21506619
type: AnswerComment

http://stackoverflow.com/q/21487137
tagged with: multithreading
type: Question
tagged with: concurrency
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21487700
favorite count: 0
type: UnansweredQuestion
has body: I have a data migration service that reads stuff from one database in chunks then migrates it into another database. To work through the 'Chunks' of data- I am trying to use a RecursiveAction and fork join pool. There reason for this is I would like to work to execute the work on these "chunks" in parallel, then get another chunk, then execute, then get another chunk, etc. What's happening is my process just stops. I see no exceptions in the logs, and I see no deadlocked threads. My code is below, my questions are: Am I missing something in my Worker? Do I need to return some value or call some method to free up a resource? Is it really dumb for me to be using a RecursiveAction here? Should I be using something different to parallelize chunks of work? I have one worker thread in my thread dump who seems to just be waiting- is this normal or some indicator of my problem? ForkJoinPool-1-worker-18 id=12191 state=WAITING - waiting on &lt;0x1b5ca93e> (a java.util.concurrent.ForkJoinPool) - locked &lt;0x1b5ca93e> (a java.util.concurrent.ForkJoinPool) at sun.misc.Unsafe.park(Native Method) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.ForkJoinPool.tryAwaitWork(ForkJoinPool.java:864) at java.util.concurrent.ForkJoinPool.work(ForkJoinPool.java:647) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:398) Code: @Component public class BulkMigrationService { final ForkJoinPool pool = new ForkJoinPool(); private static final Logger log = LoggerFactory.getLogger(BulkMigrationService.class); private SourceDataApi api; private final Migrator migrator; private MetadataService metadataService; @Autowired public BulkMigrationService(SourceDataApi api, Migrator migrator, MetadataService metadataService) { this.api = api; this.migrator = migrator; this.metadataService = metadataService; } public void migrate(Integer batchSize, Long max) throws MigrationException { Long currentCount = 0l; Integer currentIndex = 0; whi…
linked to: http://stackoverflow.com/q/16894929
score: 2
has title: Java Fork Join Pool getting stuck
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32433143

http://stackoverflow.com/comment/48363315
comment on: http://stackoverflow.com/q/21361292
has text: who said: **This is not a valid bitmap file**? (this is not clear to me...)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21418122
has title: Getting an instance of the subclass extending a superclass when a method is called
answer count: 4
linked to: http://stackoverflow.com/q/11306811
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21418286
has answer: http://stackoverflow.com/a/21418230
has answer: http://stackoverflow.com/a/21418286
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21418215
has comment: http://stackoverflow.com/comment/32311221
score: 2
has answer: http://stackoverflow.com/a/21418261
has body: So, I want to be able to get an instance of a subclass that is being run when it calls a method from the super class. For example, if I had this class: public class A { public void aMethod() { //Here is where I want to see if class B is calling the code } } public class B extends A { } public class C { B b = new B(); b.aMethod(); } And, like the comment says, I want to check, in aMethod, if class B, the subclass of class A, is calling the code.
favorite count: 0
has comment: http://stackoverflow.com/comment/32311209
upvote count: 2
accepted answer: http://stackoverflow.com/a/21418215
has comment: http://stackoverflow.com/comment/32311354

http://stackoverflow.com/a/21455258
accepted answer of: http://stackoverflow.com/q/21452907
answers question: http://stackoverflow.com/q/21452907
has body: DBObject and implementing classes can only handle BSON types, which you Student class is not. There are lots of framework which can map | convert domain objects (such as Student) to | from BSON representation and documents. Since you don't use any apparently, you will have to manually convert each Student to a DBObject yourself. BasicDBObject searchQuery = new BasicDBObject("loginid", username); BasicDBObject theUserObj = new BasicDBObject(); List&lt;Object&gt; studentsDBList = new BasicDBList(); for (Student student : studentArray) { DBObject studentDBObject = new BasicDBObject(); studentDBObject.put("firstName", student.getFirstName()); studentDBObject.put("lastName", student.getLastName()); studentDBObject.put("age", student.getAge()); studentDBObject.put("gender", student.getGender()); studentsDBList.add(studentDBObject); } theUserObj.put("phone", profile.phone); theUserObj.put("students", studentsDBList); theUserCollection.update(searchQuery, theUserObj); Also, note that you don't have to put loginid into theUserObj, as you are only querying for it
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/69688204
type: Answer
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/69690209
downvote count: 0

http://stackoverflow.com/comment/32433622
comment on: http://stackoverflow.com/q/21487476
type: Comment
type: QuestionComment
has text: i'm not manually adding any jars other than the ones listed in the mvm dependency:tree output
score: 0

http://stackoverflow.com/comment/32410286
comment on: http://stackoverflow.com/a/21474008
score: 0
type: AnswerComment
type: Comment
has text: It sounds like you want to declare your instances as singletons. This can be done through your module (when building the bindings) or by using the @Singleton annotation. See Scopes: https://code.google.com/p/google-guice/wiki/Scopes

http://stackoverflow.com/comment/32329874
comment on: http://stackoverflow.com/q/21372088
has text: i can recommend you some more steps to check: 1. Fresh unzip tomee. 2. try to deploy fresh new application(maybe problem is related with your application)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32362045
type: Comment
comment on: http://stackoverflow.com/q/21446262
type: QuestionComment
has text: @user278153 arrays of Objects are by default filled with `null` values. Your first `for` loop initializes some - but not all - of the values. When your second `for` loop tries to call `showData()` on a null entry, you get a NullPointerException.
score: 0

http://stackoverflow.com/q/21407409
has answer: http://stackoverflow.com/a/21407551
upvote count: 0
has comment: http://stackoverflow.com/comment/32292467
has comment: http://stackoverflow.com/comment/32292334
has answer: http://stackoverflow.com/a/21407461
has comment: http://stackoverflow.com/comment/32292384
has body: Consider the class class Minute implements Runnable { private int min; // constructor public void run() { while (true) { min++; wait(); } } } class Waker { // Unsure } How do I use the Waker-class to wake up / resume the waiting Minute-object?
possible better answer: http://stackoverflow.com/a/21407461
accepted answer: http://stackoverflow.com/a/21407551
favorite count: 0
has comment: http://stackoverflow.com/comment/32292173
score: -3
has title: Java: Notifying a wait()-ing object
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32292558
type: Question
answer count: 2

http://stackoverflow.com/q/21513629
type: UnansweredQuestion
tagged with: android
tagged with: bitmap
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32480873
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32480698
has comment: http://stackoverflow.com/comment/32480661
tagged with: listview
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/21515718
has body: This is more a question of application logic and performance. Project Setup: I have an Android ListView which inflates a layout that is more aesthetically pleasing than just simple text. In each row (7 to be exact), I have an Image that is fetched by URL. The problem: This ListView and its data are set by an ArrayList of model objects that serve as temporary data holders. When the rows are added the model objects are then used to set the data in the specific row's UI. The issue then comes along, that when a user scrolls down on the list a row that was once viewable is now out of the user's view. When the user scrolls back up to that row, the whole process of fetching the Image then happens again. This seems like it can be avoided by instead of passing URLs through the models then fetching the images, I should fetch the images first, then pass the bitmaps to the model, therefore when the row is visible again to the user, it does not have to re-load the image. Is there a way to write an AsyncTask that can load 7 images successfully, or do I have to create an AsyncTask object for each image? Everytime I go this route the application crashes...
has title: Android loading images to ListView AsyncTask

http://stackoverflow.com/comment/32344789
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21434949
score: 0
has text: Let's see your `ExternalUser` type too.

http://stackoverflow.com/comment/32465946
has text: Is `PessoaDAO` an interface?
comment on: http://stackoverflow.com/q/21505301
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32378306
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21455679
score: 0
has text: i posted the code http://stackoverflow.com/questions/21456343/single-java-program-to-send-and-recieve-plain-text

http://stackoverflow.com/q/21435115
has answer: http://stackoverflow.com/a/21435240
downvote count: 0
favorite count: 0
has title: Thread executorservice
tagged with: executorservice
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32022530
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32340543
score: 1
tagged with: threadpool
tagged with: java
has body: I have a problem with the start method of my thread, I don't understand everything... I show you the code: public class ThreadAction extends Thread{ @Override public void run() { ActionFactory factory = new ActionFactory(); IAction action; for (int i = 0; i &lt; list.size(); i++) { action = factory.getIAction(list.get(i)); action.setFile(file); try { // Creates a random access file stream to read from, and // optionally to write to channel = new RandomAccessFile(file, "r").getChannel(); // We put a lock on the file lock = channel.tryLock(0, file.length(), true); // after the file has been locked, we can send it action.send(); // after the file has been sent, we move it in a temporary // repository specified in the configuration file lock.release(); channel.close(); Path location = Paths.get(file.getPath()); Path destination = Paths.get(temp); Files.move(location, destination); } catch (IOException e) { logger.error("message", e); // e.printStackTrace(); } catch (OverlappingFileLockException e) { logger.error("message", e); e.printStackTrace(); } catch (SendException e) { try { lock.release(); channel.close(); } catch (IOException e1) { // TODO Auto-generated catch block logger.error("message", e1); // e1.printStackTrace(); } } } } } And I'm using my Thread here with a thread.start() but i would like to use executorService to limit my number of thread but when i try to use it nothing happens! void init() { for (Directory dir : configuration.directoriesList) { list(dir); } } void list(Directory dir) { File directory = new File(dir.path); File[] fList = directory.listFiles(); ExecutorService executor = Executors.newFixedThreadPool(8); if (fList != null) { for (File f : fList) { if (f.isFile()) { ArrayList&lt;IConfig&gt; configList = getActions(f, "ENTRY_CREATE", getDirectoriesList(f), getMatchList(f, getDirectoriesList(f))); // implement new thread with the good parameters threadAction = new ThreadAction(); threadAction.setList(configList); threadAction.setEvent("ENTRY…
has answer: http://stackoverflow.com/a/21435831
answer count: 3

http://stackoverflow.com/a/21388860
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21388807
has comment: http://stackoverflow.com/comment/32277229
type: Answer
has body: Just make a little function that fetches the entries one by one.
answers question: http://stackoverflow.com/q/21388807
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32284736

http://stackoverflow.com/a/21479846
score: 0
has body: Since it's tagged 'miltithreading', I guess the 'classic' way would be to thread off 'method()', make it an infinite loop and, instead of call/return, use wait/notify, or condvars, or a binary semaphore to exchange a flow 'token'.
answers question: http://stackoverflow.com/q/21473454
type: Answer

http://stackoverflow.com/a/21384193
answers question: http://stackoverflow.com/q/21383984
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You need both a reference to the Class type and an instance of the class (unless the method you want to invoke is static). In your pseudo code you have the correct idea, all you need to do is a quick review of the javadoc for java.lang.Class and java.lang.reflect.Method public class SettingsClass { public static final boolean BOOT_TEST = true; public static final String BOOT_CLASS = "MyClass"; public static final String BOOT_METHOD = "doMain"; } public class MyClass { public static void doMain() { } } public class MainClass { public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException { if(SettingsClass.BOOT_TEST) { Class&lt;?&gt; clazz = Class.forName(SettingsClass.BOOT_CLASS); Method m = clazz.getMethod(SettingsClass.BOOT_METHOD); m.invoke(null); System.exit(1); } }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21383984

http://stackoverflow.com/a/21586999
accepted answer of: http://stackoverflow.com/q/21511484
type: Answer
score: 2
upvote count: 2
has body: I don't know of a good solution, but just thought I point out that JSON Tree Model (JsonNode) is used to present exact JSON structure; and as such, very few of general features for filtering or transformation are applied. It is very close to WYSIWYG. Because of this, I would probably rather just traverse the Tree and prune NullNodes explicitly. Trying to configure Jackson itself to do this ends up being more work than explicit removal of nodes.
answers question: http://stackoverflow.com/q/21511484
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21484143
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has title: How to convert binary image to grey scale in opencv java
tagged with: opencv
has comment: http://stackoverflow.com/comment/32427520
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21484697
score: 1
accepted answer: http://stackoverflow.com/a/21484697
tagged with: java
tagged with: image-processing
type: Question
has body: I have a binary image as output from background subtractor method and i want to convert it to grey scale image to apply cascade classifier in it. How can i convert binary image to grey scale?

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/21392432
tags question: http://stackoverflow.com/q/21456734
tags question: http://stackoverflow.com/q/21468706
tags question: http://stackoverflow.com/q/21487045
type: Tag

apache-camel
tags question: http://stackoverflow.com/q/21504764
tags question: http://stackoverflow.com/q/21441124
tags question: http://stackoverflow.com/q/21491129
tags question: http://stackoverflow.com/q/21410330
tags question: http://stackoverflow.com/q/21419963
tags question: http://stackoverflow.com/q/21463287
tags question: http://stackoverflow.com/q/21510041
tags question: http://stackoverflow.com/q/21461075
tag name: apache-camel
tags question: http://stackoverflow.com/q/21442850
tags question: http://stackoverflow.com/q/21443234
tags question: http://stackoverflow.com/q/21432776
tags question: http://stackoverflow.com/q/21486455
tags question: http://stackoverflow.com/q/21457909
tags question: http://stackoverflow.com/q/21476344
type: Tag

http://stackoverflow.com/q/21477507
has answer: http://stackoverflow.com/a/21479187
has body: i would obtain (trought whatever Facebook API for Java) a non-expiring access token for my page; i've followed some other guides on stackoverflow but no one works for me. I need to do an autologin, and obtain the non-expiring access token, without using the web! What's the best way ? Actually i have just a page id, secret and login credentials
answer count: 1
score: 0
has title: Obtain NON-EXPIRING access token for a Facebook Page
tagged with: token
tagged with: facebook
tagged with: facebook-graph-api
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/comment/32466416
score: 17
comment on: http://stackoverflow.com/q/21505522
has text: Why the downvote and close vote? This question makes perfect sense, shows research effort, and is definitely useful.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21410288
has answer: http://stackoverflow.com/a/21411164
tagged with: hive
tagged with: java
tagged with: date
has body: I'm trying to convert a string date "Sat Jan 25 00:13:31 +0000 2014" to Unix Timestap using unix_timestamp() HiveQL function. Convert time string with given pattern to Unix time stamp (in seconds), return 0 if fail: unix_timestamp('2009-03-20', 'yyyy-MM-dd') = 1237532400 Java Doc http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#month unix_timestamp("Jan-2014","MMM-yyyy") in Hive returns NULL The function seems to work only with months expressed with an integer (ie MM). Solutions?
type: Question
has answer: http://stackoverflow.com/a/21411286
linked to: http://stackoverflow.com/q/38922754
score: 0
answer count: 3
tagged with: hiveql
has answer: http://stackoverflow.com/a/39859350
tagged with: time
type: UnansweredQuestion
has title: Unix_timestamp in Apache Hive

http://stackoverflow.com/q/21377753
accepted answer: http://stackoverflow.com/a/21378032
tagged with: selenium-webdriver
type: AnsweredQuestion
has title: mouse hover action in selenium WebDriver
tagged with: java
linked to: http://stackoverflow.com/q/14692607
type: Question
has answer: http://stackoverflow.com/a/21378641
tagged with: javascript
has answer: http://stackoverflow.com/a/21378032
score: 0
possible better answer: http://stackoverflow.com/a/21378641
answer count: 2
has body: I want to know how to do do mouse hover action in selenium Web Driver. The mouse hover action need to perform on tab. It need to hover then it need to click the tab. How can i do this using JavaScript executor and java.
has comment: http://stackoverflow.com/comment/32239644

http://stackoverflow.com/q/21480772
has title: Arrays: Objects or Variables
tagged with: arrays
answer count: 7
has answer: http://stackoverflow.com/a/21480865
favorite count: 0
has answer: http://stackoverflow.com/a/21481260
has body: Online, the question of whether arrays are objects or variables is conflicting. Are arrays objects, or variables? Blue Pelican Java book claims that they are variables, but they must be instantiated, so I'm not sure.
has comment: http://stackoverflow.com/comment/32423859
has answer: http://stackoverflow.com/a/21480880
upvote count: 1
has answer: http://stackoverflow.com/a/21481403
has comment: http://stackoverflow.com/comment/32421672
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32457184
tagged with: java
has answer: http://stackoverflow.com/a/21480870
type: Question
score: 0
has answer: http://stackoverflow.com/a/21480928
has answer: http://stackoverflow.com/a/21481184
accepted answer: http://stackoverflow.com/a/21480880
possible better answer: http://stackoverflow.com/a/21480865

http://stackoverflow.com/a/21499194
has body: I didn't see you to posting anything. Add this to your code: String param = "json=" + URLEncoder.encode(json, "UTF-8"); wr.write(param.getBytes());
score: 0
answers question: http://stackoverflow.com/q/21499012
type: Answer

http://stackoverflow.com/comment/32318385
type: Comment
type: QuestionComment
has text: I don't see how you can get that error from this code. Both those methods are declared to return Copyable in what you've posted here.
score: 0
comment on: http://stackoverflow.com/q/21421576

http://stackoverflow.com/comment/32286751
has text: Maybe you're looking for *Domain Events* and *Event Sourcing*.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21394466

http://stackoverflow.com/comment/32236328
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21375425
has text: I dnt want to change date, date should be same becuase i am getting data from service on the basis of this date
type: AnswerComment

http://stackoverflow.com/comment/32351813
type: Comment
has text: But why? Anyway, if you really need that list to be multi-dimensional (for whatever reason), I guess you'll need to search each internal list individually.
comment on: http://stackoverflow.com/a/21440934
score: 0
type: AnswerComment

http://stackoverflow.com/q/21476535
tagged with: android
linked to: http://stackoverflow.com/q/9218246
favorite count: 0
has title: jSoup extract Text out of DIV tag to String
has answer: http://stackoverflow.com/a/21476842
tagged with: text
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
answer count: 2
tagged with: jsoup
possible better answer: http://stackoverflow.com/a/21477111
has body: I want to extract some Text out of a website and store in String. I want to get this Text What goes into the question marks? protected Void doInBackground(Void... params) { try { Document document = Jsoup.connect(url).get(); Elements text = document.select("???"); desc = text.attr("???"); } catch (IOException e) { e.printStackTrace(); } return null; }
downvote count: 0
has answer: http://stackoverflow.com/a/21477111
accepted answer: http://stackoverflow.com/a/21476842

http://stackoverflow.com/comment/32203134
has text: @MagicMan: If I add @TransactionAttribute to the method find, the entity is managed. But, according to wypieprz, even without a transaction, the entity should be managed.
comment on: http://stackoverflow.com/q/21356448
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21430967
has comment: http://stackoverflow.com/comment/32334618
score: 0
has comment: http://stackoverflow.com/comment/32335102
has comment: http://stackoverflow.com/comment/32333205
has body: If you want to reverse the index order, just reverse the index order: NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument,XPathConstants.NODESET); System.out.printf("Nodelist Length:%1$d%nConstant Length:%2$d%n", nodeList.getLength(), constants.getParamColumns().length); arr = new String[constants.getParamColumns().length][nodeList.getLength()]; for(int i = 0; i &lt; nodeList.getLength(); i++) for(int j = 0; j &lt; constants.getParamColumns().length; j++) System.out.printf("Content:%1$s%n", arr[j][i]=nodeList.item(i).getAttributes().item(j)); Array indexing is left-to-right associative, meaning that the leftmost index is resolved first. Therefore, in a multidimentional array, one writes array[rowNumber][columnNumber].
answers question: http://stackoverflow.com/q/21430093
has comment: http://stackoverflow.com/comment/32333984
type: Answer

http://stackoverflow.com/comment/32462145
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21503244
type: AnswerComment
has text: @user1614466 what do you mean, "it doesn't work"? it returns the correct result for your example

http://stackoverflow.com/q/21466657
tagged with: java
tagged with: eclipse
has body: I'm new to servlet/jsp/portlet tecnology and i'm trying to understand,so as described i'm having an issue with this servlet : package trekking; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Login */ public class Login extends HttpServlet { private static final long serialVersionUID = 1L; /** * see HttpServlet#HttpServlet() */ public Login() { } /** * @param name * @param pass * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) * */ protected void doPost(HttpServletRequest request, HttpServletResponse response, String name, String pass) throws ServletException, IOException { String u,p; u=request.getParameter(name); p=request.getParameter(pass); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(" "); out.println(" "); out.println(" Hello World! "); out.println("You are "+u+"!"); out.println(" "); out.println(" "); out.println(" Hello World! "); out.println(" "); out.println(" "); } } It is called in a html page by this form : UserName Password I'm here if you need anything else. Thank you. :D
tagged with: post
accepted answer: http://stackoverflow.com/a/21466685
tagged with: servlets
type: AnsweredQuestion
has title: servlet eclipse on tomcat7 HTTP Status 405 - HTTP method POST is not supported by this URL
tagged with: tomcat
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21466737
has answer: http://stackoverflow.com/a/21466737
has answer: http://stackoverflow.com/a/21466685
score: 0

http://stackoverflow.com/comment/32421553
has text: There's no problem. If the app context is not initialized then your app is not working, is it? In which case Tomcat would return 404, which is perfectly reasonable and easily caught by the monitor. If the app context is initialized, but the health check controller finds something fishy, you can also return a 4XX or 5XX code. And if all is well, the health check controller will return 200 or similar.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21449157
type: Comment

http://stackoverflow.com/a/25838630
upvote count: 5
downvote count: 0
has body: In Intellij, I can get this behavior. When the program is running in debug mode, select Run &gt; Reload Changed Classes Note: After Intellij completes the action, it might say Loaded classes are up to date. Nothing to reload. This is misleading, because it actually DID reload your classpath resources. My environment/setup includes: Intellij 13 Embedded Tomcat Run/Debug configuration of type 'Application' (which just uses a main class) Serving static html, css and js (no jsp)
type: Answer
score: 5
answers question: http://stackoverflow.com/q/21399586

http://stackoverflow.com/q/21431834
accepted answer: http://stackoverflow.com/a/21432042
upvote count: 2
tagged with: lwjgl
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32334649
has body: I'm designing a wrapper for LWJGL and I've got a wrapper class that wraps all of the methods in a type-safe way. However, I've run into an issue which I've never really thought about before. Consider I have this method, which accepts an enum value and an int. public static void glBindBuffer(Target target, int id) { GL15.glBindBuffer(target.glValue, id); } I have a class which handles OpenGL buffer objects in an object orientated manner. It has a static method (it's static because it handles a global state) which simply detaches a buffer object from a target. I have two options; I could either accept a BufferObject instance or a Target as a parameter, like so: public static void detach(Target target) { GL.glBindBuffer(target, 0); } public static void detach(BufferObject bufferObject) { GL.glBindBuffer(bufferObject.getTarget(), 0); } Which is better to do? Note: I don't want the user to have to directly call GL.glBindBuffer(..)
possible better answer: http://stackoverflow.com/a/21431983
tagged with: wrapper
has comment: http://stackoverflow.com/comment/32334559
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32334666
has answer: http://stackoverflow.com/a/21431983
has comment: http://stackoverflow.com/comment/32334562
downvote count: 0
has answer: http://stackoverflow.com/a/21432042
favorite count: 0
type: Question
has title: Code design, method parameters

http://stackoverflow.com/q/21498563
downvote count: 0
has answer: http://stackoverflow.com/a/21498611
has comment: http://stackoverflow.com/comment/32453607
accepted answer: http://stackoverflow.com/a/21498611
type: AnsweredQuestion
score: 1
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/32453558
type: Question
answer count: 1
has title: negative infinity when using JAVA Math library
has comment: http://stackoverflow.com/comment/32453494
upvote count: 1
favorite count: 0
has body: I know that when a variable is positive zero or negative zero then the result of Math.log() would be negative infinity. Now my question is why this code returns negative infinity?! System.out.println((0.5 / Math.log(3600)* Math.log(9 / 60)+ 0.5); but when I using System.out.println((0.5 / Math.log(3600)* Math.log(0.15)+ 0.5); The answer is correct. What caused this problem and how can I fix that?!
has comment: http://stackoverflow.com/comment/32453570

http://stackoverflow.com/a/21376159
upvote count: 1
has body: Yes, you understand it well. When you do: String a = new String("hello"); There will be 2 created Strings, one on the pool and one object, not in the pool that contains a copy of the content that's stored in the object from the pool. You'll have something like that: Pool +-------+ |"hello" &lt;-------- a | | +-------+
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32236883
type: Answer
answers question: http://stackoverflow.com/q/21376093
has comment: http://stackoverflow.com/comment/32237374

http://stackoverflow.com/q/21491076
tagged with: sms
upvote count: 2
has comment: http://stackoverflow.com/comment/32440448
tagged with: android-intent
has answer: http://stackoverflow.com/a/21887612
type: Question
possible better answer: http://stackoverflow.com/a/21491113
tagged with: java
answer count: 2
downvote count: 0
tagged with: default
favorite count: 0
has title: Change SMS App Default on Android 4.4.2
has body: I would change default sms app on Android 4.4.2 I use this code: Intent sendIntent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); sendIntent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, context.getPackageName()); startActivity(sendIntent); How can i solve this? And how can i ask to change default sms app with my app? My Receiver: <action android:name="android.provider.Telephony.SMS_DELIVER" /> Thank you.
has answer: http://stackoverflow.com/a/21491113
tagged with: android
has comment: http://stackoverflow.com/comment/32440798
accepted answer: http://stackoverflow.com/a/21887612
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/21440583
has comment: http://stackoverflow.com/comment/32352156
has comment: http://stackoverflow.com/comment/32354023
has answer: http://stackoverflow.com/a/24891537
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: certificate
has title: Signed Java Applet not Working
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/32353988
has comment: http://stackoverflow.com/comment/32351169
tagged with: applet
has comment: http://stackoverflow.com/comment/32350955
tagged with: code-signing
answer count: 1
has body: I'm working on a Java Applet that used to be self-signed. Now that java 7u51 is being used, I am working to get the jar for the Applet signed. I used the certificate/key used for the apache2 ssl to sign the jar. In order to do this I had to create a new keystore using the key/certificate, and the Not Yet Commons SSL library. If I run jarsigner -verify on the applet jar, i get: This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing. The applet is still getting an invalid certificate error. I can view the certificate, and it is the same certificate used for SSL. The error message says that it was blocked due to being self-signed, but this is not a self-signed certificate! I can run the applet when I move the security settings down to "medium", but this is unacceptable for this project. The certificate I used to sign this is part of a chain (about 4 long). Is there a way I need sign the jar using the whole chain? Do I need to use a Code Signing certificate?
accepted answer: http://stackoverflow.com/a/24891537
favorite count: 0

http://stackoverflow.com/q/21497002
type: Question
type: AnsweredQuestion
has title: how to use Birt Report in Spring
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/21522637
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32508146
has body: Hello , I am using Spring Framework to Develop a web app(in J2EE). Here i need to Make some Reports. Now i am using Birt Report for Making Reports. I have created one report (in Birt) but i don't know how to add it on my current project. so, please help me..please give me some examples... please......Thanks in Advance.....
tagged with: report
tagged with: birt
downvote count: 2
has answer: http://stackoverflow.com/a/21522637
upvote count: 1

jtable
tags question: http://stackoverflow.com/q/21374629
tags question: http://stackoverflow.com/q/21464638
tags question: http://stackoverflow.com/q/21360393
tags question: http://stackoverflow.com/q/21499495
tags question: http://stackoverflow.com/q/21446450
tags question: http://stackoverflow.com/q/21504358
tags question: http://stackoverflow.com/q/21483066
tags question: http://stackoverflow.com/q/21375869
tags question: http://stackoverflow.com/q/21375451
tags question: http://stackoverflow.com/q/21420537
type: Tag
tags question: http://stackoverflow.com/q/21407003
tags question: http://stackoverflow.com/q/21361580
tags question: http://stackoverflow.com/q/21380575
tags question: http://stackoverflow.com/q/21412923
tags question: http://stackoverflow.com/q/21466391
tags question: http://stackoverflow.com/q/21480242
tags question: http://stackoverflow.com/q/21354725
tags question: http://stackoverflow.com/q/21485242
tag name: jtable
tags question: http://stackoverflow.com/q/21378390
tags question: http://stackoverflow.com/q/21511790
tags question: http://stackoverflow.com/q/21501343
tags question: http://stackoverflow.com/q/21358188
tags question: http://stackoverflow.com/q/21415182
tags question: http://stackoverflow.com/q/21430093
tags question: http://stackoverflow.com/q/21360954
tags question: http://stackoverflow.com/q/21411620
tags question: http://stackoverflow.com/q/21479611
tags question: http://stackoverflow.com/q/21510524
tags question: http://stackoverflow.com/q/21431448
tags question: http://stackoverflow.com/q/21397731
tags question: http://stackoverflow.com/q/21350011
tags question: http://stackoverflow.com/q/21442074
tags question: http://stackoverflow.com/q/21387678
tags question: http://stackoverflow.com/q/21486358

http://stackoverflow.com/a/22229235
has body: Just NOTE: acos(dot) is very not stable from numerical point of view. as was said previos, q = q1^-1 * q2 and than angle = 2*atan2(q.vec.length(), q.w)
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/21513637
downvote count: 0
has comment: http://stackoverflow.com/comment/134774519
has comment: http://stackoverflow.com/comment/113629942
score: 5

http://stackoverflow.com/comment/32261472
type: AnswerComment
type: Comment
score: 0
has text: While true, this doesn't do anything to address the NullPointerException that the OP is getting.
comment on: http://stackoverflow.com/a/21389932

http://stackoverflow.com/comment/32209016
comment on: http://stackoverflow.com/a/21360609
type: AnswerComment
has text: You have to modify `build.gradle`, the `classpath` is hardcoded to pick up the [tag:java] classes from your `build.gradle` [tag:java] source classpath. Even when you run `mvn exec:java` the classpath is set to pick up the java source files in the current maven directory. In the `JavaExec` task, I have done the same. Change the `classpath` for your [tag:java] source and the class path will change automatically. There is no - `mvn exec:java` equivalent in `gradle` you need to either apply the `application` plugin or have a `JavaExec` task.
type: Comment
score: 3

http://stackoverflow.com/q/21378607
score: 1
has body: What I need is the following: Person p = new Person(); Command.set(p, "person.name", "William"); //After that method call in line above, p.getName() should return "William" And I needed set method as generic as possible, that is, not only a person parameter but any ValueObject I wanted. I began working on this algorithm using reflection but I'm not sure if that will fit and it's giving a lot of work. I wonder if there is anything already done, such as a framework in Java. Thanks in advance!
favorite count: 0
type: Question
has title: Is there anything to set value in objects based on a path?
has answer: http://stackoverflow.com/a/21380324
has answer: http://stackoverflow.com/a/21378734
tagged with: reflection
answer count: 2
tagged with: set
has comment: http://stackoverflow.com/comment/32241128
upvote count: 1
tagged with: setvalue
possible better answer: http://stackoverflow.com/a/21378734
tagged with: java
accepted answer: http://stackoverflow.com/a/21380324
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/21429017
has body: consider 2 threads. First thread gets lock, increments count to 1 and releases the lock. Second thread gets lock, increments count to 2, releases lock, prints 2, then first thread gets the value of count (now 2) to print it. in this case you would get 2 2 specifically to your example: Thread A increments count to 1 Thread B increments it to 2 Thread A gets and prints value (2) Thread B gets value (2) Thread C inrements it to 3 and prints it Thread B prints value (still 2 since that is what it got) there you have 2 3 2 etc...
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21428508
has comment: http://stackoverflow.com/comment/32330067
upvote count: 2
has comment: http://stackoverflow.com/comment/32330329
has comment: http://stackoverflow.com/comment/32331251

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21503676
tags question: http://stackoverflow.com/q/21393323
tags question: http://stackoverflow.com/q/21478200
tags question: http://stackoverflow.com/q/21367875
tags question: http://stackoverflow.com/q/21462006
tags question: http://stackoverflow.com/q/21432545
tags question: http://stackoverflow.com/q/21471252
tags question: http://stackoverflow.com/q/21499249
tags question: http://stackoverflow.com/q/21472314
tags question: http://stackoverflow.com/q/21456331
tags question: http://stackoverflow.com/q/21389178
tags question: http://stackoverflow.com/q/21452150
tags question: http://stackoverflow.com/q/21509560
tags question: http://stackoverflow.com/q/21387170
type: Tag
tags question: http://stackoverflow.com/q/21403643
tags question: http://stackoverflow.com/q/21475544
tags question: http://stackoverflow.com/q/21492557
tags question: http://stackoverflow.com/q/21368199
tags question: http://stackoverflow.com/q/21413978
tags question: http://stackoverflow.com/q/21478692
tags question: http://stackoverflow.com/q/21383403
tags question: http://stackoverflow.com/q/21351918
tags question: http://stackoverflow.com/q/21387601
tags question: http://stackoverflow.com/q/21451565
tags question: http://stackoverflow.com/q/21428362
tags question: http://stackoverflow.com/q/21383289
tags question: http://stackoverflow.com/q/21447416
tags question: http://stackoverflow.com/q/21488119
tags question: http://stackoverflow.com/q/21479611
tags question: http://stackoverflow.com/q/21368938
tags question: http://stackoverflow.com/q/21428016
tags question: http://stackoverflow.com/q/21390019
tags question: http://stackoverflow.com/q/21384895
tags question: http://stackoverflow.com/q/21381173
tags question: http://stackoverflow.com/q/21468091
tags question: http://stackoverflow.com/q/21453964
tags question: http://stackoverflow.com/q/21394968
tags question: http://stackoverflow.com/q/21411750
tags question: http://stackoverflow.com/q/21473959
tags question: http://stackoverflow.com/q/21447771
tags question: http://stackoverflow.com/q/21419277
tags question: http://stackoverflow.com/q/21380560
tags question: http://stackoverflow.com/q/21400613
tags question: http://stackoverflow.com/q/21424518
tags question: http://stackoverflow.com/q/21470074
tags question: http://stackoverflow.com/q/21424664
tags question: http://stackoverflow.com/q/21477125
tags question: http://stackoverflow.com/q/21428734
tags question: http://stackoverflow.com/q/21467403
tags question: http://stackoverflow.com/q/21365642
tags question: http://stackoverflow.com/q/21493014
tags question: http://stackoverflow.com/q/21494634
tags question: http://stackoverflow.com/q/21472583
tags question: http://stackoverflow.com/q/21462504
tags question: http://stackoverflow.com/q/21372458
tags question: http://stackoverflow.com/q/21495326
tags question: http://stackoverflow.com/q/21500084
tags question: http://stackoverflow.com/q/21368320
tags question: http://stackoverflow.com/q/21479331
tags question: http://stackoverflow.com/q/21415630
tags question: http://stackoverflow.com/q/21464049
tags question: http://stackoverflow.com/q/21428558
tags question: http://stackoverflow.com/q/21353603
tags question: http://stackoverflow.com/q/21376258
tags question: http://stackoverflow.com/q/21501075
tags question: http://stackoverflow.com/q/21407573
tags question: http://stackoverflow.com/q/21490230
tags question: http://stackoverflow.com/q/21457436
tag name: xml
tags question: http://stackoverflow.com/q/21488728
tags question: http://stackoverflow.com/q/21480625
tags question: http://stackoverflow.com/q/21492986
tags question: http://stackoverflow.com/q/21367477
tags question: http://stackoverflow.com/q/21453840
tags question: http://stackoverflow.com/q/21461120
tags question: http://stackoverflow.com/q/21357757
tags question: http://stackoverflow.com/q/21483342
tags question: http://stackoverflow.com/q/21451142
tags question: http://stackoverflow.com/q/21360967

http://stackoverflow.com/comment/88228308
type: AnswerComment
has text: @Dargenn my bad, I was translating from code of mine. I've modified my answer.
type: Comment
comment on: http://stackoverflow.com/a/50255801
score: 0

http://stackoverflow.com/a/21511029
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21509973
answers question: http://stackoverflow.com/q/21509973
type: Answer
has body: There is support for this in Jackson , try specifying a property in the support class that holds the concrete type information: @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class") public abstract class BaseRequestDTO { ... } And on the JSON, specify the concrete type: { "@class" : "com.yourpackage.MyRequestDTO", "a" : "hello", "b" : "world" }
upvote count: 2
score: 2

http://stackoverflow.com/comment/32224216
has text: Use a `double` rather than an `int`?
comment on: http://stackoverflow.com/q/21369280
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/21402007
has comment: http://stackoverflow.com/comment/32285324
answers question: http://stackoverflow.com/q/21401884
has comment: http://stackoverflow.com/comment/32519804
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32285646
has body: You need to programatically implement the logic..by using thumsize and progress values and implementing OnSeekBarChangeListener You can ask if you have any further queries :)
has comment: http://stackoverflow.com/comment/32285607
has comment: http://stackoverflow.com/comment/32285418

http://stackoverflow.com/a/21461459
has body: The Java language specification says this about type arguments Type arguments may be either reference types or wildcards. Wildcards are useful in situations where only partial knowledge about the type parameter is required. An object, stringClass in this example, is not a reference type nor a wildcard. A type argument, the part you put between &lt;&gt; in a parameterized type variable declaration, constructor or method invocation expression, etc., can only be a reference type or a wildcard. For example, MyGenericClass&lt;String&gt; variable; // or MyGenericClass&lt;?&gt; variable; Note that primitive types also cannot be used as type arguments.
accepted answer of: http://stackoverflow.com/q/21461402
answers question: http://stackoverflow.com/q/21461402
score: 7
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32277180
has text: To some extent, everything is possible. Have you tried something? Do you have any problems?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21398235

http://stackoverflow.com/a/21435468
downvote count: 0
has body: You may query on TypeDefinition object using Name attribute: https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?query=(Name = Defect) which will return a reference to the TypeDefinition: _ref": "https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/12352608495 Now if you use the ObjectID of the TypeDefinition you may get to Attributes collection: https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/12352608495/Attributes Using "Defect" instead of ObjectID of defect type def will not work. Now you get attribute definitions of defect TypeDefinition. Here is an excerpt from the response, related to State attribute: { "_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/attributedefinition/-12507", "_objectVersion": "1", "_refObjectName": "State", "CreationDate": "2006-02-11T12:29:05.000Z", "_CreatedAt": "Feb 11, 2006", "ObjectID": -12507, "Subscription": {...}, "Workspace": null, "AllowedQueryOperators": {...}, "AllowedValueType": null, "AllowedValues": { "_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues", "_type": "AllowedAttributeValue", "Count": 4 }, "AttributeType": "RATING", "Constrained": true, "Custom": false, "ElementName": "State", "Filterable": true, "Hidden": false, "MaxFractionalDigits": -1, "MaxLength": 128, "Name": "State", "Note": "State of the defect", "Owned": true, "ReadOnly": false, "Required": true, "SystemRequired": true, "Type": "string", "VisibleOnlyToAdmins": false, "_type": "AttributeDefinition" } You can get the details of State attribute using this URL available from the response above: https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues The Attributes endpoint returns the attribute definitions and allowed values for the default workspace if the workspace is not specified. The default workspace can be overridden with the "workspace" p…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21431677
answers question: http://stackoverflow.com/q/21431677
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21432400
has comment: http://stackoverflow.com/comment/32335829
has comment: http://stackoverflow.com/comment/32336666
has body: In reference to this question, the answer specify that the unsorted array takes more time because it fails the branch prediction test. but if we make a minor change in the program: import java.util.Arrays; import java.util.Random; public class Main{ public static void main(String[] args) { // Generate data int arraySize = 32768; int data[] = new int[arraySize]; Random rnd = new Random(0); for (int c = 0; c &lt; arraySize; ++c) { data[c] = rnd.nextInt() % 256; } // !!! With this, the next loop runs faster Arrays.sort(data); // Test long start = System.nanoTime(); long sum = 0; for (int i = 0; i &lt; 100000; ++i) { // Primary loop for (int c = 0; c &lt; arraySize; ++c) { if (data[c] &gt;= 128) { sum = data[c]; } } } System.out.println((System.nanoTime() - start) / 1000000000.0); System.out.println("sum = " + sum); } } here I have replaced (from original question) if (data[c] &gt;= 128) sum += data[c]; with if (data[c] &gt;= 128) sum = data[c]; the unsorted array gives approx. the same result, I want to ask why branch prediction is not working in this case?
type: Question
has comment: http://stackoverflow.com/comment/32338023
tagged with: jmh
has answer: http://stackoverflow.com/a/21434257
has comment: http://stackoverflow.com/comment/32337474
answer count: 1
linked to: http://stackoverflow.com/q/11227809
has comment: http://stackoverflow.com/comment/32336385
upvote count: 13
tagged with: branch-prediction
has comment: http://stackoverflow.com/comment/32335980
has comment: http://stackoverflow.com/comment/32336448
has comment: http://stackoverflow.com/comment/32337381
has comment: http://stackoverflow.com/comment/32335867
has comment: http://stackoverflow.com/comment/32338008
has comment: http://stackoverflow.com/comment/32337257
has comment: http://stackoverflow.com/comment/32341626
has comment: http://stackoverflow.com/comment/32337154
has comment: http://stackoverflow.com/comment/32336832
linked to: http://stackoverflow.com/q/12479798
favorite count: 0
has comment: http://stackoverflow.com/comment/32337902
has comment: http://stackoverflow.com/comment/32337704
has comment: http://stackoverflow.com/comment/32336127
score: 13
linked to: http://stackoverflow.com/q/19689214
has title: Is branch prediction not working?
has comment: http://stackoverflow.com/comment/32337736
type: AnsweredQuestion
tagged with: microbenchmark
tagged with: performance
has comment: http://stackoverflow.com/comment/32336203
downvote count: 0
has comment: http://stackoverflow.com/comment/32354911
accepted answer: http://stackoverflow.com/a/21434257
has comment: http://stackoverflow.com/comment/32337320
tagged with: java

http://stackoverflow.com/comment/32324837
type: Comment
comment on: http://stackoverflow.com/a/21426088
score: 0
type: AnswerComment
has text: Have you "on" the status of "Google Maps Android API v2" service ?

http://stackoverflow.com/comment/33805958
score: 0
has text: Thanks. I think this is what I wanted, some reassurance that if the return takes it back to the end of my major method doing the work, where I can call cleanup() and get out. I do have some trouble still, where the state is still Active. but I'm finding all the paths through the code and making sure I allow the polite way of stopping to work. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/21445471
type: AnswerComment

http://stackoverflow.com/q/21511390
favorite count: 0
tagged with: exception
possible better answer: http://stackoverflow.com/a/21511449
has answer: http://stackoverflow.com/a/21511449
has body: I have to create a reader and to catch an exception if a file cannot be read. The code is something like this: String line; try { while ((line = reader.readLine()) != null) { //DO SOMETHING } } catch (IOException e) { System.out.println("IO operation failed."); e.printStackTrace(); } I've got 2 questions: Is this code ok? How can i make an "unreadable" file to test the code?
has title: IOException for a BufferedReader
has answer: http://stackoverflow.com/a/21511454
type: AnsweredQuestion
tagged with: ioexception
tagged with: java
downvote count: 1
type: Question
tagged with: try-catch
answer count: 2
upvote count: 0
score: -1
accepted answer: http://stackoverflow.com/a/21511454
has comment: http://stackoverflow.com/comment/32476497

http://stackoverflow.com/comment/32475279
comment on: http://stackoverflow.com/q/21510763
has text: Dividing integer by integer yields integer? What's so strange about it?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/21393448
has answer: http://stackoverflow.com/a/21395592
type: Question
has comment: http://stackoverflow.com/comment/32269838
has comment: http://stackoverflow.com/comment/32268622
tagged with: java
has comment: http://stackoverflow.com/comment/32269734
has comment: http://stackoverflow.com/comment/32268808
has title: HTML embed not working for Java Applet
score: 0
answer count: 1
tagged with: jar
tagged with: applet
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32269572
has comment: http://stackoverflow.com/comment/32269680
tagged with: http://stackoverflow.com/tag/html
has body: I've been researching on which to use between <applet>, , or , but none seem to work. When I tried to load JApplet through HTML I am got RuntimeException error java.lang.NoClassDefFoundError: com/sforce/ws/ConnectionException. When I tried to run number1.class with the number1.class being in myfile.jar it needs the other 3 jar files for the library and that is what the error is. The files look like this: tomcat-->webapps-->applet-->newhtml.html applet-->lib-->(wsc-23,enterprise,partner) applet-->applet_class-->(number1.class,myfile.jar) Any help would be appreciated. I've also looked through majority of stackoverflow questions as well as other places, but still no luck!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32271923

http://stackoverflow.com/comment/32334603
score: 0
has text: Now it appears but it doesn't show any data in the textarea and when I change the option in the combobox it shows the follow error message: Before start of result set
type: Comment
comment on: http://stackoverflow.com/a/21430650
type: AnswerComment

http://stackoverflow.com/comment/32471117
type: QuestionComment
type: Comment
score: 1
has text: @ᴍarounᴍaroun: In that case I'd probably use `Collections.synchronizedList` - which would emphasize that aspect.
comment on: http://stackoverflow.com/q/21508295

http://stackoverflow.com/comment/32195141
comment on: http://stackoverflow.com/a/21352692
score: 0
type: AnswerComment
type: Comment
has text: thanks buddy how is that different than dateAdd(day,getdate,90) ?

http://stackoverflow.com/a/21395964
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21395937
has body: You've got three problems. a and b aren't defined. Define them before entering the if statement. Define g outside of the if statement (a simple double g; will suffice), then set the values as part of your conditional logic. You do have to give it a default value if you intend to keep the else if there, since Java would complain about that not being defined. g=1 isn't going to work the way you think it should; you probably mean g == 1. With else if int a, b; // assumed instantiated with values double g = -1; // required since Java can't guarantee that the else-if will be hit if (a&lt;b) { g = 1; } else if (a&gt;b) { g = 0; } With else int a, b; // assumed instantiated with values double g; // instantiation not required since Java can guarantee the else case if (a&lt;b) { g = 1; } else { g = 0; }

list
tags question: http://stackoverflow.com/q/21461094
type: Tag
tags question: http://stackoverflow.com/q/21387457
tags question: http://stackoverflow.com/q/21498001
tags question: http://stackoverflow.com/q/21360791
tags question: http://stackoverflow.com/q/21444973
tags question: http://stackoverflow.com/q/21488728
tags question: http://stackoverflow.com/q/21430744
tags question: http://stackoverflow.com/q/21374028
tags question: http://stackoverflow.com/q/21486683
tags question: http://stackoverflow.com/q/21403992
tag name: list
tags question: http://stackoverflow.com/q/21414662
tags question: http://stackoverflow.com/q/21503160
tags question: http://stackoverflow.com/q/21493234
tags question: http://stackoverflow.com/q/21401572
tags question: http://stackoverflow.com/q/21460800
tags question: http://stackoverflow.com/q/21489779
tags question: http://stackoverflow.com/q/21436815
tags question: http://stackoverflow.com/q/21358740
tags question: http://stackoverflow.com/q/21426843
tags question: http://stackoverflow.com/q/21396334
tags question: http://stackoverflow.com/q/21511414
tags question: http://stackoverflow.com/q/21408494
tags question: http://stackoverflow.com/q/21350098
tags question: http://stackoverflow.com/q/21399854
tags question: http://stackoverflow.com/q/21365422
tags question: http://stackoverflow.com/q/21507501
tags question: http://stackoverflow.com/q/21374638
tags question: http://stackoverflow.com/q/21394396
tags question: http://stackoverflow.com/q/21370900
tags question: http://stackoverflow.com/q/21378463
tags question: http://stackoverflow.com/q/21463906
tags question: http://stackoverflow.com/q/21362228

http://stackoverflow.com/comment/32470588
type: Comment
has text: I am correcting this changes, but now new error is comming like: SoapFault - faultcode: 'soap:Client' faultstring: 'Server did not recognize the value of HTTP Header SOAPAction: tempuri.org/CelsiusToFahrenheit.'; faultactor: 'null' detail: Is any Solution now
type: AnswerComment
comment on: http://stackoverflow.com/a/21507718
score: 0

http://stackoverflow.com/comment/32252026
comment on: http://stackoverflow.com/q/21384655
type: QuestionComment
type: Comment
has text: You need a reference to your Fenetre object- you could pass one into the constructor and store in an instance variable- just like you are doing with your nb instance var (although that's not a reference of course)- or add an injector (eg setFenetre)
score: 0

http://stackoverflow.com/q/21473568
type: Question
answer count: 2
upvote count: 20
score: 18
tagged with: anonymous-class
accepted answer: http://stackoverflow.com/a/21473598
favorite count: 0
has body: The documentation on Anonymous Classes states An anonymous class cannot access local variables in its enclosing scope that are not declared as final or effectively final. I don't understand what does a variable being "effective final" mean. Can someone provide an example to help me understand what that means?
has comment: http://stackoverflow.com/comment/32409477
tagged with: final
linked to: http://stackoverflow.com/q/20938095
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21473598
tagged with: java
downvote count: 2
duplicate of: http://stackoverflow.com/q/20938095
has title: What does a variable being "effectively final" mean?
possible better answer: http://stackoverflow.com/a/21473655
has answer: http://stackoverflow.com/a/21473655

http://stackoverflow.com/q/21352740
tagged with: concurrentmodification
has body: private void btnOKActionPerformed(java.awt.event.ActionEvent evt) { try { if(txtStaffID.getText(0, 2).equals("AD")) { for(Admin admin:admincontrolpanel.adminList) { if(txtUsername.getText().equals("") || txtPassword.getText().equals("") || txtName.getText().equals("") || txtEmail.getText().equals("") || txtContactNumber.getText().equals("") || txtICNumber.getText().equals("")) { JOptionPane.showMessageDialog(null, "Please fill in the blank", "ERROR", JOptionPane.ERROR_MESSAGE); } else if(txtUsername.getText() != null &amp;&amp; txtPassword.getText() != null &amp;&amp; txtName.getText() != null &amp;&amp; txtEmail.getText() != null &amp;&amp; txtContactNumber.getText() != null &amp;&amp; txtICNumber.getText() != null) { admin.setId(txtStaffID.getText()); admin.setUsername(txtUsername.getText()); admin.setPassword(txtPassword.getText()); admin.setName(txtName.getText()); admin.setEmail(txtEmail.getText()); admin.setContactNumber(txtContactNumber.getText()); admin.setIcNumber(txtICNumber.getText()); Admin newAdmin = new Admin(admin.getId(),admin.getUsername(),admin.getPassword(),admin.getName(),admin.getEmail(),admin.getContactNumber(),admin.getIcNumber()); admincontrolpanel.adminList.remove(admin); admincontrolpanel.adminList.add(newAdmin); } } JOptionPane.showMessageDialog(null, "Successfully Added!", "Add Staff", JOptionPane.PLAIN_MESSAGE); dispose(); } } catch(Exception e) { e.printStackTrace(); } } Inside the text file got these data... AD001|jeff|jeff|jeff|jeff@gmail.com|123456|123456 AD002|admin|admin|admin|admin@gmail.com|123456|123456 When I press OK button to edi...it shows me this ConcurrentModificationException error....Anyone can help me to take a look of it?? Admin is the class...adminList is the arraylist... try { PrintWriter pw = new PrintWriter("Admin.txt"); for(Admin admin:admincontrolpanel.adminList) { pw.println(admin.getId() + "|" + admin.getUsername() + "|" + admin.getPassword() + "|" + admin.getName() + "|" + admin.getEmail() + "|" + admin.getCon…
has comment: http://stackoverflow.com/comment/32194451
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32194309
tagged with: file
tagged with: swing
has title: ConcurrentModificationException when edting the data in the arraylist to text file
type: Question
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/22909304
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/32194290
favorite count: 0
has answer: http://stackoverflow.com/a/21353580
has answer: http://stackoverflow.com/a/21352897
tagged with: arraylist

http://stackoverflow.com/comment/32339057
has text: Which parts of the strings are significant? If you want a generic expression, you need to describe patterns that should (not) be matched, not just 4 static strings.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21431987

http://stackoverflow.com/comment/92343387
has text: Hey, could you share a setup of your project setup (build.gradle or pom.xml) I struggle to set this up on spring
score: 0
type: Comment
comment on: http://stackoverflow.com/a/52550495
type: AnswerComment

http://stackoverflow.com/a/21484560
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32428464
type: Answer
has comment: http://stackoverflow.com/comment/32428766
has comment: http://stackoverflow.com/comment/32428498
has body: You have done ! Just more little change: while (i &lt; tokens.length &amp;&amp; tokens[i] &gt;= '0' &amp;&amp; tokens[i] &lt;= '9') Needs to be replaced with while (i &lt; tokens.length &amp;&amp; (Character.isDigit(tokens[i]) || tokens[i] == '.'))
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32428293
has comment: http://stackoverflow.com/comment/32428681
accepted answer of: http://stackoverflow.com/q/21484152
answers question: http://stackoverflow.com/q/21484152

http://stackoverflow.com/q/21472762
type: Question
accepted answer: http://stackoverflow.com/a/21473424
tagged with: android
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/32408365
has body: I'm new to android and I want to do a simple example where I click on a start button and another Activity is open, there a simple number starting in one and counting upwards, but I'm facing a problem, after I initialize some variables on onCreate method (In the second activity), where should I actually start the while statement to count and modify the text view?. I wrote this class: public class Counter extends Thread{ private TextView tv; private int i; public Counter( TextView tv ){ this.tv = tv; } @Override public void run() { while( true ){ tv.setText(i); try { sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } i++; } } And started the thread over here: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); counter = new Counter( (TextView) findViewById(R.id.textView2) ); counter.start( ); }
has comment: http://stackoverflow.com/comment/32408219
has comment: http://stackoverflow.com/comment/32408617
possible better answer: http://stackoverflow.com/a/21472821
has answer: http://stackoverflow.com/a/21472821
has comment: http://stackoverflow.com/comment/32408669
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/32408686
has answer: http://stackoverflow.com/a/21473424
has answer: http://stackoverflow.com/a/21472894
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32408557
has title: After onCreate Android
has comment: http://stackoverflow.com/comment/32408381

http://stackoverflow.com/comment/69099723
has text: Is there something wrong with the answer? Why the downvote?
comment on: http://stackoverflow.com/a/21506313
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21497184
answer count: 1
favorite count: 0
has body: static int gcd(int x, int y) { if (y==0) return x; return gcd(y, x%y); } When my x = 585 and y = 78 the number of steps that my method does before giving the result is 3. When I change the order, x = 78 and y = 585 the number of steps is 4. What is the cause of this dependence? I tried few pairs of integers and always when x &gt; y the number of steps is a, then after the change the number is a + 1. I tried to ask about it yesterday, I hope now I am more clear and precise.
has answer: http://stackoverflow.com/a/21497254
accepted answer: http://stackoverflow.com/a/21497254
has comment: http://stackoverflow.com/comment/32451113
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32451163
tagged with: java
tagged with: methods
type: Question
score: -1
downvote count: 2
upvote count: 1
has title: The work of a method

http://stackoverflow.com/comment/32476068
comment on: http://stackoverflow.com/a/21511090
score: 0
has text: And Based on your code I did, but I am getting java.lang.ClassCastException: java.lang.String cannot be cast to com.jpa.demo.entities.Simpletable exception Thank you very much
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21499487
has body: change: public NotesDao datasource; to public NotesDao datasource=new NotesDao();
answers question: http://stackoverflow.com/q/21499424
type: Answer
accepted answer of: http://stackoverflow.com/q/21499424
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21404560
has title: Randomly change media player volume
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21404789
has answer: http://stackoverflow.com/a/21404789
accepted answer: http://stackoverflow.com/a/21404956
type: Question
answer count: 2
tagged with: android
tagged with: volume
has body: I'm writing an android application with Java in Eclipse. The media player plays a track when a button is pressed, but I want this track to fade in and out randomly from total silence to full volume and anywhere in between. I'm thinking of using a random number generator to determine output volume. Any suggestions of how to do this and example code would be highly appreciated. When I try this: while (mp.isPlaying()) { float x = (float) Math.random(); float y = (float) Math.random(); setInterval((mp.setVolume(x,y)),2000);} Eclipse tells me that setInterval is undefined. How do I fix this?
score: 0
tagged with: java
tagged with: fade
has answer: http://stackoverflow.com/a/21404956
tagged with: random

http://stackoverflow.com/comment/32216968
type: Comment
comment on: http://stackoverflow.com/a/21365192
has text: No, return the sum of the values
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32278335
has text: have a look at my answer
comment on: http://stackoverflow.com/q/21399318
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21496738
has comment: http://stackoverflow.com/comment/32450591
has answer: http://stackoverflow.com/a/52454314
upvote count: 1
has title: Error in Eclipse - Mainclass not found
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21496874
downvote count: 0
has answer: http://stackoverflow.com/a/21496918
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/21496877
type: Question
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/21496811
has body: I'm new in programing and I like it pretty much. I've just downloaded Eclipse and I got an error I can't help me with. Unfortunately it's in German but the meaning is something like: "Main class not found" - "Fehler: Hauptklasse konnte nicht gefunden oder geladen werden" I understand that it has something to do with "public static void main(String [] args)". Due to the fact that this is totally new to me it would be cool you could assist me. Below the error source code; /** * Write a description of class Light here. * * @author (Sunny) * @version (31.01.2014) */ public class Elevator { // Variables int maxCarr; // max. carry in KG int currentCarr; // current state of carry measured in people boolean fillCondition; // filed or empty - value false = empty int currentStage; // stage where elevator remains // Constructor public Elevator() // initiation { maxCarr = 1600; currentCarr = 0; fillCondition = false; currentStage = 0; System.out.println("**********"); System.out.println("* *"); System.out.println("* *"); System.out.println("* *"); System.out.println("* *"); System.out.println("* *"); System.out.println("* *"); System.out.println("**********"); } public int (int carry) // Setting carry into the elevator { currentCarr = carry; if (currentCarr != 0) { fillCondition = true; return 1; } else { return 0; } } public void move(int stage) { if (stage &gt; currentStage) { System.out.println("moving up"); currentStage = stage; } else { System.out.println("moving down"); currentStage = stage; } } }

http://stackoverflow.com/comment/32251940
has text: Right you both are. The one thing I was missing was comparing the results of getTime() from my java.util.Date with getMillis() from my Joda DateTime. If I had done that I would have seen they were the same instant. The problem I am having, it seems, is that the TimeZone settings, both for the web server and database server, are different for my test environment, the QA environment, pre-production and production. It's a mess. But it seems the problem is at the JDBC level; if I can **always** assume that the web server is running in the same TZ (be it GMT, CET, etc) it will save consistently.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21358463
type: AnswerComment

http://stackoverflow.com/q/21482721
type: AnsweredQuestion
tagged with: netbeans
has body: String s1=t1.getText(); char ch=t2.getText().charAt(0); int a=0; int i=0; for(i=0;i&lt;s1.length();i++) { if(s1.charAt(i)==ch) a++; }t3.setText(""+a); this is my code where t1,t2,t2 are textfields. The compiler doesn't raises any error but i am repeatedly getting 1 as a result no matter whatever character at whatever place i use. PLEASE HELP!!!
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/32425214
answer count: 1
has comment: http://stackoverflow.com/comment/32425393
accepted answer: http://stackoverflow.com/a/21483418
has title: no error raised by compiler but not getting the correct answer in character occurrence program
has answer: http://stackoverflow.com/a/21483418

http://stackoverflow.com/a/22784665
answers question: http://stackoverflow.com/q/21350555
score: 1
upvote count: 1
downvote count: 0
has body: The usual way with AngularJs is to load the data from the server using a REST API. If the data is returned in JSon format it's automatically recognized by AngularJs as Javascript objects and can be added directly to the view. Here's a simple example using RESTAngular : var app = angular.module('MyApp', ['restangular']) .config(function(RestangularProvider) { RestangularProvider.setBaseUrl('my.api/rest/'); }); app.controller('MyCtrl', function($scope, Restangular) { $scope.city = 'Chicago'; $scope.restaurants = [{name:'Restaurant 1'}, {name:'Restaurant 2'}]; // Defines a resource located at "my.api/rest/restaurants/Chicago" var source = Restangular.all('restaurants').one($scope.city); source.getList().then(function(result) { $scope.restaurants = result; }); }); It's fairly easy to configure Spring MVC to produce JSon data. I don't know enough to guide you there but you'll find plenty of info out there.
type: Answer

http://stackoverflow.com/a/21355594
has comment: http://stackoverflow.com/comment/32199326
downvote count: 0
has comment: http://stackoverflow.com/comment/32199313
has comment: http://stackoverflow.com/comment/32199278
answers question: http://stackoverflow.com/q/21355547
upvote count: 2
type: Answer
has body: Your GamePanel class does not extend any Swing GUI component such as Container or one of its children. Probably it should extend JPanel. i.e., import javax.swing.JPanel; public class GamePanel extends JPanel { // .... etc } Please don't add the urgent or "help as soon as possible" bit. Yes your question is very important, but it is no more important than anyone else's. Edit: Mad's link is worth putting in the answer: The Oracle Swing Tutorial.
has comment: http://stackoverflow.com/comment/32199347
has comment: http://stackoverflow.com/comment/32199344
has comment: http://stackoverflow.com/comment/32199362
score: 2

http://stackoverflow.com/comment/32446255
type: Comment
has text: how do i know what version i am using for appache commons? I know that I am running java 1.7
score: 0
comment on: http://stackoverflow.com/q/21494053
type: QuestionComment

http://stackoverflow.com/comment/32362402
type: QuestionComment
comment on: http://stackoverflow.com/q/21446764
score: 1
has text: Where does "Hello" come from? Your input file starts with "Start". Please explain.
type: Comment

http://stackoverflow.com/comment/32433456
type: Comment
has text: @CoShark Can you see the difference between "John" and “John”? The second has curly quotes, which is what Word does for you. They won't work in Java. You can turn them off in Word, but I suggest you use NetBeans or Eclipse instead (or notepad++). All three are free.
comment on: http://stackoverflow.com/a/21487403
type: AnswerComment
score: 0

http://stackoverflow.com/q/21362228
has title: Custom List troubles
has comment: http://stackoverflow.com/comment/32213635
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/32213604
tagged with: jdbc
has body: I'm trying to put some data from DB into custom List. Class: public class TopTitles { private long count; private String title; private String url; public long getCount() { return count; } public void setCount(long count) { this.count = count; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String toString() { return count+" "+title+" "+url; } } And method: public List&lt;TopTitles&gt; getTopTitlesRating() { Session session = null; session = this.sessionFactory.getCurrentSession(); Query query = session .createSQLQuery("SELECT COUNT(title),title,url FROM SpyPath WHERE title!='Main page' GROUP BY title ORDER BY COUNT(title) DESC LIMIT 0, 10;"); List&lt;TopTitles&gt; result = query.list(); return result; } Seems ok, but when I'm trying to List&lt;TopTitles&gt; topTitlesList = spyPathService.getTopTitlesRating(); System.out.println(topTitlesList.get(0).getTitle()); it shows java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to net.babobka.blog.domain.TopTitles What's wrong? UPD: This is how I changed the method: public List&lt;TopTitles&gt; getTopTitlesRating() { Session session = null; session = this.sessionFactory.getCurrentSession(); Query query = session .createSQLQuery("SELECT COUNT(title),title,url FROM SpyPath WHERE title!='Main page' GROUP BY title ORDER BY COUNT(title) DESC LIMIT 0, 10;"); List&lt;?&gt; result = query.list(); List&lt;TopTitles&gt; list = new ArrayList&lt;TopTitles&gt;(); for(Object o : result) { list.add((TopTitles)o); } return list; } And still not working/
tagged with: list
upvote count: 1
answer count: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21362262
type: UnansweredQuestion

http://stackoverflow.com/q/21409916
tagged with: sql
type: UnansweredQuestion
has title: Hibernate query to fetch records taking much time
tagged with: spring
has comment: http://stackoverflow.com/comment/32301063
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21410112
answer count: 2
has answer: http://stackoverflow.com/a/21416579
has body: I am trying to retrieve a set of records from a table. The query I am using is: select * from EmployeeUpdates eu where eu.updateid&gt;0 and eu.department = 'EEE' The table EmployeeUpdates has around 20 million records. 'updateid' is the primary key and there are no records currently in the table with the department 'EEE'. But the query is taking lots of time, due to which the web-service call is getting timed out. Currently we have index only on the column 'updateid'. 'department' is a new column added for which we are expecting 'EEE' records. What changes can I make to retrieve the results faster?
score: 0
tagged with: oracle-database

http://stackoverflow.com/q/21463331
linked to: http://stackoverflow.com/q/5794227
type: Question
has comment: http://stackoverflow.com/comment/32396450
has title: Java: Verify Class Exists
accepted answer: http://stackoverflow.com/a/21463468
has comment: http://stackoverflow.com/comment/32396409
has comment: http://stackoverflow.com/comment/32390937
tagged with: class
has body: I thought this would be a trivial matter, but I can't seem to find a method similar to class_exists in Java. I'm writing a test to verify that a class name is defined. How can I replicate this in Java with jUnit? &lt;?php $this-&gt;assertTrue(class_exists('Car'), 'Should have a class called "Car"'); TestCar.java import org.junit.Assert; import org.junit.Test; public class TestCar { @Test public void testCarExists() { try { Class.forName("Car"); } catch(ClassNotFoundException e) { Assert.fail("Should create a class called 'Car'."); } } } Car.java public class Car { // just enough :-) }
tagged with: junit
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32396341
has comment: http://stackoverflow.com/comment/32391106
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21463468
has comment: http://stackoverflow.com/comment/32396547
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32396278
tagged with: java
has comment: http://stackoverflow.com/comment/32396884

http://stackoverflow.com/a/21476275
type: Answer
has comment: http://stackoverflow.com/comment/32413906
has comment: http://stackoverflow.com/comment/32413972
has comment: http://stackoverflow.com/comment/32414132
has comment: http://stackoverflow.com/comment/32413904
score: 0
answers question: http://stackoverflow.com/q/21476039
has body: else { x.left = insert(x.left, key, x); x.right = insert(x.right, key, x); } inserts the key in both sub-trees of x. You have to decide which branch to take, e.g. by comparing the key to the key at x, and using the right branch if key &gt;= x.key, otherwise take the left branch (if done properly you'll get an ordered tree), or take the branch which is the smallest sub-tree of x.

http://stackoverflow.com/a/21362884
answers question: http://stackoverflow.com/q/21362616
has body: HashSet is backed by a hashtable, which is an unordered data structure. This is why it has no need for a comparator. On the other hand, TreeSet is backed by a binary search tree (an ordered structure), and so it needs a comparator. The correctness of a hashtable relies on the equals method, while its performance relies on a well-chosen hashCode. You can read more about it in the Javadoc of HashSet and the Object.hashCode() method itself.
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 3
downvote count: 2
accepted answer of: http://stackoverflow.com/q/21362616

http://stackoverflow.com/q/21416886
linked to: http://stackoverflow.com/q/513832
score: 2
downvote count: 0
has body: I am new to to programming - and am learning Java. I am trying to work an if/else statement using JOptionPane. Everything works okay, except the statements. I only get the statement "Stop and get gas!" no matter what the answer entered (yes or no). Any help would be appreciated! //This program determine if I have to stop for gas on the way in to work. import javax.swing.JOptionPane; import java.util.*; public class GasIndicator { public static void main(String[] args) { String answer; String outputStr1; String outputStr2; answer = JOptionPane.showInputDialog ( "Do you have at least an eighth tank of gas? yes or no " ); outputStr1 = "You can drive straight to work"; outputStr2 = "Stop and get gas!"; if (answer == "yes") JOptionPane.showMessageDialog(null, outputStr1, "Gas", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(null, outputStr2, "Gas", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
tagged with: equals
upvote count: 2
has answer: http://stackoverflow.com/a/21416959
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21416919
tagged with: joptionpane
has title: If Else Statements with Java using JOptionPane
tagged with: java
has comment: http://stackoverflow.com/comment/32309021
has comment: http://stackoverflow.com/comment/32309055
has comment: http://stackoverflow.com/comment/32309152
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/32309133
has answer: http://stackoverflow.com/a/21416914
answer count: 3

http://stackoverflow.com/q/21457736
favorite count: 0
has body: It sounds like the newer cloud SQL JDBC drivers for app engine (1) support connection pooling. Our app uses Spring+Hibernate and we're trying to use one of the existing java frameworks for connection pooling (BoneCP, C3p0, Hikari), and have failed so far to use any of them because of app engine limitations. Stack trace using Spring+Hibernate+C3p0 below. Did anyone manage to get this to work? [INFO] java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details. [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) [INFO] at com.mchange.v2.c3p0.management.ActiveManagementCoordinator.&lt;init&gt;(ActiveManagementCoordinator.java:54) [INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [INFO] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [INFO] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [INFO] at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_(Runtime.java:127) [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:148) [INFO] at com.mchange.v2.c3p0.C3P0Registry.&lt;clinit&gt;(C3P0Registry.java:146) [INFO] at java.lang.Class.forName0(Native Method) [INFO] at java.lang.Class.forName(Class.java:190) [INFO] at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70) [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64) [INFO] at com.mchange.v2.c3p0.impl.DriverManagerDataSourceBase.&lt;init&gt;(DriverManagerDataSourceBase.java:212) [INFO] at com.mchange.v2.c3p0.DriverManagerDataSource.&lt;init&gt;(DriverManagerDataSource.java:72) .... (1): Old driver = com.google.a…
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/64515056
accepted answer: http://stackoverflow.com/a/21526563
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/38397337
downvote count: 0
score: 1
has title: Connection pool on app engine with Cloud SQL
has answer: http://stackoverflow.com/a/21526563
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/33683459
possible better answer: http://stackoverflow.com/a/30572978
answer count: 3
has answer: http://stackoverflow.com/a/30572978
upvote count: 1
tagged with: google-cloud-sql

http://stackoverflow.com/q/21359892
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jtextfield
type: Question
tagged with: jpanel
has body: I tried creating simple GUI using JFrame with below code. package sorting_array_gui; package sorting_array_gui; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; public class userwindow extends JFrame { private static final long serialVersionUID = 1L; public userwindow() { super("A Programm to Sort Your Array"); setSize(1000,600); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setVisible(true); JPanel p1= new JPanel(); JButton b1= new JButton("Click Here"); p1.add(b1); JTextField t1= new JTextField(); p1.add(t1); JLabel l1= new JLabel("This is a Lable"); p1.add(l1); add(p1,BorderLayout.CENTER); } } When I added JTextfield , JPlane misbehaved and even JButton and JLabel stoped showing. Why is that happening.
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21359930
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has title: Java JPannel not Visible

http://stackoverflow.com/q/21379824
linked to: http://stackoverflow.com/q/4261372
tagged with: java
has answer: http://stackoverflow.com/a/21379947
type: Question
tagged with: database
has body: I want to divide JDBC URL and URL params. In jdbc.properties I have: jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://db.server.tld:3306/dbName jdbc.username=user jdbc.password=pass jdbc.urlParams=?useUnicode=true&amp;amp;characterEncoding=utf-8 In spring xml config: &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location"&gt;&lt;value&gt;classpath:jdbc.properties&lt;/value&gt;&lt;/property&gt; &lt;/bean&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt; &lt;property name="url" value="${jdbc.url}${jdbc.urlParams}" /&gt; &lt;property name="username" value="${jdbc.username}" /&gt; &lt;property name="password" value="${jdbc.password}" /&gt; &lt;/bean&gt; But it doesn't work. Is there any way to join these two params?
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
has title: Spring XML conf - join two params from jdbc.properties
tagged with: spring
has comment: http://stackoverflow.com/comment/32243122

integration
tags question: http://stackoverflow.com/q/21437362
type: Tag
tags question: http://stackoverflow.com/q/21486715
tag name: integration
tags question: http://stackoverflow.com/q/21411720

http://stackoverflow.com/q/21436378
has answer: http://stackoverflow.com/a/21436747
type: Question
linked to: http://stackoverflow.com/q/7970857
has title: Queue using array in java
has answer: http://stackoverflow.com/a/26773490
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32343087
has body: I just want to ask in Queue if for example i have already 5 elements in my queue and the limit of it is 5. Then, i remove one element. Then i insert an element. Is it right that the output will be overflow? My problem is even if inserted new elements from the queue. It always say overflow. What i want is to add more elements in my queue.(I'm referring to the situation above) import java.io.*; import java.lang.*; class clrqueue { DataInputStream get=new DataInputStream(System.in); int a[]; int i,front=0,rear=0,n,item,count=0; void getdata() { try { // to enter the limit System.out.println("Enter the limit"); n=Integer.parseInt(get.readLine()); a=new int[n]; } catch(Exception e) { System.out.println(e.getMessage()); } } void enqueue() { try { if(count&lt;n) { System.out.println("Enter the element to be added:"); item=Integer.parseInt(get.readLine()); a[rear]=item; rear++; count++; } else System.out.println("QUEUE IS FULL"); } catch(Exception e) { System.out.println(e.getMessage()); } } void dequeue() { if(count!=0) { System.out.println("The item deleted is:"+a[front]); front++; count--; } else System.out.println("QUEUE IS EMPTY"); if(rear==n) rear=0; } void display() { int m=0; if(count==0) System.out.println("QUEUE IS EMPTY"); else { for(i=front;m&lt;count;i++,m++) System.out.println(" "+a[i]); } } } class Myqueue { public static void main(String arg[]) { DataInputStream get=new DataInputStream(System.in); int ch; clrqueue obj=new clrqueue(); obj.getdata(); try { do { System.out.println(" 1.Enqueue 2.Dequeue 3.Display 4.Exit"); System.out.println("Enter the choice"); ch=Integer.parseInt(get.readLine()); switch (ch) { case 1: obj.enqueue(); break; case 2: obj.dequeue(); break; case 3: obj.display(); break; } } while(ch!=4); } catch(Exception e) { System.out.println(e.getMessage()); } } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21437288
tagged with: java
tagged with: queue

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/21479627

http://stackoverflow.com/a/21356176
has comment: http://stackoverflow.com/comment/32202451
has comment: http://stackoverflow.com/comment/32205016
type: Answer
has comment: http://stackoverflow.com/comment/32205080
has body: Your question is not clear to me. If you want to accept words that start with a letter, and continue with either a letter or a digit (or an underscore) ; but exclude words from a list, you can use the regex: (?!\b(?:INT|WRITE|READ)\b)\b[A-Za-z]\w*\b If, instead of a list, you want to exclude words that consist of all capitalized letters, then try: (?!(?:\b[A-Z]+\b))\b[A-Za-z]\w*\b In Java, I believe you need to double the backslashes for the metacharacters, so it might be something like: "(?!\\b(?:INT|WRITE|READ)\\b)\\b[A-Za-z]\\w*\\b" If you also want to exclude strings within quotes, you could use something like: "[^"]+"|((?!\b(?:INT|WRITE|READ)\b)\b[A-Za-z]\w*\b) and then check to see if there is anything within capturing group 1 which would NOT include the phrases delineated by the double quote marks. Another option would be to replace all those parameters you don't want with nothing -- the word list as well as the quoted text. In Java, something like: String resultString = subjectString.replaceAll("\"[^\"]*\"|\\b(?:WRITE|INT|READ)\\b", "");
downvote count: 0
has comment: http://stackoverflow.com/comment/32202247
score: 1
has comment: http://stackoverflow.com/comment/32200776
has comment: http://stackoverflow.com/comment/32205232
has comment: http://stackoverflow.com/comment/32201262
accepted answer of: http://stackoverflow.com/q/21355834
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21355834
has comment: http://stackoverflow.com/comment/32200569
has comment: http://stackoverflow.com/comment/32201618

http://stackoverflow.com/comment/32279630
type: AnswerComment
type: Comment
score: 1
has text: If at runtime, then you're correct, my answer isn't the solution here.
comment on: http://stackoverflow.com/a/21383157

http://stackoverflow.com/a/21441459
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21441098
has body: One thing I noticed is that all of your selectors in [] are missing single quotes. By.cssSelector("button[context='UNIQUE_THING']") By.cssSelector(".btn.addWidgButt.bt-block[context='UNIQUE_THING']") By.cssSelector("span.btn-text") Your second selector is missing the leading . Your last selector will not work, as you cannot match text with CSS Selectors. You can match a class with ., or id with #. For more information, this is an excellent reference: http://www.w3schools.com/cssref/css_selectors.asp

http://stackoverflow.com/comment/32352434
score: 0
type: Comment
has text: Does the test rollback db even when it's testing methods that have @Transactional(propagation = Propagation.REQUIRES_NEW)?
comment on: http://stackoverflow.com/a/21439339
type: AnswerComment

http://stackoverflow.com/comment/32192300
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21351490
score: 0
has text: A compilable version of the code always helps others to help you out. [SSCE](http://sscce.org/)

http://stackoverflow.com/q/21477199
has body: I want a method on my api to return Observable&lt;Observable&lt;Object&gt;&gt; but I want the code in that method to know once all contained Observables have completed so that it can close something. What is the best way to do this? To be more explicit, I'm after this method to be completed: public static &lt;T&gt; Observable&lt;Observable&lt;T&gt;&gt; doWhenAllComplete( final Observable&lt;Observable&lt;T&gt;&gt; original, Action0 action) { ... }
has answer: http://stackoverflow.com/a/21477332
tagged with: java
has comment: http://stackoverflow.com/comment/32424563
type: Question
has answer: http://stackoverflow.com/a/26939614
has comment: http://stackoverflow.com/comment/32415602
has answer: http://stackoverflow.com/a/21655105
score: 0
has title: How to detect completion of all contained Observables in Observable<Observable<Object>>
answer count: 3
tagged with: system.reactive
type: UnansweredQuestion
tagged with: rx-java

http://stackoverflow.com/comment/32348378
type: Comment
has text: Done this on SQL Developer but still getting the same error. i think i am missing something that is understood
comment on: http://stackoverflow.com/a/21438524
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32404555
has text: maybe I explained badly ,Lets explain my scenario: I have a map and I crawl some locations and store them on database I want to show the location on the map as soon as they added to database so how can I understand the new rows is added?
score: 0
comment on: http://stackoverflow.com/q/21470480
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32467119
has text: I want to append to the file the data I get from the input so I can then see the contents of the output file - but then I want that same file to just be cleared on the next run.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21505961

http://stackoverflow.com/q/21510589
accepted answer: http://stackoverflow.com/a/21511269
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/21511269
score: 0
tagged with: neo4j
has body: I try this Hello world example (https://github.com/neo4j/neo4j/blob/2.0.0/community/embedded-examples/src/main/java/org/neo4j/examples/EmbeddedNeo4j.java). I inserted into this example my method: private void allNodes() { ExecutionEngine engine = new ExecutionEngine(graphDb); String query = "start n=node(*) return n"; ExecutionResult result = engine.execute(query); System.out.println(result); Iterator&lt;Node&gt; kindsOfFruit = result.columnAs("n"); while (kindsOfFruit.hasNext()) { Node kindOfFruit = kindsOfFruit.next(); System.out.println(kindOfFruit.getId()); } } When i call this method, I get this error: Hello, brave Neo4j World!Exception in thread "main" java.lang.NoClassDefFoundError: org/parboiled/scala/Parser at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader…
tagged with: scala
has title: Neo4j - java.lang.NoClassDefFoundError: org/parboiled/scala/Parser
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21383373
tagged with: web-services
has answer: http://stackoverflow.com/a/21383583
tagged with: virtual-machine
type: Question
tagged with: performance
tagged with: java
score: 0
answer count: 1
tagged with: tomcat
has body: Don't know which way of investigation should select. After some time (near 4 weeks) on continouous running web application got run slowly. Checking: catalina.out - no full gc. Regular gc takes near 0.2s and executed one time in near 10 - 30 seconds. On the same server another tomcat with web application running well. So the problem not in the host. I am really confused. What should be checked ?
has comment: http://stackoverflow.com/comment/32250156
has title: Tomcat java web application got running slowly
type: UnansweredQuestion

http://stackoverflow.com/a/21534684
has comment: http://stackoverflow.com/comment/32603064
type: Answer
answers question: http://stackoverflow.com/q/21489938
upvote count: 5
has body: Here's a proof-of-concept of a Constraint Programming approach. It's done in MiniZinc, (as usual when I prototyping CSP problems). I haven't implemented it in any Java system but hope it's of some use anyway. The MiniZinc model is here: http://www.hakank.org/minizinc/bracket_partitioning.mzn Here's the the principal approach: The array ("x") of size 1..N is for assigning the person (x[i]) to which bracket. Symmetry breaking on "x": bracket 1 must be used before bracket 2 (the constraint value_precede_chain) Another array ("set_size") of 1..N div 2 contains the number of person in each bracket. Symmetry breaking on "set_size": The values in "set_size" must be in decreasing order. Then there are three help arrays ("mins", "maxs","diffs") of size 1..N div 2 (i.e. the same same as "set_size") which includes the minimum, maximum values of each bracket, and also the difference (diff[s]) between maxs[s]-mins[s]. This difference must be within 15% (calculated as "10000*diffs[s] div maxs[s] &lt;= 1500"). This 15% requirement is what makes the model a bit messy, but interesting. The preference of 4 and 8 size brackets has been implemented by maximizing the number of brackets of size 4 and 8 (both have weight 1, the other bracket sizes have weight 0); this is the "z" variable. An alternative is to weight bracket size of 8 by 2 and size 4 of 1 (and all other weight 0) which thus prefer 8 size brackets over 4 size brackets. Notes: - There are also some other constraints - implicit constraints and symmetry breaking - which tend to speed up the model, such as: sum(set_size) = n % implicit constraint x[1] = 1 % assign the first person to bracket 1 The code also includes some stuff for randomized testing such as rand_int_array (MiniZinc don't have that as a built-in). That can be ignored. I don't know how large N can be in real life. Perhaps it's very large, then one have to add some more symmetry breaking etc or using another approach. Here's an output from running the example give…
downvote count: 0
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32601431
accepted answer of: http://stackoverflow.com/q/21489938

http://stackoverflow.com/q/21463021
tagged with: java
type: Question
tagged with: gwt
has title: Declare 2 standalone components in one UiBinder file?
answer count: 2
tagged with: uibinder
has answer: http://stackoverflow.com/a/21476393
downvote count: 0
favorite count: 0
upvote count: 2
has body: I have a dialog which fires ValidEvent (GXT custom event) : public class MyDialog extends Dialog implements HasValidHandlers { ... } So if I include it in a UiBinder file, I should be able to do something like (see @UiHandler) : @UiField MyDialog myDialog; @UiHandler("myDialog") void onValid(ValidEvent event) { .. } And I want to include the MyDialog in a widget also defined with UiBinder : public class MyWidget extends Composite { @UiField MyDialog myDialog; public MyWidget(Binder binder) { initWidget(binder.createAndBindUi(this)); } @UiHandler("myDialog") void onValid(ValidEvent event) { .. } interface Binder extends UiBinder&lt;Widget, MyWidget&gt; {} } Problem : Where to place the component in the ui.xml file? Including the dialog in the component will causes graphical problem as UiBinder will try to add the Dialog IN the widget : &lt;g:HTMLPanel&gt; &lt;MyDialog ui:field="myDialog"/&gt; &lt;/g:HTMLPanel&gt; But : In uIBinder, I can have only one root component. Question : How can I declare 2 different components in a single UiBinder file? I would like to avoid making a ui.xml just to declare the Dialog and if I instantiate it via new the @UiHandler will not work.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21477358
score: 2

http://stackoverflow.com/a/77742068
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: If using Kotlin DSL and with gradle8.5 (or perhaps even newer ones), it seems I need to write it like this: If you use "application" plugin, write in build.gradle.kts and run as: ./gradlew run plugins { application } application { mainClass.set("org.example.Main") } Or, if you use the "java" plugin, this defines a custom task called "runMe" via the JavaExec task type, and it does the same thing as above when running ./gradlew runMe. The good thing is now you can write more tasks if you have more classes with main methods. plugins { java } tasks.register<JavaExec>("runMe") { classpath = sourceSets["main"].runtimeClasspath mainClass = "org.example.Main" } More about JavaExec. The groovy example in the API doc is not very helpful...
answers question: http://stackoverflow.com/q/21358466

http://stackoverflow.com/comment/102761540
type: Comment
score: 0
type: AnswerComment
has text: No prob! Thanks for taking the time to improve your answer.
comment on: http://stackoverflow.com/a/58190488

http://stackoverflow.com/a/21484304
has comment: http://stackoverflow.com/comment/32441394
type: Answer
has comment: http://stackoverflow.com/comment/32486530
answers question: http://stackoverflow.com/q/21484162
has body: Surround the part you want to capture with parentheses to create a group (Actually, this is optional in your case since you want the entire matching area): Pattern.compile("(?&lt;=version=)(.*)") Then use matcher.group() (with no parameter) to return 1.1 for your example input. Note that you must call matcher.find() before using matcher.group(). matcher.group(x) will only work if your regexp matches the entire input string.
score: 0

http://stackoverflow.com/a/21356355
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32262347
has body: Use an Extension. They are a nice way to provide "global" stuff to actors: public class MyWebServiceExtension extends AbstractExtensionId&lt;MyWebServiceExtension.MyWebServiceExt&gt; { public static MyWebServiceExtension MyWebServiceExtProvider = new MyWebServiceExtension(); public MyWebServiceExt createExtension(ExtendedActorSystem system) { return new MyWebServiceExt(); } public static class MyWebServiceExt implements Extension { private final MyWebServiceClient client = new MyWebServiceClient(); public MyWebServiceClient getClient() { return client; } } } Then in your actor: import static com.foo.MyWebServiceExtension.MyWebServiceExtProvider; public class MyUntypedActor extends UntypedActor { final MyWebServiceClient client = MyWebServiceExtProvider.get(getContext().system()).getClient(); Or if you are using Spring you can use the IndirectActorProducer and let Spring DI your dependencies into your actors. See this project for an example.
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/54132334
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21350078
answers question: http://stackoverflow.com/q/21350078

http://stackoverflow.com/comment/32233229
type: QuestionComment
has text: So what should i add?
comment on: http://stackoverflow.com/q/21374006
score: 0
type: Comment

http://stackoverflow.com/comment/32358749
has text: I'm getting the following error:java.lang.NullPointerException org.hibernate.hql.internal.ast.util.SessionFactoryHelper.findFunctionReturnType(SessionFactoryHelper.java:399) org.hibernate.hql.internal.ast.util.SessionFactoryHelper.findFunctionReturnType(SessionFactoryHelper.java:391) org.hibernate.hql.internal.ast.tree.MethodNode.dialectFunction(MethodNode.java:115) org.hibernate.hql.internal.ast.tree.MethodNode.resolve(MethodNode.java:76)
type: Comment
comment on: http://stackoverflow.com/q/21435645
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32373966
comment on: http://stackoverflow.com/q/21453563
has text: change `public class reverseAdd`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21352550
type: Answer
has body: You are being shown the usage of the java command. Just do as follows: Navigate to where your First.java file is stored. Type javac First.java and hit enter. This will yield a First.class file. Type java First and hit enter. Notice that there is not file extension mentioned here. Please do consider PeeSkillet's answer pointing out what changes need to be made to your program.
score: 0
answers question: http://stackoverflow.com/q/21352440

http://stackoverflow.com/q/21365940
has answer: http://stackoverflow.com/a/21509934
type: Question
accepted answer: http://stackoverflow.com/a/21509934
type: AnsweredQuestion
tagged with: split-button
has body: I would create a combo box / split button similar like the debug/run button in eclipse. I tried to use BasicComboBoxUI but it changes the Look and Feel. Is there any possible way to do that?
answer count: 1
downvote count: 0
has title: Split button /Combo box button like in eclipse
favorite count: 0
tagged with: jcombobox
score: 1
tagged with: java
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/32352488
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21439652
has text: I just want to know what the order is of Listener notification. It's not a code issue. I cannot find the answer in Java documentation. Here is my clear description. JTextField can have many different KINDS of Listeners attached to it (Document, Key, UndoableEdit). When JTextField is modified by a user typing characters into it. Is it guaranteed that one of those kinds of Listeners will be notified before the others? If so, what is that order?

memoization
type: Tag
tags question: http://stackoverflow.com/q/21487889
tag name: memoization
tags question: http://stackoverflow.com/q/21505522

http://stackoverflow.com/comment/33148141
score: 0
type: Comment
has text: The sample of phpmyadmin is very nice, and i have already thought about it. I will use a JTable in that case.
comment on: http://stackoverflow.com/a/21851911
type: AnswerComment

http://stackoverflow.com/q/21503825
tagged with: filesystems
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32463247
has answer: http://stackoverflow.com/a/21504441
has body: In order to open a file (.TXT in my case) in default editor using Java, I am using java.awt.Desktop.getDesktop().edit(file); Is it possible to move the pointer to a specific line in the default editor? I feel it might depend on default editor (if it exposes such functionality) but any ideas would be appreciated.
type: UnansweredQuestion
tagged with: file
tagged with: java
has title: Java .txt open using default editor and scroll/seek
has comment: http://stackoverflow.com/comment/32463297
type: Question

http://stackoverflow.com/comment/32225120
type: Comment
has text: Although your answer may be correct, you would do well to motivate it with a sentence or two explaining why one might "Use this".
comment on: http://stackoverflow.com/a/21369537
score: 0
type: AnswerComment

http://stackoverflow.com/a/21476265
answers question: http://stackoverflow.com/q/21476104
type: Answer
accepted answer of: http://stackoverflow.com/q/21476104
score: 0
has body: It depends on which thread safe implementation you use. For example: CopyOnWriteArraySet javadoc states: "Iterators do not support the mutative remove operation." => you will get an exception if you call it.remove(). ConcurrenSkipListSet javadoc states: "Insertion, removal, and access operations safely execute concurrently by multiple threads. Iterators are weakly consistent, returning elements reflecting the state of the set at some point at or since the creation of the iterator." => you can safely assume that calling it.remove() is thread safe (as in it won't throw a ConcurrentModificationException). Note however that: if (it.hasNext()) { it.next(); it.remove(); } is not atomic, so the result of that operation can be unexpected if the set is modified concurrently.
type: AcceptedAnswer

http://stackoverflow.com/comment/32420811
comment on: http://stackoverflow.com/a/21480102
has text: I am looking into JOOQ. Can you start with looking at an existing stored procs and generate code based on the SP in MS SQL Sever?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21359711
score: 0
has body: you need to give list.add() not as add.list List is not Generic and you cannot give like List&lt;String&gt; Do like this ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (String x:salami) list.add(x);
type: Answer
answers question: http://stackoverflow.com/q/21359649

http://stackoverflow.com/comment/32212251
has text: As of java 1.6 you can use the `ScriptEngine`. http://stackoverflow.com/questions/20797012/condition-string-resolver-in-java-api/20797167#20797167
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21362680
score: 0

http://stackoverflow.com/comment/32239902
has text: this is for Browser popup, unable to inspect the element with firebug or developer tools
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21377789
type: Comment

http://stackoverflow.com/comment/32374428
comment on: http://stackoverflow.com/q/21389628
score: 0
type: Comment
type: QuestionComment
has text: Thanks for confirming that @haraldK. User3241775, what happens if you change the color model of source to TYPE_BYTE_GRAY or TYPE_USHORT_GRAY (I would expect the actual image to be >8 bit grayscale)?

http://stackoverflow.com/a/21433385
answers question: http://stackoverflow.com/q/21433288
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: It iterates over the collection specified through the object reference It is basic Expression Language (EL), and JSTL (c:forEach) things. I would assume that the only spring element is that the certifcateToolState is a spring bean. Basically what it means in pure code: for (Criteria criterion : certificateToolState.getCertificateDefinition().getAwardCriteria()) { .... }

http://stackoverflow.com/comment/32468124
score: 1
type: AnswerComment
has text: An alternative is to use a float (2.2f), which will work without the need to cast.
comment on: http://stackoverflow.com/a/21506514
type: Comment

http://stackoverflow.com/q/21480040
favorite count: 0
linked to: http://stackoverflow.com/q/5003142
tagged with: el
accepted answer: http://stackoverflow.com/a/21484819
has comment: http://stackoverflow.com/comment/32420098
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is request.setAttribute("...") necessary with EL?
upvote count: 1
type: Question
tagged with: jstl
has answer: http://stackoverflow.com/a/21484819
tagged with: jsp
has answer: http://stackoverflow.com/a/21480077
tagged with: servlets
answer count: 3
possible better answer: http://stackoverflow.com/a/21480076
downvote count: 0
has body: If I have a bean that contains the following code: private String method; public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } Is it necessary to: request.setAttribute("method", method ); For every variable that I want to be visible from the JSP?
has answer: http://stackoverflow.com/a/21480076

calculator
tags question: http://stackoverflow.com/q/21383582
tags question: http://stackoverflow.com/q/21371643
tags question: http://stackoverflow.com/q/21493431
tags question: http://stackoverflow.com/q/21506512
tags question: http://stackoverflow.com/q/21426003
type: Tag
tag name: calculator

http://stackoverflow.com/comment/32215120
comment on: http://stackoverflow.com/a/21364076
score: 0
type: AnswerComment
type: Comment
has text: You have to specify fully name of your class (including package) in @Query - just added it to my answer

http://stackoverflow.com/comment/32282234
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21376629
has text: @assylias I'll describe its behavior, this is a side product by vmware called gemfire, when i start it, at first everything works as it should be, but the memory allocation shown in task manager increases all the time, in few hours even my mouse will start to glinch and i'll be forced to kill the process... I'm using Dell Precision Workstation and this is not a weak machine...

http://stackoverflow.com/q/21426688
tagged with: difference
has comment: http://stackoverflow.com/comment/32325982
score: 45
answer count: 1
has answer: http://stackoverflow.com/a/21426731
linked to: http://stackoverflow.com/q/33923
favorite count: 0
has comment: http://stackoverflow.com/comment/89985763
has comment: http://stackoverflow.com/comment/105441425
duplicate of: http://stackoverflow.com/q/33923
has comment: http://stackoverflow.com/comment/32326440
linked to: http://stackoverflow.com/q/19884997
tagged with: recursion
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21426731
tagged with: java
has body: I'm trying to get the difference between these 2 recursive strategies. The definition I was told is the following: Tail Recursion: A call is tail-recursive if nothing has to be done after the call returns i.e. when the call returns, the returned value is immediately returned from the calling function Head Recursion: A call is head-recursive when the first statement of the function is the recursive call.
has comment: http://stackoverflow.com/comment/92470509
has comment: http://stackoverflow.com/comment/32331572
downvote count: 1
has comment: http://stackoverflow.com/comment/89984879
has title: The difference between head & tail recursion
type: Question
upvote count: 46

http://stackoverflow.com/comment/32321410
score: 0
type: AnswerComment
has text: I've tried both tshark and tcpdump running on commandline, and i was able to get the the outbound http request. so the last thing I need to do is to apply some filtering on the output file and parse it using java to extract downloadable links. thanks for your help dude @user_loser
comment on: http://stackoverflow.com/a/21396922
type: Comment

http://stackoverflow.com/a/21463166
type: Answer
has comment: http://stackoverflow.com/comment/32415362
answers question: http://stackoverflow.com/q/21463105
has body: input.useLocale(Locale.UK); You need to provide the Scanner's locale. E.g. Scanner input= new Scanner(System.in).useLocale(Locale.UK);
has comment: http://stackoverflow.com/comment/32392179
score: 0

http://stackoverflow.com/q/21482339
has answer: http://stackoverflow.com/a/21482774
possible better answer: http://stackoverflow.com/a/64909880
type: Question
score: 9
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: spring-data-jpa
answer count: 3
accepted answer: http://stackoverflow.com/a/21482774
tagged with: sql
has body: Is there a way in Spring data to dynamically form the where clause? What I want to do is have a method (which is like the findBy / get method) which runs a WHERE and AND using the mentioned properties which are NOT NULL. For example, Consider the object Person [firstName, lastName, age, gender] Our method looks something like this findBy_IfNotNullFirstName_AndIfNotNullLastName_AndIfNotNullAge_AndIfNotNullGender(String firstName, String lastName, Integer age, String gender) Thanks.
has answer: http://stackoverflow.com/a/63576205
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64909880
has title: Query creation in Spring Data - dynamic where clause
upvote count: 9
tagged with: java

http://stackoverflow.com/q/21446103
tagged with: java
has body: I have a program that interprets and sorts data for a car dealer, and there is an error when trying to retrieve the color of the cars stored in an array. Here is the main class and its sub class. class Car { protected String model; protected int price; protected int year; public Car(String m, int y, int p) { model = m; price = p; year = y; } } class NewCar extends Car { protected String color; public NewCar(String m, int y, int p, String c) { super(m, y, p); color = c; } public String toString() { return "Model: " + model + "\n" + "Year: " + year + "\n" + "Price: $" + price + "\n" + "Color: " + color + "\n" + "Selling Price: " + price + "\n\n"; } } Here is another class in which the error occurs, at if(cars[z].color.equals(shade)). The program cannot find variable color in class Car. class CarDealerShip { public String printAllCarsOfColor(String shade) { String s = ""; for(int z = 0; z &lt; i; z++) { if(cars[z].color.equals(shade)) { s += "Car " + (z + 1) + "\n" + cars[z].toString(); } } return s; } How can I have the program look in class NewCar where variable color exists?
type: Question
has answer: http://stackoverflow.com/a/21446136
has answer: http://stackoverflow.com/a/21446604
has answer: http://stackoverflow.com/a/21446151
tagged with: inheritance
possible better answer: http://stackoverflow.com/a/21446136
tagged with: class
downvote count: 0
favorite count: 0
has title: Cannot find symbol. Is looking in Superclass instead of subclass
accepted answer: http://stackoverflow.com/a/21446604
has answer: http://stackoverflow.com/a/21446155
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/q/21437324
answer count: 2
has answer: http://stackoverflow.com/a/21437465
downvote count: 0
favorite count: 0
tagged with: static-methods
tagged with: thread-sleep
has answer: http://stackoverflow.com/a/21437409
type: UnansweredQuestion
has title: SCJP Threads sleep method()
upvote count: 1
has comment: http://stackoverflow.com/comment/32344673
has body: I am reading SCJP. While reading Threads , i read about sleep() method. But this phrase , i am not getting it. Please help me "Remember that sleep() is a static method, so don't be fooled into thinking that one thread can put another thread to sleep." Some methods may look like they tell another thread to block, but they don't. If you have a reference "t" to another thread, you can write something like this: t.sleep() , t.yield() But those are actually static methods of the Thread class—they don't affect the instance t; instead they are defined to always affect the thread that's currently executing
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/21364257
has body: I recently downloaded the latest facebook sdk. The step of import is: import facebook sdk Build the sdk , in the bun/res folder there is a facebooksdk.jar ~450kb Copy the jar to desktop In my project , right click properties, in the lib add the external jar and select it include in the build path The problem is after implemnt the login class like the following: &lt;com.facebook.widget.LoginButton android:id="@+id/authButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="30dp" /&gt; it can not find the class com.facebook.widget.LoginButton , how to fix it if I would like to make the facebooksdk as jar ? Thanks
has title: Why the facebook sdk is not imported
accepted answer: http://stackoverflow.com/a/21365465
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: facebook-graph-api
favorite count: 0
type: Question
tagged with: android
tagged with: facebook
has answer: http://stackoverflow.com/a/21365465
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/32245625
comment on: http://stackoverflow.com/q/21381186
score: 0
type: Comment
has text: Is your service placed in the <context:component-scan base-package="org.hibtests" /> package?
type: QuestionComment

http://stackoverflow.com/q/21461751
has body: Sorry for that unclear question, but i must admit i don't even know how to ask it. I have the following proxy @ProxyFor(value = Fiches.class, locator = FichesLocator.class) public interface FichesProxy extends ValueProxy { FichesPKProxy getId (); void setId (FichesPKProxy id); java.lang.Integer getA (); public void setA (java.lang.Integer a); ... RefProxy getRef(); } RefProxy is @ProxyFor(value = Ref.class, locator = RefLocator.class) public interface RefProxy extends ValueProxy { ... java.lang.String getCategorie (); void setCategorie (java.lang.String categorie); ... } I know how to get A for example &lt;g:IntegerBox ui:field="A" stylePrimaryName="{style.editField}" /&gt; along with a @UiField ValueBoxEditorDecorator&lt;Integer&gt; A; How do i have to do to show the getCategorie ? I can check that the Categorie is here using this , but i don't understand how to automatically show it using UiBinder. FichesRequest fr = requestFactory.createFichesRequest(); Request&lt;FichesProxy&gt; ffr = fr.fetch( xxxx ); ffr.with(fichesDriver.getPaths()); ffr.to(new Receiver&lt;FichesProxy&gt;() { @Override public void onSuccess(FichesProxy fiches) { TllogEditorWorkflow.this.fiches = fiches; FichesRequest contextf = requestFactory.createFichesRequest(); edit(contextf); log.info(references.getCategorie()); } }).fire(); Regards, Pierre
tagged with: gwt
has answer: http://stackoverflow.com/a/21532411
has title: How to use proxy items declared within a proxy (uibinder)?
tagged with: java
tagged with: requestfactory
type: Question
has comment: http://stackoverflow.com/comment/32513099
tagged with: proxy
score: 0
tagged with: uibinder
answer count: 1
type: UnansweredQuestion

maven
tags question: http://stackoverflow.com/q/21487556
tags question: http://stackoverflow.com/q/21500692
tags question: http://stackoverflow.com/q/21466716
tags question: http://stackoverflow.com/q/21468056
tags question: http://stackoverflow.com/q/21350265
tags question: http://stackoverflow.com/q/21465975
type: Tag
tags question: http://stackoverflow.com/q/21466987
tags question: http://stackoverflow.com/q/21463989
tags question: http://stackoverflow.com/q/21358548
tags question: http://stackoverflow.com/q/21415243
tags question: http://stackoverflow.com/q/21461424
tags question: http://stackoverflow.com/q/21500750
tags question: http://stackoverflow.com/q/21489537
tags question: http://stackoverflow.com/q/21420608
tags question: http://stackoverflow.com/q/21353773
tags question: http://stackoverflow.com/q/21492036
tags question: http://stackoverflow.com/q/21424855
tags question: http://stackoverflow.com/q/21404489
tags question: http://stackoverflow.com/q/21475629
tags question: http://stackoverflow.com/q/21462396
tags question: http://stackoverflow.com/q/21425012
tags question: http://stackoverflow.com/q/21418515
tags question: http://stackoverflow.com/q/21405791
tags question: http://stackoverflow.com/q/21454925
tags question: http://stackoverflow.com/q/21500081
tags question: http://stackoverflow.com/q/21390274
tags question: http://stackoverflow.com/q/21478252
tags question: http://stackoverflow.com/q/21449550
tags question: http://stackoverflow.com/q/21430906
tags question: http://stackoverflow.com/q/21356740
tags question: http://stackoverflow.com/q/21353098
tags question: http://stackoverflow.com/q/21386371
tags question: http://stackoverflow.com/q/21367795
tags question: http://stackoverflow.com/q/21461020
tags question: http://stackoverflow.com/q/21446532
tags question: http://stackoverflow.com/q/21490521
tags question: http://stackoverflow.com/q/21468425
tags question: http://stackoverflow.com/q/21454414
tags question: http://stackoverflow.com/q/21441928
tags question: http://stackoverflow.com/q/21489134
tags question: http://stackoverflow.com/q/21513384
tags question: http://stackoverflow.com/q/21354810
tags question: http://stackoverflow.com/q/21394787
tags question: http://stackoverflow.com/q/21497744
tags question: http://stackoverflow.com/q/21395299
tags question: http://stackoverflow.com/q/21464967
tags question: http://stackoverflow.com/q/21450456
tags question: http://stackoverflow.com/q/21500676
tags question: http://stackoverflow.com/q/21453141
tags question: http://stackoverflow.com/q/21435906
tags question: http://stackoverflow.com/q/21412620
tags question: http://stackoverflow.com/q/21384755
tags question: http://stackoverflow.com/q/21486707
tags question: http://stackoverflow.com/q/21452173
tags question: http://stackoverflow.com/q/21443705
tags question: http://stackoverflow.com/q/21391921
tags question: http://stackoverflow.com/q/21409774
tags question: http://stackoverflow.com/q/21364402
tags question: http://stackoverflow.com/q/21483838
tags question: http://stackoverflow.com/q/21360995
tags question: http://stackoverflow.com/q/21418107
tags question: http://stackoverflow.com/q/21382719
tags question: http://stackoverflow.com/q/21382646
tags question: http://stackoverflow.com/q/21487476
tags question: http://stackoverflow.com/q/21443263
tags question: http://stackoverflow.com/q/21398965
tags question: http://stackoverflow.com/q/21412443
tags question: http://stackoverflow.com/q/21489814
tags question: http://stackoverflow.com/q/21398391
tags question: http://stackoverflow.com/q/21404707
tags question: http://stackoverflow.com/q/21485744
tags question: http://stackoverflow.com/q/21390878
tags question: http://stackoverflow.com/q/21478367
tags question: http://stackoverflow.com/q/21452288
tags question: http://stackoverflow.com/q/21376484
tags question: http://stackoverflow.com/q/21413526
tags question: http://stackoverflow.com/q/21503750
tags question: http://stackoverflow.com/q/21372109
tags question: http://stackoverflow.com/q/21469791

string
tags question: http://stackoverflow.com/q/21373351
tags question: http://stackoverflow.com/q/21450509
tags question: http://stackoverflow.com/q/21389712
tags question: http://stackoverflow.com/q/21432911
tags question: http://stackoverflow.com/q/21380701
tags question: http://stackoverflow.com/q/21383176
tags question: http://stackoverflow.com/q/21408401
tags question: http://stackoverflow.com/q/21460800
tags question: http://stackoverflow.com/q/21480071
tags question: http://stackoverflow.com/q/21479361
tags question: http://stackoverflow.com/q/21364441
tags question: http://stackoverflow.com/q/21387669
tags question: http://stackoverflow.com/q/21437788
tags question: http://stackoverflow.com/q/21388686
tags question: http://stackoverflow.com/q/21401880
tags question: http://stackoverflow.com/q/21506587
tags question: http://stackoverflow.com/q/21364279
tags question: http://stackoverflow.com/q/21432493
tags question: http://stackoverflow.com/q/21385024
tags question: http://stackoverflow.com/q/21442078
tags question: http://stackoverflow.com/q/21357853
tags question: http://stackoverflow.com/q/21375659
tags question: http://stackoverflow.com/q/21465169
tags question: http://stackoverflow.com/q/21477732
tags question: http://stackoverflow.com/q/21373842
tags question: http://stackoverflow.com/q/21495847
tags question: http://stackoverflow.com/q/21453027
tags question: http://stackoverflow.com/q/21484247
tags question: http://stackoverflow.com/q/21505969
tags question: http://stackoverflow.com/q/21508954
tags question: http://stackoverflow.com/q/21400819
tags question: http://stackoverflow.com/q/21458672
tags question: http://stackoverflow.com/q/21484758
tags question: http://stackoverflow.com/q/21435306
tags question: http://stackoverflow.com/q/21465439
tags question: http://stackoverflow.com/q/21371871
tags question: http://stackoverflow.com/q/21438651
tags question: http://stackoverflow.com/q/21376258
tags question: http://stackoverflow.com/q/21474975
tags question: http://stackoverflow.com/q/21358915
tags question: http://stackoverflow.com/q/21483942
tags question: http://stackoverflow.com/q/21482506
tag name: string
tags question: http://stackoverflow.com/q/21375169
tags question: http://stackoverflow.com/q/21452282
tags question: http://stackoverflow.com/q/21359251
tags question: http://stackoverflow.com/q/21423088
tags question: http://stackoverflow.com/q/21447554
tags question: http://stackoverflow.com/q/21482746
tags question: http://stackoverflow.com/q/21396766
tags question: http://stackoverflow.com/q/21365759
tags question: http://stackoverflow.com/q/21505651
tags question: http://stackoverflow.com/q/21480200
tags question: http://stackoverflow.com/q/21387948
tags question: http://stackoverflow.com/q/21401167
type: Tag
tags question: http://stackoverflow.com/q/21484152
tags question: http://stackoverflow.com/q/21360610
tags question: http://stackoverflow.com/q/21395596
tags question: http://stackoverflow.com/q/21386638
tags question: http://stackoverflow.com/q/21412933
tags question: http://stackoverflow.com/q/21428213
tags question: http://stackoverflow.com/q/21405699
tags question: http://stackoverflow.com/q/21456412
tags question: http://stackoverflow.com/q/21447980
tags question: http://stackoverflow.com/q/21452189
tags question: http://stackoverflow.com/q/21395992
tags question: http://stackoverflow.com/q/21356908
tags question: http://stackoverflow.com/q/21509969
tags question: http://stackoverflow.com/q/21446764
tags question: http://stackoverflow.com/q/21411981
tags question: http://stackoverflow.com/q/21463498
tags question: http://stackoverflow.com/q/21470539
tags question: http://stackoverflow.com/q/21393995
tags question: http://stackoverflow.com/q/21502642
tags question: http://stackoverflow.com/q/21359312
tags question: http://stackoverflow.com/q/21485150
tags question: http://stackoverflow.com/q/21505339
tags question: http://stackoverflow.com/q/21466392
tags question: http://stackoverflow.com/q/21359067

http://stackoverflow.com/q/21508545
has answer: http://stackoverflow.com/a/21509746
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32471573
accepted answer: http://stackoverflow.com/a/21508561
tagged with: java
possible better answer: http://stackoverflow.com/a/21509746
has comment: http://stackoverflow.com/comment/32471439
type: Question
answer count: 2
tagged with: hashmap
has title: How to write a HashMap to a txt file?
tagged with: file-io
tagged with: android
has answer: http://stackoverflow.com/a/21508561
score: 0
has comment: http://stackoverflow.com/comment/32471448
has body: I have a HashMap containing some data that I want to write to a file and reload the contents of the file to form the same HashMap. HashMap is as follows: HashMap&lt;Long, List&lt;DataPoint&gt;&gt; hashMap = new HashMap&lt;Long, List&lt;DataPoint&gt;&gt;(); And DataPoint class is as follows: public class DataPoint { private int time; private int songId; public DataPoint(int songId, int time) { this.songId = songId; this.time = time; } public int getTime() { return time; } public int getSongId() { return songId; } } Help is much appreciated. Thanks

http://stackoverflow.com/comment/32217725
type: Comment
type: QuestionComment
has text: @PeterLawrey - I agree, but this code goes into an application server's function, and it is impossible to know if the developer will use that function or not, so I am trying to do whatever I can to make it efficient. I ended up splitting the 64-byte method into two methods of less than 35-bytes each. thank you for your insight - I upvoted all of the useful comments.
score: 0
comment on: http://stackoverflow.com/q/21357608

http://stackoverflow.com/a/21442595
has body: These numbers are humongous. Really. 5^6 = 15625. Raise 4 to that power and you'll get enough digits as there are particles in the known Universe. Your problem with 0 comes from the fact that 4 is 100 in binary. Multiply by 4 and you get 10000 in binary. Raise to a little more than that (max power 8, 16, maybe 32 if data types support it; talking in general) and you'll drop the single 1 bit you had out of the integer representation => 0.
score: 3
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21442451

http://stackoverflow.com/q/21450932
accepted answer: http://stackoverflow.com/a/21451113
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21451110
tagged with: string
favorite count: 0
tagged with: pattern-matching
upvote count: 2
has answer: http://stackoverflow.com/a/21451113
possible better answer: http://stackoverflow.com/a/21451110
has body: How to remove the multiple occurrences of words in a String? The hard thing here is, I don't know which word it is. See below examples. This is how how I tried to split a paragraph into a sentence sentence But, there is a problem My paragraph includes dates dates dates dates like Jan 13, 2014 , words includes like U S and numbers Here, some words have multiple occurrence. Words like sentence, dates, includes and how have occurred more than once. Note than this repeat may not occur near to each other, like includes. I want to remove these so it will be like below. This is how I tried to split a paragraph into a sentence But, there is a problem My paragraph includes dates like Jan 13, 2014 , words like U S and numbers Note that removing multi occurrence does not mean removing all occurrences of the multi occurred word. It will simply keep a one copy and remove the rest. Just like the above, there will be very big Strings which I have no idea about which word has occurred more than once. How can I make this happen?
has answer: http://stackoverflow.com/a/21451247
tagged with: regex
score: 2
type: AnsweredQuestion
tagged with: java
has title: Removing Multi Ocurrences of a Word
type: Question

http://stackoverflow.com/comment/32467675
type: AnswerComment
type: Comment
has text: +1 to address crypto systems are based on this problem
comment on: http://stackoverflow.com/a/21506199
score: 0

http://stackoverflow.com/q/21358723
has title: Save file in specific folder with Google Drive SDK Java
tagged with: google-drive-api
has answer: http://stackoverflow.com/a/21358853
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/14422661
has body: Since I was not allowed to ask in the relevant thread Save file in specific folder with Google Drive SDK File body = new File(); body.setTitle(fileContent.getName()); body.setMimeType("text/plain"); body.setParents(Arrays.asList(new File.ParentReference().setId(parentId)); File file = service.files().insert(body, textContent).execute(); The File. ".ParentReference()" is giving me a problem what am I missing? My current code which will not load into folder XXX HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); GoogleTokenResponse response = flow.newTokenRequest(code).setRedirectUri(REDIRECT_URI).execute(); GoogleCredential credential = new GoogleCredential().setFromTokenResponse(response); // Create a new authorized API client Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).build(); ParentReference newParent = new ParentReference(); newParent.setId("XXX"); // Insert a file File body = new File(); body.setTitle(fileID); body.setDescription(fileID); body.setMimeType("text/plain"); body.setParents(Arrays.asList(newParent)); List&lt;File&gt; files = service.files().list().setQ("mimeType = 'application/vnd.google-apps.folder'").execute().getItems(); for (File f : files) { System.out.println(f.getTitle() + ", " + f.getMimeType()); } java.io.File fileContent = new java.io.File(fileID); FileContent mediaContent = new FileContent("text/plain", fileContent); File file = service.files().insert(body, mediaContent).execute(); System.out.println("File ID: " + file.getId());
type: Question
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32476461
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21511233
has text: sorry, my mistake. I meant the method to display the previously entered data in conjunction with the entered information.
score: 0

jboss5.x
tags question: http://stackoverflow.com/q/21381459
tag name: jboss5.x
type: Tag

http://stackoverflow.com/q/21399654
score: -1
type: Question
has answer: http://stackoverflow.com/a/21399739
has body: I have data in this format testing and I need to convert this string into an equivalent java string. Can anyone suggest the process? Thank you
has comment: http://stackoverflow.com/comment/32280352
has comment: http://stackoverflow.com/comment/32278631
has comment: http://stackoverflow.com/comment/32278670
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18471500
upvote count: 0
has title: Escaped Data covertion in to java string
tagged with: java

http://stackoverflow.com/a/21453366
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21451023
has body: On your Action Performed: @Override public void actionPerformed(ActionEvent ae) { Object obj = ae.getSource(); if(obj == btnPlayButton){ //Play Your Video } if(obj == btnPauseVideo){ //PAuse your Video } }

http://stackoverflow.com/comment/32465674
type: Comment
comment on: http://stackoverflow.com/q/21505169
type: QuestionComment
score: 0
has text: What is your activities layout? Where do you attach your LinearLayout ll, to another layout?

http://stackoverflow.com/a/21389029
has comment: http://stackoverflow.com/comment/32260194
answers question: http://stackoverflow.com/q/21388925
has comment: http://stackoverflow.com/comment/32260282
has comment: http://stackoverflow.com/comment/32260518
has comment: http://stackoverflow.com/comment/32261618
upvote count: 2
has comment: http://stackoverflow.com/comment/32260008
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32260580
type: Answer
has body: At the end of json array, {"curso":"2","clase":"B","asignatura":"Matem\u00e1ticas"} when your i is the last element, you'll get an error, you should check it before reading. your condition should be like for(int i= 0; i&lt;arrayJson.length() -1 ;i++){
score: 2
has comment: http://stackoverflow.com/comment/32260939
has comment: http://stackoverflow.com/comment/32259909
accepted answer of: http://stackoverflow.com/q/21388925

http://stackoverflow.com/comment/102873730
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21417995
has text: I'm not too familiar with OpenCV (yet) but wouldn't the logic behind this assume the video length to be 100 frames, or roughly 3.3 seconds of a 30fps video? Perhaps calculating the length of the video and frame rate dynamically could help you figure out when to set "hasNextFrame" to false to break the loop, instead of a hard-coded example
type: AnswerComment

http://stackoverflow.com/q/21513256
has body: I'm displaying a pie chart with data taken from the database. The database query has WHERE clause the year chosen by a Spinner. At the opening of Fragment everything works fine, but if you do not change year by Spinner method is called grafico(anno). I tried with onResume () but it does not work, you have some suggestions? thanks private void grafico(String anno){ // Pie Chart Section Names String[] code = new String[] {"A", "B"}; // Color of each Pie Chart Sections int[] colors = { Color.rgb(153,204,0), Color.rgb(255,68,68)}; SQLiteDatabase db = new ResgistroSpeseHelper(getActivity()).getReadableDatabase(); String sql = "SELECT SUM(a), SUM(b) FROM table WHERE data LIKE '"+anno+"%'"; Cursor c = db.rawQuery(sql, null); while (c.moveToNext()){ double a_ = c.getDouble(0); double b_ = c.getDouble(1); double somma = b_ + a_; double perc_1 = (a_ / somma) * 100; double perc_2 = (b_ / somma) * 100; // Pie Chart Section Value double[] distribution = { perc_2, perc_1 } ; // Instantiating CategorySeries to plot Pie Chart CategorySeries distributionSeries = new CategorySeries(" Android version distribution as on October 1, 2012"); for( int i=0 ; i &lt; distribution.length; i++){ // Adding a slice with its values and name to the Pie Chart distributionSeries.add(code[i], distribution[i]); //distributionSeries.add(perc_entrate); } // Instantiating a renderer for the Pie Chart DefaultRenderer defaultRenderer = new DefaultRenderer(); for(int i = 0 ;i&lt;distribution.length;i++){ SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer(); seriesRenderer.setColor(colors[i]); seriesRenderer.setDisplayChartValues(true); // Adding a renderer for a slice defaultRenderer.addSeriesRenderer(seriesRenderer); } defaultRenderer.setLabelsTextSize (12); defaultRenderer.setLegendTextSize(22); defaultRenderer.setZoomButtonsVisible(true); // Getting PieChartView to add to the custom layout mChartView = ChartFactory.getPieChartView(getActivity(),distributionSeries, defaultRenderer); // Getting …
has comment: http://stackoverflow.com/comment/32481516
has comment: http://stackoverflow.com/comment/32481640
has comment: http://stackoverflow.com/comment/32480914
tagged with: android
tagged with: fragment
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/32481260
tagged with: java
has comment: http://stackoverflow.com/comment/32481062
has comment: http://stackoverflow.com/comment/32486424
type: Question
has comment: http://stackoverflow.com/comment/32480680
has comment: http://stackoverflow.com/comment/32481975
tagged with: sqlite
has title: Android onResume() aChartengine Pie Chart

http://stackoverflow.com/comment/32538041
type: AnswerComment
type: Comment
has text: what you mean by second solution ?
comment on: http://stackoverflow.com/a/21509970
score: 0

http://stackoverflow.com/a/21427000
has body: I thought that objects only exist in the scope that they've been defined. This is a wrong assumption. Objects exists until there's no more references to them (or until it is garbage collected, depending on your view). You can store references to your objects other places than where they are defined, and make them live as long as you desire. Threads are somewhat special, the JVM will keep track of a thread and it will continue to run until its run() method ends, even if your code contains no references to the Thread object.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21426888
downvote count: 0
has comment: http://stackoverflow.com/comment/32327093
type: Answer
has comment: http://stackoverflow.com/comment/32326714
upvote count: 6
answers question: http://stackoverflow.com/q/21426888
has comment: http://stackoverflow.com/comment/32327567
score: 6

http://stackoverflow.com/comment/32284119
comment on: http://stackoverflow.com/a/21390647
has text: I tried this one, but result is the same. Can you suggest any tool for generating `xsd` from xml file? I tried one - trang, but it looks too difficult for human understanding.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32455802
type: QuestionComment
type: Comment
has text: @commonsware: you may be right, I would have never though about searching for "composition". However I don't quite understand why my example is a composition? Isn't that when I use a class member instead of a subclass? The whole event-handler-design seems to me to be not composition (as it is used in the link you provided), but something else. But I may be wrong.
comment on: http://stackoverflow.com/q/21498822
score: 0

http://stackoverflow.com/q/21400016
has body: My question is which is faster: Copying a heap ByteBuffer to a direct ByteBuffer OR coping a direct ByteBuffer to a direct ByteBuffer. From what I can tell the direct to direct approach will use the Unsafe.copyMemory otherwise if a heap array exists it will use the Bits.copyFromByteArray method, following that a while loop extracting each byte from the heap ByteBuffer to the direct ByteBuffer will be used. I assuming that the Unsafe.copyMemory will be faster, since this seems to be done outside the JVM, but I am not sure. Has any one benchmarked the three different approaches? Thanks!
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: performance
has comment: http://stackoverflow.com/comment/32283670
tagged with: java
has comment: http://stackoverflow.com/comment/32279275
type: Question
has title: Java performance ByteBuffer copying from heap to direct or direct to direct
downvote count: 0
tagged with: bytebuffer

http://stackoverflow.com/comment/32365195
type: AnswerComment
comment on: http://stackoverflow.com/a/21448062
type: Comment
has text: @AZ_ The [javadoc for 1.6 `Formatter`](http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html) says the same thing.
score: 0

http://stackoverflow.com/q/21405536
possible better answer: http://stackoverflow.com/a/48441412
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21524355
accepted answer: http://stackoverflow.com/a/21524355
tagged with: java
has title: crawl https pages with crawler4j
tagged with: crawler4j
tagged with: https
type: Question
has answer: http://stackoverflow.com/a/48441412
tagged with: ssl
has body: For months now we used crawler4j to crawl a https site. Suddenly, since last friday, we're not able to crawl the very same https site. Has something changed in the https-protocol? The site is https://enot.publicprocurement.be/enot-war/home.do As a test, just try to grab the title: Welkom op het platform e-Notification Any help is much appreciated.
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/46486895

http://stackoverflow.com/a/21416719
has comment: http://stackoverflow.com/comment/32323606
downvote count: 0
has comment: http://stackoverflow.com/comment/32348460
has comment: http://stackoverflow.com/comment/32309079
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/32316563
has comment: http://stackoverflow.com/comment/32323644
has comment: http://stackoverflow.com/comment/32316727
has comment: http://stackoverflow.com/comment/32319973
has body: The absolute easiest way is with Integer.parseInt(String, 2); (in your case: Integer.parseInt(binaryString, 2);). However, if you really want to run the loop: for(int n = binaryLength; n &gt;= 1; n--){ int digit = binaryString.charAt(n - 1) - '0'; denaryValue = denaryValue + digit * multiplier; multiplier = multiplier * 2; } Personally, I'd do this if I really wanted to reinvent the wheel: if (!binaryString.matches("[01]+")) { //here we know that there is a character that is not a 0 or a 1 //or that the string is empty } for(char c : binaryString.toCharArray()) { denaryValue += c - '0'; denaryValue &lt;&lt;= 1; //binary left shift; multiply by 2 } denaryValue &gt;&gt;= 1; //binary right shift; divide by 2
upvote count: 3
has comment: http://stackoverflow.com/comment/32323822
answers question: http://stackoverflow.com/q/21416637

http://stackoverflow.com/comment/32456012
comment on: http://stackoverflow.com/a/21494873
has text: @Ishtar I see what you mean. Corrected. Thanks.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25831351
downvote count: 1
answers question: http://stackoverflow.com/q/21498910
score: -1
upvote count: 0
type: Answer
has body: You must add this method in your code public void cleanup() { if (mp != null &amp;&amp; mp.isPlaying()) { mp.stop(); mp.release(); mp = null; } } and call this method in both button listener before MediaPlayer.create(MainActivity.this, audios[currentAudio]);

http://stackoverflow.com/comment/32244288
has text: Come on ... You start your XML with the root element "languages-list" but then you refer to "language-list" in your XSLT ?!
score: 5
comment on: http://stackoverflow.com/q/21380560
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21511882
has comment: http://stackoverflow.com/comment/32477362
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21512031
has comment: http://stackoverflow.com/comment/32477477
has answer: http://stackoverflow.com/a/21511988
accepted answer: http://stackoverflow.com/a/21511988
has body: So I have this hashmap with key as String and holds values as an integer array. HashMap&lt;String, Integer[]&gt; h = new HashMap&lt;String, Integer[]&gt;(); h.put("PID", new Integer[] {3, 5}); I was trying int first, but then I read somewhere that primitive types can't be used in generics. So, Eclipse says Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error on tokens, ConstructorHeaderName expected instead - Syntax error on tokens, delete these tokens for the second line. First line is fine for it.
has comment: http://stackoverflow.com/comment/32477417
has title: Java: HashMap behaving in an unexpected manner
has comment: http://stackoverflow.com/comment/32477347
has answer: http://stackoverflow.com/a/21512031
has comment: http://stackoverflow.com/comment/32477436
has comment: http://stackoverflow.com/comment/32477613
has comment: http://stackoverflow.com/comment/32477539
type: AnsweredQuestion
tagged with: hashmap
has comment: http://stackoverflow.com/comment/32477604
tagged with: java
has comment: http://stackoverflow.com/comment/32477528
has comment: http://stackoverflow.com/comment/32477350

http://stackoverflow.com/comment/32395894
comment on: http://stackoverflow.com/q/21465663
type: Comment
type: QuestionComment
score: 0
has text: Ask questions to to those who answered your previous exact question (a couple hours ago) if you don't understand something. Don't ask the exact question again. You previous question probably lacked clarity or effort on your part to get a precise answer, just as this question does. You could always edit your question with some updated information or more questions, if all you wanted was a bump.

http://stackoverflow.com/comment/32355854
type: QuestionComment
score: 0
has text: @John, the only way to solve with Math is by finding a similar representation such as `2^(3^(2^31250)))`. If that is what you mean then we can come to a understanding. Proposing someone to use bit shifting operations to solve a problem with giant numbers is not the way to go (I mean, as a Interviewer I would be happy with a proof that it can't be calculated anytime soon and would certainly discard someone that wrote a "correct" but unfeasible algorithm).
comment on: http://stackoverflow.com/q/21442451
type: Comment

http://stackoverflow.com/a/21412548
type: Answer
has comment: http://stackoverflow.com/comment/32309288
has body: You never call the checkFermat function from main. The only code that is executed in a Java program is the code inside of main. Any other methods that you define are only executed if they are called from within main. Therefore, your code should read: import java.lang.Math; public class Exercise { public static void checkFermat(int a, int b, int c, int n){ if ((Math.pow(a, n))+(Math.pow(b, n))==(Math.pow(c, n)) &amp;&amp; n!=2){ System.out.println("Holy smokes, Fermat was wrong!"); } else{ System.out.println("No, why would that work?"); } } public static void main(String args[]){ int a = 8; int b = 4; int c = 10; int n = 3; checkFermat(a, b, c, n); //call the method here } } Also, your local variables a, b, c, and n are not automatically applied to the function. You must pass them as arguments explicitly. Note the a, b, c, and n variables inside of main are completely separate from the a, b, c, and n in checkFermat: they are separate variables because they are declared in separate functions.
score: 8
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/21412534

http://stackoverflow.com/q/21351303
score: 1
tagged with: java
tagged with: image
tagged with: mouseevent
type: Question
has title: How can I repaint image after clicking it?
tagged with: random
downvote count: 0
favorite count: 0
tagged with: repaint
answer count: 0
has body: I'm working on a game in which you have to click an object, if you clicked right you get 1 score and so on. If you miss clicked the object you get -1 score. Now I would like to repaint the image after clicking it, It now just goes on when clicked, only the score changes. This is my code: (Note: I left the imports out, because than it will be a mess in the OP) public class Gamevenster extends JPanel implements Runnable { public String Gamestatus = "active"; private Thread thread; //public Main game; public int random(int min, int max) { int range = (max - min) + 1; return (int)(Math.random() * range) + min; } public class TestComponent extends JComponent implements MouseListener { /** * */ private static final long serialVersionUID = 1L; public TestComponent() { this.addMouseListener(this); } @Override public void mouseClicked(MouseEvent e) { int clickedX = e.getX(); int clickedY = e.getY(); System.out.println("User Clicked: " + clickedX + ", " + clickedY); } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} } Random rand = new Random(); private int x = 0; private int y = 0; Timer timer = new Timer(850, new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { x = rand.nextInt(400); y = rand.nextInt(330); repaint(); } }); public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(achtergrond, 0, 0, this.getWidth(), this.getHeight(), null); //g.drawImage(muisje, 10, 10, null); g.drawImage(muisje, x, y, 100, 100, this); } private static final long serialVersionUID = 1L; private JLabel scoreLabel = new JLabel("SCORE: " + "0"); private int score = 0; Image achtergrond, muisje; //JTextField invoer; JButton raden; JButton menu; JButton restartBtn; Gamevenster() { // CONSTRUCTOR timer.start(); setLayout(null); scoreLabel.setFont(new Font("Open Sans", Font.PLAIN, 30)); scoreLabel.se…
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/32258751
type: QuestionComment
has text: _"Where should I start?"_ - start by typing some code into your favorite IDE. Then come back here if you get stuck.
score: 4
comment on: http://stackoverflow.com/q/21388255
type: Comment

http://stackoverflow.com/comment/32318431
type: QuestionComment
comment on: http://stackoverflow.com/q/21422294
has text: that looks like a a button in action bar
score: 0
type: Comment

http://stackoverflow.com/a/21473384
has body: @Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface XmlTransient As you can see annotation @XmlTransient only can be applied in FIELDs or METHODS. It is what the API said. This annotation avoid that a specific member variable will be written in the representation of the object in XML. http://docs.oracle.com/javaee/5/api/javax/xml/bind/annotation/XmlTransient.html
type: Answer
answers question: http://stackoverflow.com/q/21473275
score: 0

http://stackoverflow.com/comment/32299187
type: AnswerComment
score: 0
type: Comment
has text: allright, `long` then. But still this will significantly reduce memory: a `long` is `8` bytes, but a string is `10*2=20 bytes`.
comment on: http://stackoverflow.com/a/21411295

http://stackoverflow.com/q/21351767
has answer: http://stackoverflow.com/a/21352312
possible better answer: http://stackoverflow.com/a/21351833
type: Question
score: 0
has title: How to check if certain digits exist in a string
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/21352433
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21351833
tagged with: regex
accepted answer: http://stackoverflow.com/a/21352433
has body: I want to check if the three digits 1,3,5 exists in a string ... or 2,7,9 for example: string 18637775 is accepted string 25553373349 is accepted string 123 is rejected string 5631 is accepted so how can i write this in regex form! I got this: \\d*1+\\d*3+\\d*5+\\d* ... but doesn't this mean that string 5631 wouldn't be accepted .. how to make 1,3,5 be accepted for their presence and not the order they appear in.
has comment: http://stackoverflow.com/comment/32193242

http://stackoverflow.com/comment/32288766
comment on: http://stackoverflow.com/a/21405431
type: AnswerComment
type: Comment
has text: Correction it is working now. Thank you for your help!
score: 1

http://stackoverflow.com/q/21370392
has comment: http://stackoverflow.com/comment/32226397
score: 0
has comment: http://stackoverflow.com/comment/32226422
has title: Java client/server application - how to get the input type from the server side?
tagged with: outputstream
accepted answer: http://stackoverflow.com/a/21370489
type: AnsweredQuestion
tagged with: java
tagged with: inputstream
type: Question
tagged with: client-server
has comment: http://stackoverflow.com/comment/32226365
answer count: 1
has body: I am currently working on a simple client/server application that takes in a single input from the command line. Valid inputs are either an integer or an 'r'. If an integer is inputted, the server is supposed to add and output the value of that integer to all previous integer inputs. If an 'r' is inputted, the server is supposed to reset the output value to 0. On the client side, I got the following code to pass the different input types to the server: if (args[0].equalsIgnoreCase("r")) { out.write("reset".getBytes()); } else { out.write(i); //i is an integer that was converted from args[0] using Integer.parseInt() } However, on the server side, I would like to determine the type of input that it gets from the client. Specifically, is there any way to make the server check if it is receiving an integer or a byte array from the client?
has answer: http://stackoverflow.com/a/21370489
has comment: http://stackoverflow.com/comment/32226465

http://stackoverflow.com/q/21387409
has answer: http://stackoverflow.com/a/21387473
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32256879
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21387549
has title: How can I end a program during a try catch statement in Java?
has answer: http://stackoverflow.com/a/21387464
has answer: http://stackoverflow.com/a/21387454
answer count: 6
score: -1
has answer: http://stackoverflow.com/a/21387458
has comment: http://stackoverflow.com/comment/32257523
has comment: http://stackoverflow.com/comment/32256991
upvote count: 2
downvote count: 3
has body: I already asked a question about how to have a message pop up and say "please enter a number input" but it was supposed to end the program. Not crash it, but end the program then you would have to rerun it. ` try { number = in.nextInt(); if(number &gt;= 8) { number = 8; } else if (number &lt;= 0) { number = 0; } } catch (InputMismatchException exc) { System.out.println("Program requires NUMBER input"); } ` I tried doing a "break;" in the catch (experimented I guess) and it didn't work. UPDATE: Thanks everyone, I tried return in a previous project and it didn't work. But it worked here so thank you again!!
has answer: http://stackoverflow.com/a/21387462
has comment: http://stackoverflow.com/comment/32256887
linked to: http://stackoverflow.com/q/744676
favorite count: 0

http://stackoverflow.com/comment/32297315
has text: No, I did not check that possibility. I guess that could be another way.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21406757
type: Comment

http://stackoverflow.com/q/21386574
type: UnansweredQuestion
has body: We want to scale horizontally by pushing data to different database based on user groups. This is required since data would be huge. Right now we are looking at RDBMS only. Spring and hibernate/Eclipse-link is what options we have. I have few questions around it and I see similar questions have been asked multiple times. I am asking this again since I want to understand few more specifics. What are the best practices one should follow when using multiple databases?(Detailed questions below) Multiple session factories or single session factory? What is the recommended approach? I see lot of posts talking about creating multiple session factories and dynamic data source implementation uses single session factory and provides different data source based on user group. Any scalability issues using single session factory having many user groups? All sessions are tied to session factories or the underlying data source? I am assuming that multiple connection pools would be created based on each db am I right? Dynamic data source implementation of spring to handle multiple databases or Hibernate multi-tenancy? Are their any issues with Transaction mgmt when it comes to using dynamic data source? I didn't see any posts except for 2nd level cache. If used c3P0 for connection pooling how its handled in the case of dynamic data source approach? Any Dos and donts for above approaches?
has title: Handling muliple database using spring and hibernate
tagged with: java
tagged with: hibernate
type: Question
tagged with: session
has answer: http://stackoverflow.com/a/21386893
score: 0
answer count: 1
tagged with: multi-tenant

inputstream
tags question: http://stackoverflow.com/q/21370392
tags question: http://stackoverflow.com/q/21369365
tags question: http://stackoverflow.com/q/21392909
tag name: inputstream
type: Tag
tags question: http://stackoverflow.com/q/21385513
tags question: http://stackoverflow.com/q/21365046
tags question: http://stackoverflow.com/q/21360480

http://stackoverflow.com/a/21537344
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21492326
has body: The defect was in the bottom of the #sendRequest() method. It was ignoring the Builder object returned and re-using the WebTarget to create a new request (which creates a new builder. The last three lines of code in that method should have been: return builder.buildDelete().invoke(); } // default to HttpMethod.GET return builder.buildGet().invoke();

http://stackoverflow.com/comment/32318397
type: AnswerComment
score: 0
type: Comment
has text: @KerPPag Are you trying to do POST-REDIRECT-GET-REDIRECT-GET? No, then don't redirect in your GET.
comment on: http://stackoverflow.com/a/21422287

http://stackoverflow.com/q/21460079
answer count: 1
accepted answer: http://stackoverflow.com/a/21463677
has title: Call Java (ImageJ plugin BoneJ) from a Jython script
type: AnsweredQuestion
tagged with: java
type: Question
has body: **Sorry, I am very new to both python and java so I might not recognize that this has been answered and only needs adjusted for my situation. Essentially I have a script manager that operates in a python environment and I need to pass data off to the bonej plugin for analysis, which should then return an array that will then be used by another python script for further analysis. I have been directed to jython as a way to do this, but I can't figure out how to import imageJ as if it were a module. I know that I can simply open imagej from a command line and direct it to analyze an image, but this is not what I need because it simply returns an average in a segment of bone. Basically I need to tell imagej that it should analyze this segment of bone, return the array, then this next segment of bone. An additional python script interpolates the arrays onto a predefined background grid. If anyone has some insight on how to achieve this back and fort from jython I would appreciate it.
tagged with: jython
tagged with: imagej
linked to: http://stackoverflow.com/q/10579824
linked to: http://stackoverflow.com/q/537682
has answer: http://stackoverflow.com/a/21463677
score: 0

http://stackoverflow.com/q/21410683
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/21410744
possible better answer: http://stackoverflow.com/a/21410759
score: 55
upvote count: 57
has answer: http://stackoverflow.com/a/21410806
has answer: http://stackoverflow.com/a/21410759
favorite count: 0
has answer: http://stackoverflow.com/a/21410777
answer count: 5
has title: Boolean.getBoolean("true") returns false
has answer: http://stackoverflow.com/a/62318181
has comment: http://stackoverflow.com/comment/32300996
has body: I'm trying to make function that reads ini file. Why Boolean.getBoolean("true") returns false? How to use this conversation in correct way in java 1.4? Does it depends on system settings?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21410744
tagged with: java

http://stackoverflow.com/q/21483153
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/8974350
has title: How to cast java.lang.reflect.Type to enum?
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/8974350
favorite count: 0
has comment: http://stackoverflow.com/comment/32426062
has answer: http://stackoverflow.com/a/21483441
accepted answer: http://stackoverflow.com/a/21483441
downvote count: 0
has body: I have fairly simple problem. I have a variable of type java.lang.reflect.Type and I want to do two different things to it in case its holds class or enumeration. I can fairly simple check if the varaible is enum by simply asking .isEnum(). However to call the specific enumeration methods I need to cast this variable to be enumeration. Here is some code for illustration. I know it does not make much of a sence, but its just for the cast illustration: public class TestClass { public static String text = "MySampleTextClass."; } public enum TestEnum { MySampleText } public class Tester { public static Object retrieveValue (java.lang.reflect.Type myVar, String enumStringValue) { String enumStringValue = "MySampleText"; // the variable is enum!!! if (myVar.isEnum()) { return (Enum myVar).valueOf(enumStringValue); } // the variable is class!!! else { return myVar.getClass().getSimpleName(); } } } I tried casts like (java.lang.Enum myVar).valueOf(enumString); or (java.lang.Enum&lt;?&gt; myVar).valueOf(enumString); but I can't make it work. Any ideas?
type: Question
type: AnsweredQuestion
tagged with: enums
tagged with: reflection

fieldtype
tags question: http://stackoverflow.com/q/21379712
type: Tag
tag name: fieldtype

http://stackoverflow.com/comment/32475129
type: QuestionComment
comment on: http://stackoverflow.com/q/21510453
has text: Is `Text` a mutable class (so the `hashCode()` might produce different results and therefore store a new key/value pair into the map)? If so, you should replace it with an immutable one as [mutable keys shouldn't be used for keys](http://stackoverflow.com/questions/7842049/are-mutable-hashmap-keys-a-dangerous-practice). Probably all you have to do is to override `hashCode()`, `equals(Object)` and maybe `toString()` of `Text`
score: 0
type: Comment

oracle-database
tags question: http://stackoverflow.com/q/21418275
tags question: http://stackoverflow.com/q/21485466
tags question: http://stackoverflow.com/q/21411944
tags question: http://stackoverflow.com/q/21366438
tag name: oracle-database
tags question: http://stackoverflow.com/q/21478666
tags question: http://stackoverflow.com/q/21381820
tags question: http://stackoverflow.com/q/21512480
type: Tag
tags question: http://stackoverflow.com/q/21513126
tags question: http://stackoverflow.com/q/21408640
tags question: http://stackoverflow.com/q/21458900
tags question: http://stackoverflow.com/q/21460074
tags question: http://stackoverflow.com/q/21409916
tags question: http://stackoverflow.com/q/21396765
tags question: http://stackoverflow.com/q/21426128
tags question: http://stackoverflow.com/q/21442442
tags question: http://stackoverflow.com/q/21485461
tags question: http://stackoverflow.com/q/21378414
tags question: http://stackoverflow.com/q/21485325
tags question: http://stackoverflow.com/q/21433706
tags question: http://stackoverflow.com/q/21438351
tags question: http://stackoverflow.com/q/21416375
tags question: http://stackoverflow.com/q/21451388
tags question: http://stackoverflow.com/q/21375208
tags question: http://stackoverflow.com/q/21474211
tags question: http://stackoverflow.com/q/21510372
tags question: http://stackoverflow.com/q/21451601
tags question: http://stackoverflow.com/q/21452804
tags question: http://stackoverflow.com/q/21477954
tags question: http://stackoverflow.com/q/21510353
tags question: http://stackoverflow.com/q/21481742
tags question: http://stackoverflow.com/q/21464328
tags question: http://stackoverflow.com/q/21490154

http://stackoverflow.com/a/21486604
has comment: http://stackoverflow.com/comment/32541890
has body: Spring will be checking the security roles and throwing an exception before executing the handler. You would normally be able to catch this exception in the client onFailure() method of the Request but the exception thrown may not be serialisable or most likely not available to the GWT client side code and cannot be serialised - leading to the error. It looks like you are using the gwt-dispatch library? I haven't used this for some time but you can override the SpringSecureDispatchServlet and add your own implementation of the doUnexpectedFailure(Throwable e) method. In there you could check the exception to see if it is a Spring security exception and instead of calling RPCServletUtils.writeResponseForUnexpectedFailure(...) that returns a status code of 500 implement your own that returns a more suitable error code (401, or 403).
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32541259
type: Answer
accepted answer of: http://stackoverflow.com/q/21473970
upvote count: 1
answers question: http://stackoverflow.com/q/21473970
has comment: http://stackoverflow.com/comment/32539519
has comment: http://stackoverflow.com/comment/32540850
type: AcceptedAnswer

http://stackoverflow.com/comment/32477396
has text: I understand that and I wouldn't spend a lot of time and just a basic compilation error. When I don't have the quotes it says the table doesn't exist so I thought maybe it might have to do with the integration with a different database because I have tried the same example with a different database and it worked. And I have looked over my database table to make sure I did not use quotes in creating the table or any of the fields so I don't understand why the code cannot recognize the name without the quotes
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21511392
type: AnswerComment

http://stackoverflow.com/comment/56074039
type: Comment
score: 3
has text: and where is the code responsible for certificate creation ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21411130

http://stackoverflow.com/a/21475049
type: Answer
has body: Your arraylist must be of type Rectangle to be able to do this. ArrayList&lt;Rectangle&gt; name = new ArrayList&lt;Rectangle&gt;()
score: 0
answers question: http://stackoverflow.com/q/21475002

http://stackoverflow.com/comment/32393506
score: 2
comment on: http://stackoverflow.com/a/21464757
type: AnswerComment
type: Comment
has text: That's largely irrelevant when the program runs as both the class and the png will be on the classpath.

http://stackoverflow.com/comment/32212735
comment on: http://stackoverflow.com/q/21363051
type: Comment
score: 0
has text: Try `java -jar myfile.jar`
type: QuestionComment

http://stackoverflow.com/q/21485261
has title: How to turn off code coverage in SonarQube 4?
type: Question
has body: How to turn off code coverage in SonarQube 4? I have JMockit usage in unit tests and JaCoCo code coverage plugin in Sonar. They conflict because they use different javaagents to edit bytecode of classes (as I know). I want to switch off code coverage in Sonar. I can exclude my project in settings of Jacoco, but it doesn't help.
tagged with: java
tagged with: jacoco
tagged with: sonarqube
score: 2
downvote count: 0
answer count: 1
tagged with: jmockit
favorite count: 0
has answer: http://stackoverflow.com/a/23991343
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/32506923
comment on: http://stackoverflow.com/a/21517446
score: 0
type: Comment
has text: I'd prefer not to go the embedded route. Do you have a link to some examples of server extensions in SDN?
type: AnswerComment

http://stackoverflow.com/a/21400663
has comment: http://stackoverflow.com/comment/32288028
answers question: http://stackoverflow.com/q/21400479
has comment: http://stackoverflow.com/comment/32280973
upvote count: 2
has comment: http://stackoverflow.com/comment/32298471
has comment: http://stackoverflow.com/comment/32295684
has comment: http://stackoverflow.com/comment/32280659
type: Answer
has comment: http://stackoverflow.com/comment/32290634
score: 2
has comment: http://stackoverflow.com/comment/32296358
downvote count: 0
has body: to check if java is 64-bit: java -version 2&gt;&amp;1|find /i "64-Bit" &amp;&amp; echo YEP!||echo NOPE! To get free memory : wmic os get freephysicalmemory or: systeminfo | find "Physical Memory" EDIT Universal and fast way to get free memory: mshta "javascript:close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(GetObject('winmgmts:').ExecQuery('Select * from Win32_PerfFormattedData_PerfOS_Memory').ItemIndex(0).AvailableBytes));"|more assign result to variable: for /f "usebackq" %%a in (`mshta ^"javascript^:close^(new ActiveXObject^(^'Scripting.FileSystemObject^'^).GetStandardStream^(1^).Write^(GetObject^(^'winmgmts:^'^).ExecQuery^(^'Select * from Win32_PerfFormattedData_PerfOS_Memory^'^).ItemIndex^(0^).AvailableBytes^)^);^"^|more`) do set free_mem=%%a
has comment: http://stackoverflow.com/comment/32289268

http://stackoverflow.com/comment/32349457
has text: @user3250237: exactly, and temp is always 0.
comment on: http://stackoverflow.com/q/21439889
score: 0
type: Comment
type: QuestionComment

android-edittext
tags question: http://stackoverflow.com/q/21369629
tags question: http://stackoverflow.com/q/21419960
tags question: http://stackoverflow.com/q/21420264
tags question: http://stackoverflow.com/q/21358915
tags question: http://stackoverflow.com/q/21371413
type: Tag
tags question: http://stackoverflow.com/q/21500956
tag name: android-edittext

http://stackoverflow.com/comment/32472584
type: AnswerComment
type: Comment
has text: Doesn't work. In addition, I use the same `.classpath` as you see in the post in a dummy project I set up called `MainProject2`, which has only the `Hello World` program. In this project, the program will compile and run perfectly well. It is only in my big project that it doesn't work. Note that all other settings seem to be the same in this second project as well.
comment on: http://stackoverflow.com/a/21509137
score: 0

http://stackoverflow.com/comment/32363329
score: 2
has text: Could you use `Double.parse(String)` is would that be cheating?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21447308

http://stackoverflow.com/comment/32210115
comment on: http://stackoverflow.com/a/21361617
has text: Sorry, the file path is "C:\\\\Personal\\test.xlsx"
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32221604
type: QuestionComment
has text: When I run my jar I get D:\>java -jar C:\Users\MAG\git\StrangeCtrl\strangectrl\target\strangectrl-1.1-alpha.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21367795

http://stackoverflow.com/comment/32310856
score: 0
comment on: http://stackoverflow.com/a/21417202
type: Comment
type: AnswerComment
has text: So under the current configuration I have, when should the loadParams method be called?

http://stackoverflow.com/comment/32354231
score: 0
type: QuestionComment
type: Comment
has text: you do understand what perspective projection is, do you?
comment on: http://stackoverflow.com/q/21442242

http://stackoverflow.com/a/21495978
type: Answer
has body: The trick is to use andReturn() MvcResult result = springMvc.perform(MockMvcRequestBuilders .get("/jobsdetails/2").accept(MediaType.APPLICATION_JSON)).andReturn(); String content = result.getResponse().getContentAsString();
score: 74
upvote count: 74
downvote count: 0
answers question: http://stackoverflow.com/q/21495296

http://stackoverflow.com/q/21470707
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21473976
type: UnansweredQuestion
has body: I am planing to Maven develop a module that actually needs to read configuration data something like below, where tag will be repeated multiple times with different path name and can be same and different URL and parameters and then attempt to access those URLs and paths in Java classes. In Java I should be able to read all tags and its parameters for given type. then I will process them in Java one by one. What is best way to configure this data and read in Java? Should it be normal properties file loading process by Java or there is any new best practice using spring or any other utility. Basically I want to know is there any way of configuring data other than in this XML format and then parsing it? Since the data is static in that XML, my client don't want to use database. mypath httpfile http://acdsds:8380/gis/ sad spwd 100 DROD_MEF.gif
tagged with: spring
has answer: http://stackoverflow.com/a/21471978
tagged with: java
has answer: http://stackoverflow.com/a/21473762
type: Question
has comment: http://stackoverflow.com/comment/32406986
linked to: http://stackoverflow.com/q/8233542
has title: How to configure properties in XML?

http://stackoverflow.com/comment/32365895
comment on: http://stackoverflow.com/a/21448734
score: 0
type: AnswerComment
has text: @JonSkeet That makes sense. I feel foolish for forgetting counting starts at 0. Thanks.
type: Comment

http://stackoverflow.com/comment/32336901
comment on: http://stackoverflow.com/a/21431987
score: 0
type: AnswerComment
type: Comment
has text: Hi Thanks for replying. This is a good solution. But I prefer a more general solution, like not using "Good 'X" in the regex.

http://stackoverflow.com/a/21488855
score: 0
answers question: http://stackoverflow.com/q/21488724
has comment: http://stackoverflow.com/comment/32440637
type: Answer
has body: You have only defined a form-login module. I believe that you also need to specify http-basic. For example: &lt;sec:http-basic /&gt;
has comment: http://stackoverflow.com/comment/32436703

http://stackoverflow.com/comment/32415304
type: AnswerComment
has text: It doesn't save much indeed, but it is a lot cleaner. When you select a count, it is a safe assumption there is one row.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21476846

http://stackoverflow.com/q/21433854
score: 1
favorite count: 0
tagged with: resultset
type: Question
has answer: http://stackoverflow.com/a/21434242
upvote count: 1
answer count: 1
has title: Multiple Resultsets to excel file in Java
tagged with: export-to-excel
tagged with: java
type: UnansweredQuestion
has body: I have a question about Resultsets to Excel file in Java. Let me explain scenario; I have many sql queries and many resultsets under different classes. This resultset returns; Example1 50 20 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package program; import java.sql.*; /** * * @author Lacrymae_Ev */ public class SQLQueries1{ loginscreen logindetails = new loginscreen(); private static Statement stmt; private static final String query = "select 'Example1' as Example1,sum(dur) as dur,sum(tot)as tot from table1 with(nolock)\n" + "where date between '2013-07-01 00:00:00.000' and '2013-07-01 23:59:59.999'"; /** * @param args the command line arguments * @throws java.sql.SQLException */ public static void main(String[] args) throws SQLException { // TODO code application logic here try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://192.168.200.10;" + "databaseName=ExampleDB;" + "user=exampleuser;" + "password=examplepassword;"; Connection con = DriverManager.getConnection(connectionUrl); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String Example1 = rs.getString("Example1"); int dur = rs.getInt("dur"); int tot = rs.getInt("tot"); System.out.println(Example1 + "\t" + dur + "\t" + tot); } } catch (SQLException e) { System.out.println("Wrong id or password!"); } catch (ClassNotFoundException cE) { System.out.println("Class Not Found Exception: "+ cE.toString()); } finally { if (stmt != null) { stmt.close(); } } } This resultset returns; Example2 100 50 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package program; import java.sql.*; /** * * @author Lacrymae_Ev */ public class SQLQueries2{ loginscreen log…
downvote count: 0

http://stackoverflow.com/q/21484524
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21484946
has comment: http://stackoverflow.com/comment/32428042
possible better answer: http://stackoverflow.com/a/21484563
has answer: http://stackoverflow.com/a/21484563
has comment: http://stackoverflow.com/comment/32428328
has title: Generics in Constructor Parameters
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21484946
tagged with: generics
has comment: http://stackoverflow.com/comment/32428071
has body: I know that this is a very silly question since I once knew stuff like that. But I have a really hard time now getting this done. I have a constructor for a Class which should get an ArrayList which is filled with Objects that implement my interface called CollisionObserver. Here is my constructor-head: public Cursor(GL gl, LibraryFinger finger, Vector direction, float radius, int index, ArrayList<T extends CollisionObserver> observerList) Can anybody tell me where I make the big mistake? I tried ArrayList<CollisionObserver> too, but this doesn't work too, since when I call the constructor with Objects that implement CollisionObserver the error message says the constructor is undefined. Ok, here is the complete Cursor class: public class Cursor implements CollisionSubject{ private Vector direction; private GL gl; private float radius; private LibraryFinger finger; private GLUT glut; protected static float[] sphere_center = new float[3]; private ArrayList<CollisionObserver> observer = new ArrayList<CollisionObserver>(); public Cursor(GL gl, LibraryFinger finger, Vector direction, float radius, int index, ArrayList<T extends CollisionObserver> observerList){ this.gl = gl; this.finger = finger; this.direction = direction; this.radius = radius; glut = new GLUT(); //Finetuning for fingermovements! The vector delivered by the LeapListener is to be considered as //raw-data. It has to be adjusted to the environment in which the fingertracking is used. sphere_center[0] = (float) (finger.getX()/15); sphere_center[1] = (float) ((finger.getY()/20)*-1); sphere_center[2] = (float) (finger.getZ()/5); gl.glTranslatef(sphere_center[0], sphere_center[1], sphere_center[2]); gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); gl.glColor3f(0.757f, 0.804f, 0.804f); glut.glutSolidSphere(radius, 16, 16); for (int i = 0; i < index; i++){ registerCollisionObserver(observerList.get(i)); } myPosition(); } @Override public void registerCollisionObserver(CollisionObserver o) { observer.add(…
has comment: http://stackoverflow.com/comment/32427996
type: Question

http://stackoverflow.com/comment/32199387
type: Comment
has text: @nhgrif Since the return value of `chooseUpgrade()` is a magic `int` that stands for some particular upgrade selection, this is a perfect example of when to use an enum. Even if it made sense structurally to retain the `switch`, it's a lot easier to understand `ATTACK_SPEED` and `DAMAGE` than `1` and `3` (and less error-prone).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21354652

http://stackoverflow.com/a/21425247
has body: The time complexity of your code is O(n), because you are traversing the whole tree, i.e. you are visiting all its nodes. However, if you don't have BST, but just a binary tree, that is the best you can achieve without having a pointer on a parent node (in that case, build paths from both nodes to root node and return a node that is in both paths). If you have BST, than you can locate both nodes and find least common ancestor in O(h), where h is a height of the tree and that is O(log n) if tree is balanced. Final remark - if you are preparing for a competition or an interview, make sure to take care of corner cases. Your code does not handle the case where one of nodes is not contained in the tree.
upvote count: 2
has comment: http://stackoverflow.com/comment/32324225
has comment: http://stackoverflow.com/comment/32323541
has comment: http://stackoverflow.com/comment/32325024
has comment: http://stackoverflow.com/comment/32325508
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21423444
downvote count: 0
has comment: http://stackoverflow.com/comment/32325925
has comment: http://stackoverflow.com/comment/32324535

http://stackoverflow.com/q/21455679
has comment: http://stackoverflow.com/comment/32378306
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32377586
has comment: http://stackoverflow.com/comment/32377090
has comment: http://stackoverflow.com/comment/32377275
has comment: http://stackoverflow.com/comment/32377121
has body: I programmed a client program which receives just a plain text from the server through port number 2000 (say) in a recieve method in a Router1 class. Now I want to send this data from the Client program to another program say (Client2) through another port number 2001 in a send method of the same class Router1. Is this allowable way to do ? I get Connection refused:connect exception. import java.io.*; import java.util.*; import java.net.*; import java.sql.*; class Router{ String str; public void receive(){ try{ while(true){ Socket so=new Socket("localhost",2000); BufferedReader br=new BufferedReader(new InputStreamReader(so.getInputStream())); str=br.readLine(); System.out.println("server has sent:"+str); so.close();} }catch(IOException e){ e.printStackTrace();} } public void send(){ int i,index=0,min=100; int row=2; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:DSN2"); Statement st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rs=st.executeQuery("select * from Table1"); //rs.absolute(row); rs.next(); rs.next(); //System.out.println(rs.getInt(1)+"\t"+rs.getInt(2)+"\t"+rs.getInt(3)+"\t"+rs.getInt(4)+"\t"+rs.getInt(5)+"\t"+rs.getInt(6)); for( i=2;i&lt;7;i++){ int value=rs.getInt(i); System.out.println("hello"); if(value&lt;min){ index=i; min=value;} } System.out.println("min is"+min); System.out.println("AT index"+index); switch(index){ case 2: ioConnect(); break; case 3: ioConnect(); break; case 4: ioConnect(); break; case 5: ioConnect(); break; case 6: ioConnect(); break; } }catch(Exception e){ e.printStackTrace(); } } public void ioConnect(){ try{ ServerSocket ss=new ServerSocket(2001); Socket so=ss.accept(); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter the message"); String str=br.readLine(); PrintStream ps=new PrintStream(so.getOutputStream()); ps.println(str); } catch(Exception e){ e.printStackTrace(); } } } …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21455749
tagged with: network-programming
has title: can a single java program send and receive data through two different ports
tagged with: java
has answer: http://stackoverflow.com/a/21455723

http://stackoverflow.com/q/21380883
has comment: http://stackoverflow.com/comment/32245103
tagged with: java
has body: I got a different type of numbers in my json string. So parsing this numbers with JSONObject leads to 3.7E-4-like representation of this numbers. I prefer to see numbers as a string. What to do? How to prevent such conversion? {"data": {"number1":0.0004, "number2":0.00038, "number3":0.00037 }}
has comment: http://stackoverflow.com/comment/32244950
downvote count: 1
has comment: http://stackoverflow.com/comment/32245000
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21382246
has comment: http://stackoverflow.com/comment/32247162
score: 0
has comment: http://stackoverflow.com/comment/32247267
has answer: http://stackoverflow.com/a/21382074
favorite count: 0
has title: org.json.JSONObject messing with data
linked to: http://stackoverflow.com/q/8710450
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/32246857
has comment: http://stackoverflow.com/comment/32244679

http://stackoverflow.com/comment/32433829
type: QuestionComment
comment on: http://stackoverflow.com/q/21487626
has text: No! That is the big problem!! I have given it a thought!
score: 0
type: Comment

http://stackoverflow.com/q/21432001
has answer: http://stackoverflow.com/a/21432110
downvote count: 0
has comment: http://stackoverflow.com/comment/32334825
favorite count: 0
has answer: http://stackoverflow.com/a/21432332
tagged with: android
type: AnsweredQuestion
has title: Improve search in array
tagged with: java
has body: I'm a newbie to Android and Java so please be nice :) I have an EditText in my application which is used to search for a particular string in a String[] My code works well, but not as I want: ArrayList&lt;String&gt; allProd = new ArrayList&lt;String&gt;; ArrayList&lt;String&gt; allProd_sort = new ArrayList&lt;String&gt;; allProd = [the table is brown, the cat is red, the dog is white]; String[] allProdString = allProd.toArray(new String[allProd.size()]); ... //inputSearch is the EditText inputSearch.addTextChangeListener (new TextWatcher() { ... @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { int textLength = inputSearch.getText().length(); String text = inputSearch.getText().toString(); for (int y = 0; y&lt; allProdString.length; y++) { //in my case i want that the search start when there are min 3 characters in inputSearch if(textLength &lt;= allProdString[y].length() &amp;&amp; textLength &gt;=3) { if (Pattern.compile(Pattern.quote(text), Pattern.CASE_INSENSITIVE) .matcher(allProdString[y]).find()) { allProd_sort.add(allProdString[y]); } } } } }); This code produces these results: if I search for "table is" => allProd_sort will be [the table is brown] but if I search for "table brown" => allProd_sort will be empty but I want [the table is brown] how can I improve this? thanks everybody
type: Question
accepted answer: http://stackoverflow.com/a/21432332
answer count: 2
possible better answer: http://stackoverflow.com/a/21432110
score: 5
upvote count: 5

http://stackoverflow.com/comment/32201958
comment on: http://stackoverflow.com/a/21356954
has text: Unless you want to the background to be resizable, this is waste of effort. Also, the scaling image in this way doesn't take into consideration the ratio of the original image and doesn't generally produce a nice result - IMHO
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21402061
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32397064
has comment: http://stackoverflow.com/comment/32282818
tagged with: java
has body: i am relatively new to java programming and programming for android and have been experimenting with android bluetooth comms using the Ketai library for the processing IDE specifically for use with android and tried to run the example program bluetoothcursors.pde that comes with the library but i keep getting the "application has stopped unexpectedly" error and the console indicates a null pointer exception error. The actual output is below: FATAL EXCEPTION: Animation Thread java.lang.NullPointerException at ketai.net.bluetooth.KBluetoothListener.&lt;init&gt;(KBluetoothListener.java:56) at ketai.net.bluetooth.KetaiBluetooth.start(KetaiBluetooth.java:207) at processing.test.bluetoothcursors.BluetoothCursors.setup(BluetoothCursors.java:80) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:1019) However i cant seem to see where the null pointer exception is coming from. I assume the null pointer exception relates to a variable that has not been instantiated properly. I have tried a process of elimination to try and isolate the cause but i get the same error but with slightly different source. I have also posted this question on the processing forum but have not received a reply. I just assumed that since it was part of the examples for the library it would work so maybe the error is being created somewhere else. I have tried other library examples and theses all work fine so i dont think its my setup. I also have other bluetooth programs working on android from processing but these use pure java code and are harder to follow. I have had a look at some of the similar questions which have been sort-of helpful but i am still stuck. I have set the correct bluetooth etc permissions and am using android version 2.3.3 and processing version 2.0. Any help with this is much appreciated. Cheers.
type: Question
has comment: http://stackoverflow.com/comment/32375010
has comment: http://stackoverflow.com/comment/32374977
has comment: http://stackoverflow.com/comment/32284583
tagged with: processing-ide
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/32282811
score: 0
has comment: http://stackoverflow.com/comment/34588521
has title: null pointer exception when programming for android phone from processing IDE

http://stackoverflow.com/q/21361109
has title: BufferedImage, same image after conversion to byte array and back, but different after grey conversion
score: 6
tagged with: bufferedimage
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/33034569
has comment: http://stackoverflow.com/comment/32227779
has body: I need to convert BufferedImages (RGB, no artefacts) to byte arrays for sending. While unit testing I stumbled over a problem with either BufferedImage, my expectation, or my code. A BufferedImage converted to a byte array and back yields after conversion again the same byte array. I assume it is the same image. However, if I convert both the original and the seemingly identical back-converted image to grey scale this gives me totally different images (not just a byte, really different!). Obviously, I expect the grey scale images to be identical as the source is identical. Can anybody enlighten me? Am I expecting something wrong? I have a complete stripped down example. import java.awt.BasicStroke; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ColorConvertOp; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Random; import javax.imageio.ImageIO; public class GreyImageProblem { private static Random random = new Random(); private static int randInt(int from, int to) { return random.nextInt(to-from+1)+from; } private static java.awt.Color randColor() { return new java.awt.Color(randInt(0,256*256*256)); } // a random image with different RGB colors public static BufferedImage genImage() { int width = randInt(180, 640); int height = randInt(120, 480); BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = im.createGraphics(); graphics.setStroke(new BasicStroke(6)); Rectangle rectangle = new Rectangle(0, 0, width, height); for (int i=0; i &lt; 42; i+=1) { int x = randInt(0, width), y = randInt(0, height); int sw = randInt(0, width)/10, sh = randInt(0, height)/10; graphics.setColor(randColor()); rectangle.setBounds(x, y, sw, sh); graphics.draw(rectangle); } return im; } // make it grey publ…
tagged with: arrays
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37961648
has comment: http://stackoverflow.com/comment/32223255
has comment: http://stackoverflow.com/comment/49878399
favorite count: 0
has comment: http://stackoverflow.com/comment/32209435
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32216812
tagged with: java

http://stackoverflow.com/q/21452212
linked to: http://stackoverflow.com/q/6403131
has body: In my applet, I want to comunicate with browser through win = (JSObject) JSObject.getWindow(this); This line is called in init() method of applet. First time everything work's fine, at the end of process page is reloaded and applet destroyed. But second time win object seems to be unavailable, in fact if i try to access it i obtain java.lang.InterruptedException at java.lang.Object.wait(Native Method) at sun.plugin2.message.Queue.waitForMessage(Unknown Source) at sun.plugin2.message.Pipe$2.run(Unknown Source) at com.sun.deploy.util.Waiter$1.wait(Unknown Source) at com.sun.deploy.util.Waiter.runAndWait(Unknown Source) at sun.plugin2.message.Pipe.receive(Unknown Source) at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source) at sun.plugin2.main.client.MessagePassingJSObject.eval(Unknown Source)
has title: Using JSObject in applet to communicate with browser
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/32381469
tagged with: java
upvote count: 1
type: Question
downvote count: 0
tagged with: javascript
tagged with: applet
has comment: http://stackoverflow.com/comment/32405480
favorite count: 0
type: UnansweredQuestion

typeahead
type: Tag
tags question: http://stackoverflow.com/q/21453354
tag name: typeahead

http://stackoverflow.com/comment/32432238
comment on: http://stackoverflow.com/a/21486155
has text: @John I don't think an applet is required - it seems that the op just needs a plain Java program and a place to run it...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32477087
score: 0
has text: It works, thank you! I thought of something like this before but was not sure if it is good idea so I just skipped it. I will accept this ASAP :) EDIT: And it is great you mentioned that XML part where method must be only in View's context, no more wasting time for trying to do something that is not possible.
type: Comment
comment on: http://stackoverflow.com/a/21511658
type: AnswerComment

http://stackoverflow.com/a/21481531
accepted answer of: http://stackoverflow.com/q/21481277
answers question: http://stackoverflow.com/q/21481277
score: 5
type: AcceptedAnswer
type: Answer
upvote count: 5
has comment: http://stackoverflow.com/comment/32446404
has body: You are declaring hashIndex outside of the loop StringBuffer hashIndex = new StringBuffer(""); ... for(int i=0;i&lt;jsonArray.length();i++) { hashIndex.append(...); This means that the StringBuffer keeps getting bigger and bigger as you iterate the buckets until it finally explodes! I think you meant to declare hashIndex inside the loop.
downvote count: 0

http://stackoverflow.com/a/21387821
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32267653
has comment: http://stackoverflow.com/comment/32258495
type: Answer
answers question: http://stackoverflow.com/q/21387688
score: 2
has comment: http://stackoverflow.com/comment/32265857
accepted answer of: http://stackoverflow.com/q/21387688
has body: Doubles are not perfect representations of the real number line. They have only about 16 digits of precision. In successive computations, errors can build, sometimes catastrophically. In your case, this has not happened, so be happy. The value of 0.1 is a nice example. In IEEE floating point, it has only an approximate representation. As a binary fraction, it is 0.0[0011] where the part in square braces repeats forever. This is why floating point numbers (including doubles) may not be the best choice for representing prices. I highly suggest reading this classic summary: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
has comment: http://stackoverflow.com/comment/32267979
upvote count: 2

http://stackoverflow.com/q/21390079
score: 0
has answer: http://stackoverflow.com/a/21390158
answer count: 5
has comment: http://stackoverflow.com/comment/32262129
has answer: http://stackoverflow.com/a/21390160
accepted answer: http://stackoverflow.com/a/21390160
has answer: http://stackoverflow.com/a/21390189
tagged with: equals
has comment: http://stackoverflow.com/comment/32262000
has title: using double equal operator with boolean
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21390158
tagged with: java
has answer: http://stackoverflow.com/a/21390164
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/32261976
downvote count: 2
has body: So, I'm facing finals next week and I went through some old tests. This one caught my attention because I can't seem to understand the code. public class Start { boolean zustand = false; public static void main (Strings[] args){ Start obj = new Start(); for(int i = 0; i &lt;= 3; i++){ if(obj.getZustand() == true){ System.out.println(""+i+ " true"); } else{ System.out.println(""+i+ " false"); } } } public boolean getZustand(){ zustand = (zustand == false); return zustand; } } I thought the output would be 0 true 1 true 2 true 3 true but I tried them on eclipse and the output is 0 true 1 false 2 true 3 false Can anyone please explain to me why they're not all true?
has answer: http://stackoverflow.com/a/21390163
favorite count: 0
has comment: http://stackoverflow.com/comment/32261874

version
tags question: http://stackoverflow.com/q/21385497
tags question: http://stackoverflow.com/q/21386601
tags question: http://stackoverflow.com/q/21357088
tags question: http://stackoverflow.com/q/21397679
tags question: http://stackoverflow.com/q/21384290
tags question: http://stackoverflow.com/q/21362446
type: Tag
tag name: version
tags question: http://stackoverflow.com/q/21377900

http://stackoverflow.com/comment/32344645
comment on: http://stackoverflow.com/a/21435240
score: 0
has text: Can you please add logger calls to `run` method ensure the code is not being executed?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32374913
type: Comment
comment on: http://stackoverflow.com/a/21454207
type: AnswerComment
has text: Cant understand what you want to say.Can you explain better
score: 0

http://stackoverflow.com/q/21431254
has comment: http://stackoverflow.com/comment/32333702
has answer: http://stackoverflow.com/a/21455551
has answer: http://stackoverflow.com/a/45256488
tagged with: return
tagged with: textfield
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32333518
tagged with: swing
has title: return value from Action Listener
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32333515
has body: I've got this function, I want to return a value when I click on the button. I know it doesn't work, but how do I fix this? I already googled about it, but couldn't find something relevant. My code: public String OutputText() { layout.show(mainpanel, "PANEL"); testbutton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { return textfield.getText(); } }); }
has answer: http://stackoverflow.com/a/21431452
has comment: http://stackoverflow.com/comment/32333559
answer count: 3
downvote count: 0
tagged with: button
favorite count: 0

http://stackoverflow.com/comment/32207533
score: 3
type: Comment
has text: You have never give a value to any position in the array. They are 0.
type: QuestionComment
comment on: http://stackoverflow.com/q/21359980

http://stackoverflow.com/comment/32417406
comment on: http://stackoverflow.com/a/21478156
score: 1
has text: Default password for JRE's cacerts is `changeit`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32343170
has text: take a look at this maybe can help you: is about a mistake in some version of jena..https://github.com/pyvandenbussche/sparqles/issues/9
type: AnswerComment
comment on: http://stackoverflow.com/a/21435668
score: 0
type: Comment

http://stackoverflow.com/comment/32359148
has text: can you please show us a screenshot of how it should look like, vs how it looks like? also, it seems weird that you used both "alignParentLeft" and "layout_toLeftOf" - did you want to align to a specific view or to the parent?
comment on: http://stackoverflow.com/q/21444425
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32409231
score: 0
type: Comment
type: QuestionComment
has text: subString() and/or indexOf() and/or split() will help you.. Any specific reason that is forcing you to use regex?
comment on: http://stackoverflow.com/q/21473400

http://stackoverflow.com/comment/32256158
has text: Your code won't compile.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21386047
score: 0

http://stackoverflow.com/q/21377011
has comment: http://stackoverflow.com/comment/32240951
has title: Error: java.io.IOException: wrong value class: class org.apache.hadoop.io.Text is not class Myclass
tagged with: java
tagged with: elastic-map-reduce
has comment: http://stackoverflow.com/comment/32238874
has body: I have my mapper and reducers as follows. But I am getting some kind of strange exception. I can't figure out why is it throwing such kind of exception. public static class MyMapper implements Mapper&lt;LongWritable, Text, Text, Info&gt; { @Override public void map(LongWritable key, Text value, OutputCollector&lt;Text, Info&gt; output, Reporter reporter) throws IOException { Text text = new Text("someText") //process output.collect(text, infoObjeject); } } public static class MyReducer implements Reducer&lt;Text, Info, Text, Text&gt; { @Override public void reduce(Text key, Iterator&lt;Info&gt; values, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { String value = "xyz" //derived in some way //process output.collect(key, new Text(value)); //exception occurs at this line } } System.out.println("Starting v14 "); JobConf conf = new JobConf(RouteBuilderJob.class); conf.setJobName("xyz"); String jarLocation =ClassUtil.findContainingJar(getClass()); System.out.println("path of jar file = " + jarLocation); conf.setJarByClass(RouteBuilderJob.class); conf.setMapOutputKeyClass(Text.class); conf.setMapOutputValueClass(Info.class); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(Text.class); //am i missing something here??? conf.setMapperClass(RouteBuilderJob.RouteMapper.class); conf.setCombinerClass(RouteBuilderJob.RouteReducer.class); conf.setReducerClass(RouteBuilderJob.RouteReducer.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths(conf, new Path(args[0])); FileOutputFormat.setOutputPath(conf, new Path(args[1])); JobClient.runJob(conf); I am getting an exception: Error: java.io.IOException: wrong value class: class org.apache.hadoop.io.Text is not class com.xyz.mypackage.Info at org.apache.hadoop.mapred.IFile$Writer.append(IFile.java:199) at org.apache.hadoop.mapred.Task$CombineOutputCollector.collect(Task.java:1307) at com.xyz.mypackage.job.MyJob$Rout…
has comment: http://stackoverflow.com/comment/32239559
type: Question
upvote count: 4
tagged with: hadoop
has comment: http://stackoverflow.com/comment/32238613
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32238548
has comment: http://stackoverflow.com/comment/32238928
has answer: http://stackoverflow.com/a/23458932
has comment: http://stackoverflow.com/comment/32238751
has comment: http://stackoverflow.com/comment/32239605
has comment: http://stackoverflow.com/comment/32239647
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/32239511
score: 3

http://stackoverflow.com/comment/32269202
score: 1
type: AnswerComment
has text: Doing this without _any_ libraries is hard when you consider all the weird rules regarding leap years and such.
type: Comment
comment on: http://stackoverflow.com/a/21393892

http://stackoverflow.com/comment/32399119
type: QuestionComment
comment on: http://stackoverflow.com/q/21467479
score: 1
has text: You've changed the question into something quite different. What do you get a `0` with? What variable? Did you include an instance variable `type` in `Entity` that you didn't show?
type: Comment

http://stackoverflow.com/comment/32239965
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21365998
type: AnswerComment
has text: It was about war file - if you want to use ear packaging you can use TomEE

http://stackoverflow.com/q/21453856
favorite count: 0
type: Question
has title: Difference between @Transactional and @TransactionAttribute
score: 9
possible better answer: http://stackoverflow.com/a/61435100
accepted answer: http://stackoverflow.com/a/21454132
has body: I started persistence coding and I came across annotations such as @Transactional and @TransactionAttribute. I understand the basic functionality of these two annotations and also that they can be used at both class level and at the method level. What I would like to understand better is the difference between these two annotations. Any help would be appreciated. Thanks.
answer count: 2
upvote count: 9
tagged with: transactions
tagged with: java
tagged with: hibernate
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21454132
has answer: http://stackoverflow.com/a/61435100

http://stackoverflow.com/q/21494452
upvote count: 0
has comment: http://stackoverflow.com/comment/32446833
has comment: http://stackoverflow.com/comment/32446866
score: -1
has comment: http://stackoverflow.com/comment/32446848
has comment: http://stackoverflow.com/comment/32447074
has comment: http://stackoverflow.com/comment/32446862
has title: board game previous sum value store
answer count: 1
favorite count: 0
has body: hello i am making one board game .in that i getting one dice value and i adding to one variable . but before rolling dice i want to store pervious turn value into one varible. can anybody suggest how to do that?? i am doing like this way but its not giving me success. on dice click event public static int sum = 0; public static int lastvalue = 0; int[] rollingnumber = new int[48]; lastvalue++; sum = sum + gs.getImagelevel(); gs.setLastsum(sum); for (int i = 0; i &lt; lastvalue; i++) { rollingnumber[i] = gs.getLastsum(); Log.i("hello", "i :: " + i + "array :: " + rollingnumber[i] + "lastvalue :: " + lastvalue); }
has answer: http://stackoverflow.com/a/21494683
tagged with: android
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32446855
accepted answer: http://stackoverflow.com/a/21494683

http://stackoverflow.com/q/21407605
answer count: 2
has comment: http://stackoverflow.com/comment/32292585
downvote count: 0
favorite count: 0
has body: i have a custom arrayadapter with some pre_populated data and more data is to be added to it from the user input.The problem is that duplicate values are still added to the arrayadapter..here is my code: String s;//holds data from user input for(int i=0 ; i&lt;my_adapter.getCount() ; i++){ MyCollection itemObject=my_adapter.getItem(i); //MyCollection is an object from the collection class String c=itemObject.toString(); if(c.matches(s)){ //do not add s to array adapter }else{ //add s to arrayadapter my_arrayvalues.add(new MyCollection(s)); my_adapter.notifyDataSetChanged(); } Running the above code,no change is effected on the adapter even when the the values do not match..if i just run the project without including the above duplicate values are added.how can i correct this? after following the answers i have done as suggested but still the duplicates are being added: the updated code hs = new HashSet(); my_arrayvalues.add(new MyCollections(s)); hs.addAll(my_arrayvalues); my_arrayvalues.clear(); my_arrayvalues.addAll(hs); my_adapter.notifyDataSetChanged();
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21407672
has answer: http://stackoverflow.com/a/21407693
score: 2
has title: how to ensure an arrayadapter does not accept duplicate values
tagged with: android-arrayadapter
tagged with: java
linked to: http://stackoverflow.com/q/7633742
type: Question
tagged with: arrays

http://stackoverflow.com/a/21423495
score: 1
has comment: http://stackoverflow.com/comment/32320463
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21423394
accepted answer of: http://stackoverflow.com/q/21423394
type: Answer
has comment: http://stackoverflow.com/comment/32320403
has comment: http://stackoverflow.com/comment/32320303
has body: //you need to change the IMEI activity to class public static class IMEI { public static String get_dev_id(Context ctx){ //Getting the Object of TelephonyManager TelephonyManager tManager = (TelephonyManager)ctx.getSystemService(Context.TELEPHONY_SERVICE); //Getting IMEI Number of Devide String Imei=tManager.getDeviceId(); return Imei; } } // And you need to call it with String imei_num = IMEI.get_dev_id(context); EDITED: You can use static instead..

http://stackoverflow.com/a/21425368
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21412314
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21412314
type: Answer
has body: Your client certificate isn't trusted by the server's truststore. The server sends a list of trusted CAs and the client has to send a certificate that is trusted by one of them. It couldn't, so it sent a null cert chain instead. If your client certificate is self-signed, or signed by an untrusted CA, you need to export it from your client keystore and import it as a trusted cert into the server's truststore.

http://stackoverflow.com/a/21398068
has body: Inseted of this startActivity(new Intent (MyArrayAdapter.this,Add_new_employee.class) ); use this context.startActivity(new Intent (context,Add_new_employee.class) ); Note: Make sure you had declared Add_new_employee in android manifest.xml
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32276303
has comment: http://stackoverflow.com/comment/32276391
accepted answer of: http://stackoverflow.com/q/21398021
answers question: http://stackoverflow.com/q/21398021
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/32303180
type: Comment
has text: http://stackoverflow.com/questions/8924599/how-to-count-the-exact-number-of-words-in-a-string-that-has-empty-spaces-between
score: 0
comment on: http://stackoverflow.com/q/21413590
type: QuestionComment

http://stackoverflow.com/comment/32383603
type: Comment
comment on: http://stackoverflow.com/a/21459229
has text: I've written *label1.setVerticalAlignment(SwingConstants.TOP)*, but I still see that JLabel is similar to first picture attached.
score: 0
type: AnswerComment

http://stackoverflow.com/a/55607477
answers question: http://stackoverflow.com/q/21448907
has body: For my case, I was previously doing android development having the android studio and a virtual machine running for an entire night I realized this error when I tried to start my apache Kafka server. I restarted my laptop to reset memory and then started Kafka server all over again hope this helps someone out there!..
score: 0
type: Answer

http://stackoverflow.com/q/21485379
tagged with: java
has body: I am using iReport 5.1.0 and JasperReports Server 5. I was able to set the report page size orientation to Landscape and was able to preview the report in Landscape. But my problem is when exporting it to Docx or RTF, when printing the report, the print preview and printing of the report is in portrait, making the actual report cut. How do I set up the print orientation of my jrxml file or how do I make the printing landscape?
has comment: http://stackoverflow.com/comment/32973569
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/32448208
answer count: 0
type: UnansweredQuestion
type: Question
has title: How to set print orientation to landscape
tagged with: orientation
score: 0

http://stackoverflow.com/a/21434320
score: 1
has body: To answer the question, it is possible to program in C for Android using NDK. And, as the way from C to Assembler is rather short, may be possible in Assembler as well. And while Java performance is currently rather good, a claim no language ever could check an array for duplicates faster seems for me somewhat an overestimation. However switching between languages is complex, and for the task so trivial you may loose performance by just accessing your array an JNI level. It may be more reasonable to rethink the algorithm. For instance: If you just need to iterate over the list but must have it ordered, use LinkedHashSet. This will prevent the duplicate items from beginning. If you have a lot of duplicates, the removal operation may be too expensive as big parts of the array may be moved a lot of times. Try to set items to be removed to null instead and then recreate the array from scratch skipping nulls.
answers question: http://stackoverflow.com/q/21432733
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32264038
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21391252
has text: I will always remember my C compiler in university days which warned me about a 'suspicious' cast I had made... and it was indeed suspicious!! :D
score: 0

http://stackoverflow.com/q/21438850
accepted answer: http://stackoverflow.com/a/21441375
answer count: 1
tagged with: google-analytics-api
has title: Google Analytics - Enforce Screen Tracking
tagged with: google-analytics
score: 0
tagged with: java
tagged with: api
has answer: http://stackoverflow.com/a/21441375
type: Question
type: AnsweredQuestion
tagged with: android
has body: Good evening. I am using Google Analytics v3 in my Android app. I want to simulate screen views in my MainActivity. How can I enforce a screen view? Using EasyTracker it's not working as follows: // track one screen easyTracker.set(Fields.SCREEN_NAME, "First Screen"); easyTracker.send(MapBuilder.createAppView().build()); // track another screen easyTracker.set(Fields.SCREEN_NAME, "Second Screen"); easyTracker.send(MapBuilder.createAppView().build()); It just tracks the first screen but not the second. How can I achieve that?

http://stackoverflow.com/q/21442286
upvote count: 1
has comment: http://stackoverflow.com/comment/32354049
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/21442316
has body: What would be the difference between long x = 43 and long x = 43L in Java? Do both of them initialize x to be have the long data type?
has answer: http://stackoverflow.com/a/21442336
has title: What is the difference between typing long x = 43 and long x = 43L in Java?
favorite count: 0
has answer: http://stackoverflow.com/a/21442335
has answer: http://stackoverflow.com/a/21442323
answer count: 4
has comment: http://stackoverflow.com/comment/32354016
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21442316
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21442323

http://stackoverflow.com/q/21492832
tagged with: unix
favorite count: 0
tagged with: terminal
accepted answer: http://stackoverflow.com/a/21492906
upvote count: 1
tagged with: putty
has comment: http://stackoverflow.com/comment/33646054
has title: How to view a runnable .jar's output via SSH client
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21492906
has body: I have a .jar runnable running on my server. When I run the file locally I am able to see its output via my IDE. Similarly I can connect via SSH and run the file and see the output, but when I close the session the JAR exits. Is there any way to have my application continuously running and then tapping into the java applications output using a terminal service like SSH without having to stop/start the application. Any help would be appreciated.
answer count: 1
downvote count: 0
tagged with: ssh

http://stackoverflow.com/comment/32299812
has text: @MartinJames Are you suggesting that the problem isn't so much the size of the task but that the data transfer between threads should be small compared to the size of the task to be performed? So dataIn+dataOut << taskSize. I knew this was the case for GPU based concurrency, I didn't realise it was the same for regular multithreading
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21411245

http://stackoverflow.com/q/21473454
has answer: http://stackoverflow.com/a/21473800
has comment: http://stackoverflow.com/comment/32409464
tagged with: yield-return
has body: Is it possible to create a method that can temporarily pause itself by "returning" and then resuming when it is called again? It should act as if it never returned (i.e. retain all its variables, continue executing the next line, etc.). public static void main(String args) { method(); //should start method //do stuff ONLY AFTER method() RETURNS method(); //should continue method at same place as it ended //do more stuff ONLY AFTER method() RETURNS } private static void method() { while(true) { //do stuff return; //do different stuff return; //do a third thing return; //then start all over } } I saw a few questions on StackOverflow that are similar, but none of the answers seemed sufficient or explanatory.
answer count: 5
has comment: http://stackoverflow.com/comment/32409408
has comment: http://stackoverflow.com/comment/32409272
has answer: http://stackoverflow.com/a/21473692
has answer: http://stackoverflow.com/a/21495788
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2352399
has comment: http://stackoverflow.com/comment/32409930
score: 0
has comment: http://stackoverflow.com/comment/32409247
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32409562
possible better answer: http://stackoverflow.com/a/21473692
accepted answer: http://stackoverflow.com/a/21473800
type: Question
has comment: http://stackoverflow.com/comment/32409657
has comment: http://stackoverflow.com/comment/32423878
has comment: http://stackoverflow.com/comment/32409428
tagged with: java
has title: Temporarily pause a method until next call
has comment: http://stackoverflow.com/comment/32409571
linked to: http://stackoverflow.com/q/10565172
has comment: http://stackoverflow.com/comment/32409381
has comment: http://stackoverflow.com/comment/32409514
has answer: http://stackoverflow.com/a/21479846
has comment: http://stackoverflow.com/comment/32409835
has answer: http://stackoverflow.com/a/21474160

http://stackoverflow.com/a/21446170
type: Answer
has body: There are two conditions that should be met to use float instead of double: There is a significant, useful performance gain. Float is precise enough for the calculation in question. Evaluating the first condition is relatively simple and easy. Measure the job using double. Measure again, with the same inputs and other conditions, using float. Is the float version significantly faster? Generally, the main benefit comes from more efficient use of caches, memory, and data transfer bandwidth. The difficult part is evaluating the second condition. Getting insufficiently precise answers, or even wrong answers, is useless. For many calculations, relatively simple analysis can show double is precise enough. Showing the same for float is often much harder.
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/52476892
has comment: http://stackoverflow.com/comment/52477865
answers question: http://stackoverflow.com/q/21445662

http://stackoverflow.com/a/21473534
answers question: http://stackoverflow.com/q/21473460
upvote count: 3
has body: Remember, JPanel extends from JComponent, so basically, it's the same process. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import net.java.balloontip.CustomBalloonTip; import net.java.balloontip.examples.complete.Utils; public class Test { public static void main(String[] args) { new Test(); } public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private CustomBalloonTip customBalloonTip; private Rectangle square = new Rectangle(50, 50, 200, 200); public TestPane() { customBalloonTip = new CustomBalloonTip(this, new JLabel(" I'm a " + Utils.monospace("CustomBalloonTip") + ". "), square, Utils.createBalloonTipStyle(), Utils.createBalloonTipPositioner(), null); customBalloonTip.setVisible(false); addMouseMotionListener(new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { if (square.contains(e.getPoint())) { customBalloonTip.setVisible(true); } else { customBalloonTip.setVisible(false); } } }); } @Override public Dimension getPreferredSize() { return new Dimension(300, 300); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) …
has comment: http://stackoverflow.com/comment/32409730
has comment: http://stackoverflow.com/comment/32410373
has comment: http://stackoverflow.com/comment/32409663
has comment: http://stackoverflow.com/comment/32410499
has comment: http://stackoverflow.com/comment/32410709
has comment: http://stackoverflow.com/comment/32410407
has comment: http://stackoverflow.com/comment/32409444
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32410582
has comment: http://stackoverflow.com/comment/32409422
has comment: http://stackoverflow.com/comment/32410665
has comment: http://stackoverflow.com/comment/32410512
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/32410589
has comment: http://stackoverflow.com/comment/32410466
has comment: http://stackoverflow.com/comment/32409520
accepted answer of: http://stackoverflow.com/q/21473460

http://stackoverflow.com/a/21448266
accepted answer of: http://stackoverflow.com/q/21447855
downvote count: 1
has body: Try this way private void drawer(Canvas canvas) { Bitmap bitmapOriginal = BitmapFactory.decodeResource(getResources(), R.drawable.circle); Bitmap bitmapNew = Bitmap.createBitmap(bitmapOriginal.getWidth(), bitmapOriginal.getHeight(), Config.ARGB_8888); bitmapNew.eraseColor(Color.WHITE); // color that You want to set canvas.drawBitmap(bitmapNew, 0, 0, null); canvas.drawBitmap(bitmapOriginal, 0, 0, null); }
has comment: http://stackoverflow.com/comment/32397645
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32407322
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21447855
upvote count: 3
has comment: http://stackoverflow.com/comment/32365364

http://stackoverflow.com/a/21516209
answers question: http://stackoverflow.com/q/21496465
has body: Please use the instructions on https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ or use already existing interfaces like RestFB or Spring (https://spring.io/guides/gs/accessing-facebook/)
type: Answer
score: 0

http://stackoverflow.com/comment/32455707
type: Comment
comment on: http://stackoverflow.com/a/21499809
score: 0
type: AnswerComment
has text: be sure to remove the previous keyPressed event!

http://stackoverflow.com/comment/32341810
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21425176
type: QuestionComment
has text: The code in the answer to other question you reference ought to work fine if you look up based on a CharacterRun rather than a Paragraph - what happens if you try it?

http://stackoverflow.com/comment/32442180
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21491920
has text: I have an arrayList of numbers, which for context are the ages of people. I want to loop through this arrayList and print all the ages of the people that are younger than 50. getList() is an accessor method to get the arrayList as it is in anoter class

http://stackoverflow.com/comment/32447914
comment on: http://stackoverflow.com/q/21495117
type: Comment
type: QuestionComment
has text: Is your project in Java or Scala?
score: 0

ms-project
type: Tag
tags question: http://stackoverflow.com/q/21454825
tag name: ms-project
tags question: http://stackoverflow.com/q/21377701

http://stackoverflow.com/comment/32426037
score: 0
type: Comment
type: QuestionComment
has text: Does this one, which mentions jar caching, help? [Found unsigned entry in resource … .jar](http://stackoverflow.com/q/7182762/1281433).
comment on: http://stackoverflow.com/q/21482716

http://stackoverflow.com/a/21442110
type: Answer
answers question: http://stackoverflow.com/q/21441551
score: -1
has comment: http://stackoverflow.com/comment/32359637
downvote count: 1
has body: I changed my test to this and it worked: @Test public void testReturnWidgetIdsFromSearchWord(){ List&lt;Integer&gt; widgetIds = null; String searchText = "someText"; /*when(jdbt.queryForList("SELECT idwidgets FROM descriptions " + "WHERE descriptiontext LIKE '%"+ searchText + "%'", args, Integer.class)).thenReturn(idList);*/ when(jdbt.queryForList(Matchers.anyString(), Matchers.any(MapSqlParameterSource.class), (Class&lt;Integer&gt;) Matchers.anyVararg())).thenReturn(idList); widgetIds = (List&lt;Integer&gt;) dDao.returnWidgetIdsFromSearchWord(searchText); System.out.println(widgetIds.size()); assertEquals(widgetIds, idList); } Thanks for the help
upvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21441551

http://stackoverflow.com/q/21389474
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/32261676
possible better answer: http://stackoverflow.com/a/21389812
has answer: http://stackoverflow.com/a/21389946
accepted answer: http://stackoverflow.com/a/21389946
has comment: http://stackoverflow.com/comment/32260936
has answer: http://stackoverflow.com/a/21389812
tagged with: linkedhashmap
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32261071
has body: I have the following structure: import java.util.LinkedHashMap; ... LinkedHashMap &lt;String, Object&gt;level0 = new LinkedHashMap&lt;String, Object&gt;(); LinkedHashMap &lt;String, Object&gt;level1 = new LinkedHashMap&lt;String, Object&gt;(); LinkedHashMap &lt;String, Object&gt;level2 = new LinkedHashMap&lt;String, Object&gt;(); LinkedHashMap &lt;String, Object&gt;level3 = new LinkedHashMap&lt;String, Object&gt;(); level1.put("level2", level2); level2.put("level2", level3); level0.put("level1", level1); System.out.println(level0); Output this: { level1={ level2={} } } I need to set a value through a "path" (or something), would be something like this: MapThisObject example = new MapThisObject(level0); example.putValue("level1.level2", "string", "test"); example.putValue("level1.level2", "int", 1); example.putValue("level1.level2", "object", new LinkedHashMap()); System.out.println(example.result()); /*output: { level1={ level2={ string="test", int=1, Object={} } } } */ In other words, there is the possibility to put or set values ​​for "multidimensional objects" through a "path" (like Xpath)?
tagged with: java
has title: Put value LinkedHashMap multidimensional
has comment: http://stackoverflow.com/comment/32261284
type: Question
has comment: http://stackoverflow.com/comment/32261229
answer count: 2
has comment: http://stackoverflow.com/comment/32261190
score: 0

http://stackoverflow.com/q/21481962
has body: I have made a Tower Defense game and there is one thing that bothers me. I have set the starting value of money but I cannot get the value to carry over to the next level. Any ideas? public void define() { room = new Room(); save = new Save(); store = new Store(); if(level == 1){ coinage = 50; health = 100; } if(level == 2){ coinage = 40; health = 100; } if(level &gt; 2){ coinage = 30; health = 100; } if(level &gt; 8){ coinage = 0; } Hmm so I tried this: public static int coinage = 0, health = 100; and then if(level == 1){ coinage += 50; } if(level == 2){ coinage += 40; } I am sure I am doing something wrong here. When the second level comes up the starting value is still 40. How could I fix that? Here is a link to the full code!
has title: Java | retrieving data
upvote count: 1
has comment: http://stackoverflow.com/comment/32433741
has comment: http://stackoverflow.com/comment/32423744
type: Question
has comment: http://stackoverflow.com/comment/32434944
has comment: http://stackoverflow.com/comment/32435390
score: -1
accepted answer: http://stackoverflow.com/a/21482045
has comment: http://stackoverflow.com/comment/32428522
has comment: http://stackoverflow.com/comment/32426450
answer count: 1
has comment: http://stackoverflow.com/comment/32434408
has comment: http://stackoverflow.com/comment/32434471
favorite count: 0
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21482045
has comment: http://stackoverflow.com/comment/32427085
has comment: http://stackoverflow.com/comment/32423611
tagged with: java

http://stackoverflow.com/q/21416114
favorite count: 0
tagged with: proxy
has comment: http://stackoverflow.com/comment/43065489
has answer: http://stackoverflow.com/a/26218729
tagged with: vert.x
answer count: 4
has body: Has anybody had a luck trying to use vertx bihind a corporate proxy? I have tried whatever possible ways that comes to my head to provide the proxy information to vertx. Nothing works so far. set environment variable http_proxy=http://mycorporate.proxy.com:8080 - no luck set environment variable VERTX_OPTS='-Dhttp.proxyHost=mycorporate.proxy.com -Dhttp.proxyPort=8080' - no luck set environment variables http.proxyHost=mycorporate.proxy.com http.proxyPort=8080 no luck Injecting extra echo into vertx command I can see that proxy related parameters are being passed to JVM correctly but required module still can't be downloaded ("vertx run hello.js" just stuck obviously trying to download io.vertx~lang-rhino~2.0.0-final) Proxy itself is ok - I'm using it with no problem for maven, sbt and other different stuff requiring proxy Same laptop being used from home can successfully run "vertx run hello.js" with downloading io.vertx~lang-rhino~2.0.0-final (for the first run) I have just started evaluating vertx for our company needs and this is my very first choking point hindering my further attempts to make a decision. So far I have to follow next steps as workaround: 1 Run from home and get whatever required modules in sys-mods. 2 Manually upload the module(s) to sys-mods on the test server when back to the office. Obviously this is not a normal way to run anything.
type: UnansweredQuestion
has title: running vertx behind a proxy
score: 6
type: Question
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/24795875
has answer: http://stackoverflow.com/a/57357255
downvote count: 0
has answer: http://stackoverflow.com/a/56795726

http://stackoverflow.com/comment/32432557
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21486968
has text: For that matter you *could* get the backing `char[]` and use `System.arraycopy()`, and create new Strings, or ... any number of other things :)

http://stackoverflow.com/comment/32414121
score: 3
type: QuestionComment
has text: http://stackoverflow.com/questions/1994255/how-to-write-console-output-to-a-txt-file Possible duplicate.
type: Comment
comment on: http://stackoverflow.com/q/21476423

http://stackoverflow.com/q/21441701
has comment: http://stackoverflow.com/comment/32352849
has body: I am asked to "Write a static method which, given a String as an input parameter, will return another String representing the input string with all vowels removed." I'm not exactly sure what they mean by this. I wrote this below. What would I need to change to the answer? Thanks public static void main(String[] args) { String s = "Hello there"; String s1 = s.replaceAll("[AaEeIiOoUu]", ""); System.out.print(s1); }
answer count: 4
has answer: http://stackoverflow.com/a/21441913
has comment: http://stackoverflow.com/comment/32352856
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21441866
has comment: http://stackoverflow.com/comment/32352911
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32352974
has answer: http://stackoverflow.com/a/21441863
has comment: http://stackoverflow.com/comment/32353034
downvote count: 0
has comment: http://stackoverflow.com/comment/32352731
favorite count: 0
has title: Beginner: Static Methods
has answer: http://stackoverflow.com/a/21441880

http://stackoverflow.com/a/21488259
has comment: http://stackoverflow.com/comment/32435853
has comment: http://stackoverflow.com/comment/32435211
has comment: http://stackoverflow.com/comment/32435813
score: 0
has comment: http://stackoverflow.com/comment/32435798
type: Answer
has comment: http://stackoverflow.com/comment/32435131
has body: For each of these three (configuration, data, analysis), get their child nodes and drill down until you get to your errors (i.e. to your result tags). You will find these below analysis (but not directly below it). So you can just drill down from analysis downwards.
answers question: http://stackoverflow.com/q/21488225

http://stackoverflow.com/comment/32470984
type: AnswerComment
score: 0
type: Comment
has text: Yes. He asked about iterating a `Collection` whilst also adding and removing elements sometimes. A standard for-loop would not even work in this case as variable `i` implies that you are retrieving based on an index (like within a list), and not all collections necessarily support that (consider a `Set`). Furthermore, adding or removing an element while iterating using said loop would throw a `ConcurrentModificationException` in most cases, which creates the problem that he was asking about in the first place.
comment on: http://stackoverflow.com/a/21508082

http://stackoverflow.com/a/21413140
has body: You can use the View Pager instead of the horizontalScrollView. http://developer.android.com/reference/android/support/v4/view/ViewPager.html To keep the View pager at half the screen use something like this: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/White" android:orientation="vertical"&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1.5"&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/pagerPromo" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;com.viewpagerindicator.CirclePageIndicator android:id="@+id/indicatorPromo" android:layout_height="wrap_content" android:layout_width="match_parent" android:padding="5dp" android:layout_alignParentBottom="true"/&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1.0" android:orientation="vertical"&gt; This View Pager has a circle indicator at the bottom but you can remove that if you like. Just play around with the weights and see what works best for you.
has comment: http://stackoverflow.com/comment/32303806
answers question: http://stackoverflow.com/q/21411510
score: 0
has comment: http://stackoverflow.com/comment/32302929
type: Answer

http://stackoverflow.com/comment/32431618
type: Comment
score: 1
has text: To anyone who wants to downvote this for lack of research, please give [File2](http://camel.apache.org/file2.html) a solid read. You'll see *some* documentation surrounding the notion of a `readLock`, but nowhere does it actually answer my questions!!!
type: QuestionComment
comment on: http://stackoverflow.com/q/21486455

http://stackoverflow.com/comment/32282191
has text: btw ... Did you get it working with Jetty first? That project comes configured to use the Maven Jetty plugin. Just run `mvn install jetty:run` from the command-line.
comment on: http://stackoverflow.com/q/21401005
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/32279855
has text: Clearly *you* don't know the difference between "'float' with a small 'f'", which is what I recommended here, and which *cannot be null,* and 'Float', which *can* be null. NB 'private' has nothing to do with it either way. Ask around yourself. You're not impressing anyone here.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21398698
type: Comment

http://stackoverflow.com/comment/32570689
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46790/discussion-between-wbest-and-jarnbjo)
comment on: http://stackoverflow.com/a/21538216
type: AnswerComment
score: 0

http://stackoverflow.com/q/21383056
score: 2
upvote count: 2
has title: How to dynamically chose a service to execute based on String with DI?
has answer: http://stackoverflow.com/a/21383500
tagged with: spring
type: AnsweredQuestion
tagged with: dependency-injection
tagged with: java
has answer: http://stackoverflow.com/a/21383514
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32248951
accepted answer: http://stackoverflow.com/a/21383500
downvote count: 0
possible better answer: http://stackoverflow.com/a/21383514
has body: I have a String as input, and based on this I'd like to chose a service to execute. For the following approach I'd have a delegator class that gets all possible services auto injected using Spring 4. But could improve this? Or is this a good approach to delegate to a speficic service? Especially I don't know if injecting all my services that may be chosen based on the action in this class. class Delegator { public MyService findService(String action) { switch (action) { case "A": return serviceA; break; case "B": return serviceB; break; //lots of other cases } return null; } @Autowired private MyService serviceA; @Autowired private MyService serviceB; }
favorite count: 0

http://stackoverflow.com/a/21445199
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21445166
has body: you should put some java title/textfield and change the text in it to the number you want
score: 1
upvote count: 1

http://stackoverflow.com/a/21457700
accepted answer of: http://stackoverflow.com/q/21457615
answers question: http://stackoverflow.com/q/21457615
type: Answer
has body: The key to your problem is I believe likely to be one of references, but I can't tell for sure since the information that you have given us so far is very limited. Likely the one class does not have a valid reference to the displayed instance of the other class, meaning that you are possibly calling methods on a non-displayed object. If so, the key is to pass that reference in via a setter method or constructor parameter. The details of a solution will depend on the details and code of the problem. So if you need more help, please provide us with much more relevant information and relevant code, preferably an mcve (please check the link). Edit Regarding your recent additions to your question: Your frame variable should not be static. This is not likely causing your problem, but will likely cause significant problems later on. Make it an instance variable and give the class methods to set it, to change its state, and to extract its state. Your showMeUpdate() method calls repaint() on the JInternalFrame object, but you don't show us why you think that this will do anything of importance. A call to repaint() should not change the state of a component, but should only allow the component to re-draw itself and change its appearance due to some other previous change in state. Again, your question remains short of essential details. The more relevant information that you can give us (without overwhelming us with irrelevant information) the better we will be equipped to help. You will want to learn and abide by Java naming convention: Java class names should begin with an upper case letter and method and variable names with lower case letters. This may seem trivial to you now, but by following these conventions, others (us!) who are reading your code will understand it better and quicker, and be able to give you better help. Your code is not close to the mcve standard. The closer you adhere to this standard, the better we can understand your code and your problem.
score: 0
has comment: http://stackoverflow.com/comment/32381418
type: AcceptedAnswer

http://stackoverflow.com/q/21471763
type: UnansweredQuestion
tagged with: compression
tagged with: video
tagged with: java
type: Question
tagged with: codec
has body: I have a project in my university which asks for the creation of a video codec. The problem is the even though i have studied a lot about video compression , techniques , algorithms etc but i can't find anywhere how to get the pixel values from video frames(because this is the first think to do in order to apply Discrete cosine transform later).
tagged with: frames
score: 0
has comment: http://stackoverflow.com/comment/32406876
has title: How to get pixel values from all frames of a video?
has comment: http://stackoverflow.com/comment/32409017
answer count: 0

http://stackoverflow.com/comment/32464794
has text: Dave I didn't come across this in my search so i'll have to look into it. At the high-level it seems to just create the documents for you, I can successfully write a .doc with the code that isn't the issue. The problem is writing it to the letter head which is also a .doc that contains a footer & header .
type: AnswerComment
comment on: http://stackoverflow.com/a/21500978
score: 0
type: Comment

http://stackoverflow.com/q/21489090
has answer: http://stackoverflow.com/a/21489248
has comment: http://stackoverflow.com/comment/32436742
tagged with: regex
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32436978
type: Question
has comment: http://stackoverflow.com/comment/32436633
tagged with: java
has answer: http://stackoverflow.com/a/21489174
accepted answer: http://stackoverflow.com/a/21489174
has answer: http://stackoverflow.com/a/21489266
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/21489248
has body: String name = "B R ER"; String[] a = {"U","G"}; For(int i= 0 ; i &lt; a.length ; i++) { String temp = name.replaceAll("\\s",a[i]); name = temp; } // But on result it shows BGRGER ... how to get result BURGER.
has comment: http://stackoverflow.com/comment/32436935
has title: how to replace space one by one using regex in java?
favorite count: 0

http://stackoverflow.com/q/21432124
has comment: http://stackoverflow.com/comment/32335045
upvote count: 3
has comment: http://stackoverflow.com/comment/32335325
has title: ArrayIndexOutOfBoundsException in HashMap
has answer: http://stackoverflow.com/a/21432496
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/21432496
has comment: http://stackoverflow.com/comment/89176023
downvote count: 0
has body: I have a weird exception that I cannot reproduce (come from bugsense): java.lang.ArrayIndexOutOfBoundsException: length=0; index=1 at java.util.HashMap.addNewEntry(HashMap.java:476) at java.util.HashMap.put(HashMap.java:408) How come put method on ConcurrentHashMap can throw ArrayIndexOutOfBoundsException ? (I tried also to use ConcurrentHashMap but without any luck) any ideas? EDIT: Adding code: final Map&lt;String, DataSource&gt; dataSources = new ConcurrentHashMap&lt;String, DataSource&gt;(); public void setDataSource(@Nonnull String field, @Nullable DataSource source) { // concurrent hash map doesnt allow null values if (field != null) { if (source != null) { dataSources.put(field, source); } else { dataSources.remove(field); } } } Many threads call this method simultaneously Thanks.
has comment: http://stackoverflow.com/comment/32338034
score: 3
tagged with: android
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/32409422
comment on: http://stackoverflow.com/a/21473534
type: Comment
has text: I don't think the OP is referring to tooltips.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21511076
tagged with: java
tagged with: rsa
has comment: http://stackoverflow.com/comment/32476273
type: Question
has comment: http://stackoverflow.com/comment/32478662
has comment: http://stackoverflow.com/comment/32476743
has comment: http://stackoverflow.com/comment/32476352
score: 0
tagged with: file-io
tagged with: cryptography
has body: So, I'm trying to encrypt and decrypt sound files using Java's RSA library. It works without a problem when I'm doing it with Strings, and I have studied RSA encryption, so I know what I'm doing. The problem must be with handling files or BigIntegers. Code for encrypting bytes in a file, then decrypting it and putting it in a new file: File sound = new File("F://java/Projekt kryptering/ljudtest.wma"); FileReader fr = new FileReader(sound); int fragSize = 200; ArrayList&lt;BigInteger&gt; encryptedFragments = new ArrayList&lt;BigInteger&gt;((int)(sound.length()/fragSize)); //create an aproximation on number of BigIntegers required byte byt; byte[] buf = new byte[fragSize]; int bufPos = 0; while((byt = (byte)fr.read()) != -1){ buf[bufPos++] = byt; if(bufPos == fragSize){ BigInteger soundFrag = new BigInteger(buf); System.out.println("unencrypted bigInt: " + soundFrag); encryptedFragments.add(soundFrag.modPow(pub.getPublicExponent(), pub.getModulus())); bufPos = 0; } } fr.close(); File decryptedSound = new File("F://java/Projekt kryptering/ljudtest2.wma"); decryptedSound.createNewFile(); FileWriter fw = new FileWriter(decryptedSound); for(BigInteger frag : encryptedFragments){ BigInteger decrypted = frag.modPow(priv.getPrivateExponent(), priv.getModulus()); System.out.println("decrypted frag " + decrypted); byte[] frags = decrypted.toByteArray(); for(byte fragg : frags) fw.write(fragg); } fw.close(); What happens when i try to do it is that the resulting file only becomes 276 bytes (the original file is 22,3kB). You can also see some Sytem.outs in the code and here's the result from those: unencrypted bigInt: &lt;Very long number&gt; unencrypted bigInt: &lt;Very long number 2&gt; unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypted bigInt: 0 unencrypt…
has comment: http://stackoverflow.com/comment/32475915
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32475977
has comment: http://stackoverflow.com/comment/32476704
has title: Encrypting sound files using RSA and Java
answer count: 0

http://stackoverflow.com/comment/32234687
score: 0
type: Comment
has text: ohh...means the render will keep help you check whether there consisting data in every cell or not right??
type: AnswerComment
comment on: http://stackoverflow.com/a/21374889

http://stackoverflow.com/q/21500213
has answer: http://stackoverflow.com/a/21500230
has answer: http://stackoverflow.com/a/21500682
accepted answer: http://stackoverflow.com/a/21500682
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21501828
has comment: http://stackoverflow.com/comment/32456381
type: Question
has title: Emulator crash, java.lang.OutOfMemoryError
downvote count: 0
has answer: http://stackoverflow.com/a/21500341
has comment: http://stackoverflow.com/comment/32456397
has body: For my app, I got a bunch of switch methods, for a drawer. After clicking 3 items on the drawer, the fourth one causes the app to crash and I get this error. java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840) at android.content.res.Resources.loadDrawable(Resources.java:2110) at android.content.res.Resources.getDrawable(Resources.java:700) at android.widget.ImageView.resolveUri(ImageView.java:638) at android.widget.ImageView.setImageResource(ImageView.java:367) at icykum.JasonSafaiyeh.cocg.troopScreen$PlaceholderFragment.onCreateView(troopScreen.java:636) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Troop Screen: public class troopScreen extends ActionBarActivity implements TroopNavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the …
tagged with: android
has comment: http://stackoverflow.com/comment/32456489
has answer: http://stackoverflow.com/a/21501828
has comment: http://stackoverflow.com/comment/32456411
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/32456502
tagged with: out-of-memory
upvote count: 2

http://stackoverflow.com/comment/32437804
type: AnswerComment
has text: `dataPath("")` paradoxically doesn't return the data folder of the sketch, but a folder [`null\data\ `] inside the IDE folder.
type: Comment
comment on: http://stackoverflow.com/a/21470833
score: 0

http://stackoverflow.com/q/21460461
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/43076519
tagged with: offline
upvote count: 5
has body: I have parsed the JSON Data in a listview and now I want to make it available offline. Is there a way to save the JSON data at the phone so that you can see the data if your phone is offline? Does someone knows an example? EDIT works now: public class MainActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new TheTask().execute(); } class TheTask extends AsyncTask&lt;Void, Void, JSONArray&gt; { InputStream is = null; String result = ""; JSONArray jArray = null; ProgressDialog pd; @Override protected void onPostExecute(JSONArray result) { super.onPostExecute(result); pd.dismiss(); ArrayList&lt;String&gt; list= new ArrayList&lt;String&gt;(); try { for(int i=0;i&lt;result.length();i++) { JSONObject jb = result.getJSONObject(i) ; String name = jb.getString("name")+" "+jb.getString("Art"); list.add(name); } } catch(Exception e) { e.printStackTrace(); } setListAdapter(new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_list_item_1, list)); } @Override protected void onPreExecute() { super.onPreExecute(); pd = ProgressDialog.show(MainActivity.this, "State", "Loading...", true); } @Override protected JSONArray doInBackground(Void... arg0) { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("***"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } // Convert response to string try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); writeToFile(result); } catch (Exception e) { Log.e("log_ta…
has answer: http://stackoverflow.com/a/23250625
has answer: http://stackoverflow.com/a/21460660
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34585952
downvote count: 0
has answer: http://stackoverflow.com/a/21460548
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/34585952
linked to: http://stackoverflow.com/q/14376807
type: Question
score: 5
has comment: http://stackoverflow.com/comment/32385641
linked to: http://stackoverflow.com/q/2850573
has title: How to Cache Json data to be available offline?
has answer: http://stackoverflow.com/a/55442851
tagged with: android
has answer: http://stackoverflow.com/a/21460508
accepted answer: http://stackoverflow.com/a/21460508

http://stackoverflow.com/q/21386601
score: 0
tagged with: environment-variables
tagged with: version
answer count: 1
has comment: http://stackoverflow.com/comment/32256355
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32297308
has answer: http://stackoverflow.com/a/21410657
has body: On the computers (running fedora) at my work R-2.15 is installed by default. I downloaded R-3.0.2 because I need several packages which are only available for R 3. When i try to call an Rscript from java using Runtime.getRuntime().exec(command); with command being the String Array {"/path/to/Rscript/3-0" "name/of/script" "...args..."} I get the error WARNING: ignoring environment value of R_HOME and it says that it couldn't load the needed packages. When i run the very same command in a terminal it works well. What is the difference between the call via java and the call on the console. And how can I fix it? EDIT 1: when i run my locally installed R-3 version, libPaths returns &gt; .libPaths() [1] "/home/&lt;homedir&gt;/.bin/R-3.0.2/library" But when i call an Rscript from Java, libPaths returns [1] "/home/&lt;homedir&gt;/R/x86_64-redhat-linux-gnu-library/2.15" [2] "/usr/lib64/R/library" [3] "/usr/share/R/library" [4] "/home/&lt;homedir&gt;/.bin/R-3.0.2/library" The problem seems to be that Java adds any environment variables that tell R to load packages from the 2.15 installation. How can i prevent this? EDIT 2: When i list all environment variables using the System.getenv(); method nothing R-related is shown, the same is the case when i list the environment variables using printenv in the terminal. But when i call Sys.getenv in R the variables R_HOME, R_LIBS, ... are defined. How are these defined?
tagged with: java
has title: Call R from java - different R version
type: Question
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/a/41507468
has comment: http://stackoverflow.com/comment/139971672
type: Answer
has body: Further to @StaxMan's answer, here's some code to prune the NullNodes: public static void stripNulls(JsonNode node) { Iterator&lt;JsonNode&gt; it = node.iterator(); while (it.hasNext()) { JsonNode child = it.next(); if (child.isNull()) it.remove(); else stripNulls(child); } }
answers question: http://stackoverflow.com/q/21511484
score: 9
upvote count: 9
downvote count: 0

http://stackoverflow.com/comment/32464559
score: 1
comment on: http://stackoverflow.com/q/21503624
type: Comment
type: QuestionComment
has text: This might clear some doubts - http://www.buggybread.com/2013/07/java-importance-of-abstract-classes-and.html

http://stackoverflow.com/comment/32402047
comment on: http://stackoverflow.com/a/21469060
type: AnswerComment
has text: I don't. I had stated that at the original post, and a comment or two. Just trying to learn what I can. The more knowledge, the better.
score: 0
type: Comment

http://stackoverflow.com/a/21433780
accepted answer of: http://stackoverflow.com/q/21433374
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32338199
has body: Throwing an exception from a method like actionPerformed is forbidden by the langage semantic. Even if it would have been authorized, what do you think the main event handling thread will be able to do with such an exception ? What you need is to re-think the way your interface works. For example, if an action is forbidden then your interface must show it, by disabling objects for example. It is much more ergonomic to not let the user be able to click on a button than to let it click and send him some feedback that his action was bad. In more complex scenarii you just have to let some modal dialog appears to inform the user that what he asked is impossible for the moment. This may be the result of some exception thrown during your event handler, but you catch it not throw it: ... actionPerformed(...) { if (someConditionOccured) { JOptionPane.showMessageDialog(...); } else { // do what you want on normal condition } Now the that could be something like : ... actionPerformed(...) { try { // something } catch (...) { JOptionPane.showMessageDialog(...); } You can use any other suitable dialog.
answers question: http://stackoverflow.com/q/21433374
has comment: http://stackoverflow.com/comment/32338453
has comment: http://stackoverflow.com/comment/32339651
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32401804
type: Answer

http://stackoverflow.com/a/21473943
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21472314
type: Answer
upvote count: 1
has body: At the high level, you just need to take care of these things: - Better have the images sliced for either XHDPI (720x1280) OR XXHDPI (1080x1920) resolution and keep them in respective folders. XHDPI images into drawable-xhdpi and XXHDPI images into drawable-xxhdpi folder. One set of image slices are enough. - You don't need to write different XML layouts for the same screen if you are not supporting Tablets (except for very rare times) - Try to avoid hard coding the android:layout_width &amp; android:layout_height parameters. Use wrap_content, fill_parent OR match_parent. - Try to avoid keeping any image slices inside simple drawable folder instead keep inside specific drawable folders like drawable-xhdpi , drawable-hdpi etc. - Try to use, color codes &amp; 9 patch images as much as possible instead of using images for everything which will reduce the build size and also helps in avoiding OutOfMemoryException. - Inside simple drawable folder, keep all your XML drawables like background of a button with separate images for clicked &amp; focused states etc. If you follow these steps, you don't need to worry about supporting multiple screen resolutions for most of the cases.

http://stackoverflow.com/q/21496764
has comment: http://stackoverflow.com/comment/32451569
answer count: 0
has title: Good way for getting metadata from a Database?
linked to: http://stackoverflow.com/q/12599412
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5180339
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32455792
has comment: http://stackoverflow.com/comment/32450410
tagged with: java
has body: I have a swing application that creates a JTable mapped to a table in sqlserver database, So far I've used JDBC to retreive the metadata for the table and then recreate it in my java application as a JTable. This is the code that retrieves the metadata public ResultSetMetaData getMetaData(String table) { // Load database driver if not already loaded try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); // Establish network connection to database Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=DBank;integratedSecurity=tr ue"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT TOP 1 * FROM " +table); return rs.getMetaData(); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } return null; } And it works fine, But now I want to transfer all of my connectivity to EJB JPA, So my question is, What would be a good way to retrieve metadata from the DBs' table using JPA if that's even possible?
tagged with: ejb
tagged with: jpa
tagged with: persistence
score: 0
linked to: http://stackoverflow.com/q/8951053

http://stackoverflow.com/a/37985832
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/68185387
upvote count: 0
type: Answer
has body: Depends on the solution listed above, I've came into this MapAdapter that addresses both marshaling and unmarshalling process. @XmlType public class MapWrapper{ private List&lt;JAXBElement&lt;String&gt;&gt; properties = new ArrayList&lt;&gt;(); public MapWrapper(){ } @XmlAnyElement public List&lt;JAXBElement&lt;String&gt;&gt; getProperties() { return properties; } public void setProperties(List&lt;JAXBElement&lt;String&gt;&gt; properties) { this.properties = properties; } @Override public String toString() { return "MapWrapper [properties=" + toMap() + "]"; } public Map&lt;String, String&gt; toMap(){ //Note: Due to type erasure, you cannot use properties.stream() directly when unmashalling is used. List&lt;?&gt; props = properties; return props.stream().collect(Collectors.toMap(MapWrapper::extractLocalName, MapWrapper::extractTextContent)); } @SuppressWarnings("unchecked") private static String extractLocalName(Object obj){ Map&lt;Class&lt;?&gt;, Function&lt;? super Object, String&gt;&gt; strFuncs = new HashMap&lt;&gt;(); strFuncs.put(JAXBElement.class, (jaxb) -&gt; ((JAXBElement&lt;String&gt;)jaxb).getName().getLocalPart()); strFuncs.put(Element.class, ele -&gt; ((Element) ele).getLocalName()); return extractPart(obj, strFuncs).orElse(""); } @SuppressWarnings("unchecked") private static String extractTextContent(Object obj){ Map&lt;Class&lt;?&gt;, Function&lt;? super Object, String&gt;&gt; strFuncs = new HashMap&lt;&gt;(); strFuncs.put(JAXBElement.class, (jaxb) -&gt; ((JAXBElement&lt;String&gt;)jaxb).getValue()); strFuncs.put(Element.class, ele -&gt; ((Element) ele).getTextContent()); return extractPart(obj, strFuncs).orElse(""); } private static &lt;ObjType, T&gt; Optional&lt;T&gt; extractPart(ObjType obj, Map&lt;Class&lt;?&gt;, Function&lt;? super ObjType, T&gt;&gt; strFuncs){ for(Class&lt;?&gt; clazz : strFuncs.keySet()){ if(clazz.isInstance(obj)){ return Optional.of(strFuncs.get(clazz).apply(obj)); } } return Optional.empty(); } } public class MapAdapter extend…
answers question: http://stackoverflow.com/q/21382202

http://stackoverflow.com/a/21537381
downvote count: 0
type: Answer
has body: In general, a single producer for all topics will be more network efficient. If the kafka client sees more than one topic+partition on the same Kafka Node, it can send messages for both topic+partitions in a single message. Kafka optimizes for message batches so this is efficient. In addition, your web servers only need to maintain at-most one tcp connection to each Kafka node, instead of one connection per producer, per node. For more info on Kafka's design: https://kafka.apache.org/documentation.html#design As you mention in comments, lock contention may become a limiting factor, YMMV.
accepted answer of: http://stackoverflow.com/q/21376715
answers question: http://stackoverflow.com/q/21376715
score: 12
upvote count: 12
type: AcceptedAnswer

http://stackoverflow.com/q/21373837
tagged with: java
has comment: http://stackoverflow.com/comment/32232517
tagged with: eclipse
type: Question
tagged with: jsp
has body: All of a sudden as I accidentally remove a jar file from maven repository .m2 folder(I am not sure it is relevant) and Eclipse complaint about this error message to all projects. How can I clean this up? I can see if I set STS/Eclipse as "Build Automatically" then if I make any change to the application then the project can rebuild the update, but if I choose to "clean.." and make clean build of the whole project then this error start to kick out.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32232534
favorite count: 0
has title: Eclipse: All projects in the workspace start to give An internal error occurred during: "Validating XXXX" NullPointer Exception
has comment: http://stackoverflow.com/comment/32232935
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33632968
tagged with: spring
has comment: http://stackoverflow.com/comment/32232482
downvote count: 0
has comment: http://stackoverflow.com/comment/32232981
score: 1

http://stackoverflow.com/a/21455009
downvote count: 0
has comment: http://stackoverflow.com/comment/32376244
type: Answer
answers question: http://stackoverflow.com/q/21453840
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32376499
has comment: http://stackoverflow.com/comment/32377781
accepted answer of: http://stackoverflow.com/q/21453840
has body: So far, I see two problems: param* A name test in XPath doesn't work the same way as a glob. Broadly speaking, you either match a name completely, or you use * to match any node of the principal node type for that axis (normally an element). As such, param* does not match things like param, param0, param-something-else, it's just an invalid expression. /[ You can't have a predicate filtering nothing. A nodeset must be matched by a nodetest first, then filtered by a predicate. There are two possibilities here: The / is superfluous and must be removed (if you are trying to use the predicate to filter the nodeset returned by the expression preceding the /). A nodetest must be inserted after the /, (if you are trying to filter the children or descendants of nodes within that nodeset).
has comment: http://stackoverflow.com/comment/32376920
type: AcceptedAnswer

http://stackoverflow.com/comment/32362100
comment on: http://stackoverflow.com/q/21442242
score: 0
type: QuestionComment
type: Comment
has text: I corrected the title. I had written pixel instead of point. I am trying to figure out how to correctly create a line from 2 points on a canvas. Currently, I cannot make sense of the behavior of the line on my canvas.

webchromeclient
tag name: webchromeclient
tags question: http://stackoverflow.com/q/21455763
type: Tag

http://stackoverflow.com/comment/32202383
has text: Every way you can imagine. You have raw sockets to your disposal you could write your data as Word files onto a virtually mounted NAS disk.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21356973

http://stackoverflow.com/a/21353132
has body: You have not initialised timePicker1 in your Beregning activity. Add the initCommonGui() method in your Beregning class and call it from the onCreate method before calling setCurrentTimeOnView().
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/21352851
has comment: http://stackoverflow.com/comment/32195352
has comment: http://stackoverflow.com/comment/32195147
has comment: http://stackoverflow.com/comment/32195046
type: Answer
has comment: http://stackoverflow.com/comment/32195390
upvote count: 1
has comment: http://stackoverflow.com/comment/32195319
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21352851

http://stackoverflow.com/q/21479580
score: 3
has answer: http://stackoverflow.com/a/21481473
tagged with: jsf
upvote count: 3
answer count: 2
has body: It has been some hours I'm working on this but still I haven't figured out what is the right way of using JPA with JSF. I have a session scoped managed bean that can do a lot of things, and one of them is persisting some entity objects. At the beginning, I created a producer method, request scoped, that build my EntityManager objects. Anyway a read here that injecting a requested scoped bean into a session scoped ones is done wrapping that instance into an Instance object. Done. But when I try to use that EM I got a transaction required exception. Keep on reading on the internet someone tells that I have to inject the EM directly into my managed beans using the PersistenceContext annotation. Anyway I thought it has more sense using a persistenceUnit annotation and creating my em inside my methods where I needed them. Injection works, but I still get a transaction required exception when I try to persist something! So here I am asking: what is the right way of doing this? edit: I'm using Jboss eap 6.2 using default settings. I'm deploying my data source using a xml file inside WEB-INF, so I'm using JTA.
has comment: http://stackoverflow.com/comment/32419563
tagged with: java
tagged with: hibernate
has title: JPA and JSF: right way of injecting EntityManager
accepted answer: http://stackoverflow.com/a/21481473
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/21480055
has comment: http://stackoverflow.com/comment/32420024
has answer: http://stackoverflow.com/a/21480055
favorite count: 0
tagged with: cdi
type: Question

http://stackoverflow.com/comment/32415471
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21477254
score: 0
has text: In Java you don't have to worry about "common" memory leaks... The in-built garbage Collector will take care of it...

http://stackoverflow.com/q/21356378
has comment: http://stackoverflow.com/comment/32200844
tagged with: android
type: UnansweredQuestion
tagged with: android-actionbar
has answer: http://stackoverflow.com/a/32923752
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32201018
has title: Android adding action buttons problems
has comment: http://stackoverflow.com/comment/32200873
type: Question
has body: I tried to add two action buttons on the action bar, for visibility one is defined as: android:showAsAction="ifRoom" another one is defined as: android:showAsAction="never" The problem is I can see the ic_action_search icon but I could not see the ic_action_overflow icon. This is the main_activity_actions.xml in menu folder: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:MyFirstApp="http://schemas.android.com/apk/res-auto" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" MyFirstApp:showAsAction="ifRoom" /&gt; &lt;!-- Settings, should always be in the overflow --&gt; &lt;item android:id="@+id/action_settings" android:icon="@drawable/ic_action_overflow" android:title="@string/action_settings" MyFirstApp:showAsAction="never" /&gt; &lt;/menu&gt; and this is the Java code that includes the buttons: @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_activity_actions, menu); return super.onCreateOptionsMenu(menu); //return true; } public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_search: // openSearch(); return true; case R.id.action_settings: // openSettings(); return true; default: return super.onOptionsItemSelected(item); } } So whats wrong with my code? cheers
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32200946
favorite count: 0

http://stackoverflow.com/a/21498188
has comment: http://stackoverflow.com/comment/32453119
score: 0
answers question: http://stackoverflow.com/q/21497720
has body: I don't think so, how would it know that this line is the 10'th line if it hadn't read the first 9 ?. But you can read the file once,store it in an ArrayList or some Data Structure and than access each line alone. You can store line 1 in index ,line 2 in index 2...
type: Answer

http://stackoverflow.com/a/21491113
has comment: http://stackoverflow.com/comment/114445127
upvote count: 5
has comment: http://stackoverflow.com/comment/32441642
type: Answer
has comment: http://stackoverflow.com/comment/38195679
has comment: http://stackoverflow.com/comment/32442882
has comment: http://stackoverflow.com/comment/114476534
downvote count: 0
has comment: http://stackoverflow.com/comment/32441986
has comment: http://stackoverflow.com/comment/114477186
has comment: http://stackoverflow.com/comment/32440848
has comment: http://stackoverflow.com/comment/32441719
has comment: http://stackoverflow.com/comment/32441764
has comment: http://stackoverflow.com/comment/32440791
score: 5
has body: I would change default sms app on Android 4.4.2 You cannot change the default SMS app. You can, however, ask the user to change the default SMS app, using Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT. This is covered in the official blog post on the SMS changes in Android 4.4.
answers question: http://stackoverflow.com/q/21491076
has comment: http://stackoverflow.com/comment/114445755
has comment: http://stackoverflow.com/comment/32442854

http://stackoverflow.com/comment/32412889
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21475613
has text: Why would you need to do that?

multithreading
tags question: http://stackoverflow.com/q/21429428
tags question: http://stackoverflow.com/q/21426888
tags question: http://stackoverflow.com/q/21496634
tags question: http://stackoverflow.com/q/21360642
tags question: http://stackoverflow.com/q/21359813
tags question: http://stackoverflow.com/q/21357481
tags question: http://stackoverflow.com/q/21359691
tags question: http://stackoverflow.com/q/21479403
tags question: http://stackoverflow.com/q/21354409
type: Tag
tags question: http://stackoverflow.com/q/21399270
tags question: http://stackoverflow.com/q/21350064
tags question: http://stackoverflow.com/q/21405713
tags question: http://stackoverflow.com/q/21481899
tags question: http://stackoverflow.com/q/21435403
tags question: http://stackoverflow.com/q/21491215
tags question: http://stackoverflow.com/q/21406671
tags question: http://stackoverflow.com/q/21365894
tags question: http://stackoverflow.com/q/21369269
tags question: http://stackoverflow.com/q/21423642
tags question: http://stackoverflow.com/q/21359770
tags question: http://stackoverflow.com/q/21504681
tags question: http://stackoverflow.com/q/21471069
tags question: http://stackoverflow.com/q/21457378
tags question: http://stackoverflow.com/q/21425695
tags question: http://stackoverflow.com/q/21366491
tags question: http://stackoverflow.com/q/21375587
tags question: http://stackoverflow.com/q/21374188
tags question: http://stackoverflow.com/q/21460276
tags question: http://stackoverflow.com/q/21413432
tags question: http://stackoverflow.com/q/21365845
tags question: http://stackoverflow.com/q/21373295
tags question: http://stackoverflow.com/q/21453217
tags question: http://stackoverflow.com/q/21442322
tags question: http://stackoverflow.com/q/21485361
tags question: http://stackoverflow.com/q/21514255
tags question: http://stackoverflow.com/q/21433430
tags question: http://stackoverflow.com/q/21439355
tags question: http://stackoverflow.com/q/21429374
tags question: http://stackoverflow.com/q/21383345
tags question: http://stackoverflow.com/q/21356526
tags question: http://stackoverflow.com/q/21439745
tags question: http://stackoverflow.com/q/21428512
tags question: http://stackoverflow.com/q/21410988
tags question: http://stackoverflow.com/q/21386931
tags question: http://stackoverflow.com/q/21436570
tags question: http://stackoverflow.com/q/21421523
tags question: http://stackoverflow.com/q/21458625
tags question: http://stackoverflow.com/q/21514142
tags question: http://stackoverflow.com/q/21505370
tags question: http://stackoverflow.com/q/21481345
tags question: http://stackoverflow.com/q/21387486
tags question: http://stackoverflow.com/q/21416428
tags question: http://stackoverflow.com/q/21497658
tags question: http://stackoverflow.com/q/21380910
tags question: http://stackoverflow.com/q/21428508
tags question: http://stackoverflow.com/q/21468814
tags question: http://stackoverflow.com/q/21418735
tags question: http://stackoverflow.com/q/21500772
tags question: http://stackoverflow.com/q/21364369
tags question: http://stackoverflow.com/q/21391520
tags question: http://stackoverflow.com/q/21356691
tags question: http://stackoverflow.com/q/21445224
tags question: http://stackoverflow.com/q/21445303
tags question: http://stackoverflow.com/q/21456643
tags question: http://stackoverflow.com/q/21500807
tags question: http://stackoverflow.com/q/21398631
tags question: http://stackoverflow.com/q/21512550
tags question: http://stackoverflow.com/q/21467439
tags question: http://stackoverflow.com/q/21416780
tags question: http://stackoverflow.com/q/21476104
tags question: http://stackoverflow.com/q/21373276
tags question: http://stackoverflow.com/q/21400851
tags question: http://stackoverflow.com/q/21413530
tags question: http://stackoverflow.com/q/21429621
tags question: http://stackoverflow.com/q/21440346
tags question: http://stackoverflow.com/q/21368450
tags question: http://stackoverflow.com/q/21438946
tags question: http://stackoverflow.com/q/21389765
tags question: http://stackoverflow.com/q/21384655

http://stackoverflow.com/comment/32206034
comment on: http://stackoverflow.com/q/21359044
score: 0
type: QuestionComment
has text: My head just exploded. It's a miracle I could type this comment.
type: Comment

http://stackoverflow.com/a/21388344
answers question: http://stackoverflow.com/q/21387686
type: AcceptedAnswer
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21387686
has body: The regex .{1,50} should work, though I'd suggest sticking with @Size unless you plan on making the validation more complex.
downvote count: 0

http://stackoverflow.com/q/21497866
possible better answer: http://stackoverflow.com/a/21497878
has answer: http://stackoverflow.com/a/21497878
has answer: http://stackoverflow.com/a/21497921
has comment: http://stackoverflow.com/comment/32452318
answer count: 4
downvote count: 2
tagged with: loops
has body: I want to ask user to insert operator and get the answer till user enters keys other than +,-,* or \ .I did the program like this.But it will not work properly.Its looping even for other keys.What is the problem with the coding? public static void main(String Args[]) throws IOException { InputStreamReader myrdr=new InputStreamReader(System.in); BufferedReader myBfr=new BufferedReader(myrdr); Scanner myScanner=new Scanner(System.in); String mathOp; float Res,Num1,Num2; System.out.print("Mathematical Operator :"); mathOp=myBfr.readLine(); Res=0; while(mathOp!="+"||mathOp!="-"||mathOp!="*"||mathOp!="\\") { System.out.print("Enter number one: "); Num1=myScanner.nextInt(); System.out.print("Enter Number Two: "); Num2=myScanner.nextInt(); switch(mathOp) { case "+": Res=Num1+Num2; break; case "-": Res=Num1-Num2; break; case "\\": Res=Num1/Num2; break; case "*": Res=Num1*Num2; break; default: { System.out.println("Programme Exits"); return; } } System.out.println("Answer is : "+Res); System.out.print("Mathematical Operator :"); mathOp=myBfr.readLine(); } }
has title: While loop dosnt work properly in my programm
type: AnsweredQuestion
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/32452691
accepted answer: http://stackoverflow.com/a/21497921
has answer: http://stackoverflow.com/a/21497925
type: Question
linked to: http://stackoverflow.com/q/513832
upvote count: 0
has answer: http://stackoverflow.com/a/21498120
has comment: http://stackoverflow.com/comment/32452377
favorite count: 0
tagged with: while-loop

http://stackoverflow.com/q/21504160
downvote count: 1
type: Question
tagged with: liferay
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32493816
has answer: http://stackoverflow.com/a/21535830
score: -1
favorite count: 0
has body: I do get the following exception in Liferay 6.1.20 EE when I try to get a JournalArticleDisplay with a template. The template exists, the JournalArticle exists - everything is fine ;) And the same code works in 6.1.30 EE ;) But as soon as I call this method in 6.1.20 EE, it breaks because companyId shall not be 0 : Caused by: com.liferay.portal.kernel.templateparser.TransformException: Unhandled exception at com.liferay.portal.kernel.templateparser.BaseTemplateParser.transform(BaseTemplateParser.java:135) at com.liferay.portal.kernel.templateparser.BaseTransformer.transform(BaseTransformer.java:163) at com.liferay.portlet.journal.util.JournalUtil.transform(JournalUtil.java:1036) at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.getArticleDisplay(JournalArticleLocalServiceImpl.java:1090) ... 87 more Caused by: com.liferay.portal.NoSuchCompanyException: No Company exists with the primary key 0 at com.liferay.portal.service.persistence.CompanyPersistenceImpl.findByPrimaryKey(CompanyPersistenceImpl.java:486) at com.liferay.portal.service.base.CompanyLocalServiceBaseImpl.getCompany(CompanyLocalServiceBaseImpl.java:385) at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122) at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118) at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211) at com.sun.proxy.$Proxy113.getCompany(Unknown Source) at com.liferay.portal.service.CompanyLocalServiceUtil.getCompany(CompanyLocalServiceUtil.java:181) at com.liferay.portal.kernel.templateparser.BaseTemplateParser.getCompany(Bas…
tagged with: liferay-6
accepted answer: http://stackoverflow.com/a/21535830
type: AnsweredQuestion
tagged with: java
has title: Can´t get Liferay ArticleDisplay in 6.1.20 EE

http://stackoverflow.com/a/21424702
type: Answer
answers question: http://stackoverflow.com/q/21424560
upvote count: 1
score: 1
has body: Create a model class such as : public class Dimensions{ private double l; private double b; public Dimensions(double l, double b){ this.l=l; this.b=b; } public void setL(double l){ this.l=l; } public void setB(double b){ this.b=b; } public double getB(){ return this.b; } public double getL(){ return this.l; } } Now you can add in arraylist by the following way: ArrayList&lt;Dimensions&gt; shapes=new ArrayList&lt;Dimensions&gt;(); shapes.add(new Dimensions(2.5,3.5)); shapes.add(new Dimensions(5.6,6.5)); And access it by the following way: double l; double b; for(Dimensions dimensions:shapes){ l=dimensions.getL(); b=dimensions.getB(); //some more dimensions specific code goes here }
downvote count: 0

http://stackoverflow.com/a/21365192
has comment: http://stackoverflow.com/comment/32216968
type: Answer
has comment: http://stackoverflow.com/comment/32216858
has comment: http://stackoverflow.com/comment/32216895
has body: I think it's getting stuck at: if (row &gt;= 0 &amp;&amp; row &lt; m.length &amp;&amp; col &gt;= 0 &amp;&amp; col &lt; m[row].length) printPathWeights(m, row, col - 1, sum += m[row][col]); // Left if (row &gt;= 0 &amp;&amp; row &lt; m.length &amp;&amp; col &gt;= 0 &amp;&amp; col &lt; m[row].length) printPathWeights(m, row, col + 1, sum += m[row][col]); // Right It will perpetually keep jumping back and forth. And, as Miquel pointed out, why can't the paths go up? Solution: (Assuming paths may not cross themselves, otherwise the sum goes off to infinity) Keep track of where you've been. Pass that history to the next recursion. Add the value of the tile that you're on to the sum value that was passed as a parameter. If you're at the finish, print the sum. Else: Try to go in four possible directions. This will fail if there is no cell in that direction, IE you're at the edge. It will also fail if you've already been there. If you can't move anywhere, IE you're stuck, you return without doing anything.
score: 1
answers question: http://stackoverflow.com/q/21365112
has comment: http://stackoverflow.com/comment/32216511
has comment: http://stackoverflow.com/comment/32216817
upvote count: 1
has comment: http://stackoverflow.com/comment/32216701
has comment: http://stackoverflow.com/comment/32216925
downvote count: 0

http://stackoverflow.com/comment/32221444
comment on: http://stackoverflow.com/q/21367795
score: 0
has text: could you please post stacktrace for your mvn build with `-e`
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32301833
score: 0
has text: "I am not sure I want to put on my PATH %java_home%/bin before C:\Windows\System32" What happened when you tried exactly that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21412853

http://stackoverflow.com/a/21428605
has comment: http://stackoverflow.com/comment/32329504
has comment: http://stackoverflow.com/comment/32329349
has comment: http://stackoverflow.com/comment/32329246
has comment: http://stackoverflow.com/comment/32333619
type: AcceptedAnswer
downvote count: 0
has body: Update Because you seem to want an explanation for the specific case of "2 3 2" X increments i (now 1) Y increments i (now 2) X reads i (X loads 2) Y reads i (Y loads 2) Y prints the value previously loaded (prints 2) Z increments i, reads i, prints i (prints 3) X prints the value previously loaded (prints 2) The point is: System.out.print(" " + count) isn't atomic. The thread can be preempted after performing a volatile read and before printing the value. If you want to prevent duplicate values from being printed, you have to perform the volatile read inside the lock: public void increment() { int localCount; synchronized (lock) { count = count + 1; localCount = count; // volatile load } System.out.print(" " + localCount); } This wouldn't prevent values from being printed out of order though. In order to print them in order, without duplicates, you'd have to move the print into the lock as well. Old Answer The print statement is outside the lock. Consider the code running inside System.out.print(" " + count). A thread X increments i Thread X evaluates the print arguments and performs a volatile read on the count variable, and loads the value 2. Thread X is preempted by Thread Y, which increments i Thread Y loads i (which is now 3), calls the print method which runs to completion. Thread Y is preempted, and Thread X now runs print to completion, which prints 2. This would make the numbers show out of order, such as "3 2 4". Some numbers might also be repeated when: Thread X increments i (which is now 2) Thread Y increments i(which is now 3) Thread X prints i (which is 3) Thread Y prints i (which is 3)
type: Answer
answers question: http://stackoverflow.com/q/21428508
accepted answer of: http://stackoverflow.com/q/21428508
score: 7
has comment: http://stackoverflow.com/comment/32329562
upvote count: 7

http://stackoverflow.com/comment/32409117
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21472806
type: Comment
has text: @kapilchhattani Sure, you're right, I should/could have explained this. I just added that explanation to my answer. Thank you for pointing that out!

http://stackoverflow.com/q/21394345
answer count: 1
has answer: http://stackoverflow.com/a/21394404
tagged with: classloader
type: UnansweredQuestion
score: 0
tagged with: java
has title: Java image will not display when imported from source folder
tagged with: image
type: Question
has body: I am a beginner in coding, and I am experimenting with GUI objects. Using BlueJ, I ran into trouble when using images when I noticed that they would not display when I packed them into a .jar One of the solutions I read was to put the images in a "src" folder and import the sources in the classes where they're used. I attempted to use that method here. I had it working, but I modified some code and now I can't find what's wrong with it. import java.awt.*; import java.io.*; import javax.swing.*; public class getResources { public static void showPicture(int file) { String stringFile = String.valueOf(file); JFrame window = new JFrame("Picture Window"); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream("/" + stringFile + ".png"); JLabel picture = new JLabel(new ImageIcon("/" + stringFile + ".png")); JLabel indicate = new JLabel(); indicate.setText(stringFile); panel.add(indicate); panel.add(picture); window.getContentPane().add(panel, BorderLayout.CENTER); window.pack(); window.setLocationRelativeTo(null); window.setVisible(true); } }

gmail
type: Tag
tags question: http://stackoverflow.com/q/21401228
tags question: http://stackoverflow.com/q/21473679
tag name: gmail

http://stackoverflow.com/q/21359033
answer count: 2
tagged with: nullpointerexception
tagged with: random
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21359038
has title: Null Pointer Exception when trying to use (java.util.Random) in method - beginner Java
type: AnsweredQuestion
downvote count: 0
has body: I'm currently trying to write a very simple program to test the capabilities of the "Random" class (java.util.Random) in a few ways, however I receive a Null Pointer Exception error when trying to run. My code: import java.util.Random; public class RandomTester { public Random r; public RandomTester() { Random r = new Random(); } public void printOneRandom() { int s = 0; s = r.nextInt(256); //NULL POINTER EXCEPTION HERE System.out.println("Random 8-bit number: " + s); } public void printMultiRandom(int howMany) { for(int i=0 ; i&lt;howMany ; i++) { System.out.println("Random 8-bit number: " + r.nextInt(256)); } } } It works fine if I move the constructor from RandomTester() to either one of the methods but I was under the impression that writing it the above way should be okay. It may well just be I'm not quite grasping something fundamental or indeed that I should have instantiate the object elsewhere. Thank you for any help, there's no main method shown as I'm using BlueJ (a learner IDE). It's also my first time exploring some of the basic classes.
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21359065
type: Question
has answer: http://stackoverflow.com/a/21359065
accepted answer: http://stackoverflow.com/a/21359038

http://stackoverflow.com/comment/32261333
score: 0
type: AnswerComment
type: Comment
has text: I don't understand this "anonymous classes cannot be refered". Do you mean you can't refer to anonymous classes?
comment on: http://stackoverflow.com/a/21381385

classpath
tags question: http://stackoverflow.com/q/21470120
tags question: http://stackoverflow.com/q/21508913
tags question: http://stackoverflow.com/q/21360968
tags question: http://stackoverflow.com/q/21421969
tags question: http://stackoverflow.com/q/21417093
tags question: http://stackoverflow.com/q/21381607
tags question: http://stackoverflow.com/q/21470655
tags question: http://stackoverflow.com/q/21421465
tags question: http://stackoverflow.com/q/21350265
type: Tag
tag name: classpath
tags question: http://stackoverflow.com/q/21447520

http://stackoverflow.com/comment/32336668
comment on: http://stackoverflow.com/a/21430419
type: AnswerComment
score: 0
type: Comment
has text: Or #3 just access a variable in its scope which is exactly what he's doing.

http://stackoverflow.com/a/21362711
upvote count: 1
has body: Little update in toString() in the class GroceryList.In for each loop it should be items.toString() @Override public String toString(){ String retuurn = ""; for (GroceryItem items : item) { if(items != null){ retuurn += **items**.toString() + "\n"; } } return retuurn; } Also override the toString() in GroceryItem class. Hope this helps.
answers question: http://stackoverflow.com/q/21362417
downvote count: 0
has comment: http://stackoverflow.com/comment/32212277
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32213446
has comment: http://stackoverflow.com/comment/32213631

http://stackoverflow.com/a/21415041
has body: The idea to eliminate recursion is as follows: when all connections of a node get known value, that node is enqueued to execution. In your example, at the start these are nodes N1, N2, N7. Executor takes nodes ready for execution from the queue one by one, computes output value and passes it to the next connections, which may cause enqueueing another nodes etc. When the execution queue become empty, the result is ready. You can program executor and nodes yourself (200-300 lines of code), or take ready-made library. To search for libraries, look for "colored Petri net java implementation". There are numerous java implementations of Petri net engines available. I did not use any of them except for my own df4h-core. Start from FormulaTest.java which computes various mathematical formulas. You'll have to implement your own nodes which compute boolean operations.
type: Answer
answers question: http://stackoverflow.com/q/21413989
upvote count: 1
score: 1
downvote count: 0

awtrobot
tags question: http://stackoverflow.com/q/21377712
tags question: http://stackoverflow.com/q/21355201
tag name: awtrobot
type: Tag
tags question: http://stackoverflow.com/q/21465341
tags question: http://stackoverflow.com/q/21509463

http://stackoverflow.com/comment/32408047
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21472567
type: AnswerComment
has text: or else you could cast like getValue((float) 12.36565);

http://stackoverflow.com/comment/32352747
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21439675
score: 0
has text: @AaronMarcus: see Edit 3.

http://stackoverflow.com/q/21404761
tagged with: java
score: 0
type: Question
tagged with: jboss
has answer: http://stackoverflow.com/a/21406757
answer count: 1
linked to: http://stackoverflow.com/q/3683364
tagged with: logrotate
accepted answer: http://stackoverflow.com/a/21406757
has title: How to avoid log4j output external modification
type: AnsweredQuestion
has body: I had a request to find a solution for making a log file secure from editing from the user (not root user) running the JBoss instance of an application (Linux environment) First idea I had is to use the chattr +a from root user to allow only the appending of new raw in the log file. But the Log4j file is configured to rotate the file each day and for this reason I suppose that I should repeat the chattr command for each file created everyday. I also not sure that the past day file in its "append only" state can be zipped from rotation. Any suggestion or alternative way to proceed is welcomed.

http://stackoverflow.com/a/21351038
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: You are using the try-with-resources syntax that was introduced in Java 7. You need to change it to the Java 6 way. You could do something like this: PreparedStatement stm = null; ResultSet rs = null; for (String string : sql) { try { stm = con.prepareStatement(string); rs = stm.executeQuery(); while (rs.next()) { System.out.println(rs.getString("usuario_senha")); } } finally { if (rs != null) { rs.close(); } if (stm != null) { stm.close(); } } }
accepted answer of: http://stackoverflow.com/q/21351010
answers question: http://stackoverflow.com/q/21351010
score: 2

http://stackoverflow.com/a/21355846
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21355818
has body: Your ArrayList isn't typed, so everything coming from it is an Object. Conversely, Object doesn't have an isLight() method, hence the "cannot find symbol" error. To solve this, either type your ArrayList... private ArrayList&lt;Packet&gt; shipmentList = new ArrayList&lt;&gt;(); ... or cast to Packet when you use get: ((Packet)shipmentList.get(i)).isLight() Of the two options, typing the ArrayList is simpler and safer, since you don't have to remember to cast every time you're getting a value from it.
type: Answer
accepted answer of: http://stackoverflow.com/q/21355818
has comment: http://stackoverflow.com/comment/32199839
score: 2
upvote count: 2

http://stackoverflow.com/q/21464780
has body: I'm trying to understand variable declarations in Java. Actually, I'm trying to understand why you would not declare variables at the top of class, initiate them, and then use as needed. In the Headstart Java book it states local variables are declared within a method and initiated within the code block. I understand that aspect. My question is, if you know the variable, why would you not declare it at the beggining of the method, instead of waiting and declaring/initializing in the middle of code? Wouldn't that make code harder to read? ex: Class Foo { while.... blah blah int bar = 3 + dog.getsize(); }
answer count: 4
linked to: http://stackoverflow.com/q/2448843
tagged with: declaration
has answer: http://stackoverflow.com/a/21464888
has title: Declaring Variables in java within methods
has comment: http://stackoverflow.com/comment/32393504
has answer: http://stackoverflow.com/a/21464953
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21464872
has answer: http://stackoverflow.com/a/21464872
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21464900
linked to: http://stackoverflow.com/q/10204828
tagged with: variables
accepted answer: http://stackoverflow.com/a/21464888

http://stackoverflow.com/a/21467089
answers question: http://stackoverflow.com/q/21466952
has body: You need to add the MySQL Connector JAR, then you can connect like this, it is only a snippet! URL, USERNAME and PASSWORD are Stringconstants with the Username/Password for accessing the DB and the URL is like "jdbc:mysql://localhost:3306/&lt;'DB_NAME'>" [...] try { Driver driver = (Driver) Class.forName("com.mysql.jdbc.Driver").newInstance(); DriverManager.registerDriver(driver); connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); maybe this will help.
type: Answer
score: 0

http://stackoverflow.com/comment/32424355
comment on: http://stackoverflow.com/a/21482435
score: 0
has text: yes I think that the interviewer wants as answer that you can't use primitive types as keys
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32261673
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21390040
type: QuestionComment
has text: Can't you just call featureAt(i)? You might also try FeatureVector.this.featureat(i). Both of these suggestions assumes your inner class is non-static.

http://stackoverflow.com/comment/32246933
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21376306

http://stackoverflow.com/comment/32293705
type: QuestionComment
has text: Q1 After receive the data from controller, the services about the entity perform the validation and return to controller that return to client, so the validation ocurrs in the service layer. Q2 is about how can I process the response data from server.
comment on: http://stackoverflow.com/q/21407607
score: 0
type: Comment

http://stackoverflow.com/comment/32373280
has text: Thanks. I verified the details.They are 100% Identical..SQL Server Jar file
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21452931

http://stackoverflow.com/q/21465629
tagged with: rest
tagged with: exception
has answer: http://stackoverflow.com/a/21465746
accepted answer: http://stackoverflow.com/a/21465746
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Exception handling - gracefully exit
has body: I've a REST service which in turn consumes a SOAP WebService. Incase if i get an exception while calling the SOAP WS, what kind of exception to be thrown from REST service ? Will it be RuntimeException with http status code 500 ? Or should i gracefully exit by giving a proper error message and code as response to the caller, if so, what would be the http status code in this case ?
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21428213
tagged with: string
tagged with: hex
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32328768
linked to: http://stackoverflow.com/q/605891
has answer: http://stackoverflow.com/a/21428471
tagged with: java
type: Question
has body: how can be done in java, to check string to prompt error when string have special characters which have an EBCDIC value greater than hexadecimal “3F” or an ASCII value greater than hexadecimal “1F”. Occurrences of values EBCDIC “00” - “3F” and ASCII “00” - “1F” are not valid. sorry if my question repeated or confuse Thanks in advance
answer count: 1
tagged with: ascii
score: 0
has title: java string to filter based on particular ascii value

http://stackoverflow.com/a/21381193
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32252629
has comment: http://stackoverflow.com/comment/32252875
has comment: http://stackoverflow.com/comment/32253170
has comment: http://stackoverflow.com/comment/32250995
has body: The first step here is to give each cylinder a different color to allow you to see which one is which. Next: When you create a cylinder, then it's centered at the origin. Since you want to chain them at the end point, you need to move them accordingly: First, you need to move the cylinder (or its transformation matrix) by -half its height to virtually move the "cylinder origin" to it's end. The next step is that you need to apply the same transformation matrix to the end point (this time plus a full cylinder height), so it lines up with the actual end point. That said, I would suggest you create a helper function that can create a cylinder between two points. This would allow you to say: Point endPoint = cylinder(new Point(-1,.5,0), new Point(0,.5,0)) cylinder(endPoint, new Point(0,-.5,0)) ... or even create a helper function which accepts a list of points and creates all the cylinders between them.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21378362
has comment: http://stackoverflow.com/comment/32253110
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21378362

http://stackoverflow.com/comment/32295706
comment on: http://stackoverflow.com/q/21409397
type: Comment
type: QuestionComment
has text: @Funtik I am different user and that person is someone else I have written with my approach can you please advise on this.
score: 0

http://stackoverflow.com/a/21357064
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21356901
has body: You can simply change all your for loops to the form for (int i = 0; i &lt; count; i++) - this way the loops will only loop the numbers that were actually set, not all numbers in the array. BTW: If you ever need some variable-sized array in the future you can use a List (from the java.util package). In your example I would use an ArrayList&lt;Integer&gt;. This is a list that uses an array internally, but increases its size if the array gets too small (by creating a new array and copying the contents).
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21356901

http://stackoverflow.com/comment/32283605
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21402538
has text: Do you want to obtain this piece of information programmatically when handling the exception or only to view this information when debugging?

http://stackoverflow.com/comment/32216060
type: Comment
has text: Have you filed in the ticket on JIRA?. Link is on the web site of the plugin.
score: 0
comment on: http://stackoverflow.com/q/21364402
type: QuestionComment

http://stackoverflow.com/q/21481451
tagged with: android-networking
has comment: http://stackoverflow.com/comment/32422492
has answer: http://stackoverflow.com/a/21481543
has body: I have a login activity with to tabs. One for logging in and other one for signing up. I want to check network connection continuesly so I have coded a thread. I want to show a dialog when there is not a connection which says check your internet connection and try again, and there is a button for trying again. here is my code: package com.geniboys.sosyaaal; import java.util.Locale; import android.app.ActionBar; import android.app.AlertDialog; import android.app.FragmentTransaction; import android.content.Context; import android.content.DialogInterface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.ViewGroup; public class Logger extends FragmentActivity implements ActionBar.TabListener { /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which * will keep every loaded fragment in memory. If this becomes too memory * intensive, it may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; static boolean isBoxOpen = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logger); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setTitle("Sosyaaal"); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.act…
has comment: http://stackoverflow.com/comment/32422531
answer count: 1
favorite count: 0
upvote count: 2
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
has title: App crashes when trying to show AlertDialog in thread
type: Question
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/21481543

http://stackoverflow.com/comment/32398581
comment on: http://stackoverflow.com/a/21467295
type: Comment
score: 0
has text: it's not either-or. two sequential return statements are compile time error ( [unreachable statement error](http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.21) )
type: AnswerComment

http://stackoverflow.com/q/21412534
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32301533
has title: Why does my Java code not execute System.out.println?
upvote count: 7
has answer: http://stackoverflow.com/a/21412598
score: 3
has answer: http://stackoverflow.com/a/21412571
tagged with: java
has comment: http://stackoverflow.com/comment/32301254
has comment: http://stackoverflow.com/comment/32301365
type: Question
has answer: http://stackoverflow.com/a/21412548
downvote count: 4
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/21412676
has answer: http://stackoverflow.com/a/21412767
favorite count: 0
has body: I'm using the Netbeans IDE, and it has not detected any bugs. I'm just curious as to why this code is not executing. FYI this is Exercise 4.4 from "Think Java: How to think like a computer scientist." import java.lang.Math; public class Exercise { public static void checkFermat(int a, int b, int c, int n){ if ((Math.pow(a, n))+(Math.pow(b, n))==(Math.pow(c, n)) &amp;&amp; n!=2){ System.out.println("Holy smokes, Fermat was wrong!"); } else{ System.out.println("No, why would that work?"); } } public static void main(String args[]){ int a = 8; int b = 4; int c = 10; int n = 3; } }

http://stackoverflow.com/q/21379317
has body: I have an application based on eclipse RCP and have a problems log view in that. I am facing a problem that once the errors are being logged in my error view for an event listener. Now for another event listener, the errors in the error log view are getting appended to the previous error messages instead of refreshing the view and displaying it newly. Please tell me how to refresh the view or delete the previous errors if a listener is selected.
score: 0
has title: How to refresh problems log view for each event listener in eclipse RCP?
tagged with: view
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32242464
has comment: http://stackoverflow.com/comment/32242793
has comment: http://stackoverflow.com/comment/32242080
tagged with: java
tagged with: rcp
type: Question
has comment: http://stackoverflow.com/comment/32242175

http://stackoverflow.com/a/21467043
has comment: http://stackoverflow.com/comment/32399658
has comment: http://stackoverflow.com/comment/32400365
has comment: http://stackoverflow.com/comment/32398785
has comment: http://stackoverflow.com/comment/32398043
score: 0
has comment: http://stackoverflow.com/comment/32400028
has comment: http://stackoverflow.com/comment/32400634
has comment: http://stackoverflow.com/comment/32400771
answers question: http://stackoverflow.com/q/21466491
type: Answer
has body: Does your table have a column named _id? If not you might need to select the individual columns (which you should do anyway instead of select *) and alias your key primary key to be _id.
has comment: http://stackoverflow.com/comment/32398328

http://stackoverflow.com/q/21431448
has answer: http://stackoverflow.com/a/52268724
tagged with: java
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/32334353
type: Question
has answer: http://stackoverflow.com/a/21431885
has title: java.lang.illegalargumentexception:cannot set a null TableModel
downvote count: 0
has answer: http://stackoverflow.com/a/21431776
has comment: http://stackoverflow.com/comment/32333954
tagged with: jtable
possible better answer: http://stackoverflow.com/a/21431885
answer count: 3
tagged with: exception
score: 1
favorite count: 0
tagged with: swing
accepted answer: http://stackoverflow.com/a/21431776
has body: I have made a jframe where i have to provide the medicine name and manufacturer name,,then click the search button.. and it will fetch the data from the mysql database and show in the jtable. the jframe looks like this: but when i am giving only medicine name and clicking search button.its not fetching the data ,its just fetching the column names from the database..: and when i am giving both the values its giving :java.lang.illegalargumentexception:cannot set a null TableModel: My srch_btnActionPerformed method is: private void srch_btnActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: /*if((jTextField1.getText())!=null || (jTextField2.getText())!=null) {*/ String sql="select * from medicine where med_name=? or manufacturer_name=?"; try{ pst=conn.prepareStatement(sql); pst.setString(1, jTextField1.getText()); pst.setString(2,jTextField2.getText()); rs=pst.executeQuery(); if(rs.next()){ jTable1.setModel(DbUtils.resultSetToTableModel(rs)); } else { JOptionPane.showMessageDialog(null, "No entry with such names in DataBase!"); jTextField1.setText(null); jTextField2.setText(null); } } catch(Exception e) { JOptionPane.showMessageDialog(null,e); } /* */ } Please help..
type: AnsweredQuestion

http://stackoverflow.com/comment/32283145
comment on: http://stackoverflow.com/a/21399164
type: AnswerComment
score: 0
type: Comment
has text: Hi, a newbie in stackoverflow. Would this help? http://chat.stackoverflow.com/rooms/46214/android-issue-in-network

http://stackoverflow.com/comment/32351193
comment on: http://stackoverflow.com/a/21439744
type: AnswerComment
type: Comment
has text: he can use semaphores or monitors for this problem too. 1 step at a time. Understand how to use wait and notify and its disadvantage and hence he will look for other better solution
score: 0

http://stackoverflow.com/comment/32453219
has text: startActivity(i); doesn't make a different
comment on: http://stackoverflow.com/a/21497217
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21400917
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21400851
score: -1
has comment: http://stackoverflow.com/comment/32282909
has body: try this one count down timer http://developer.android.com/reference/android/os/CountDownTimer.html

http://stackoverflow.com/comment/33545320
type: Comment
comment on: http://stackoverflow.com/a/21353163
has text: Offtopic, put OP please don't accept all suggested edits... I hate roboreviewers!
score: 0
type: AnswerComment

http://stackoverflow.com/q/21356908
has answer: http://stackoverflow.com/a/21356972
has answer: http://stackoverflow.com/a/21356962
type: UnansweredQuestion
tagged with: input
upvote count: 1
has body: Scanner in = new Scanner(System.in); String err = "\nThat's not a card color!\n\n"; System.out.print("Is your card red, green or blue? "); String card = in.nextLine(); if ((!"red".equals(card))){ System.out.print(err); System.exit(0); } The user has to input a string that equals either 'red', 'green', or 'blue'. I have it working fine for just 'red', but how do I have it check MULTIPLE strings? Thank you all! It is now working. Sorry I am kind of new to Java. I tried an else if before but now that the System.out.print(err); System.exit(0); is in an else statement it is working perfectly!
has title: Reading and checking multiple strings from user input
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21357197
downvote count: 0
tagged with: string
favorite count: 0
tagged with: compare
score: 1
answer count: 4
has answer: http://stackoverflow.com/a/21356964

http://stackoverflow.com/a/21479009
accepted answer of: http://stackoverflow.com/q/21478811
has comment: http://stackoverflow.com/comment/32430388
answers question: http://stackoverflow.com/q/21478811
type: AcceptedAnswer
type: Answer
has body: The problem with your recursive approach that it is basically performs a DFS, so you always go in one direction, following the longest branch. But this branch is always decaying. Since you are also maintaining a traversed set - it falsely ensures that you don't visit the same vertex later on for the other branch (the other recursive call). There are 2 ways to solve this issue: More elegant and probably more efficient - change your algorithm from a DFS to BFS. change cells at distance 1 from the source, then cells at distance 2, and so on... Less elegant - but will require minimal changes to the code: change the stop condition of your algorithm, instead of if (traversed[x][z]) { return; } do something like if (heightMapping[x][z] > startHeight) { return; }. This will ensure you can update the height if it should be higher and work as intended. The BFS updating should be something like (pseudo-code): Q &lt;- new Queue() //or even better - priority queue that holds the highest point at the top Q.push((x,y,height) visited[width][depth]; //init as all false while Q.empty() == false: curr &lt;- Q.pop() if (sanity check for x&lt;0 , y&lt; 0 ,..): continue if visited[x][y] == true: continue if height &lt;= 0: //or some epsilon instead of 0 if there are floating point issues continue heights[x][y] = height visited[x][y] = true Q.push(x+1,y,calculateNewHeight(...)) ... //similarly for all directions
score: 3
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/32459438
score: 1
type: Comment
type: QuestionComment
has text: the concurrent collections do not use the synchronized keyword and are thread safe.
comment on: http://stackoverflow.com/q/21501808

http://stackoverflow.com/a/21365091
type: Answer
has comment: http://stackoverflow.com/comment/32218913
has comment: http://stackoverflow.com/comment/32218823
upvote count: 1
has body: In Java, double values are IEEE floating point numbers. Unless they are a power of 2 (or sums of powers of 2, e.g. 1/8 + 1/4 = 3/8), they cannot be represented exactly, even if they have high precision. Some floating point operations will compound the round-off error present in these floating point numbers. In cases you've described above : The sum of 0.1+0.1....8 times result 0.7999999999999999 whereas in second sum is result 0.8 thts y it result true.
answers question: http://stackoverflow.com/q/21364992
downvote count: 0
score: 1

http://stackoverflow.com/q/21408640
has answer: http://stackoverflow.com/a/21495452
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has body: Java, hibernate + oracle. Users are stored in datababase and have national characters in their names (ü, ß etc). Now I need to create a convenient search function. Example: when user type 'do', 'dö' or 'doe' then entry 'Fidörner' should be found. Currently there are only 3 rules like above one defined by business but I expect there will more. what are the recommended solutions? google search appliance? lucene? hibernate search? solr? custom text normalization (can it be done quickly)? any other tools?
has title: search with national / multilingual chars with java and oracle
downvote count: 0
answer count: 1
favorite count: 0
tagged with: multilingual
type: UnansweredQuestion
tagged with: oracle-database
tagged with: search-engine

http://stackoverflow.com/comment/32418212
type: AnswerComment
has text: would it be possible for you share an example Thanks in advance
type: Comment
comment on: http://stackoverflow.com/a/21478842
score: 0

http://stackoverflow.com/a/21506136
has comment: http://stackoverflow.com/comment/73022045
downvote count: 3
has comment: http://stackoverflow.com/comment/53490370
score: -3
answers question: http://stackoverflow.com/q/21506079
upvote count: 0
type: Answer
has body: Create a new method, and put your assert in that method, annotate that method @After @Test(expected = IllegalArgumentException.class) public void cdIntoNonExistantFolder() { cdTool.changeDirectory("nonexistant"); } @After public void after() { assertThat(cdTool.getStatusCode(), not(equalTo(0))); }

http://stackoverflow.com/comment/32237981
score: 0
type: QuestionComment
type: Comment
has text: Yes, it is done in the Event Dispatch Thread, when the user clicks on an add-product-button on a toolbar.
comment on: http://stackoverflow.com/q/21376426

http://stackoverflow.com/q/21425094
has comment: http://stackoverflow.com/comment/32326826
answer count: 0
type: UnansweredQuestion
tagged with: jsf
tagged with: java
tagged with: hyperlink
has comment: http://stackoverflow.com/comment/32323205
type: Question
has title: Handlings multiple hyperlink in an object in jsf datatable
has body: I have this situation were I need to have two display multiple hyperlink present in a single object. The code is as below public HashMap&lt;String, RowData&gt; createRowDataIndexFromTuple(HashMap&lt;String, String&gt; row, DbTableTupleDataSetManager manager, HashMap&lt;String, String&gt; ermObjectPrimaryNameMap, HashMap&lt;String, String&gt; ermWithDateDataFormatMap, String sqlQuery) throws IllegalDataSetStructureException { HashMap&lt;String, RowData&gt; index = new HashMap&lt;String, RowData&gt;(); boolean columnHyperlink = Boolean.FALSE; for (Map.Entry&lt;String, String&gt; entry : row.entrySet()) { String columnName = entry.getKey(); String changeTypeString = row.get(DataStoreUtils.CHANGE_TYPE_ATTRIBUTE_TYPE_NAME); String data = entry.getValue(); columnHyperlink = Boolean.FALSE; String dataColor = ""; String orgData = ""; String value="https://"; String delimitor=","; String delimitor1="\\n"; String tempData=""; String destinationString1=""; // final String lineSplit = System.getProperty("line.separator"); if (columnName.contains(Crdutil.getMDMConstants().get("HYPERLINK_COLUMN_CONSTANT_NAME")) || columnName.contains(Crdutil.getMDMConstants().get("HYPERLINK_COLUMN_CONSTANT_NAME"))) { columnHyperlink = Boolean.TRUE; if(null != data){ StringTokenizer token = new StringTokenizer(data, delimitor);//split the string into individual url's ArrayList&lt;String&gt; tokens = new ArrayList&lt;String&gt;(); String destinationString="\n"; while (token.hasMoreTokens()) { tokens.add(token.nextToken()); //create array list of url's } //check each url whether has http,https,ftp as part of web address,if not append it with https for (int i = 0; i &lt; tokens.size(); i++) { tempData = tokens.get(i); if (tokens.get(i) != null &amp;&amp; !tokens.get(i).isEmpty() &amp;&amp; !"http".equalsIgnoreCase(tokens.get(i) .toString().substring(0, 4)) &amp;&amp; !"ftp".equalsIgnoreCase(tokens.get(i) .toString().substring(0, 3)) &amp;&amp; !"https".equalsIgnoreCase(tokens.get(i) .toString().subst…
score: 0

http://stackoverflow.com/q/21418173
has comment: http://stackoverflow.com/comment/32311383
tagged with: class
has answer: http://stackoverflow.com/a/21418290
downvote count: 0
possible better answer: http://stackoverflow.com/a/21418219
favorite count: 0
has answer: http://stackoverflow.com/a/21419123
has answer: http://stackoverflow.com/a/21418219
has comment: http://stackoverflow.com/comment/32311462
tagged with: hierarchy
has comment: http://stackoverflow.com/comment/32311358
linked to: http://stackoverflow.com/q/7854084
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/21418264
tagged with: java
has title: Making an array of objects
accepted answer: http://stackoverflow.com/a/21419123
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/4930114
tagged with: arrays
has body: I have made a class called Fish: public class Fish { private String species; private int size; //Constructor public Fish(int x, String s) { size = x; species = s; } public String getSpecies() { return species; } public int getSize() { return size; } public String toString() { return String.format("A %dcm %s", size, species); } } And I have also started to make a class called pond that is meant to have an attribute called 'fish' that holds an array of Fish objects. I am unsure of how to do this. Here is my attempt so far. I am public class Pond { private int capacity; private Object[] fish; //This is what I am trying to initialize. list of Fish. private int numFish; //Capacity Constructor public Pond(int n, int c) { n = numFish; c = capacity; } public int getNumFish() { return numFish; } public boolean isFull() { boolean isFull = false; if (numFish &gt;= capacity) { isFull = true; } else { isFull = false; } return isFull; } public String toString() { return String.format("Pond with %d fish", numFish); } public void add(Fish aFish) { if (numFish &lt;= capacity) { numFish += 1; fish.add Fish; } else { numFish += 0; } } }

http://stackoverflow.com/q/21358828
has title: Interface, abstract class or another approach java
possible better answer: http://stackoverflow.com/a/21359000
has comment: http://stackoverflow.com/comment/32205469
accepted answer: http://stackoverflow.com/a/21358849
has body: I have objects Res1 and Res2. public class Res1 { public String foo1; public String foo2; } public class Res2 { public String foo3; public String foo4 } I also have an object Response public class Response { public ResMsg res; public String code; public String error; } Res1 and Res2 need to be of type ResMsg. Should I create an empty abstract class public abstract class ResMsg { } and have both Res1 and Res2 extend this class, or should I create an empty interface and then have them implement this interface. Having an empty interface or an abstract class seems like an odd thing. What is the best way to do this? Edit I am working on a web service that is passing data from one web service to another. In order to better troubleshoot end to end issues I want to create a common Response that will encapsulate responses like Res1 and Res2 (original responses that I am getting from the back-end), and add fields code and error.
score: 0
has comment: http://stackoverflow.com/comment/32205673
has comment: http://stackoverflow.com/comment/32205978
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21358849
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21359000
answer count: 2

http://stackoverflow.com/comment/32379746
type: Comment
type: QuestionComment
has text: If it's going to be readonly, why do you use a select?
comment on: http://stackoverflow.com/q/21457264
score: 0

http://stackoverflow.com/q/21428204
score: 0
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32328524
tagged with: inner-classes
has answer: http://stackoverflow.com/a/21430110
has title: class within a class,conflict of same data member in both these classes
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21428262
has body: class A { private int b; public A(int x) { b=x } public class B { int b; public B(int x) { b=x; } public void display() { System.out.println("b of outer class is"); //how can I refer to the b of class A? System.out.println("b of inner class is"+b); } } } There is a class defined within class,and is public,non static member of the outer class,now if there is a conflict between the outer class instance member and the inner class instance member that is with the same name how one can refer to the outer class instance data member.

http://stackoverflow.com/q/21436891
favorite count: 0
has body: I have been working on an android application project that uses HTTP Get to send and receive data from MySQL through a PHP file using JSON from Java. I have lately been running into some issues in theory behind best practices using HTTP Transport and passing Parameters via a URL. First Question: How should I be passing my data to my PHP Webservices ? Currently I am just passing the data through single parameters using key value pairs like so: myurl.com/retrieveinfo.php?user_id=453&amp;password=sha1-hash-value Should I be moving this type of request to append a JSON object onto the URL instead? like so: myurl.com/retrieveinfo.php?{\"users\":{\"username\":\"User1Name\" ,\"user_id\":453 , \"password\":\"sha1-hash-value\"}} Second Question: *How should I be handling the JSON Response from the Server ? Do I need to push this work off to a handler and make sure the UI Thread is not the one doing this work? * Currently I am just parsing the JSON using separate methods for each Object Type such as User.Class private void parseUserInfo(JSONObject response){ // Do all my Parsing for a User Object try{ JSONArray users = response.getJSONArray("users"); JSONObject user = users.getJSONObject(0); // Get the User info etc... }catch(JSONException ex){ ex.printStackTrace(); } } Notes.Class private void parseNotes(JSONObject response){ // Do all my Parsing for a Note Object try{ JSONArray notes = response.getJSONArray("notes"); for (int index = 0; index &lt; notes.length() ; index++) { JSONObject note = notes.getJSONObject(index); // Get all the note info etc... } }catch(JSONException ex){ ex.printStackTrace(); } } Third Question: I would like my PHP server files to only work for my Application. So what is the best way to secure my PHP files on my server so a request to my files wont go through if its run in a browser ? Should I be sending some temp key that only my application knows about ? Thanks
type: UnansweredQuestion
tagged with: android
tagged with: php
has title: Best Practice Using JSON to pass data from Java to PHP and PHP to Java Securely
score: 2
upvote count: 2
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21437540

http://stackoverflow.com/comment/32399818
type: Comment
type: QuestionComment
has text: try to use abstraction. You just need to create 1 activity and reuse it, sending the necessary data to show
comment on: http://stackoverflow.com/q/21467798
score: 0

soa
type: Tag
tags question: http://stackoverflow.com/q/21411524
tag name: soa
tags question: http://stackoverflow.com/q/21449450

http://stackoverflow.com/q/21395299
tagged with: android-bootstrap
favorite count: 0
upvote count: 2
tagged with: android
tagged with: maven
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21584976
tagged with: java
possible better answer: http://stackoverflow.com/a/21401470
accepted answer: http://stackoverflow.com/a/21584976
type: Question
has answer: http://stackoverflow.com/a/21401470
answer count: 2
downvote count: 0
has body: I am trying to set up my development environment for Android Bootstrap. I cloned the repo and then executed the maven command: "mvn package clean" but whenever I do get the following error message: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project android-bootstrap: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.6:resources: org/codehaus/plexus/util/Scanner I am using maven version 3.1.1, java version 1.7.0_51 How do I resolve this issue?
has title: Maven Android Issue
has comment: http://stackoverflow.com/comment/32272915

http://stackoverflow.com/comment/32411934
has text: It's the [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) algorithm.
score: 2
comment on: http://stackoverflow.com/q/21475147
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32191208
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21350862
has text: If I'm understanding correctly, you should be able to fix this by getting the application path at runtime, then prepending that to your script and file paths. You may also be able to load them as classpath resources. Can you provide an example of how you're using these files and scripts in your application?

http://stackoverflow.com/comment/32418595
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21479132
type: AnswerComment
has text: +1 for questioning the question.

http://stackoverflow.com/q/21503529
tagged with: android
has answer: http://stackoverflow.com/a/21503600
tagged with: java
tagged with: geolocation
type: Question
has body: I'm trying to translate the fused longitude/longitude coordinates into a street address, as per the tutorial here. Everything works great until this line (line is at the end): (new GetAddressTask(this)).execute(mLocation); Where it says "The constructor LocationServices.GetAddressTask(LocationServices.GetAddressTask) is undefined." I'm new to Java programming / Android in general, so if you could help me in laymans terms that'd be great. Here's the code: import java.io.IOException; import java.util.List; import java.util.Locale; import android.content.Context; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.location.LocationClient; public class LocationServices extends FragmentActivity implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener { private LocationClient mLocationClient; Location mCurrentLocation; private TextView mAddress; private ProgressBar mActivityIndicator; /* * Called by Location Services when the request to connect the * client finishes successfully. At this point, you can * request the current location or start periodic updates */ @Override public void onConnected(Bundle dataBundle) { // Display the connection status mCurrentLocation = mLocationClient.getLastLocation(); Toast.makeText(this, "Your location is " + mCurrentLocation, Toast.LENGTH_LONG).show(); } /* * Called by Location Services if the connection to the * location client drops because of an error. */ @Override public void onDisconnected() { // Display the connection status Toast.makeText(th…
score: 0
answer count: 1
has title: Android - Google Location Services - Constructor LocationServices.GetAddressTask is undefined
type: UnansweredQuestion

http://stackoverflow.com/q/21453634
tagged with: selenium-webdriver
tagged with: java
tagged with: iframe
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/32374497
has comment: http://stackoverflow.com/comment/32374571
has comment: http://stackoverflow.com/comment/32374718
tagged with: javascript
has comment: http://stackoverflow.com/comment/32374029
has body: Hi please provide me the solutions for below hmtl sippnet where i need to click on facebook icon and popup window will open but when clicked using selenium click action is not displaying any error but popup window is not appearing. please give me solution if you come have any. Html tag is as below: <iframe id="f3117c4afe0839e" class="fb_ltr" scrolling="no" name="feea6afdd270a" style="border: medium none; overflow: hidden; height: 20px; width: 78px;" title="Like this content on Facebook." src="http://www.facebook.com/plugins/like.php?api_key=&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D29%23cb%3Df1bb10fdb4eaa3c%26domain%3D%26origin%3Dhttp%253A%252F%252Fts.co.uk%252Ff3d88d5ccc0f77a%26relation%3Dparent.parent&colorscheme=light&extended_social_context=false&href=http%3A%2F%2Freasion.ui.co.uk%2Fbeauty%2Funlimited-chocolate-fondue-for-2%2F&layout=button_count&locale=en_US&node_type=link&sdk=joey&send=false&show_faces=false&width=90"> Like Thanks in advance
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21461791
has title: facebook login window is not populating when we click on facebook 'like' button in selenium webdrvier
type: UnansweredQuestion

http://stackoverflow.com/q/21377561
has comment: http://stackoverflow.com/comment/32239177
accepted answer: http://stackoverflow.com/a/21377689
score: 0
has comment: http://stackoverflow.com/comment/32239084
has comment: http://stackoverflow.com/comment/32239086
answer count: 1
has answer: http://stackoverflow.com/a/21377689
type: AnsweredQuestion
has body: I have some String variables: private String cur, last, avg, vol, shop; I have method which accept String and gives me some result: public void SomeMethod(String somestring) { //Here some action with `string` System.out.print(result) } So i want to put result into one of String variables, but this variable must be named as value of somestring in my method. Some method which compare somestring with existent variables names. Is such a thing even possible?
has comment: http://stackoverflow.com/comment/32239276
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32239149
has title: Set custom variables from method

http://stackoverflow.com/comment/32305594
type: AnswerComment
score: 0
has text: Ah! I don't think there's a way to disable that specific warning without annotating it or disabling all the other warnings. If you aren't going to modify the library source, the only workaround otherwise that I can think of would be to compile the library into a jar, and then simply linking against that jar. Or compile everything with two distinct javac tasks, one for the library, and one for the rest.
type: Comment
comment on: http://stackoverflow.com/a/21409516

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/21509301
tags question: http://stackoverflow.com/q/21479658
tags question: http://stackoverflow.com/q/21367871

http://stackoverflow.com/comment/32256079
type: Comment
type: QuestionComment
has text: The exception will tell you what line it's occurring on. Look at that line and consider all the object references and the operations being performed on them. One of those accounts for your NPE.
comment on: http://stackoverflow.com/q/21386822
score: 0

http://stackoverflow.com/a/21471482
has comment: http://stackoverflow.com/comment/32408868
has comment: http://stackoverflow.com/comment/32409248
score: 0
answers question: http://stackoverflow.com/q/21471457
has body: Have a look at http://jsonlint.com/ As JSON is a set of name/value pairs you will get this error Parse error on line 4: ...: [ "123123": { "not ----------------------^ Expecting '}', ',', ']' If you want to have dynamic keys for the name/value pairs you could always write out the JSON in your program logic (Not Jackson)
type: Answer

plugins
tags question: http://stackoverflow.com/q/21483254
tags question: http://stackoverflow.com/q/21478252
tags question: http://stackoverflow.com/q/21489134
tags question: http://stackoverflow.com/q/21382719
tag name: plugins
tags question: http://stackoverflow.com/q/21408429
type: Tag

http://stackoverflow.com/comment/32306548
type: Comment
has text: is there a resource that I could use to get a better understanding of java syntax? that's really what's messing me up. I know what I want to do and how I want to do it, but I don't know how to type it up in java syntax. I want to turn each letter of each word into an integer, have a for loop check each integer, and then shift it over. If the integer goes past z, I then want to go back to A.
comment on: http://stackoverflow.com/a/21412262
type: AnswerComment
score: 0

http://stackoverflow.com/a/21426602
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21426367
type: Answer
upvote count: 1
has body: This question does not relate to either java or jconsole. This is about terminal facilities. Putty is used to perform SSH connection. If the remote server is Unix like system you can use command screen to perform what you want. Take a look on Unix shell reference to learn how to use screen.
score: 1
answers question: http://stackoverflow.com/q/21426367
type: AcceptedAnswer

sensors
type: Tag
tags question: http://stackoverflow.com/q/21366987
tags question: http://stackoverflow.com/q/21357818
tag name: sensors
tags question: http://stackoverflow.com/q/21358663

http://stackoverflow.com/comment/32280844
comment on: http://stackoverflow.com/a/21381414
type: Comment
has text: @user1168608 Why do you have to close it? Why not simply update the content?
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32325186
comment on: http://stackoverflow.com/q/21416176
type: QuestionComment
has text: I am searching for an object model to map Geometry instances from SQL results. The difference between SQL/MM and SFS 1.2.1 is quite small, but there is a difference nevertheless. So for me it's not really about the features, but a match of the class hierarchy.
score: 0
type: Comment

http://stackoverflow.com/comment/32374193
comment on: http://stackoverflow.com/q/21451008
has text: I Just did FILE->EXPORT->JAVA->Runnable JAR FILE.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32305061
comment on: http://stackoverflow.com/a/21413939
has text: -1 You should not be creating a new JLabel. The idea of a renderer is to use a single component for all rendering.
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32291961
type: Comment
score: 0
type: AnswerComment
has text: Same thought process that led to my comment.
comment on: http://stackoverflow.com/a/21406669

http://stackoverflow.com/a/21386865
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: If you're to loop over str but delete from strb, you need to keep two indexes/pointers, one to str and one to strb. Try this. public class Test015 { public static void main(String a[]) throws Exception { String z = "111aaaa2222bbb"; System.out.println(kuisStringOp(z)); } public static String kuisStringOp(String str){ StringBuilder strb = new StringBuilder(str); int i = 0; int j = 0; for (i = 0; i &lt; str.length(); i++) { if(strb.charAt(j)&lt;'a'||strb.charAt(j)&gt;'z'){ strb.deleteCharAt(j); }else{ j++; } } return strb.toString(); } }
answers question: http://stackoverflow.com/q/21386764

http://stackoverflow.com/comment/32190655
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21350346
type: AnswerComment
has text: @rperson No. `static inner` classes are often called just `nested class`. And `non-static inner` classes are just called `inner class`.

http://stackoverflow.com/comment/32528617
type: Comment
has text: I'm afraid that's not possible to place action items left of the application icon and would again discourage you from doing this. You will only be able to do this using a custom view in your action bar, or replacing the action bar altogether with something else. As for removing the action bar for an activity, you can simply provide a non-Sherlock or ActionBar theme.
comment on: http://stackoverflow.com/a/21502044
type: AnswerComment
score: 0

http://stackoverflow.com/comment/69653592
type: QuestionComment
score: 1
has text: This is a good question, and it deserves to be reopened. In Java, `boolean` and `Boolean` are very different beasts; the people who flagged **duplicate** are probably unaware of this. Unfortunately, they voted on a subject they did not study enough.
comment on: http://stackoverflow.com/q/21509150
type: Comment

http://stackoverflow.com/a/21406696
type: Answer
accepted answer of: http://stackoverflow.com/q/21406483
answers question: http://stackoverflow.com/q/21406483
has body: In the first case, you have also provided the table name as a parameter. Prepared statements take the column names as parameters. You need to provide the table name in the statement while using prepareStatement
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/32247197
has text: What do you mean by archive? Do you just want to package them together? Perhaps a ZIP file with no compression?
comment on: http://stackoverflow.com/q/21382183
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32191079
comment on: http://stackoverflow.com/q/21350819
score: 0
type: QuestionComment
has text: Like the first Screenshot of this app: https://play.google.com/store/apps/details?id=com.virblue.mystudylife
type: Comment

http://stackoverflow.com/comment/32355872
comment on: http://stackoverflow.com/a/21443267
type: AnswerComment
type: Comment
score: 1
has text: True, I was trying to highlight the incorrect scope in the example by using `this` in mine but I see what you mean.

http://stackoverflow.com/comment/32272854
type: QuestionComment
has text: it's a kind of pointless question. If you need an array, you need an array...
type: Comment
comment on: http://stackoverflow.com/q/21395998
score: 5

http://stackoverflow.com/comment/32331715
comment on: http://stackoverflow.com/q/21429991
type: QuestionComment
type: Comment
score: 0
has text: key_ID KEY value pairs of type String

http://stackoverflow.com/comment/32209904
type: QuestionComment
comment on: http://stackoverflow.com/q/21361318
has text: the only string I am trying to match is : & quot;m& quot;:[& quot;value& quot;,569,& quot;time& quot;,\\{& quot;time& quot;:& quot;+00000001952-03-11 and it is without thw space between & and quot . the string actually has the "quot" word in it. But it is getting displayed as " when i given it along wid &
score: 0
type: Comment

http://stackoverflow.com/comment/32237196
has text: the XMLReader does parse the whole xml so i do not encode it myself. It doent return an öäü it does return some characters that cant be displayed with the font so i get some kind of squares for example. The font does have öäü i just checked it. Link to the reader: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils/XmlReader.java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21376258

http://stackoverflow.com/comment/32270514
type: Comment
comment on: http://stackoverflow.com/a/21371759
type: AnswerComment
has text: Its working on EMR !. But to run on windows should I actually install hadoop or just bulidng the plugin and importing JARS and then running the application is enough ?.
score: 0

http://stackoverflow.com/a/21444745
score: 0
answers question: http://stackoverflow.com/q/21394479
type: Answer
has body: This is not possible. The query is created independent of the parameters that are set later, it will not take the specific values into account. I don't see a possibility to build a JPQL query that takes care of both cases and delivers your desired result. So you have to check for null manually, i.e. in code. Either you build two queries that you choose dependent of the value of the parameter or you use the criteria API to dynamically build the query. In this case (if it stays this simple with only one parameter) the first variant is preferable; if you have a higher or variable number of parameters you should use the latter.

http://stackoverflow.com/q/21360085
has answer: http://stackoverflow.com/a/21360243
has comment: http://stackoverflow.com/comment/32208019
has title: Using for loop for an ArrayLIst in Java (Blue J)?
tagged with: foreach
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: for-loop
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/21360128
has body: Basically I've been having difficulty using a for loop to find the largest magnitude of an earthquake stored in an arraylist in class observatory. I get an error telling me that the variable "i" in my for loop cannot be found for the method to find the largest magnitude recorded by the observatory. class Observatory { private String name; private String country; private int yearStarted; private int area; private int runningTotal; private ArrayList&lt;Earthquake&gt; earthquakes; private ArrayList&lt;String&gt; observatories; Scanner userInput = newScanner(System.in); private double largestMag(ArrayList&lt;Earthquake&gt; earthquake, double magnitude) { if (earthquake == null || earthquake.isEmpty()){ return 0; } for (Earthquake quake : earthquake) { if (earthquake.get(0) &lt; earthquake.get(i)){ return earthquake.get(i); } if (earthquake.get(0) &gt; earthquake.get(i)){ return earthquake.get(0); } } } I know its something to do with the fact that in my earthquake class you add the earthquakes the array list is storing more than one piece of information? this is my earthquake class public class Earthquake { // instance variables - replace the example below with your own private double magnitude; private double latitude; private double longitude; private int yearOfEvent; private String position; private String details; public Earthquake() { magnitude = 0; latitude = 0; longitude = 0; yearOfEvent = 0; } public void setMagnitude(double magnitude) { this.magnitude= magnitude; } public double getMagnitude() { return magnitude; } public void setYear(int yearOfEvent) { this.yearOfEvent = yearOfEvent; } public int getYear() { return yearOfEvent; } public void setPosition(double latitude, double longitude) { this.latitude = latitude; this.longitude = longitude; } public String getPosition() { position = latitude + ", " + longitude; return position; } public String getDetails() { details = magnitude + " ," + latitude + "," + longitude + ","+ yearOfEvent; return details; } } I'm n…
tagged with: arraylist
upvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21376671
has comment: http://stackoverflow.com/comment/32282066
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/32282923
answers question: http://stackoverflow.com/q/21376629
type: Answer
accepted answer of: http://stackoverflow.com/q/21376629
upvote count: 4
has body: Beware that your OS is only aware of the total amount of memory java has reserved over the time (and java will not return that amount of memory easily AFAIK). However java may not be using all that memory at a given moment, so you can see differences between those two numbers. For example, if you launch your program like this java -Xmx512m -Xms256m ... Then your JVM will take 256 MB as soon as it starts (and the OS will tell you so, more or less). However, if you open your memory peek tool (be it visualvm, jconsole, etc.), it may show that you are using less than that (it is just you have not needed to use the whole of your reserved heap).

http://stackoverflow.com/comment/32294719
type: QuestionComment
comment on: http://stackoverflow.com/q/21408800
has text: What size is the file you are reading? java.lang.OutOfMemoryError is thrown when your computer runs out of memory because you are running really heavy programs in Java.
score: 0
type: Comment

http://stackoverflow.com/comment/32289423
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21405928
has text: what exception you faced write first.
score: 0

http://stackoverflow.com/q/21360220
upvote count: 1
has body: all I want to upload and import a large excel files having more than one million records in to my Java program. I can easily import small files using Apache POI in to my system , but when i starts with large files application throws and out of memory error, i searched google and found many threads on so , i tried everything but could not get around of this. can anybody give me solution for my particular problem, import time is not an issue for me, right now also i can bear with performance issue as well, just want to import this data in to my existing system without oem error. I have very good configuration on my system and java has enough memory to use so hardware is not an issue. Thanks
downvote count: 1
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/21360261
has comment: http://stackoverflow.com/comment/32208430
answer count: 1
favorite count: 0
has title: Large Excel File - Upload and Import - Java
tagged with: apache-poi
type: UnansweredQuestion

http://stackoverflow.com/comment/32449165
comment on: http://stackoverflow.com/q/21495995
score: 0
has text: What should `abcd!e` become?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21419150
type: Question
has comment: http://stackoverflow.com/comment/32313168
has comment: http://stackoverflow.com/comment/32313103
has comment: http://stackoverflow.com/comment/32313760
score: 0
has comment: http://stackoverflow.com/comment/32313275
linked to: http://stackoverflow.com/q/1359817
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32313159
has answer: http://stackoverflow.com/a/21419187
has body: Teaching myself Java, I reached an example problem that asks me to create a cash register program that will calculate the total change back to the customer in Dollars, Nickels, Quarters, Dimes, and pennies. I worked out the user input but getting the correct sub-units is tricky part. For example: it's was easy to write the line of code that returned $1 dollar back if the cost was $4 and amount tendered was $5. But the trouble I am having is putting how many dimes and pennies needed in the correct field. ex2: total cost $4.62, tendered: $5, change: $0.38 System.out.print("Enter the sale amount: $ "); double sale = user.nextDouble(); System.out.print("Enter the amount tendered by customer: $ "); double tendered = user.nextDouble(); double totalChange = (tendered - sale); System.out.printf("TOTAL CHANGE: $ %.2f\n", totalChange); dollars = totalChange/1; quarters = totalChange/25; dimes = totalChange/10; nickels = totalChange/5; pennies = totalChange/1; System.out.printf("DOLLARS: %.2f\n", dollars); System.out.printf("QUARTERS: %.2f\n", quarters); System.out.printf("DIMES: %.2f\n", dimes); System.out.printf("NICKELS: %.2f\n", nickels); System.out.printf("PENNIES: %.2f\n", pennies); I don't need the answer (because I want to learn and teach myself), but just need some advice on how to go about doing so. EDIT: What am I doing wrong with this algorithm: dollars = totalChange/1; dollars = (int)dollars; dl = totalChange % 1; quarters = dl/0.25; q = quarters % 0.25; quarters = (int)quarters; dimes = q / .10; d = dimes % .10; nickels = d / .5; n = nickels % .5; pennies = n / .1; n = pennies/ .1;
tagged with: java
has title: Java cash register: Getting change from in different subunits
has comment: http://stackoverflow.com/comment/32316997

http://stackoverflow.com/a/21477332
answers question: http://stackoverflow.com/q/21477199
score: 2
has body: Apologies that my answer is in .NET (as is the system.reactive tag); I am sure you can translate it though! If your IObservable&lt;IObservable&lt;Object&gt;&gt; is given by source then: source.Merge() .Subscribe(_ =&gt; {}, /* not interested in onNext */ () =&gt; /* onCompleted action here, called when all complete */); Note: This will break down if any of the streams error (causing the merged stream to terminate at that point), so you can also do this to swallow errors on the individual streams: source.SelectMany(x =&gt; x.Catch(Observable.Empty&lt;Object&gt;())) .Subscribe(_ =&gt; {}, /* not interested in onNext */ () =&gt; /* onCompleted action here, called when all complete */);
upvote count: 2
has comment: http://stackoverflow.com/comment/32725573
downvote count: 0
has comment: http://stackoverflow.com/comment/32729954
has comment: http://stackoverflow.com/comment/32723089
type: Answer
has comment: http://stackoverflow.com/comment/32726486

http://stackoverflow.com/comment/32340212
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21434453
type: QuestionComment
has text: so I added a few logs. The app gets stuck at Cursor c = sampleDB.rawQuery("SELECT id,welawa,lati,longi FROM " + TABLE_LOCATIONS + " LIMIT 5", null); .

http://stackoverflow.com/q/21452894
score: 0
has answer: http://stackoverflow.com/a/21453721
has body: I am trying to send data to Action in Json format through Ajax call. But i am getting following error. 1. No object in the CompoundRoot has a publicly accessible property named 'PersonDetailsAction' (no setter could be found). 2. Error setting expression 'PersonDetailsAction' with value 'actions.PersonDetailsAction@680e6039' My attempt is following: Struts.xml <interceptor name="jsonToPOJO" class="interceptors.FromJsonInterceptor" /> /welcome.html home.html function send() { var jsonData = { "firstName" : "John", "lastName" : "Smith", } $.ajax({ url : './PersonDetailAction.action', type : 'post', data: JSON.stringify(jsonData), contentType: "application/json; charset=utf-8", traditional: true, success : function(data) { document.getElementById("result").innerHTML = data; }, }); } PersonDetailsAction.java public class PersonDetailsAction { String firstName, lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String execute(){ return "success"; } } FromJsonInterceptor public String intercept(ActionInvocation actInvc) throws Exception { ServletRequest request = ServletActionContext.getRequest(); Gson gsonObject = new Gson(); PersonDetailsAction pdAction; pdAction = gsonObject.fromJson(request.getReader(), PersonDetailsAction.class); System.out.println(pdAction.getFirstName()); System.out.println(pdAction.getLastName()); ValueStack vs = actInvc.getStack(); vs.setValue("PersonDetailsAction", pdAction); return actInvc.invoke(); } StackTrace: No object in the CompoundRoot has a publicly accessible property named 'PersonDetailsAction' (no setter could be found). - [unknown location] com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:106) ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2332) ognl.ASTProperty.setValueBody(AST…
accepted answer: http://stackoverflow.com/a/21453721
has title: No object in the CompoundRoot has a publicly accessible property named
answer count: 1
tagged with: interceptor
type: AnsweredQuestion
tagged with: java
tagged with: struts
type: Question

http://stackoverflow.com/comment/32336630
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21432733
has text: i have List<Contact>.. now i want to remove the duplication using Contact.write() method... this method returns the contact with all its contents as a string..
score: 0

http://stackoverflow.com/comment/32249197
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21383219
type: Comment
has text: Thank you for the answer! i didn't have this problem with C++. So the solution is to remove the creation of the array from the constructor and add it to the method?

http://stackoverflow.com/q/21383967
tagged with: helios
tagged with: eclipse
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/36381083
has title: Java 1.7.0_45 Update and Eclipse Helios incompatibility issues
has comment: http://stackoverflow.com/comment/32250631
type: AnsweredQuestion
has body: Anyone else getting this error after Java update to 1.7.0_45 ? running Eclipse Helios on Windows 8 - x64
has comment: http://stackoverflow.com/comment/32251584
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/36381083
has comment: http://stackoverflow.com/comment/32251596
has comment: http://stackoverflow.com/comment/32250763

http://stackoverflow.com/comment/32331034
score: 2
has text: This indentation for the `;` is very ugly.
comment on: http://stackoverflow.com/q/21429749
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32214904
type: QuestionComment
has text: username is unique in database. The code makes it so I can alert the user to whats going on. Make an answer if you can help with how to get the database to search
comment on: http://stackoverflow.com/q/21364204
score: 0
type: Comment

http://stackoverflow.com/a/21435627
has body: What is your hibernate session creation strategy. Is your code using the same session again and again? Instead of : protected Session getSession() { return sessionFactory.getCurrentSession(); } try opening a new session for each request: protected Session getSession() { return sessionFactory.openSession(); } Each session has a session cache to which all retrieved or persisted objects are added. If you keep on using the same session for querying many-many entities, it 'may' lead to such a scenario. Give the change a try and do let us know if helps. The right way Use one of the performance monitoring tools to see what's really causing the issue: http://java.dzone.com/articles/java-performance-troubleshooti-0
upvote count: 2
type: Answer
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32350784
answers question: http://stackoverflow.com/q/21435250

http://stackoverflow.com/q/21352797
tagged with: navigation-drawer
tagged with: instantiationexception
tagged with: java
has title: How to Add Navigation Drawer in all Activities
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21353162
has body: I have a navigation Drawer in my App.Now i need to make that drawer appear in all my activities. I saw many questions similar to this &amp; found a Solution https://stackoverflow.com/a/4922740/2781359 But I tried it in my App.Then it throws an Exception. So Help me in the Right Direction :) Thanks for your Help ... Logcat 01-25 22:35:14.062: E/AndroidRuntime(17091): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ControllerDroid.client/com.ControllerDroid.client.activity.ControlActivity}: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.app.ActivityThread.access$800(ActivityThread.java:145) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.os.Handler.dispatchMessage(Handler.java:102) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.os.Looper.loop(Looper.java:136) 01-25 22:35:14.062: E/AndroidRuntime(17091): at android.app.ActivityThread.main(ActivityThread.java:5081) 01-25 22:35:14.062: E/AndroidRuntime(17091): at java.lang.reflect.Method.invokeNative(Native Method) 01-25 22:35:14.062: E/AndroidRuntime(17091): at java.lang.reflect.Method.invoke(Method.java:515) 01-25 22:35:14.062: E/AndroidRuntime(17091): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781) 01-25 22:35:14.062: E/AndroidRuntime(17091): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 01-25 22:35:14.062: E/AndroidRuntime(17091): at dalvik.system.NativeStart.main(Native Method) 01-25 22:35:14.062: E/AndroidRuntime(17091): Caused by: java.lang.UnsupportedOperatio…
tagged with: android
tagged with: android-actionbar-compat
has comment: http://stackoverflow.com/comment/32277337
linked to: http://stackoverflow.com/q/4922641
has answer: http://stackoverflow.com/a/21352928
has comment: http://stackoverflow.com/comment/32194971
type: UnansweredQuestion

http://stackoverflow.com/q/21475322
tagged with: jpa
answer count: 1
score: 0
has body: I am new JPA and I am facing exceptions when I retrieve the values from composite primiary key table. Exception Description: Problem compiling [select t from ASSIGN_TASK_EMPLOYEE t]. [14, 34] The abstract schema type 'ASSIGN_TASK_EMPLOYEE' is unknown. at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605) Following are my code @Entity @Table(name = "ASSIGN_TASK_EMPLOYEE") //@IdClass(AssignTaskEmployeePk.class) public class AssignTaskEmployee implements Serializable { @EmbeddedId private AssignTaskEmployeePk assignTaskEmployeePk; public AssignTaskEmployeePk getAssignTaskEmployeePk() { return assignTaskEmployeePk; } public void setAssignTaskEmployeePk(AssignTaskEmployeePk assignTaskEmployeePk) { this.assignTaskEmployeePk = assignTaskEmployeePk; } } @Embeddable public class AssignTaskEmployeePk { private String employeeId; private String taskId; public AssignTaskEmployeePk() { } @Override public boolean equals(Object obj) { // TODO Auto-generated method stub if (obj instanceof AssignTaskEmployeePk) { AssignTaskEmployeePk employeePk = (AssignTaskEmployeePk) obj; if (!employeePk.getEmployeeId().equals(this.employeeId)) { return false; } else if (!employeePk.getTaskId().equals(this.taskId)) { return false; } } else { return false; } return false; } @Override public int hashCode() { return employeeId.hashCode() + taskId.hashCode() ; } public String getEmployeeId() { return employeeId; } public void setEmployeeId(String employeeId) { this.employeeId = employeeId; } public String getTaskId() { return taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } } I have added four values in the databases for composite primary key ASSIGN_TASK_EMPLOYEE (table) which PK table EMP_ID TASKID 1 2 2 4 3 5 4 6 Now I would like to get the tasks assigned to emp_id 1 For that I wrote the query below:This would supposed to return list of AssignTaskEmployee object. entityManager.createQuery("select t from ASSIGN_TASK_EMPLOYEE t").get…
has answer: http://stackoverflow.com/a/21475424
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21475424
has title: jpa composite primary key table not returning values
tagged with: java
linked to: http://stackoverflow.com/q/4676904

http://stackoverflow.com/q/21356273
downvote count: 0
tagged with: javascript
tagged with: inheritance
has comment: http://stackoverflow.com/comment/32200615
accepted answer: http://stackoverflow.com/a/21357259
answer count: 1
favorite count: 0
upvote count: 1
has title: How to access super class members in Nashorn
tagged with: nashorn
type: AnsweredQuestion
has body: I'm attempting to extend a concrete Java class (TableCell from javafx libs) in JavaScript, then call a method on the superclass. I have no problem doing this with the Rhino engine, but it's failing on Nashorn. My code is: var Cell = Java.extend(fx.TableCell); var cell = new Cell() { updateItem: function (item, isEmpty) { if(!isEmpty){ cell.super$setText(item); } } }; return cell; In addition to the "super$setText" syntax above, which was added to nashorn back in August, I have tried the Java.super call as mentioned in Accessing Methods of a Superclass in the nashorn guide: var Cell = Java.extend(fx.TableCell); var cell = new Cell() { updateItem: function (item, isEmpty) { if(!isEmpty){ Java.super(cell).setText(item); } } }; return cell; These snippets both fail when the corresponding table view is being populated. cell.super$setText throws 'null' has no such function "super$setText" which strikes me as odd, as I've pasted the entire contents of the method - there should be no way the closed-over cell variable becomes null. Java.super(cell).setText throws "cannot call undefined." I've also tried the convenient property syntax cell.text = item which appears to set a new javascript field without complaining, but does nothing to display the text in the table view. My JDK8 build is quite recent C:\&gt; java -version java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b124) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b66, mixed mode) I'm having trouble discerning if this is a nashorn bug, or a problem with my source. Is this the correct syntax? I'm also wondering if it matters that setText is not defined on TableCell, but one of its superclasses. Is nashorn only able to traverse one level up the hierarchy?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21357259
type: Question

http://stackoverflow.com/comment/32323799
type: Comment
type: QuestionComment
has text: That solved the ServerMode pw.println("HI!!") part, but nothing else is working as of yet :(
score: 0
comment on: http://stackoverflow.com/q/21424127

http://stackoverflow.com/comment/32495881
type: QuestionComment
type: Comment
has text: It really is there in that URL, try refreshing your page if need be
score: 0
comment on: http://stackoverflow.com/q/21425176

http://stackoverflow.com/q/21504403
has answer: http://stackoverflow.com/a/21504462
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/32464460
has answer: http://stackoverflow.com/a/21504417
has comment: http://stackoverflow.com/comment/32464493
has comment: http://stackoverflow.com/comment/32464424
tagged with: encapsulation
possible better answer: http://stackoverflow.com/a/21504417
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/21504462
tagged with: class
has comment: http://stackoverflow.com/comment/32464373
type: AnsweredQuestion
has body: I am opening a .class file using COMSOL multi-physics, and it works fine for one .class file, but I can't open several .class files at a time. My problem is that I want to be able to build more complicated objects inside the class that I open but, when I import these classes and build the project, I end up with multiple .class files. When I open the main .class file in COMSOL, a "error running java class", which I assume is because I've only opened one class. I am not very familiar with programming in Java, but I started trying to put my classes inside one file, but when I build there still 3 output .class files. Also, in case it matters, I am running on a windows 7 machine and using Eclipse... I would greatly appreciate any suggestions.
has comment: http://stackoverflow.com/comment/32464211
has answer: http://stackoverflow.com/a/21504481
has title: Can I build multiple classes into one .class file in Java?
type: Question
tagged with: build

http://stackoverflow.com/a/21506606
score: 2
answers question: http://stackoverflow.com/q/21506587
has body: Do like this public boolean isCorrect(int idx, String userGuess) { return userGuess.equalsIgnoreCase(getWord(idx)); } or public boolean isCorrect(int idx, String userGuess) { return userGuess.toUpperCase().equals(getWord(idx).toUpperCase()); }
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/32470689
type: Comment
comment on: http://stackoverflow.com/a/21493544
score: 0
type: AnswerComment
has text: First, verify that this is the issue. Then the simplest solution is to change your GameManager hub. Change to SendConnection(string header, string data) eg.

http://stackoverflow.com/q/21386449
answer count: 5
type: UnansweredQuestion
tagged with: spring
score: 19
upvote count: 19
linked to: http://stackoverflow.com/q/56360094
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/52550495
type: Question
tagged with: mongodb
downvote count: 0
has answer: http://stackoverflow.com/a/21387294
has answer: http://stackoverflow.com/a/56794472
has title: Spring data and mongodb - simple roll back with spring within @Transactional
has answer: http://stackoverflow.com/a/61682209
tagged with: rollback
has answer: http://stackoverflow.com/a/61224692
favorite count: 0
has body: I have 2 repositories, one for mongodb (DocumentRepository) and the other for hibernate entity (EntityRepository) I have a simple service: @Transactional public doSomePersisting() { try { this.entityRepository.save(entity); this.documentRepository.save(document); } catch(...) { //Rollback mongoDB here } } Is it possible to rollback the mongoDB on the "//Rollback mongoDB here" line? I already got a rollback from the entity part (Transactional annotation)

http://stackoverflow.com/comment/32270941
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21394621
has text: For B, you first used a bounded type parameter then you passed a parameterized type: B<SuperUser>. Did you try the generic type: B?

http://stackoverflow.com/comment/32429408
comment on: http://stackoverflow.com/a/21485137
type: AnswerComment
has text: Thanks so much for the quick response! I am not trying to be rude, I am really grateful for the help, but how am I using multiple JFrames/how does it apply to this situtation? I am reading the post anyways, of course. Also, what is a way around my problem? I was thinking to put the variables I have to call from one of the classes as static so I don't have to instantiate(correct use of the word?) the SocketManager class, and I can just do `SocketManager.connectionStatus`. Would this work? Again, thanks so much for the help
score: 0
type: Comment

http://stackoverflow.com/comment/32441316
score: 0
type: AnswerComment
has text: Would changing it to int and returning p1[i] & p2[i] be sufficient? im thinking that or calling the whole readScores method in the wins method then taking then doing a compare and contrast of the scores in there. Is that possible?
type: Comment
comment on: http://stackoverflow.com/a/21491381

http://stackoverflow.com/comment/32380773
has text: @JonSkeet The reason not to use multi-catch is implied by the question: it won't help eliminate the `instanceof` because there is both common and specific handling involved.
comment on: http://stackoverflow.com/q/21457491
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32570642
score: 0
comment on: http://stackoverflow.com/a/21437997
type: AnswerComment
has text: I apologize. Yes. I forgot that by the time I finished deciphering the answer. Yes. This is truly a beautiful and elegant solution. I think it could be more readable if you clearly establish definitions of the components and describe why each step is taken. It is really hard to read right now. +1 anyway, for awesomeness.
type: Comment

http://stackoverflow.com/a/21380894
answers question: http://stackoverflow.com/q/21380733
upvote count: 2
has body: try to use Simple date formatter, like: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// or any date format you want System.out.println(sdf.format(rs.getDate("data")));
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/21380733

http://stackoverflow.com/comment/32535109
type: Comment
has text: I'm a bit confused, you say now left and right is ok, but in the question, you say that your problem is X only goes to 579 instead of all the way to 660... so which one is it? Instead of sending the project, can you make the code a bit more simple. For example, I don't know what ivTouch is in your code? Is it relevant to the problem here? Same about all the colors... can you get rid of that code and still show what problem you are experiencing?
comment on: http://stackoverflow.com/a/21507510
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32292599
has text: That makes sense! I thought I would have to call the `notify()`-function using the exact object that was `wait()`ing, which obviously makes little sense. Thanks!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21407551

http://stackoverflow.com/a/21415220
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: List&lt;String&gt; emails = Arrays.asList(emailArray); Collections.sort(emails, new alphabeticalComparator());
answers question: http://stackoverflow.com/q/21415017

http://stackoverflow.com/a/21579938
has comment: http://stackoverflow.com/comment/32649657
has comment: http://stackoverflow.com/comment/32638025
has body: I dont know anything similar to that of ActiveMq that can be used with Spring TaskExecutor . Your Requirement " The idea being, that when consuming messages from a message queue (an ActiveMQ that utilizes message groups), then the execution of message processing tasks would be performed in-order (a task processing a message from a message group does not start before the previous task processing a message from that group has not finished). " My suggestion : The requirement you have specified, can be executed without having any trouble in simple Java . You can create a virtual Queue using a simple table in the database and use custom query to generate the content in the way you need. When the data's are there in the database you can do all the operations like fetching the similar data, reusing the data etc. Once you implement these simple steps all the operations that you do with ActiveMQ can be accomplished without much overhead. Insert each request into the database. Fetch the data according to the requirements. Build the content you need from the data's you have fetched. Do the operations you need to do using the task Scheduler. Remove the Data from the database. I don't see anything much troubling in your requirements to use some custom codes. Hope it helps. Good Luck :) Solution Without using a Database. 1 Create a Class file with all the elements you need. Like id, name, Address etc. 2 Create a static final HashMap like this with key as the grouping value and an arraylist of className as the value. public static final HashMap&lt;Key, List&lt;ClassName&gt;&gt; map= new HashMap&lt;Key, List&lt;ClassName&gt;&gt;(); 3 Now add the class to the list in the HashMap if there exist an entry for the key. else put a new hash value with the new key and an ArrayList with the class. if(map.containsKey(className.getId())){ map.get(className.getId()).add(className); } else{ List&lt;ClassName&gt; lstClass= new ArrayList&lt;ClassName&gt;(); lstClass.add(className); map.put(classN…
score: 1
answers question: http://stackoverflow.com/q/21450306
has comment: http://stackoverflow.com/comment/32757307
downvote count: 0
has comment: http://stackoverflow.com/comment/32760602
type: Answer
upvote count: 1

http://stackoverflow.com/comment/32418359
score: 0
type: QuestionComment
has text: I've edited the original post and added the code of the module. Thanks for your support!
type: Comment
comment on: http://stackoverflow.com/q/21475229

http://stackoverflow.com/a/21369101
upvote count: 2
has body: Read about BDD, this is very nice technique for making tests easy to write and understand (read) Test-driven development is a software development methodology which essentially states that for each unit of software, a software developer must: define a test set for the unit first; then implement the unit; finally verify that the implementation of the unit makes the tests succeed. Well written test should have GivenWhenThen sections (Given) some context (When) some action is carried out (Then) a particular set of observable consequences should obtain This style is known as SpecificationByExample Given-When-Then is a style of representing tests - or as its advocates would say - specifying a system's behavior using SpecificationByExample. Example test @Test public void testFindUserByName() { // given SetOfUsers instance = new SetOfUsers(); // when User result = instance.findUserByName("Bob"); // then assertEquals("Bob", result.getName()); } Nice to read: Arrange Act Assert Alternatives Maintainable Tests
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21368999
type: Answer
answers question: http://stackoverflow.com/q/21368999
score: 2

http://stackoverflow.com/comment/32319738
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21422583
has text: http://stackoverflow.com/questions/10679588/android-access-to-remote-sql-database/10682780#10682780 will explain to you some steps on how to achieve this.
score: 0

http://stackoverflow.com/a/21401916
accepted answer of: http://stackoverflow.com/q/21399660
answers question: http://stackoverflow.com/q/21399660
has body: It seems that this Hibernate property is only a hint to Hibernate. See here and in Hibernate ORM Docs, where they say Except when you explicitly flush(), there are absolutely no guarantees about when the Session executes the JDBC calls, only the order in which they are executed. More to this, the FlushMode.ALWAYS enum value Javadoc states that The Session is flushed before every query. This is almost always unnecessary and inefficient. I'm not sure if by "query" they mean only a database interrogation (reads) or any kind of operation, including inserts, updates and deletes. If I were you, I would explicitly place a session.flush() call after the first update. I know that declarative way is cleaner, but sometimes imperative programming makes your business safer.
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32282834
downvote count: 0
score: 1

http://stackoverflow.com/a/21355742
has body: You are looking for a concurrent server. A concurrent server basically creates a child process for each client. Here is a basic way to do in java http://www.how2java.com/2012/05/how-to-create-concurrent-server-using.html
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21355671

http://stackoverflow.com/q/21366225
score: 1
has title: Making a main menu in Java
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 1
downvote count: 0
has body: hey guys i have this code, and i have been working on it for a while. Its a game that when the start button is clicked a bunch of buttons pop onto the screen and one button is highlighted, if the player clicks the highlighted button the player gains score but if the player doesn't click the correct button the player loses score. The game works fine, but when i tried to make the main menu is where things went wrong. When i click the start button it opens the window where the game is supposed to be(it has the correct window name so i know its working), however there aren't any buttons. Can someone please help since i have been stuck on this problem for about a week. Thanks import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; public class ClickerMenu extends JFrame { private JButton start, settings, exit, about; public ClickerMenu() { super("Main Menu"); setLayout(new FlowLayout()); start = new JButton(" Start Game "); settings = new JButton(" Settings "); exit = new JButton(" Exit "); about = new JButton(" About "); add(start); add(about); add(settings); add(exit); HandlerClass handler = new HandlerClass(); start.addActionListener(handler); about.addActionListener(handler); settings.addActionListener(handler); exit.addActionListener(handler); } public class HandlerClass implements ActionListener { public void actionPerformed(ActionEvent event) { if (event.getSource() == start) { ClickerMain main = new ClickerMain(); main.main(null); } if (event.getSource() == settings) { } if (event.getSource() == about) { } if (event.getSource() == exit) { System.exit(0); } } } } and the game code is: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; public class Clicker extends JFrame { private int counter = 0, place = 0, score, timer, holder, number, index; private JButton button[] = new JButton[20]; randomButtons rbutt…
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23025116
upvote count: 1
tagged with: methods
tagged with: swing
tagged with: jbutton
linked to: http://stackoverflow.com/q/21459718

http://stackoverflow.com/a/21508249
answers question: http://stackoverflow.com/q/21508097
type: Answer
has body: Arrays are zero indexed. e.g. a 100-element array will actually have valid index range of [0,99]. I'm assuming this happens on the line p = pairList.get(i); You need to implement some logic to make sure that you're not overstepping the bounds. You're already using an iterator to iterate through pairList, which would protect you from this, but you're also mixing in the index i, which defeats the purpose of the iterator. At the very least, include a check before you try to access an element. Something like: if (i &gt;= pairList.size()) break;
has comment: http://stackoverflow.com/comment/32471154
has comment: http://stackoverflow.com/comment/32471131
score: 0

http://stackoverflow.com/a/21394618
has body: According to EclipseLink JPA UserGuide it does support IS NULL / IS NOT NULL operators so you should be able to write your SQL statement as follows: SELECT ... FROM ... WHERE street_address IS NULL Edit For instance, if I have a named query, and I set a parameter to null, how do I get EclipseLink to generate IS NULL not = NULL Let SQL handle this for you. In your example: String sql = "SELECT ... FROM ... WHERE (street_address = :address OR street_address IS NULL)"; Query query = em.createQuery(sql); query.setParameter("address", address.getStreetAddress()); If address.getStreetAddress() is not null then first OR expression is the relevant to the query. Otherwise still match the second expression.
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21394479
type: Answer
score: 4

http://stackoverflow.com/comment/32432016
comment on: http://stackoverflow.com/a/21485404
type: Comment
has text: Thank you for your hint. After removing all CR/LF function works.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21378604
answer count: 1
tagged with: hibernate-entitymanager
has title: EntityManagerFactory nullPointerException if @Autowire
has comment: http://stackoverflow.com/comment/32241142
has answer: http://stackoverflow.com/a/21379498
score: 0
has comment: http://stackoverflow.com/comment/32241369
tagged with: autowired
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21379498
tagged with: java
type: Question
has body: Tell me please where I have error if in one of my DAOImpl Autowiring work normaly, but in PcDAOImpl I have nullPointer Exception? All project located on GitHub And here is stacktrace from tomcat: Jan 27, 2014 12:30:37 PM org.apache.catalina.core.ApplicationContext log at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Jan 27, 2014 12:30:55 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.springapp.mvc.dao.PcDAOImpl.getEM(PcDAOImpl.java:25) at com.springapp.mvc.dao.PcDAOImpl.findAll(PcDAOImpl.java:105) at com.springapp.mvc.controllers.AppController.getPCList(AppController.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.su…

http://stackoverflow.com/q/21366560
type: Question
accepted answer: http://stackoverflow.com/a/21366632
has comment: http://stackoverflow.com/comment/32219267
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32219114
score: 0
answer count: 3
tagged with: arrays
has title: Make new int[] array or use loop to set every index to 0? Java
possible better answer: http://stackoverflow.com/a/21366591
has answer: http://stackoverflow.com/a/21366591
has comment: http://stackoverflow.com/comment/32218936
has body: I'm making a yahtzee game in java, and I have a variable called frequencyCount which is an array keeping track of how many die there is of each one. I reset this array after each roll with a for loop setting each index to 0. for(int i = 0; i &lt; frequencyCount.length; i++) { frequencyCount[i] = 0; } But is there any problem with just creating a new array each time like this: frequencyCount = new int[6]; The reset method will be called 45 times per player per game. Which way is best? Is it a problem to keep creating new arrays, or doesn't it matter since this is a small game?
has answer: http://stackoverflow.com/a/21366632
has comment: http://stackoverflow.com/comment/32219080
has comment: http://stackoverflow.com/comment/32219252
has answer: http://stackoverflow.com/a/21366633

http://stackoverflow.com/comment/32243555
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21379947
has text: http://pastebin.com/hFAFBPwX Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'jdbc' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'
score: 0

http://stackoverflow.com/comment/32300713
has text: Nope - `jLayeredPane2.getComponent(j).getText()` will fail, since not every component provides a `getText()` method.
comment on: http://stackoverflow.com/a/21412189
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32363470
score: 1
has text: either use `i++` or just change it to `for (char ch : s.toCharArray())`
comment on: http://stackoverflow.com/a/21447367
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21443823
has body: This tutorial should help you: http://developer.android.com/training/implementing-navigation/nav-drawer.html This is the code snippet for switching fragments // Insert the fragment by replacing any existing fragment FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.content_frame, fragment) .commit();
score: 0
answers question: http://stackoverflow.com/q/21442054
type: Answer

http://stackoverflow.com/q/21478221
has body: I'm trying to embed jruby in a weblogic app to run sass/compass with no luck ;-( This is what've done so far: Install sass/compass GEMS: java -jar jruby-complete-1.7.10.jar -S gem install -i . compass --no-rdoc --no-ri Create a jar that contains all the gems jar uf jruby-complete-1.7.10.jar -C sass-compass . Check that the new jruby-complete-1.7.10.jar contains all the gems: java -jar jruby-complete-1.7.10.jar -S gem list *** LOCAL GEMS *** bouncy-castle-java (1.5.0147) chunky_png (1.2.9) compass (0.12.2) fssm (0.2.10) jruby-openssl (0.9.3) json (1.8.0 java) krypt (0.0.1) krypt-core (0.0.1 universal-java) krypt-provider-jdk (0.0.1) rake (10.1.0) rdoc (4.0.1) sass (3.2.14) So far, so good, I verify that my new uber jruby-complete-1.7.10.jar contains sass and compass gems Enters weblogic (Weblogic 11 - Oracle 10.3.6) I create a WebApp with a servlet that uses JRuby to compile sass/compass css and put it inside an EAR Deploy the ear so the structure is like: MyEAR |-APP-INF | |-classes | |-lib | |-jruby-complete-1.7.10.jar &lt;- my jruby jar that contains sass/compass gems |-META-INF |-MyWAR |-META-INF |-WEB-INF |-classes | |-MyServlet.class &lt;- the servlet that compiles sass |-lib |-web.xml When I call the servlet to compile some sass/compass css, I get the following error: LoadError: no such file to load -- sass/plugin require at org/jruby/RubyKernel.java:1083 require at classpath:/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55 (root) at :2 In order to compile my sass/compass styles I've to run the following ruby script: require 'rubygems' require 'sass/plugin' require 'sass/engine' source = '...the scss code....' engine = Sass::Engine.new(source,{ :syntax =&gt; :scss, :compass =&gt; {:css_dir =&gt; '/styles',:js_dir =&gt; '/scripts',images_dir =&gt; '/images'} }) result = engine.render So in my servlet I use jruby like: ScriptingContainer rubyEngine = new ScriptingContainer(LocalContextScope.CONCURRENT); String rubyScript = ... final St…
has comment: http://stackoverflow.com/comment/32471034
has comment: http://stackoverflow.com/comment/32454108
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/21508439
tagged with: weblogic
has title: Use GEMS in a JRUBY embeded on Weblogic
type: AnsweredQuestion
tagged with: jruby
accepted answer: http://stackoverflow.com/a/21508439
type: Question

http://stackoverflow.com/comment/32283899
type: Comment
has text: Surely the binary output of each compilation will be different, but check it anyway. Once you are sure of this, have a look at gradle docs and your eclipse compiler configuration and try to finetune both in order to produce the same code (target JVM level, debug level, etc.)
comment on: http://stackoverflow.com/q/21402641
score: 0
type: QuestionComment

http://stackoverflow.com/a/21492314
answers question: http://stackoverflow.com/q/21490246
has body: I got it right with useSticks' answer like that: public void myMethod() { final StackTraceElement[] trace = Thread.currentThread().getStackTrace(); for(int i=0; i &lt; trace.length-1; i++) { if( trace[i].equals(trace[trace.length-1]) ) { throw new RuntimeException("do not call me again"); } } handle(); } thanks to all of you
type: Answer
upvote count: 2
downvote count: 1
score: 1

http://stackoverflow.com/comment/32359628
type: Comment
comment on: http://stackoverflow.com/a/21445268
has text: @zapl Okay but that seems a little weird and self-defeating. `while (!Thread.interrupted()) {` would make more sense.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21380191
has answer: http://stackoverflow.com/a/21380770
score: 0
has comment: http://stackoverflow.com/comment/32245128
answer count: 1
has title: Singletons in Restlet applications for working with variables
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32245878
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32245360
has body: I need your help. I've a Java Restlet server for indexing documents. I would like to have Map (synchronized) where each resource can write to or read from. As I found each resource is different thread. Main problem is, that in ServerRunner I put class as a parameter not object, so I don't know how to give there information with this Map. I was trying to use singletons like this: ServerRunner public class ServerRunner { public static void main(String[] args) throws Exception { //Server server = new Server(Protocol.HTTP, 8888, ChickenResource.class); //server.start(); Component component = new Component(); component.getServers().add(Protocol.HTTP, 8888); DocIndexingResource test = DocIndexingResource.getInstance(); List&lt;IndexedFile&gt; listIndexedFiles = Collections.synchronizedList(new ArrayList&lt;IndexedFile&gt;()); test.setupMap(listIndexedFiles); component.getDefaultHost().attach("/chickens/{id}", test.getClass()); //listIndexedFiles.add(new IndexedFile("asas", "aa", 2, null)); //DocIndexingResource.getInstance().addIndexedFile(); System.out.println("salajlalasjaksadsa"); component.start(); } } and here is DocIndexingResource class: package docindexing.docindexing; import java.rmi.server.UID; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import org.restlet.resource.Get; import org.restlet.resource.Post; import org.restlet.resource.ResourceException; import org.restlet.resource.ServerResource; public class DocIndexingResource extends ServerResource { private List&lt;IndexedFile&gt; listIndexedFiles; @Override protected void doInit() throws ResourceException { super.doInit(); } public static DocIndexingResource getInstance (){ return instance; } private static DocIndexingResource instance = new DocIndexingResource(); /*@Get("json") public Chicken getChicken() { return new Chicken(1000, Double.POSITIVE_INFINITY); }*/ @Get("json") public String findById() { int id = Integer.p…
tagged with: restlet

http://stackoverflow.com/a/21557246
has comment: http://stackoverflow.com/comment/32559446
has comment: http://stackoverflow.com/comment/32557012
type: Answer
has body: The following is a crude solution. But it works nevertheless :p public boolean isElementPresent() { try { new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocatedBy(By.id("")); return true; } catch (TimeOutException e) { return false; } } When we use the WebDriverWait Class for waiting for a element to be present in the web page, a TimeOut Exception is thrown after the specified time. We catch it and return false. If no exception is thrown(if element is found), we return true. If you are looking for checking whether the element is enabled or is displayed, explore the isDisplayed or isEnabled methods associated with WebElement. But please note that if the element is not physically present in the webpage, an exception is thrown.
answers question: http://stackoverflow.com/q/21511901
has comment: http://stackoverflow.com/comment/32559292
score: 0

http://stackoverflow.com/a/21391814
score: 2
has comment: http://stackoverflow.com/comment/32265248
has body: The error arrises on line 62 which I assume is in your big if else section. Within there you have several ind++ calls. This increments the pointer you use in the loop. So if your code must go through several of these statements it will go beyond the array index. Additionally you have an issue in the for loop as joval mentioned Edit The ++ unary operator increments the variable (-- decrements). Placing the ++ after the variable name (x++) will increment before evaluation, where ++x will increment after evaluation. This is a common test question for CS students so I suggest you do some more research and practice regarding the operator.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21391683
type: Answer

http://stackoverflow.com/q/21428728
has title: How many requests to Twitter API my program consumes
score: 0
answer count: 1
tagged with: twitter4j
tagged with: java
tagged with: twitter
type: UnansweredQuestion
has body: I need some help with Twitter API error 429:Returned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource. I am using twitter4j and I am trying to store my friends' timelines. The thing is that at the point my code hangs (twitter bans me) don't believe I have reached the Rate Limit yet. It is important to understand in order to put properly the wait() or sleep() method. My code is the following: ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey("appKey") .setOAuthConsumerSecret("appSecret") .setOAuthAccessToken("userKey") .setOAuthAccessTokenSecret("userSecret") .setUseSSL(true); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter; twitter = tf.getInstance(); Paging paging; DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); Long tweetsinceId=0L; try{ long cursor = -1; IDs ids = twitter.getFriendsIDs(cursor); long[] id = ids.getIDs(); ResponseList&lt;User&gt; users = twitter.lookupUsers(id); int numoftweets=1; int count=0; /**************START: Store the friends of the user in the list usernames - The search will be performed only for the accounts included in the list**************************************************************************************/ for (User user : users) { numoftweets = user.getStatusesCount(); userId = user.getId(); System.out.println("INSERT INTO userinfo " + "VALUES ("+userId+",'"+user.getName()+"','"+ user.getScreenName()+"','"+dateformat.format(user.getCreatedAt())+"',"+ user.getFavouritesCount()+","+ user.getFollowersCount() +","+user.getFriendsCount()+",'"+ user.getDescription()+"','"+user.getLocation()+"',null,"+ numoftweets+",'"+ user.getURL() +"','"+ user.getMiniProfileImageURL()+"',null, null, '"+user.getLang()+"',"+ user.getAccessLevel()+");"); count++; int numberofpages = Math.round(numoftweets / 100); for (int j=1;j&lt;=numberofpages;j++){ if (tweetsinceId==0L){ paging…
type: Question
has answer: http://stackoverflow.com/a/21441479

http://stackoverflow.com/a/21382875
score: 8
downvote count: 0
answers question: http://stackoverflow.com/q/21379589
accepted answer of: http://stackoverflow.com/q/21379589
upvote count: 8
has body: You are submitting the Job before telling the job which JAR class corresponds to it. It's pretty clear in your error message: 14/01/27 16:52:26 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). Swap the last two lines of your driver, and it will work: job.setJarByClass(WordCount.class); job.waitForCompletion(true);
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32305334
comment on: http://stackoverflow.com/a/21414039
score: 0
type: Comment
has text: @CherryW: I see. Regarding your latest code, get rid of the local myContentPane variable. Declare and initialize it in the class, and don't re-declare and initialize it in the main method.
type: AnswerComment

http://stackoverflow.com/a/21400786
type: Answer
has body: 1.: Folders and packages, is not the only benefit. It also gives you a proper project structure. This is convention over configuration, since when you understood the structure of one Maven project, you won't get lost in any other project. I suggest to read a book about Maven, for instance "Better Builds with Maven". 2.: src/main/java: all your source classes, src/main/resource: addtional resources, src/test/java: test classes, src/test/resources: additional resources for the test 3.: The quickstart is good for a starter. It is true that it has a quite old JUnit dependency and creates some default folders and classes. But if you want a different type of project there a lot of other archetypes out there. If you use the command mvn archetype:generate -DgroupId=test -DartifactId=test you will get a long list of available archetypes to choose from. If you use eclipse you can also select the archetype in a dialog. There is a archetype for Selenium projects, but it requires understanding of Maven and Git.
accepted answer of: http://stackoverflow.com/q/21398965
answers question: http://stackoverflow.com/q/21398965
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/32386932
type: Comment
comment on: http://stackoverflow.com/q/21461094
score: 1
has text: Are you sure that "C" is in the list? for debugging try printing out each item and print when you remove an item.
type: QuestionComment

http://stackoverflow.com/comment/32428852
type: Comment
has text: Thanks a lot. That solved it. I completely messed up the T and the wildcard.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21484946

http://stackoverflow.com/a/21445313
has comment: http://stackoverflow.com/comment/32359890
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21444359
has body: From the error it is clear that the resultset does not have the column named 'employID'. To troubleshoot this issue you can do either of these: 1. Inspect the resultset metadata and look at the column names that you are getting. 2. Or use column position in resultset.getString() methods to get the values and verify if you are getting employID values.

http://stackoverflow.com/comment/33835756
comment on: http://stackoverflow.com/q/21453373
score: 0
has text: possible duplicate of [No Persistence provider for EntityManager named X](http://stackoverflow.com/questions/19322827/no-persistence-provider-for-entitymanager-named-x)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32200873
has text: I like to see the other buttons hide in the `overflow` icon, so how do I achieve that? I am following the tutorial at http://developer.android.com/training/basics/actionbar/adding-buttons.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21356378

http://stackoverflow.com/q/21381564
upvote count: 0
has comment: http://stackoverflow.com/comment/32246518
duplicate of: http://stackoverflow.com/q/25425130
accepted answer: http://stackoverflow.com/a/21381765
has comment: http://stackoverflow.com/comment/32246238
has comment: http://stackoverflow.com/comment/32245990
tagged with: while-loop
has comment: http://stackoverflow.com/comment/32245974
has title: Java while loop not exiting without println
has comment: http://stackoverflow.com/comment/32246029
favorite count: 0
has comment: http://stackoverflow.com/comment/32246024
possible better answer: http://stackoverflow.com/a/21381954
has answer: http://stackoverflow.com/a/21381954
downvote count: 1
has answer: http://stackoverflow.com/a/21381765
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32246055
tagged with: java
has body: I'm currently running a separate task in a Java Swingworker, and here is the code (edited for clarity): while (true) { while (value == 0) { value = utils.getValue(); System.out.println("Value is zero"); } System.out.println("Value isn't zero, out of loop"); } This code runs perfectly fine. However, if I remove the println("Value is zero"), nothing happens, and the loop is never exited. Another thread is handling the population of the value, which gets updated roughly 5 seconds after the program starting. I'm a little confused as to why the code only executes if there is a println in there. Can anyone shine any light on this?
score: -1
tagged with: loops
linked to: http://stackoverflow.com/q/25425130
type: Question
answer count: 2
tagged with: swingworker
has comment: http://stackoverflow.com/comment/32246080

http://stackoverflow.com/comment/32351557
type: Comment
has text: How do I make it not look crazy?
type: AnswerComment
comment on: http://stackoverflow.com/a/21440031
score: 0

http://stackoverflow.com/comment/32404385
type: Comment
score: 0
has text: I had no syntax errors before adding this and it, and when i add the 1st ten = ran.nextInt(10); it dosent come up with an error, but when i add the second int twenty = ran.nextInt(20); then the syntax error occurs. is there a way i can write a function to pass the numbers through then create an array of true/false's? And i added code.
comment on: http://stackoverflow.com/a/21463452
type: AnswerComment

http://stackoverflow.com/comment/32390848
has text: @may And use a debugger.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21462320
type: Comment

http://stackoverflow.com/comment/32353404
has text: That only works after I add the image to the classpath by putting in the module as mentioned in the article. Without adding it to the module in Jboss, the code you mentioned is not picking the image up.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21439997

http://stackoverflow.com/q/21400661
answer count: 2
has body: Find the nearest leaf node from given node in binary tree. if the tree is : 1 2 3 4 5 6 7 9 8 than the shortest leaf node from 2 is 3. Can somebody help me is devising an algo for this. Thanks. I am able to find if the node is root node ( by simple DFS) but not able to device an algo for this case where the node is not the ancestor of the shortest distant leaf node. Tree representation : Class TreeNode{ int val; TreeNode left, right; } You are given with a Node i.e. t1 and root i.e. t.
has title: nearest leaf node from given node in binary tree
favorite count: 0
has comment: http://stackoverflow.com/comment/32280467
has comment: http://stackoverflow.com/comment/32280583
has answer: http://stackoverflow.com/a/21400767
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32280426
has comment: http://stackoverflow.com/comment/32280543
has comment: http://stackoverflow.com/comment/32280506
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32280454
tagged with: tree
tagged with: algorithm
tagged with: data-structures
has answer: http://stackoverflow.com/a/21401182

http://stackoverflow.com/comment/32227537
comment on: http://stackoverflow.com/q/21371087
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/tutorial/extra/generics/wildcards.html
score: 4

http://stackoverflow.com/comment/32367690
type: AnswerComment
has text: Fixed. Ah, I'm doing it in a fiddle.
type: Comment
comment on: http://stackoverflow.com/a/21448752
score: 1

http://stackoverflow.com/a/21350460
has body: else if(score&gt;0){ score = score -1; scoreLabel.setText("SCORE: " + score); }
upvote count: 1
answers question: http://stackoverflow.com/q/21350424
type: Answer
has comment: http://stackoverflow.com/comment/32190563
downvote count: 0
score: 1

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/21424910

http://stackoverflow.com/comment/32347369
has text: use JS for Form Validation and submission.. meaning the click of the submit button should trigger a js function which then submits to the servlet based on successful validation
comment on: http://stackoverflow.com/q/21438701
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/21475055
has comment: http://stackoverflow.com/comment/32412283
answers question: http://stackoverflow.com/q/21474749
has body: put your main method in a seperate class file. the first thing the compiler reads is the main method. so if you put it in another class file your shouldn't be getting any problems unless you forget to import the class. as for inheritance this is useful http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
score: 0
type: Answer

http://stackoverflow.com/q/21399247
tagged with: multithreading
has answer: http://stackoverflow.com/a/21399382
has body: In the Java document, it says that the interrupt function could interrupt the object.wait. But in my test, in windows it is yes, it could be interrupted, but in Linux it is false, it could NOT interrupted. It seems that the reason is from the Glibc 2.1.3 the pthread_cond_wait could no longer be interrupted by the system signal. Am I right for my understand? public static void main(String[] args) { Thread t = new Thread() { public void run() { Object obj = new Object(); synchronized(obj) { try { obj.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block System.out.println("interrupted"); e.printStackTrace(); } } } }; t.start(); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } t.interrupt(); System.out.println("interrupt is called"); try { Thread.sleep(100000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/21399323
type: Question
has comment: http://stackoverflow.com/comment/32278346
has comment: http://stackoverflow.com/comment/32277938
answer count: 3
upvote count: 1
favorite count: 0
has title: Could Java object.wait be interrupted?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21401740
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/32476644
score: 1
comment on: http://stackoverflow.com/q/21511477
type: Comment
type: QuestionComment
has text: What are you trying to accomplish with this design?

http://stackoverflow.com/comment/32392651
comment on: http://stackoverflow.com/a/21464157
type: AnswerComment
has text: When the element doesn't exist, Eclipse would tell me so. But this isn't the case
score: 0
type: Comment

http://stackoverflow.com/q/21394466
has comment: http://stackoverflow.com/comment/32270197
accepted answer: http://stackoverflow.com/a/21394726
tagged with: java
has body: What is a good design pattern to document or log every operation (business logic) that is done inside the system? Let's say I want to write a small log or notify the user about every operation? For instance, in the system you may order a cleaning service for your house and I want to give the user feedback after each step: Cleaning service ordered > cleaning is being done > cleaning is finished I was thinking about Observer pattern but I'm a bit confused. Thanks.
possible better answer: http://stackoverflow.com/a/21394722
tagged with: observer-pattern
has answer: http://stackoverflow.com/a/21394722
upvote count: 4
type: AnsweredQuestion
favorite count: 0
type: Question
score: 3
has comment: http://stackoverflow.com/comment/32286751
has comment: http://stackoverflow.com/comment/32270442
has answer: http://stackoverflow.com/a/21394726
answer count: 2
has title: A good design pattern for documenting every operation
tagged with: domain-driven-design
tagged with: design-patterns
downvote count: 1

http://stackoverflow.com/comment/32355497
has text: have updated to C:\Program Files\Java\jre7\bin and it works (i have java.exe in system32 folder aswell?!) but hey it now works :-)
score: 0
comment on: http://stackoverflow.com/q/21442923
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21356245
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32216467
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21355769
has comment: http://stackoverflow.com/comment/32207327
has comment: http://stackoverflow.com/comment/32207444
answers question: http://stackoverflow.com/q/21355769
score: 2
has comment: http://stackoverflow.com/comment/32206754
has body: If, you have followed some of the advice from your previous question you may have avoided this issue. As near as I can tell, your problem is you're not calling super.paint, which is responsible for (amongst a lot of other things) preparing the Graphics context for painting. It does this, by clearing what ever was painted on it previously. Instead of overriding paint of JApplet, which will cause flicker when the applet is updated, you should start with something like a JPanel and override it's paintComponent method. JPanel is double buffered, which will prevent any flicker from occuring. Don't forget to call super.paintComponent. You shouldn't be calling fillBorder every time paint is called, this is wasteful on a number of levels, instead, you should only call it when you need to. With a little bit more clever design, you could actually get away with calling it from the constructor, but I don't have the time to re-code your entire program. The size the applet is defined by the HTML page which contains it, not the applet itself, relying on magic numbers (like APP_WIDTH and APP_HEIGHT) is a bad idea. You should, instead, rely on known values, like getWidth and getHeight. This of course assumes you'd like to be able to resize the playable area and avoid possible issues with people deploying your applet with the wrong size ;) While, I'm guessing that placeCheckers is a test method, you should know, paint can be called any number of times for any number of reasons, many of which you don't control, this means that the checkers will be randomized each time paint is called. Instead, you should consider creating a virtual board which contains the information about the state of the game and update this as required. You would then simply use the painting process to reflect this model. An example of how I might "start"... import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.util.Random; import javax.swing.JApplet; import javax.swing.JPanel; pu…

http://stackoverflow.com/comment/32329017
has text: I only want to give you the pointer to: http://stackoverflow.com/questions/11880924/how-to-add-custom-method-to-spring-data-jpa - if you know this, than everything is right.
comment on: http://stackoverflow.com/q/21428302
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21415182
tagged with: java
type: Question
answer count: 1
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/21415670
has title: Populating a JTable with parsed information
has comment: http://stackoverflow.com/comment/32305977
has body: I am trying to populate a JTable with information taken from a website (namely price and item name). I have a class that asks the user to input a URL and scans the page for the price and item name as well as the URL. Currently it takes all the parsed information and stores it in three different text files, one for price, one for item name, and one for the URL. I am trying to populate a JTable containing three columns (item name, price, and URL) with this information but every time I scan a new page the text files are overwritten and the previous information is lost. I don't necessarily need the JTable to be populated via the text file, I just need it to somehow get the information. Here is some of my code. public BestBuy (JFrame frame){ super (frame, "Best Buy URL", true); setLayout (new FlowLayout()); label = new JLabel ("Enter Best Buy URL"); add (label); url = new JTextField ("Enter URL Here", 40); add (url); submit = new JButton ("Submit"); add (submit); event b = new event (); submit.addActionListener (b); } public class event implements ActionListener{ public void actionPerformed (ActionEvent b){ try { String datab = url.getText(); //perform your operation datab = datab.trim(); datab = datab.toLowerCase(); Document document = Jsoup.connect(datab).get(); String amountb = document.select(".amount").first().text(); String nameb = document.select(".product-title").first().text(); FileWriter stream = new FileWriter ("C:\\Users\\Daniel\\Desktop\\price.txt"); BufferedWriter out = new BufferedWriter (stream); out.write(amountb + "\n"); out.newLine(); out.close(); FileWriter stream1 = new FileWriter ("C:\\Users\\Daniel\\Desktop\\itemName.txt"); BufferedWriter out1 = new BufferedWriter (stream1); out1.write(nameb + "\n"); out1.newLine(); out1.close(); FileWriter stream2 = new FileWriter ("C:\\Users\\Daniel\\Desktop\\url.txt"); BufferedWriter out2 = new BufferedWriter (stream2); out2.write(datab + "\n"); out2.newLine(); out2.close(); } catch (Exception ex) { } setVisible…
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21415670
has comment: http://stackoverflow.com/comment/32305976

http://stackoverflow.com/comment/32331927
score: 1
comment on: http://stackoverflow.com/q/21430325
has text: You didn't provide what you try so far. This kind of a case you can't expect an answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21429067
type: Answer
has body: Compiler can't replace all references to local variable with a constant but when the instance of inner class is constructed, the value is passed to appropriate constructor and stored in variable. According to need, It is cumbersome to automatically implement it.
answers question: http://stackoverflow.com/q/21421697
score: 0

http://stackoverflow.com/q/21506587
tagged with: java
upvote count: 2
answer count: 3
tagged with: string
favorite count: 0
has title: Accept capitalized string input
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21506600
tagged with: swing
has answer: http://stackoverflow.com/a/21506606
has answer: http://stackoverflow.com/a/21506600
type: Question
has answer: http://stackoverflow.com/a/21506596
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21506596
has body: I have a game program wherein the user is asked to guess the scrambled word given. For example: Scrambled word: loglab Your guess: The word is global, every time I input "GLOBAL" it says the word is incorrect. I tried to use toUpperCase but it didn't worked. How can my program be able to accept strings inputted even if it's capitalized? Below are some of my codes. I wont post it all because it's too long, but if you need more of it just inform me. Please help me with regards to this matter thank you. StaticWordLibrary.java: public boolean isCorrect(int idx, String userGuess) { return userGuess.equals(getWord(idx)); } WordLibrary.java: public abstract boolean isCorrect(int idx, String userGuess); Anagrams.java: private void guessedWordActionPerformed(java.awt.event.ActionEvent evt) { if (wordLibrary.isCorrect(wordIdx, guessedWord.getText())){ JOptionPane.showMessageDialog(null, "Your answer is correct! Guess another word.","", JOptionPane.INFORMATION_MESSAGE); getRootPane().setDefaultButton(nextTrial); } else { JOptionPane.showMessageDialog(null, "Your answer is incorrect! Please try again.","", JOptionPane.ERROR_MESSAGE); guessedWord.setText(""); } guessedWord.requestFocusInWindow(); }
tagged with: oop

http://stackoverflow.com/comment/32428475
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis you'll notice I referenced that same content in my question...
comment on: http://stackoverflow.com/q/21484606

http://stackoverflow.com/comment/32227298
has text: You're seeding the calendar with the same time each time, so wouldn't you expect it to return the same result?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21370942

http://stackoverflow.com/q/21352756
tagged with: enums
tagged with: java
possible better answer: http://stackoverflow.com/a/21352859
has answer: http://stackoverflow.com/a/21352859
answer count: 2
has answer: http://stackoverflow.com/a/21353146
downvote count: 0
favorite count: 0
has title: use spring to initialize a field in java enum
has comment: http://stackoverflow.com/comment/32194356
tagged with: spring
score: 2
type: AnsweredQuestion
has body: I have a requirement to initialize the "flag" field in a java enum by spring: public enum EntitySequenceType { TypeOne(-1), TypeTwo(-1000); private boolean flag; EntitySequenceType(long firstId){ System.out.println("enum's constructor: "+this.name()+" firstId="+firstId); } public void setFlag(boolean val) { this.flag = val; } public boolean getFlag() { return this.flag; } } The spring config is: <property name="flag" value="true"/> TypeOne But I have met some problems, so I have the following questions: 1.It seems that I can only write a single value in the tag in the config xml, I can't figure out why it is like this. 2.When I debugging the code, I found that when spring is initializing the bean, although I only write one constructor-arg value in the config xml, the constructor is called twice.How could this happen? 3.In the constructor of EntitySequenceType, I found that the "flag"'s value is null, why? There is "afterPropertiesSet()" can be called if the enum implements InitializingBean, but it is not called every time a enum type is constructed, so is there any method to be called after the field is set by spring, but is called every time a enum type is called? Thanks for your answers!
accepted answer: http://stackoverflow.com/a/21353146
upvote count: 2
type: Question

http://stackoverflow.com/comment/32349539
type: AnswerComment
comment on: http://stackoverflow.com/a/21439764
type: Comment
has text: @JonSkeet Ah, right. I have an issue of never looking at titles, and I often automatically take the body as the more concrete definition of an inquiry.
score: 0

http://stackoverflow.com/q/21417780
accepted answer: http://stackoverflow.com/a/21417835
has title: Simple binary search tree in Java
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
tagged with: data-structures
has answer: http://stackoverflow.com/a/21417835
answer count: 1
score: 1
favorite count: 0
has body: Here there is code for a simple BST in Java that keys are only int, but when I want to test it and use print() just root.key can be printed and root.right and root.left are null. public class BST { private class Node { private int key; private Node left, right; public Node(int key) { this.key = key; } } private Node root; public BST(int key) { root = new Node(key); } public void insert(int key) { insert(root, key); } private void insert(Node x, int key) { if (x == null) { x = new Node(key); } if (key &gt; x.key) { insert(x.right, key); } else if (key &lt; x.key) { insert(x.left, key); } else { x.key = key; } } public void print() { print(root); } private void print(Node x) { System.out.print(x.key + " "); if (x.left != null) print(x.left); if (x.right != null) print(x.right); } } For example, when I insert 25, 9, 10, 30, 40 and call print() then it just prints 25.
upvote count: 2

deserialization
type: Tag
tags question: http://stackoverflow.com/q/21392994
tags question: http://stackoverflow.com/q/21364575
tags question: http://stackoverflow.com/q/21381420
tag name: deserialization
tags question: http://stackoverflow.com/q/21441827
tags question: http://stackoverflow.com/q/21383019
tags question: http://stackoverflow.com/q/21485923
tags question: http://stackoverflow.com/q/21447604

http://stackoverflow.com/a/21368215
answers question: http://stackoverflow.com/q/21367875
accepted answer of: http://stackoverflow.com/q/21367875
score: 0
type: AcceptedAnswer
type: Answer
has body: Add this member variable to the class: long startTime; Add this to your onCreate()-method: startTime = System.currentTimeMillis(); Add this to your onClick()-method: long timeElapsedMS = System.currentTimeMillis()-startTime; //gets the time difference in milliseconds long timeElapsedSeconds = timeElapsedMS/1000; textView.setText("You took "+timeElapsedSeconds+" seconds");

http://stackoverflow.com/a/21424689
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21423655
type: Answer
answers question: http://stackoverflow.com/q/21423655
has body: Thanks @Keppil. I managed to solve from your valuable comment I was using below code to set label barPlot.getRenderer().setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); barPlot.getRenderer().setBaseItemLabelsVisible(true); The mistake was invoking default constructor StandardCategoryItemLabelGenerator(). See question labels are not in percent % format. I solved by passing NumberFormat instance pctFormat to the parameterized constructor StandardCategoryItemLabelGenerator(java.lang.String labelFormat, java.text.NumberFormat formatter) barPlot.getRenderer().setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}",pctFormat)); barPlot.getRenderer().setBaseItemLabelsVisible(true); Now format has been applied to the labels also.
score: 0

http://stackoverflow.com/comment/32581800
comment on: http://stackoverflow.com/q/21479658
has text: @ryvantage Here is the content of the manifest file:@ryvantage Here is the content of the
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32267064
type: Comment
has text: I think this might definitely be along the lines of what I need. Thank you for your insight and help!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21390376

http://stackoverflow.com/comment/32372151
score: 1
has text: @JiewMeng make sure to escape all backslashes if you use it as a Java string literal, e.g. use `\\\\ ` instead of `\\ `.
type: QuestionComment
comment on: http://stackoverflow.com/q/21452282
type: Comment

http://stackoverflow.com/q/21351300
score: 1
favorite count: 0
has title: How to disable ant in eclipse
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21372210
tagged with: python
has body: I am new to Python and only installed Eclipse + Pydev as the autoformatting possibilities would help me with the annoyingly stringent indentation rules of Python, which weren't being caught by Geany for example. (These have cost me HOURS of futile searching for even very simple intentaion problems). I don't need Java or Jython (yet), so how do I disable the interference from Ant at Run time? Or is there another IDE with autoformatting that doesn't need Java support that would be better suited?
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32197982
tagged with: pydev
has comment: http://stackoverflow.com/comment/32192939
tagged with: ant
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21351085
downvote count: 0
has body: "My problem is that some of the components are moving around when the user puts text into the optionsTxt jtextarea. Anyone know where I should start to stop this happening?" Start by putting your JTextArea in a ScrollPane and setLineWrap(true) and setWrapStyleWord(true). You may want to consider doing this with both JTextAreas you have JTextArea optionsTxtUrl = new JTextArea(1,15); optionsTxtUrl.setLineWrap(true); optionsTxtUrl.setWrapStyleWord(true); JScrollPane scroll = new JScrollPane(optionsTxtUrl); options.add(scroll); // take out options.add(optionsTxtUrl); This will make your lines wrap when they reach the right edge of the text area public void setWrapStyleWord(boolean word) - Sets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (whitespace) if they are too long to fit within the allocated width. If set to false, the lines will be wrapped at character boundaries. By default this property is false. public void setLineWrap(boolean wrap) - Sets the line-wrapping policy of the text area. If set to true the lines will be wrapped if they are too long to fit within the allocated width. If set to false, the lines will always be unwrapped. A PropertyChange event ("lineWrap") is fired when the policy is changed. By default this property is false. If this doesn't solve your problem, you should edit your post with a Minimal, Complete, Tested and Readable example so we can test out your problem.
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/21351007
answers question: http://stackoverflow.com/q/21351007

http://stackoverflow.com/comment/41515061
has text: This question appears to be off-topic because it is essentially a poll.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21406934

http://stackoverflow.com/q/21431712
score: 0
has comment: http://stackoverflow.com/comment/32334381
has title: How to stop running services from another activity?
tagged with: android
has comment: http://stackoverflow.com/comment/32334339
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32334675
has body: I want to stop the services of location updating after making a call function in android. From main activity I used ACTION_CALL for calling one number.I also used one Location_Listener to update the location. after calling it stop working of Location_Update.
has comment: http://stackoverflow.com/comment/32334418

search-engine
type: Tag
tags question: http://stackoverflow.com/q/21408640
tag name: search-engine

http://stackoverflow.com/q/21391347
has title: Error when publishing CXF WebService to Glassfish4
has body: When publishing a CXF WebService to Glassfish4, I get the following error message: deploy is failing=Error occurred during deployment: Exception while deploying the app [...] : The lifecycle method [close] must not throw a checked exception. Related annotation information: annotation [@javax.annotation.PreDestroy()] on annotated element [public void org.apache.cxf.rs.security.saml.sso.AbstractSSOSpHandler.close() throws java.io.IOException] of type [METHOD]. Please see server.log for more details. Versions: apache-cxf-3.0.0-milestone1 Glassfish 4.0 (I had the same issue with the amq-5.8.0 libs in the CXF-3.0.0 Distribution, which i resolved by just updating to amq-5.9.0 libs) Any help is appreciated. Thx.
answer count: 1
accepted answer: http://stackoverflow.com/a/21425568
score: 0
tagged with: glassfish-4
tagged with: web-services
type: Question
has answer: http://stackoverflow.com/a/21425568
type: AnsweredQuestion
tagged with: cxf
tagged with: java

http://stackoverflow.com/comment/32303289
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21413507
has text: thanks, I am still not 100% complete but coming closer. Both of them add to the 'end' of the list no matter what right? if an interviewer asks me to make an add to end method both would be acceptable? I don't get why you said the first method adds to the current position, isn't the current position ALWAYS going to be the last position because head's value is the last value added. Is this how 90% of people would write it?

http://stackoverflow.com/a/21403365
type: Answer
answers question: http://stackoverflow.com/q/21403045
score: 0
has body: When deserializing you have created an empty ArrayList list. You must not try to add elements with list.set(i, ...); i++;! Instead use list.add(...). See http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html for details.

http://stackoverflow.com/q/21450165
linked to: http://stackoverflow.com/q/21203484
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21450499
favorite count: 0
tagged with: android
tagged with: windows
has body: i have a C# pogram to execute Checklists on Windows. Now i'm working on an Android App to execute this checklists too. Now i need a service or something else to synchronize the checklists between the windows program ad the Android app. Maybe i write a WebService für the App but i found nothing about hosting a Java-WebServices on Android (for the local network). Because the Android device and the PC are always in the same network. Maybe someone of you have a good idea.
accepted answer: http://stackoverflow.com/a/21450499
upvote count: 1
tagged with: web-services
type: Question
has title: Best way to synchronize files between android and windows
tagged with: c#
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/21438069
type: AnsweredQuestion
score: 2
tagged with: hivemq
tagged with: java
has body: I am in the process of interfacing to a RESTful API for a proprietary server running internal to my organization. We are using HiveMQ and I have created a simple plugin based on the incredibly useful documentation over at the HiveMQ website. I have also reviewed the Caching and Non-Blocking philosophy so understand I need to take those into consideration when writing my plugin code. Our RESTful API has implemented the Spring Security Remember-Me Auth and our HiveMQ plugin will use the 'valid' response to provide user Auth in HiveMQ. My question is are there any recommended Java RESTful clients that interface with HiveMQ best? Obviously I've searched around and know there are various options. I'm hoping someone with more experience with HiveMQ can provide insight as to what has/hasn't worked better/worse than others. Cheers!
has title: HiveMQ RESTful Authentication Plugin
type: Question
has answer: http://stackoverflow.com/a/21458808
downvote count: 0
tagged with: api
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21458808
tagged with: rest
upvote count: 2
tagged with: mqtt

http://stackoverflow.com/q/21480242
tagged with: swing
has comment: http://stackoverflow.com/comment/32439732
tagged with: java
has comment: http://stackoverflow.com/comment/32421094
has title: prevent jtable column from resizing after certain value is exceeded
type: Question
has body: I have a jtable having a total column width of X pixels. I want to prevent any column in that jtable from resizing when the total width exceeds that X pixels. I tried PropertyChangeListener and other custom implementations in vain.
answer count: 1
has answer: http://stackoverflow.com/a/21480360
tagged with: jtable
score: 0
type: UnansweredQuestion
tagged with: propertychangelistener

http://stackoverflow.com/a/21485222
downvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/41765361
has comment: http://stackoverflow.com/comment/57018712
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21417419
has comment: http://stackoverflow.com/comment/56958860
has comment: http://stackoverflow.com/comment/63932277
upvote count: 165
has comment: http://stackoverflow.com/comment/44816132
score: 157
answers question: http://stackoverflow.com/q/21417419
has comment: http://stackoverflow.com/comment/44141699
has body: The AAR file consists of a JAR file and some resource files (it is basically a standard zip file with a custom file extension). Here are the steps to convert: Extract the AAR file using standard zip extract (rename it to *.zip to make it easier) Find the classes.jar file in the extracted files Rename it as you like and use that jar file in your project
has comment: http://stackoverflow.com/comment/50596530

http://stackoverflow.com/comment/32431733
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21480087
type: AnswerComment
has text: after all, the last thing I've fixed was the connector, that was using tomee syntax, not activemq syntax as you correctly pointed out. Thanks!

http://stackoverflow.com/q/21363644
has comment: http://stackoverflow.com/comment/32213839
has answer: http://stackoverflow.com/a/21363835
has answer: http://stackoverflow.com/a/21363756
upvote count: 3
has answer: http://stackoverflow.com/a/21363741
has comment: http://stackoverflow.com/comment/32213842
has comment: http://stackoverflow.com/comment/32214305
has title: "Exception:java.lang.StringIndexOutOfBoundsException: String index out of range"
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21363735
tagged with: java
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/21363756
possible better answer: http://stackoverflow.com/a/21363735
downvote count: 4
answer count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/32213704
has answer: http://stackoverflow.com/a/48864153
has answer: http://stackoverflow.com/a/21363805
has body: Here is the problem: Return true if the string "cat" and "dog" appear the same number of times in the given string. Examples: catDog("catdog") → true; catDog("catcat") → false; catDog("1cat1cadodog") → true public boolean catDog(String str) { int countCat=0; int countDog=0; for (int i=0; i&lt;str.length();i++) { if (str.charAt(i)== 'c'&amp;&amp; str.length()&gt;=3) { if (str.substring(i,i+3).equals("cat")) countCat++; } } for (int i=0; i&lt;str.length();i++) { if (str.charAt(i)== 'd' &amp;&amp; str.length()&gt;=3) { if (str.substring(i,i+3).equals("dog")) countDog++; } } if (countCat == countDog) return true; else return false; }
has comment: http://stackoverflow.com/comment/32213811
has comment: http://stackoverflow.com/comment/32214191

http://stackoverflow.com/q/21507646
has comment: http://stackoverflow.com/comment/32470390
favorite count: 0
has comment: http://stackoverflow.com/comment/32470438
type: Question
tagged with: javasound
has answer: http://stackoverflow.com/a/21507842
answer count: 2
tagged with: repaint
accepted answer: http://stackoverflow.com/a/21507842
has title: Choppy frame rate using a SourceDataLine
tagged with: frame-rate
possible better answer: http://stackoverflow.com/a/21537809
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21537809
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/32523025
has comment: http://stackoverflow.com/comment/32470236
has body: I've been programming sound with simple Swing graphics for a little while, but my frame rates are choppy for some reason. Generally I'm doing something like the following on a background thread: for(;;) { // do some drawing aPanel.updateABufferedImage(); // ask for asynchronous repaint aPanel.repaint(); // write the sound aSourceDataLine.write(bytes, 0, bytes.length); } Through debugging, I think I've already traced the problem to the blocking behavior of SourceDataLine#write. Its doc states the following: If the caller attempts to write more data than can currently be written [...], this method blocks until the requested amount of data has been written. So, what this seems to mean is SourceDataLine actually has its own buffer that it is filling when we pass our buffer to write. It only blocks when its own buffer is full. This seems to be the holdup: getting it to block predictably. To demonstrate the issue, here's a minimal example which: writes 0's to a SourceDataLine (no audible sound) and times it. draws an arbitrary graphic (flips each pixel color) and times the repaint cycle. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.sound.sampled.*; class FrameRateWithSound implements Runnable { public static void main(String[] args) { SwingUtilities.invokeLater(new FrameRateWithSound()); } volatile boolean soundOn = true; PaintPanel panel; @Override public void run() { JFrame frame = new JFrame(); JPanel content = new JPanel(new BorderLayout()); final JCheckBox soundCheck = new JCheckBox("Sound", soundOn); soundCheck.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { soundOn = soundCheck.isSelected(); } }); panel = new PaintPanel(); content.add(soundCheck, BorderLayout.NORTH); content.add(panel, BorderLayout.CENTER); frame.setContentPane(content); frame.pack(); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true…
type: AnsweredQuestion

gmaven
type: Tag
tags question: http://stackoverflow.com/q/21462396
tag name: gmaven

http://stackoverflow.com/comment/32239693
score: 0
comment on: http://stackoverflow.com/q/21377571
type: QuestionComment
type: Comment
has text: chech this part in your code: GCMRegistrar.checkDevice( this); GCMRegistrar.checkManifest( this); if (GCMRegistrar.isRegistered( this)) { Log.d("info", GCMRegistrar.getRegistrationId( this)); } final String regId = GCMRegistrar.getRegistrationId( this); System.out.println(regId); r=regId; if (regId.equals("")) { GCMRegistrar.register( this, "<----UR ID---->"); Log.d("info", GCMRegistrar.getRegistrationId( this)); r=regId; System.out.println(r); } else { Log.d("info", "already registered as" + regId); }

http://stackoverflow.com/a/21408856
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21408620
has body: I would bet the problem is that you're only drawing a single point, so it's hard to see. Your code works fine for me. However, you should be extending JPanel, not JFrame. Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/painting/
downvote count: 0

http://stackoverflow.com/q/21444291
has comment: http://stackoverflow.com/comment/32357959
type: Question
tagged with: java
has body: I'm trying to save a bitmap to a specific folder in the private app's directory but android is having none of it. I can save files in the main directory and I can create subdirectories but I cannot save files to the subdirectories. I Here's the method I'm using: public void saveBitMap(String fileName, Bitmap bitMap, String album){ //Creating the subdirectory. This works File albumDir=new File(getFilesDir(), album); albumDir.mkdirs(); albumDir.setWritable(true); albumDir.setWritable(true); fileName = albumDir.getAbsolutePath()+"/"+fileName; //Creating the file in the subdirectory. This doesn't work FileOutputStream outputStream; try { outputStream = openFileOutput(fileName, Context.MODE_PRIVATE); bitMap.compress(CompressFormat.PNG, 90, outputStream); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } //Checking that the files and folders have been saved File dir = getFilesDir(); for(File f: dir.listFiles()){ Log.d("ggg", f.getName()); if(f.isDirectory()){ Log.d("ggg",f.list().length+""); for(String g:f.list()){ Log.d("ggg", g +" "+ f); } } } }
score: 0
has title: Android - how do I save a file to a subdirectory of the main app's directory?
has comment: http://stackoverflow.com/comment/32358237
tagged with: java-io
tagged with: android
has comment: http://stackoverflow.com/comment/32358371
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32551467
comment on: http://stackoverflow.com/q/21433750
type: Comment
type: QuestionComment
has text: @zapl....Take a look my question, please. I have some new informations.
score: 0

http://stackoverflow.com/comment/32202511
comment on: http://stackoverflow.com/q/21354429
score: 0
has text: Thank you for these comments. I indeed need to study more about these things. Would you like to answer this question? I do not have a canonical answer. JSON works somehow now.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21450399
has comment: http://stackoverflow.com/comment/32369139
type: Answer
has comment: http://stackoverflow.com/comment/32368964
has body: try{ BufferedWriter writer = new BufferedWriter(new FileWriter("filecsv.csv")); for(int index11 = 0; index11 &lt; a.length; index11++) { for(int subIndex1 = 0; subIndex1 &lt; 2; subIndex1++){ writer.write(String.valueOf(a[index11][subIndex1])); if(subIndex1&lt;2-1){ writer.write(","); } } writer.write("\n"); } } catch(IOException ex){ ex.printStackTrace(); } writer.close();
accepted answer of: http://stackoverflow.com/q/21450329
answers question: http://stackoverflow.com/q/21450329
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32396017
comment on: http://stackoverflow.com/q/21464720
score: 0
has text: Seems strange to me, I only have access to 2.2 and the `ValueIterator` implements the interface.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32427859
type: Comment
comment on: http://stackoverflow.com/q/21482093
has text: @Phil It's definitely the easiest (and works well, unless you often switch domain names) approach.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32192280
type: Comment
score: 0
has text: I am familiar with the java code..I need some help forming the javascript code since I can't use java
type: AnswerComment
comment on: http://stackoverflow.com/a/21351576

http://stackoverflow.com/comment/32266267
comment on: http://stackoverflow.com/a/21391326
type: AnswerComment
has text: That's a step in the wrong direction. If you really want to, you can put that code into `build.gradle`. However, it will slow down every single Gradle invocation (even, say, `gradle tasks`).
score: 0
type: Comment

http://stackoverflow.com/q/21418916
tagged with: spring
has answer: http://stackoverflow.com/a/21596387
tagged with: java
type: Question
score: 3
answer count: 1
downvote count: 0
tagged with: spring-cache
favorite count: 0
has title: Preloaded Ehcache Ignored when using @Cacheable Annotation
tagged with: ehcache
has body: I'm still new to the ehcache API so I may be missing something obvious but here's my current issue. I currently have a persistent-disk cache that's being stored on my server. I'm currently implementing a passive write-behind cache method that saves key/value pairs to a database table. In the event the persistent-disk cache is lost, I'd like to restore the cache from the database table. Example I'm using for my write-behind logic: http://scalejava.blogspot.com/2011/10/ehcache-write-behind-example.html I'm building a disk persistent using the following method: import com.googlecode.ehcache.annotations.Cacheable; import com.googlecode.ehcache.annotations.KeyGenerator; import com.googlecode.ehcache.annotations.PartialCacheKey; @Cacheable(cacheName = "readRuleCache", keyGenerator=@KeyGenerator(name="StringCacheKeyGenerator")) public Rule read(@PartialCacheKey Rule rule,String info) { System.out.print("Cache miss: "+ rule.toString()); //code to manipulate Rule object using info try{ String serialziedRule =objectSerializer.convertToString(Rule); readRuleCache.putWithWriter(new Element(rule.toString(),serialziedRule )); } catch(IOException ioe) { System.out.println("error serializing rule object"); ioe.printStackTrace(); } return rule; } The write method I'm overriding in my CacheWriter implementation works fine. Things are getting saved to the database. @Override public void write(final Element element) throws CacheException { String insertKeyValuePair ="INSERT INTO RULE_CACHE (ID, VALUE) VALUES " + "('"+element.getObjectKey().toString()+"','" +element.getObjectValue().toString()+"')"; Statement statement; try { statement = connection.createStatement(); statement.executeUpdate(insertKeyValuePair); statement.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Querying and De-serializing the string back in to an object works fine too. I've validated that all the values of the object are present. The disk persistent cache is also be…
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/comment/32675468
score: 1
type: AnswerComment
has text: here is a port number for example: jdbc-uri="jdbc:sqlserver://localhost:1791;databaseName=ofbiz;SelectMethod=cursor;"
comment on: http://stackoverflow.com/a/21509188
type: Comment

http://stackoverflow.com/comment/32212386
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21362828
has text: Thanks for helping. I am aware that different Java versions have different features. But what I'd like to know, is this: Let's say I made a program using JDK 7, but this program doesn't use any feature that JRE 6 doesn't support. My question is if I need to compile my program in some special way, or do anything special, so it will be able to run on JRE 6 - or is compiling as usual enough?
score: 0

http://stackoverflow.com/comment/32343717
type: AnswerComment
comment on: http://stackoverflow.com/a/21412689
type: Comment
has text: @learner Please consider accepting the answer if this was helpful. Regarding the security settings: please post another question, this is something different and posting a new question helps people find it later on.
score: 0

aspect
tags question: http://stackoverflow.com/q/21499386
type: Tag
tag name: aspect

http://stackoverflow.com/q/21414720
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32305118
type: Question
has comment: http://stackoverflow.com/comment/32305306
answer count: 1
has body: Is there a way of using reflection to create a class programmatically? For instance. Is there a private constructor we can use to create a class type that then can be used to create instances of that class? I know that there are other tricks like generating source code and compiling it, or generating byte code and loading it using a classloader... But I want to see if it is possible to somehow create an instance of java.lang.Class directly. I want to write the following code in clojure: (def c (create-class "com.example.Dog" {:fields {"legs" 4} :methods {"bark" (... do something ...)} :constructors {.....}})) (def d1 (.newInstance c)) (def d2 (.newInstance c))
has comment: http://stackoverflow.com/comment/32306999
has comment: http://stackoverflow.com/comment/32307405
upvote count: 1
linked to: http://stackoverflow.com/q/2566754
has comment: http://stackoverflow.com/comment/32308449
tagged with: clojure
has answer: http://stackoverflow.com/a/21416913
favorite count: 0
has comment: http://stackoverflow.com/comment/32305163
has title: Is there a way to create a java class type programmatically?
has comment: http://stackoverflow.com/comment/32318394
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32305232

http://stackoverflow.com/a/21379807
score: 0
has body: I'm guessing you're using CSVWriter. if you check source code for writeNext, it always adds new line at the end. The easiest solution without changing too much with your project, if files are not too big, is just to write into an in-memory stream, then flush it all into a file except the last new line character.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21379575
type: Answer
answers question: http://stackoverflow.com/q/21379575

http://stackoverflow.com/comment/32381141
score: 0
type: AnswerComment
type: Comment
has text: could you add some code snippet to have an idea about your export utility..check if this can help- [web page to excel](http://www.quicklyjava.com/export-web-page-to-excel/)
comment on: http://stackoverflow.com/a/21446975

http://stackoverflow.com/a/21466785
has body: change the color: radio2.setTextColor(Color.parseColor("#bcbddc"));
score: 0
answers question: http://stackoverflow.com/q/21372953
type: Answer

http://stackoverflow.com/comment/126232820
type: QuestionComment
comment on: http://stackoverflow.com/q/21476263
score: 0
has text: This has nothing to do with varargs. Strings are immutable in java
type: Comment

url-rewriting
tags question: http://stackoverflow.com/q/21485046
tags question: http://stackoverflow.com/q/21451868
type: Tag
tag name: url-rewriting

http://stackoverflow.com/comment/32334932
has text: http://stackoverflow.com/questions/21245712/unable-to-send-json-object-to-rest-web-service/21245771#21245771 if you want to use json.
score: 2
comment on: http://stackoverflow.com/q/21431609
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32345439
comment on: http://stackoverflow.com/q/21437806
score: 3
has text: Either use an object that stores the type of object and count of that object, or use a different structure like a map where the keys are object type and the values are the count. It'll be easier than having to related stacks that must match in order.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28625248
type: Answer
score: 2
upvote count: 2
has body: Replace c.sendJavascript("javascript:getMassTimes()"); with myBrowser.loadUrl("javascript:getMassTimes()");. This worked for my problem. If you want to pass a String from the activity to javascript use String msgToSend = "Hello World!"; myBrowser.loadUrl("javascript:callFromActivity(\""+msgToSend+"\")");
answers question: http://stackoverflow.com/q/21483506
downvote count: 0

http://stackoverflow.com/comment/32204135
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21357755
score: 1
has text: I modified the original post as I did specify dimensions in `dimens.xml`but as you pointed out if I assign `?attr/actionBarSize` to `paddingTop` the code runs fine, so what's wrong?

http://stackoverflow.com/comment/32317012
type: AnswerComment
has text: I would rather say _reference it from a variable named `staff`_.
type: Comment
comment on: http://stackoverflow.com/a/21421461
score: 1

http://stackoverflow.com/comment/32218529
type: Comment
comment on: http://stackoverflow.com/a/21357198
has text: That error usually means that there's someplace where the plugin version still isn't set to 0.8. Have you checked all your build.gradle files?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21478459
has comment: http://stackoverflow.com/comment/32419146
score: 2
has title: accessing excel as database with jdbc
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32418002
has comment: http://stackoverflow.com/comment/32419238
has comment: http://stackoverflow.com/comment/32417652
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32424143
favorite count: 0
has comment: http://stackoverflow.com/comment/32417737
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/32417916
tagged with: excel
has comment: http://stackoverflow.com/comment/32417681
has answer: http://stackoverflow.com/a/21483164
tagged with: java
has body: I have to design an application for accessing excel application as database. My problem is I have to create multiple connection for each transaction and if I miss any of closing it, the excel is not being update. I want to design pattern where i am able to access the excel. Any one help me in designing a common pattern through which i wont be having problem. I want something like this, but we are not able to use it to access excel. Thanks in advance! i have this method in utility class static ResultSet getExcelData(String filePath,String sqlQuery){ ResultSet rs=null; try{ conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ="+filePath+";READONLY=false"); stmt= conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); rs=stmt.executeQuery( sqlQuery ); }catch (Exception e) { e.printStackTrace(); return null; // TODO: handle exception }finally{ } return rs; } and i am calling it this way ResultSet rs=JdbcUtil.getExcelData("D:\\AB_demo\\AB_demo\\test.xls", "Select max(int(ID)) from [MAIN$] where HEADER_IND is not Null AND int(ID)&lt;"+excelId); int databaseId = 0; if(rs.next()) { databaseId=rs.getInt(1); } ResultSet rs1=JdbcUtil.getExcelData("D:\\AB_demo\\AB_demo\\test.xls", "SELECT * from [MAIN$] where id= '"+databaseId+"'or id='"+excelId+"'"); i am calling this method twice after which im updating the excel file by using stmt.executeUpdate(sql); its returning the integer 1 but its not reflecting in excel.when i use process explorer the file is still in use.i need a design pattern or come code to overcome his kind of problem.

http://stackoverflow.com/a/21528349
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32536450
answers question: http://stackoverflow.com/q/21473324
has body: int resultInt = connMgr.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableHIPRI"); Will return -1 if the device doesn't support HiPri; you have to fall back to forcing the 3g / 4g connection by turning off the wifi (and returning it to its previous state once you've finished). Can't remember if all CDMA devices don't support HiPri, but it might be the device you're testing on?

http://stackoverflow.com/q/21399093
tagged with: network-programming
has comment: http://stackoverflow.com/comment/32277815
has comment: http://stackoverflow.com/comment/32277713
has comment: http://stackoverflow.com/comment/32282179
has answer: http://stackoverflow.com/a/21399164
answer count: 1
has comment: http://stackoverflow.com/comment/32277789
has title: Android App Crashes When Sending Data To Server
tagged with: android
has body: I am trying to send some data to my server which is publicly available on the internet. The app gets started as a service after boot is completed (permission is added), how ever the app crashes. I have narrowed the code down. It seems like it crashes when it is trying to send data to the server. Below is my code. I really appreciate if you guys can help me on this. package com.example.bootstart; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.os.AsyncTask; import android.util.Log; class SendData extends AsyncTask&lt;Void, Void, Boolean&gt; { public void sendinfo(){ // Creating HTTP client HttpClient httpClient = new DefaultHttpClient(); // Creating HTTP Post HttpPost httpPost = new HttpPost( "http://www.mydomain.com/controller_name/funtion_name"); // Building post parameters // key and value pair List&lt;NameValuePair&gt; nameValuePair = new ArrayList&lt;NameValuePair&gt;(4); nameValuePair.add(new BasicNameValuePair("imei", "12345")); nameValuePair.add(new BasicNameValuePair("welawa", "12315646545")); nameValuePair.add(new BasicNameValuePair("lat", "123.25")); nameValuePair.add(new BasicNameValuePair("long", "52.22323")); // Url Encoding the POST parameters try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair)); } catch (UnsupportedEncodingException e) { // writing error to Log e.printStackTrace(); } // Making HTTP Request try { HttpResponse response = httpClient.execute(httpPost); // writing response to log Log.d("Http Response:", response.toString()); } catch (ClientProtocolException e) …
has comment: http://stackoverflow.com/comment/32282139
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21399164
has comment: http://stackoverflow.com/comment/32277757
score: 0
tagged with: java
tagged with: android-emulator
type: Question

http://stackoverflow.com/a/21479786
score: 2
accepted answer of: http://stackoverflow.com/q/21479751
has comment: http://stackoverflow.com/comment/32420153
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Why not just run one query? You an do: select (SELECT COUNT(*) FROM table1) as table1cnt, (SELECT COUNT(*) FROM table2) as table2cnt, (SELECT COUNT(*) FROM table3) as table3cnt; You can also return one value per row, but you'll want an additional column to identify the table: select which, cnt from ((SELECT 'table1' as which, COUNT(*) as cnt FROM table1) union all (SELECT 'table2' as which, COUNT(*) as cnt FROM table2) union all (SELECT 'table3' as which, COUNT(*) as cnt FROM table3) ) t
has comment: http://stackoverflow.com/comment/32420043
type: Answer
answers question: http://stackoverflow.com/q/21479751

http://stackoverflow.com/q/21439745
has body: I am trying to establish a UDP send/Receive app. I send a message, the server responds back, and then the server MAY send more info over time. I created a thread to send the message, and another Async thread to continuously check in the background for new messages. However, I am not receiving the messages correctly. It works correctly if I have a constant feed of receive packets, but it doesn't work when the receive is random. For example: Port 1: constantly sends data to my client, so I receive new packets every second. The result is fine, my app shows each and every new packet. My "Receiving update" even ticks to go like "Receiving." "Receiving.." "Receiving..." Port 2: i receive packets randomly. it shows them only if I keep clicking my send button. My receiving progress dots only iterate when I press the send button. Sometimes a packet flashes and goes away. I am trying to make port 2 work. I tried putting my inbackground() function to sleep for 2 seconds after I publish a progress, but that didn't help. I am really confused how to make it so I can constantly receive UDP packets. Here is my code. EDIT: Now port 2 displays correctly, the message doesn't just flash and disappear. However, my Receiving... progress dots update really slow. My question is, in my "doInBackground" function, I have the infinite while loop, doesn't that loop execute constantly really fast? So even if there is no new message, I still publish at the end of the loop so that my "Receiving.." progress dots should move right? EDIT AGAIN: I literally changed nothing to the source code, just some layout stuff, and now port 2 doesn't work again. It doesn't show any new receives or the receiving update bar. If I go to port 1 with the constant feed, then everything updates perfectly... I tried looking at other questions, couldn't decipher what to do. Thanks for your help! import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; im…
has comment: http://stackoverflow.com/comment/81315172
downvote count: 0
favorite count: 0
tagged with: udp
tagged with: android
answer count: 1
tagged with: asynchronous
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has title: How to have a continuous receive UDP in an async function for android?
has answer: http://stackoverflow.com/a/28266238
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/32347939
score: 0
type: Comment
has text: @ron it's important that your servlet can handle the situation when the variables are missing because there's nothing stopping a user entering `http://yourserver/youapp/loginPage` in a browser.
type: AnswerComment
comment on: http://stackoverflow.com/a/21439028

http://stackoverflow.com/q/21437556
tagged with: java
has title: Loop insert date Android
has answer: http://stackoverflow.com/a/21437729
tagged with: sqlite
answer count: 1
has comment: http://stackoverflow.com/comment/32344929
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/21437729
type: AnsweredQuestion
has body: Calendar1, Calendar2 are declared at the beginning of class. and I use them with 2 datepicker dialog. Now I'm inserting a record each month between Calendar1 and Calendar2, but the insertion of the record begins the month following the month in Calendar1 chosen. For example, if I choose 01/01/2014 in Calendar1 records are inserted from 01/02/2014 public void date(View v){ SQLiteDatabase db = ....; ContentValues cv = ....; SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" ); for(int i=0; calendar1.getTime().before(calendar2.getTime()); i++) { calendar1.add(Calendar.MONTH, 1); if (calendar1.getTime().before(calendar2.getTime())) { // insert calendar1 into db DB String strDate = sdf.format(calendar1.getTime() ); cv.put(tTable.DATE, strDate);
downvote count: 3
upvote count: 1
tagged with: calendar
has comment: http://stackoverflow.com/comment/32344950
type: Question
score: -2

http://stackoverflow.com/a/21446517
downvote count: 0
has body: IF month is 1,2, or 3, season = "Winter Would simply become... String season = ""; switch (month) { case 1: case 2: case 3: season = "Winter"; break; case ...: // etc... } case will fall through to the next case unless there is a break Take a look at The switch Statement for more details
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21446481

http://stackoverflow.com/a/21368609
has body: Hashes are not unique, hence they are not appropriate for uniqueId. As to probability of hash collision, you could read about birthday paradox. Actually (from what I recall) when drawing from an uniform distribution of N values, you should expect collision after drawing $\sqrt(N)$ (you could get collision much earlier). The problem is that Java's implementation of hashCode (and especially when hashing short strings) doesn't provide uniform distribution, so you'll get collision much earlier.
has comment: http://stackoverflow.com/comment/32223284
answers question: http://stackoverflow.com/q/21368492
type: Answer
has comment: http://stackoverflow.com/comment/32223152
score: 9
upvote count: 9
downvote count: 0

http://stackoverflow.com/q/21390437
has answer: http://stackoverflow.com/a/21390477
has answer: http://stackoverflow.com/a/69628531
has comment: http://stackoverflow.com/comment/32288717
upvote count: 16
possible better answer: http://stackoverflow.com/a/21390477
tagged with: java
has answer: http://stackoverflow.com/a/21390474
has comment: http://stackoverflow.com/comment/32265211
has body: Why does the following code cause ClassNotFoundException? public class App02 { public static class A { } public static void main(String[] args) throws ClassNotFoundException { try { System.out.println("A.class.getCanonicalName() = " + A.class.getCanonicalName()); Class c = Class.forName("tests.App02.A"); //error on this line System.out.println(c.getName()); } catch(Exception e) { e.printStackTrace(); } } } Output: A.class.getCanonicalName() = tests.App02.A java.lang.ClassNotFoundException: tests.App02.A 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:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at tests.App02.main(App02.java:15)
has comment: http://stackoverflow.com/comment/32264318
answer count: 4
has comment: http://stackoverflow.com/comment/32265611
has comment: http://stackoverflow.com/comment/32283927
downvote count: 0
has answer: http://stackoverflow.com/a/21390502
score: 16
has title: Why can't load inner class? ClassNotFoundException
accepted answer: http://stackoverflow.com/a/21390474
type: Question
tagged with: classnotfoundexception
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/32262578
tagged with: classloader

http://stackoverflow.com/a/21491060
answers question: http://stackoverflow.com/q/21491004
has body: It takes the String s (the method's parameter) and looks at the first character. If it's not the c character, then add it to the end of the return string, then remove the first character from s. What you're left with is the same string but without any instances of the character c. s = "hello" return = "" first loop: s = "hello" (set c2 to first char) c2 = "h" (h is not 'o') return = "h" (append c2 to end) second loop: s = "ello" c2 = "e" return = "he" third loop: s = "llo" c2 = "l" return = "hel" fourth loop: s = "lo" c2 = "l" return = "hell" fifth loop: s = "o" c2 = "o" ("o" matches 'o' character) return = "hell" (c2 isn't appended) sixth loop: s = "" (loop ends) The line inside the while loop: if(s.equals("")) return to_return; means if s is an empty string, then return the value of "return_to", which ends the loop and exits the method. Since the while() loop will never end, the last return statement will never be reached.
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32440501
score: 1

http://stackoverflow.com/a/21418542
has body: The issue is that you might be modifying "enemiesList" (removing/adding elements for example), while the list is being itarated here: for (Sprite s : enemiesList) { s.ID = index; index++; } Try making that method synchronized and see what happens (as well as the one that adds elements into the list): public synchronized static void checkECount(int id) { canUpdate = false; enemyCount = enemyCount - 1; enemiesList.remove(id); int index = 0; for (Sprite s : enemiesList) { s.ID = index; index++; } canUpdate = true; } I actually see a potential disaster here when "createEnemies" is being called, give it a try and see what happens... Hope this Helps... Regards!
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21418508
has comment: http://stackoverflow.com/comment/32313637
has comment: http://stackoverflow.com/comment/32313539
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32416662
has text: As @SilviuBurcea suggests, use external merge sort. Here's an example in Java: http://www.ashishsharma.me/2011/08/external-merge-sort.html
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/21477871

http://stackoverflow.com/q/21425566
type: Question
has answer: http://stackoverflow.com/a/21425621
possible better answer: http://stackoverflow.com/a/21425590
has answer: http://stackoverflow.com/a/21425635
has answer: http://stackoverflow.com/a/21425604
tagged with: arraylist
answer count: 5
accepted answer: http://stackoverflow.com/a/21425604
has comment: http://stackoverflow.com/comment/32323748
tagged with: object
type: AnsweredQuestion
score: 0
tagged with: java
has body: Why is the entires variable not defined If i made the arraylist called entires public class College { Student s = new Student(); ArrayList &lt;Student&gt; entries; public College() { entries = new ArrayList&lt;Student&gt;(); } public void add(Student s) { entires.add(s); } } Edited so ArrayList is available to the class?
has answer: http://stackoverflow.com/a/21425670
has title: Unable to add to an object into ArrayList
has answer: http://stackoverflow.com/a/21425590

http://stackoverflow.com/a/21570364
has body: UPDATE It seems, that this is related to a bug with unicode characters in lwjgl on OSX: [FIXED] Unicode input If you update to the latest lwjgl library 2.9.1 this should be fixed. From the changelog: 2013-10-13 kappaOne .../org/lwjgl/opengl/MacOSXNativeKeyboard.java, src/native/macosx/org_lwjgl_opengl_Display.m: Fix keyboard key codes to return Unicode characters instead of ASCII characters see: 2.9.1-changelog.txt Original Answer How do you get input from special characters in Libgdx? You can implement the interface com.badlogic.gdx.InputProcessor and set the current input processor by calling Gdx.input.setInputProcessor(inputProcessor ); Then you should be able to receive notifications about all typed characters (special or not) in the method InputProcessor#keyTyped(char c). Actually this is more or less, what the class TextField does (not exactly, it listens for input by extending com.badlogic.gdx.scenes.scene2d.InputListener). I had a quick look at the relevant source code of TextFields keyTyped method: [...] if (font.containsCharacter(character)) { // here the character gets added to the text field } [...] So it seems, that the font of the text field must support the character, otherwise it will not be displayed. I have no mac to test this, but I would guess, that the BitmapFont used by default on your mac does not support the special characters. Try to set a different BitmapFont for the TextField (see TextField.setStyle(TextFieldStyle style)) and see if this solves the problem.
has comment: http://stackoverflow.com/comment/32626367
downvote count: 0
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34930826
has comment: http://stackoverflow.com/comment/32627152
has comment: http://stackoverflow.com/comment/32654179
accepted answer of: http://stackoverflow.com/q/21416741
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/21416741

http://stackoverflow.com/a/21466196
has body: I came up with this code : Element div = doc.select("ol.list_products.list_product_summaries").first(); for (Element element : div.children()) { System.out.println(element.select("span.metascore_w.medium.game").text()); System.out.println(element.select("h3.product_title").text()); }
type: Answer
accepted answer of: http://stackoverflow.com/q/21464752
answers question: http://stackoverflow.com/q/21464752
upvote count: 1
type: AcceptedAnswer
downvote count: 1
score: 0

http://stackoverflow.com/comment/32739075
score: 0
type: Comment
type: QuestionComment
has text: Same issue (although haven't been able to find the intellij log) - but same log on ejabberd side, and same message in IntelliJ client. I can connect fine with Adium, I should note. Have you found a solution?
comment on: http://stackoverflow.com/q/21401438

http://stackoverflow.com/q/21489817
has comment: http://stackoverflow.com/comment/32459883
has comment: http://stackoverflow.com/comment/32440402
type: Question
has comment: http://stackoverflow.com/comment/32440821
has comment: http://stackoverflow.com/comment/32440492
has title: Android - Cant read file, getting exception
has comment: http://stackoverflow.com/comment/32460260
has comment: http://stackoverflow.com/comment/32440566
has comment: http://stackoverflow.com/comment/32460055
upvote count: 1
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/32440534
has comment: http://stackoverflow.com/comment/32459815
favorite count: 0
has comment: http://stackoverflow.com/comment/32440880
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32440935
tagged with: android
has body: i have an issue which is driving me crazy. So I have two methods, one for reading and the other for writing. I have a class called Converastion which holds an ArrayList&lt;ChatMessage&gt; and some String properties. Both Converastion and ChatMessage implements Serializable and I have I know I can save this Conversation object to the FileSystem. But when I try to read this and then write it (update the Conversation), it doesn't work quite well. The issue is on reading, I always get the java.io.EOFException when I know the Conversation object always has been written before. Here are the my two methods: public Conversation getConversation(String userId, boolean createByDefault){ try { File f = new File(sApplicationContext.getFilesDir() + "/" + "Conversation" + "/" + userId); FileInputStream fis = new FileInputStream(f); ObjectInputStream in = new ObjectInputStream(fis); Conversation ret = (Conversation) in.readObject(); in.close(); return ret; } catch (Exception e) { e.printStackTrace(); Conversation conv = new Conversation(); conv.userId = userId; conv.usernameChat = userId + "@" + XMPPController.HOST; if(createByDefault) setConversation(conv); return conv; } } public void setConversation(Conversation conv){ try { File dir = new File(sApplicationContext.getFilesDir(), "Conversation"); if(!dir.exists()) { dir.mkdir(); } File newFile = new File(sApplicationContext.getFilesDir(), "Conversation" + "/" + conv.userId); newFile.createNewFile(); FileOutputStream fos = new FileOutputStream(newFile); ObjectOutputStream out = new ObjectOutputStream(fos); out.writeObject(conv); out.close(); } catch (Exception e) { e.printStackTrace(); } } Now I use these methods in a loop, which causes the problem. onListIQ calles multiple times rapedly, a listener called from another class. I even tried to set synchronized(this) but no luck, here's the code: public void onListIQ(ListChatIQ listIQ){ // get the conversation Conversation conv = getConversation(listIQ.userId, true); // loop through …
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/32459942
has comment: http://stackoverflow.com/comment/32440658
score: 1
has comment: http://stackoverflow.com/comment/32440526
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/32452655
has comment: http://stackoverflow.com/comment/32459778
has comment: http://stackoverflow.com/comment/32459682
has comment: http://stackoverflow.com/comment/32440586

servlets
tags question: http://stackoverflow.com/q/21415413
tags question: http://stackoverflow.com/q/21439089
tags question: http://stackoverflow.com/q/21361243
tags question: http://stackoverflow.com/q/21496836
tags question: http://stackoverflow.com/q/21500286
tags question: http://stackoverflow.com/q/21488379
tags question: http://stackoverflow.com/q/21485194
tags question: http://stackoverflow.com/q/21502149
tags question: http://stackoverflow.com/q/21380043
tags question: http://stackoverflow.com/q/21473959
tags question: http://stackoverflow.com/q/21371968
tags question: http://stackoverflow.com/q/21474066
tags question: http://stackoverflow.com/q/21500676
tags question: http://stackoverflow.com/q/21360231
tags question: http://stackoverflow.com/q/21420887
tags question: http://stackoverflow.com/q/21416619
tags question: http://stackoverflow.com/q/21406946
tags question: http://stackoverflow.com/q/21402203
tags question: http://stackoverflow.com/q/21513124
tags question: http://stackoverflow.com/q/21450602
tags question: http://stackoverflow.com/q/21500681
tags question: http://stackoverflow.com/q/21378773
tags question: http://stackoverflow.com/q/21438701
tags question: http://stackoverflow.com/q/21512164
tags question: http://stackoverflow.com/q/21381305
tags question: http://stackoverflow.com/q/21461797
tags question: http://stackoverflow.com/q/21360091
tags question: http://stackoverflow.com/q/21360891
tags question: http://stackoverflow.com/q/21451868
tags question: http://stackoverflow.com/q/21441331
tags question: http://stackoverflow.com/q/21503640
tags question: http://stackoverflow.com/q/21491551
tags question: http://stackoverflow.com/q/21422964
tags question: http://stackoverflow.com/q/21463646
tags question: http://stackoverflow.com/q/21422168
tags question: http://stackoverflow.com/q/21370678
tags question: http://stackoverflow.com/q/21480040
tags question: http://stackoverflow.com/q/21416796
tags question: http://stackoverflow.com/q/21496076
tags question: http://stackoverflow.com/q/21434082
tags question: http://stackoverflow.com/q/21457408
tags question: http://stackoverflow.com/q/21503559
tags question: http://stackoverflow.com/q/21449646
tags question: http://stackoverflow.com/q/21399103
tags question: http://stackoverflow.com/q/21424931
tags question: http://stackoverflow.com/q/21489231
tags question: http://stackoverflow.com/q/21472682
tags question: http://stackoverflow.com/q/21422185
tags question: http://stackoverflow.com/q/21478778
tags question: http://stackoverflow.com/q/21496278
tags question: http://stackoverflow.com/q/21452716
tags question: http://stackoverflow.com/q/21418101
tags question: http://stackoverflow.com/q/21486576
tag name: servlets
tags question: http://stackoverflow.com/q/21507762
tags question: http://stackoverflow.com/q/21374161
tags question: http://stackoverflow.com/q/21446883
type: Tag
tags question: http://stackoverflow.com/q/21452418
tags question: http://stackoverflow.com/q/21465767
tags question: http://stackoverflow.com/q/21490289
tags question: http://stackoverflow.com/q/21398476
tags question: http://stackoverflow.com/q/21487644
tags question: http://stackoverflow.com/q/21459021
tags question: http://stackoverflow.com/q/21412620
tags question: http://stackoverflow.com/q/21466657
tags question: http://stackoverflow.com/q/21372581
tags question: http://stackoverflow.com/q/21510177
tags question: http://stackoverflow.com/q/21484223
tags question: http://stackoverflow.com/q/21442412
tags question: http://stackoverflow.com/q/21390809
tags question: http://stackoverflow.com/q/21511233
tags question: http://stackoverflow.com/q/21501190
tags question: http://stackoverflow.com/q/21461020
tags question: http://stackoverflow.com/q/21496645

http://stackoverflow.com/a/21494579
has comment: http://stackoverflow.com/comment/32447633
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21494455
upvote count: 2
has body: Here is the code for finding index: int index = 0; while (true) { currentProbability -= probabilities[index]; if (currentProbability &lt;= 0) { break; } index++; }
type: Answer

sqlexception
tags question: http://stackoverflow.com/q/21355188
tags question: http://stackoverflow.com/q/21366438
type: Tag
tag name: sqlexception

http://stackoverflow.com/q/21480457
tagged with: android-ndk
has comment: http://stackoverflow.com/comment/32421989
type: Question
has answer: http://stackoverflow.com/a/21519073
linked to: http://stackoverflow.com/q/21480981
has answer: http://stackoverflow.com/a/21480836
has comment: http://stackoverflow.com/comment/32428413
tagged with: java
possible better answer: http://stackoverflow.com/a/21480836
answer count: 3
has title: UnsatisfiedLinkError: Native method not found
has answer: http://stackoverflow.com/a/21523375
has comment: http://stackoverflow.com/comment/32427786
has comment: http://stackoverflow.com/comment/32423050
score: 0
tagged with: android
has body: I know this question has been asked to death so far, but none of the solutions I read worked for me, so I thought I'd see if anyone can come up with a new answer. Here is the Java code: private native int nativeVideoPlayerMain(String fileName, int loop,int audioFileType, int skipFrames, int rgb565, int yuvRgbAsm, int skipBidirFrames, int queueSizeMin, int queueSizeMax, int queueSizeTotal, int queueSizeAudio, int fastMode, int debugMode, int syncType, int seekDuration, int ffmpegFlags); in package com.example.player and class DemoRenderer. Here is the native code definition: extern C_LINKAGE int Java_com_example_player_DemoRenderer_nativeVideoPlayerMain(JNIEnv* env, jobject obj, jstring jfileName, jint loopAfterPlay, jint audioFileType, jint skipFrames, jint rgb565, jint yuvRgbAsm, jint skipBidirFrames, jint queueSizeMin, jint queueSizeMax, jint totalQueueSize, jint audioQueueSize, jint fastMode, jint debugMode, jint syncType, jint seekDuration, jint ffmpegFlags) { jboolean isCopy; int argc = 1; int my_loop_after_play; int my_audio_file_type; int my_skip_frames; int my_rgb_565; int my_yuv_rgb_asm; int my_skip_bidir_frames; int my_queue_size_min; int my_queue_size_max; int my_total_queue_size; int my_audio_queue_size; int my_fast_mode; int my_debug_mode; int my_sync_type; int my_seek_duration; int my_ffmpeg_flags; #ifdef BROOV_C const char *fileString = (*env)-&gt;GetStringUTFChars(env, jfileName, &amp;isCopy); #else const char *fileString = env-&gt;GetStringUTFChars(jfileName, &amp;isCopy); #endif char lclFileName[FILE_NAME_SIZE]; strncpy(lclFileName, fileString, FILE_NAME_SIZE); #ifdef BROOV_C (*env)-&gt;ReleaseStringUTFChars(env, jfileName, fileString); #else env-&gt;ReleaseStringUTFChars(jfileName, fileString); #endif char *argv[] = { lclFileName }; my_loop_after_play = loopAfterPlay; my_audio_file_type = audioFileType; my_skip_frames = skipFrames; my_rgb_565 = rgb565; my_yuv_rgb_asm = yuvRgbAsm; my_skip_bidir_frames = skipBidirFrames; my_queue_size_min = queueSiz…
has comment: http://stackoverflow.com/comment/32422644
has comment: http://stackoverflow.com/comment/32431566
has comment: http://stackoverflow.com/comment/32421907
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21523375
has comment: http://stackoverflow.com/comment/32423021
has comment: http://stackoverflow.com/comment/32456656
has comment: http://stackoverflow.com/comment/32422179

http://stackoverflow.com/comment/32303821
score: 0
type: Comment
has text: @jalynn2 For that specific reason, it needs to have the leading `/`. Otherwise, it would be resolved relative the package that `Configures` is in.
comment on: http://stackoverflow.com/a/21413970
type: AnswerComment

http://stackoverflow.com/comment/32223117
type: Comment
comment on: http://stackoverflow.com/q/21364414
has text: Now "@Autowired FormValidator" works, but JSR 303 built in annotations still don't do anything. :-(
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32351150
comment on: http://stackoverflow.com/a/21391686
score: 0
type: Comment
has text: The system I am using does not give me a connection from session object like in your example. I am getting the session from hibernatesessionfactory. Do you know how I can get the connection ? Or do I have to get entityManager ? If so, how do I get the entityManager ? Thanks... Not too knowledgable about hibernate.. I am on hibernate 4.1.4
type: AnswerComment

http://stackoverflow.com/q/21427762
has title: JFreeChart: set line colors for XY Chart - 4 series, 2 datasets, dual axes
upvote count: 6
has answer: http://stackoverflow.com/a/21429044
score: 6
tagged with: jfreechart
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21454019
answer count: 2
downvote count: 0
favorite count: 0
has body: I can't seem to set individual line colors for all four lines. When I use the lines: plot.getRenderer().setSeriesPaint(0, new Color(0x00, 0xFF, 0x00)); plot.getRenderer().setSeriesPaint(1, new Color(0x00, 0x00, 0x00)); (In the code below), it applies the first line to the FIRST series in BOTH datasets, and the second line to the SECOND series in BOTH datasets. How can I set a different color for all 4 lines? Thanks! private JFreeChart createXYLineChart(String title) { XYDataset dataset1 = createXYVoltageDataset(); XYDataset dataset2 = createXYCurrentDataset(); JFreeChart chart = ChartFactory.createXYLineChart("Profile", "Set Current", "Voltage", null); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDataset(0, dataset1); plot.setDataset(1, dataset2); plot.setRangeAxis(1, new NumberAxis("Actual Current")); plot.mapDatasetToRangeAxis(1, 1); //2nd dataset to 2nd y-axi plot.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF)); plot.setDomainGridlinePaint(new Color(0x00, 0x00, 0xff)); plot.setRangeGridlinePaint(new Color(0xff, 0x00, 0x00)); plot.getRenderer().setSeriesPaint(0, new Color(0x00, 0xFF, 0x00)); plot.getRenderer().setSeriesPaint(1, new Color(0x00, 0x00, 0x00)); //plot.getRenderer().setSeriesPaint(2, new Color(0xFF, 0x00, 0x00)); // Does nothing //plot.getRenderer().setSeriesPaint(3, new Color(0x00, 0x00, 0xFF)); // Does nothing //plot.getRenderer(1).setSeriesPaint(3, new Color(0x00, 0x00, 0xFF)); // Null pointer exceptiopn return chart; } private XYDataset createXYVoltageDataset() { final XYSeries s1 = new XYSeries("Min Voltage"); final XYSeries s2 = new XYSeries("Max Voltage"); for (int i = 0; i &lt; profile.getNumSteps(); i++) s1.add(i, profile.getStepMinVoltage(i)); for (int i = 0; i &lt; profile.getNumSteps(); i++) s2.add(i, profile.getStepMaxVoltage(i)); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); return dataset; } private XYDataset createXYCurrentDataset() { final XYSeries s1 = new XYSeries("Min Current…
type: UnansweredQuestion

http://stackoverflow.com/q/21385649
type: AnsweredQuestion
tagged with: project
tagged with: java
type: Question
tagged with: chat
score: 0
has body: I am totally new to android as well as java for android programming. I have to create an android app which uses wifi to chat with the devices available in the available wifi area. I wouls like to know how can i implement this? What are the requirements to create such app? If it is already created, i would like to download one for the reference purpose. Kindly help me.
answer count: 1
tagged with: wifi
favorite count: 0
upvote count: 3
downvote count: 3
tagged with: android
has title: Create Android Wifi Chat application
has answer: http://stackoverflow.com/a/21385716
accepted answer: http://stackoverflow.com/a/21385716

sessioncontext
type: Tag
tags question: http://stackoverflow.com/q/21498366
tag name: sessioncontext

http://stackoverflow.com/comment/32249696
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21381173
has text: I solved it. Read my answer below.

http://stackoverflow.com/comment/32446488
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21494240
has text: Unless you can provide an explanation of a specific problem, everyone is inclined to believe that this is homework.
type: Comment

http://stackoverflow.com/a/21505644
has comment: http://stackoverflow.com/comment/32475492
has comment: http://stackoverflow.com/comment/32475034
has body: While I wait for you to update your Question with a decent explanation of what you tried and how it failed ... AFAIK the only approaches that are guaranteed to work reliable AND portably involve the program that is writing the print file telling the other program when it is done. If you control the program that is writing the print file, you can modify it to do stuff when it is finished. If the program is (or could be) launched via a wrapper, you could modify the wrapper. If it is an external program that you exec from Java, you could use Process.waitFor() to test when it exits. Solutions involving locking and checking file update timestamps run into various portability and reliability concerns. Re: your current solution. Your "is completely written" test is actually testing whether you can open the file. If the file does not exist (because the printing hasn't even started yet!), this will create an empty file and say it is completed. WRONG! If the file does exist, the open attempt may attempt to lock the file, but that is operating system specific. (And on Linux, there is no locking unless all programs involved use locking explicitly.) So basically, this won't work on Linux at all. (On Windows, it will work provided that you don't test the file before it has been created ... and that is a "race condition" that makes the solution unreliable, at least in theory.) So what are the other alternatives? You could poll the file's last modification date or it size, to see when it / they stop changing. After a suitable (heuristic!) period of inactivity, assume that the file is completed. You could implement the above using a FileWatcherService. (Complete with a heuristic inactivity period, etcetera) You could try to use Lock ... except that the chances are that the program that is writing the files isn't using locks (on Linux). (The Lock API is for discretionary locking, and it relies on all applications involved using locking, either implicitly or explicitly. On Linux / Uni…
has comment: http://stackoverflow.com/comment/32466716
score: 0
has comment: http://stackoverflow.com/comment/32466795
has comment: http://stackoverflow.com/comment/32466589
type: Answer
has comment: http://stackoverflow.com/comment/32474917
has comment: http://stackoverflow.com/comment/32475084
answers question: http://stackoverflow.com/q/21505408

http://stackoverflow.com/a/22115824
has body: I suggest you upgrade your jersey server dependency. when I searched for the 1.4 version pom, I got this file http://repo1.maven.org/maven2/com/sun/jersey/jersey-server/1.4/jersey-server-1.4.pom. It does not look like any pom I have ever seen and that may be source of your trouble. I also noticed that the 1.4 version is fairly old. 1.18 is the current release version.
answers question: http://stackoverflow.com/q/21493567
score: 0
type: Answer

http://stackoverflow.com/comment/32422644
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21480457
has text: Do you load the library in Java using static{System.loadLibrary("libname");} ?
score: 0

http://stackoverflow.com/comment/103118660
type: Comment
has text: Same answer, but with Gradle: https://stackoverflow.com/a/51961286/1762224
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21438755

http://stackoverflow.com/q/21474152
has answer: http://stackoverflow.com/a/21474390
favorite count: 0
has body: For the game I'm making I'm trying to make a simple title screen with a play button that begins the game once it's pressed. I've heard that a card layout is best suited for this, but now that I implemented it for some reason my input into the game is being ignored. Here's a simplified version of the problem, and thanks for the help. MainFrame.java //package panels.examples; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class MainFrame extends JFrame implements ActionListener { JPanel headerPanel; JPanel bodyPanel; JPanel panel1,panel2; JButton button1,button2; Container con; CardLayout clayout; public MainFrame() { //con=getContentPane(); clayout=new CardLayout(); headerPanel=new JPanel(); bodyPanel=new JPanel(clayout); button1=new JButton("button1"); button2=new JButton("button2"); //add three buttons to headerPanel headerPanel.add(button1); headerPanel.add(button2); button1.addActionListener(this); button2.addActionListener(this); panel1=new JPanel(); panel1.add(new JLabel("Panel1")); panel1.setBackground(Color.pink); panel2=new PrizePanel(); panel2.add(new JLabel("Panel2")); panel2.setBackground(Color.gray); //add above three panels to bodyPanel bodyPanel.add(panel1,"one"); bodyPanel.add(panel2,"two"); setLayout(new BorderLayout()); setSize(800,400); add(headerPanel,BorderLayout.NORTH); add(bodyPanel,BorderLayout.CENTER); // headerPanel.setBounds(0,0,600,100); bodyPanel.setBounds(0,100, 600, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String args[]) { new MainFrame(); } public void actionPerformed(ActionEvent e) { if(e.getSource()==button1) { clayout.show(bodyPanel, "one"); } else if(e.getSource()==button2) { clayout.show(bodyPanel, "two"); } } } PrizePanel.java /…
downvote count: 0
tagged with: jframe
score: 1
tagged with: swing
has title: CardLayout Input Issue Java
has answer: http://stackoverflow.com/a/21474195
accepted answer: http://stackoverflow.com/a/21474195
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/21474390
type: Question
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/32760602
score: 0
type: AnswerComment
has text: @Manjabes This is definitely a solution, but i not familiar with any packages that do this requirement.!!
type: Comment
comment on: http://stackoverflow.com/a/21579938

http://stackoverflow.com/comment/32351206
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21440780
has text: Sorry, my bad. In SavingsAccount, method deposit

http://stackoverflow.com/comment/32351765
has text: you need to use matches, no startsWith. Also please read the documentation, startsWith does not use a regex.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21441145

http://stackoverflow.com/comment/32299171
has text: Sounds like premature optimization.
comment on: http://stackoverflow.com/q/21411320
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/21440413
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32350385
has comment: http://stackoverflow.com/comment/32353096
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21440483
has comment: http://stackoverflow.com/comment/32350489
favorite count: 0
has title: error: cannot find symbol input.nextdouble
has answer: http://stackoverflow.com/a/21440574
possible better answer: http://stackoverflow.com/a/21440574
has body: Cant figure out why I keep getting this error. I'm trying to write a program that will add the sum of a 2 digit number. SplitNum.java:9: error: cannot find symbol double digit = input.nextdouble(); ^ symbol: method nextdouble() location: variable input of type Scanner 1 error Code: import java.util.Scanner; public class SplitNum { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter 2 digit number"); double digit = input.nextdouble(); double tens = digit / 10.0; double ones = digit % 10.0; double sum = tens+ones; System.out.println(sum); }//end main }//end class
accepted answer: http://stackoverflow.com/a/21440483
has comment: http://stackoverflow.com/comment/32350410

http://stackoverflow.com/comment/32478892
comment on: http://stackoverflow.com/q/21512731
has text: "how to display it on my JPANEL", What is "it"?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32230723
has text: Care to give an explanation?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21372822

http://stackoverflow.com/a/21495986
type: Answer
accepted answer of: http://stackoverflow.com/q/21451565
answers question: http://stackoverflow.com/q/21451565
has body: optaplanner-core works based on POJO's (javabeans). It's oblivious to the fact that in optaplanner-examples, those POJO's are being read/written to XML files by XStream (and it doesn't care). Similarly, you can use any other technology to store those POJO's: JPA (for example Hibernate-ORM, OpenJPA, ...) to store them into a database JDBC to store them into a database. Note: JDBC works with SQL statements, so you 'll need to manually map SQL records to POJO's. JAXB to store them in XML XStream to store them in XML (as the examples do it) Infinispan, mongodb, ... to store them in to a big data cloud. Note: might require manually mapping too, unless you use hibernate-ogm ... OptaPlanner doesn't care, so it doesn't restrict you :)
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/32455634
comment on: http://stackoverflow.com/a/21499313
type: AnswerComment
type: Comment
score: 0
has text: Works! However, when I accidentally pressed backspace, the MessageDialog comes out.

http://stackoverflow.com/a/21399048
answers question: http://stackoverflow.com/q/21398760
has body: The code UserListItemHolder userListItemInstance = responseEntity.getBody(); // null ... Log.i("LoginListService else condition", "" + userListItemInstance.getUserListItems()); userListItemInstance.setStatus("false"); return userListItemInstance.getUserListItems(); might be the source of the issue. If responseEntity.getBody() is null, then userListItemInstance will also be null. Then, when you call userListItemInstance.getUserListItems();, it will throw NullPointerException since userListItemInstance is null. Edit : I suggest you to create an instance of UserListItemHolder and set the status after that, something like this: } else { userListItemInstance = new UserListItemHolder(); userListItemInstance.setStatus("false"); return userListItemInstance.getUserListItems(); }
has comment: http://stackoverflow.com/comment/32278920
has comment: http://stackoverflow.com/comment/32278161
has comment: http://stackoverflow.com/comment/32278177
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32278522
score: 0
has comment: http://stackoverflow.com/comment/32278698
has comment: http://stackoverflow.com/comment/32279285
type: Answer
accepted answer of: http://stackoverflow.com/q/21398760
has comment: http://stackoverflow.com/comment/32277883

http://stackoverflow.com/q/21470696
has answer: http://stackoverflow.com/a/21470715
type: Question
tagged with: tostring
has comment: http://stackoverflow.com/comment/32404707
tagged with: java
has title: Struggling with toString method in Java
has comment: http://stackoverflow.com/comment/32404804
upvote count: 1
answer count: 1
downvote count: 0
has body: I have created a Class which can add, subtract, multiply or divide two rational numbers. However I am struggling with the toString method. As I create the result in the main method, how do I finish my toString method as my compiler is telling me "result cannot be resolved to a variable". Thank you public class Rational { private static int num; private static int denom; public Rational() { num = 0; denom = 1; } public Rational(int num, int denom) { this.num = num; this.denom = denom; } public int getNum() { return num; } public int getDenom() { return denom; } public Rational add(Rational rhs) { return new Rational(num*rhs.denom+rhs.num*denom, denom*rhs.denom); } public Rational subtract(Rational rhs) { return new Rational(num*rhs.denom-rhs.num*denom, denom*rhs.denom); } public Rational multiply(Rational rhs) { return new Rational(num*rhs.num, denom*rhs.denom); } public Rational divide(Rational rhs) { return new Rational(num*rhs.denom, denom*rhs.num); } public String toString() { String str = "" ; return "" ; } public static void main(String[] args) { Rational r1 = new Rational(1, 2); // 1/2 Rational r2 = new Rational(3, 4); // 3/4 Rational result = new Rational(); result = r1.add(r2); System.out.println( result.toString() ); } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/21470715
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32404741
score: 1

http://stackoverflow.com/q/21498367
has body: HttpResponse response = httpClient.execute(new HttpGet(URL)); HttpEntity entity = response.getEntity(); String responseString = new BasicResponseHandler().handleResponse(response); After this how do we parse responseString to check it is a XML or SOAP Message or XSD Document or a WSDL Document.
score: 0
has title: How to Check using HttpResponse, the response body is a SOAP Messages or it is a XML Message or XSD Document or it is a WSDL Document
has answer: http://stackoverflow.com/a/21508424
tagged with: java-ee-6
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: java
type: Question
tagged with: open-source
tagged with: apache

http://stackoverflow.com/a/21502503
downvote count: 0
score: 1
upvote count: 1
has body: For simple caching you can use ehcache. If JPA implementation is based on Hibernate, infinispan is the right choice. Distributed caching is better in infinispan compared to ehcache as it can be run as an individual process (infinispan Hot Rod Server).
answers question: http://stackoverflow.com/q/21398265
type: Answer

http://stackoverflow.com/comment/32319349
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21422898
has text: @jkin But they do have corresponding Class objects.

http://stackoverflow.com/q/21435848
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32346007
has body: I recently got a job offer asking for quartz 3.0 developers and experience in C++/QPP and unix shell scripting. I have experience and worked with quartz 1.x and java but nowhere hav i heard about quartz 3.0 and cannot find any mentioning anywhere in the internet. I am wondering whether it is a whole different software named as quartz and I hence do not have any relevant experience. As prior to the interview I want be well prepared as per their requirements hence....kindly please help if you have any insights.
downvote count: 0
favorite count: 0
tagged with: c++
answer count: 0
has title: What is Quartz 3.0? And does Quartz work with C++
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32342687
tagged with: quartz-scheduler
upvote count: 1

http://stackoverflow.com/comment/107182612
type: AnswerComment
comment on: http://stackoverflow.com/a/21474859
score: 0
type: Comment
has text: And does anyone know if there is an alternative to work with non-static inner classes?

http://stackoverflow.com/comment/32352307
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21439652
has text: sorry we are volunteers here and by default we don't want to diagnose anything isn't clear from description or SSCCE, MCVE, we don't plant and grow guessing here

http://stackoverflow.com/comment/32226867
type: QuestionComment
has text: I suspect most people do the same, subject to putting private helper methods near the method they help if it's only one, but since the advent of IDEs that show you all your methods in alpha order and let you navigate to one with a mouse-click these are minor concerns. More time is wasted debating code cosmetics in this industry than I care to contemplate.
score: 2
comment on: http://stackoverflow.com/q/21370641
type: Comment

http://stackoverflow.com/q/21406671
tagged with: swingworker
has title: How do I run Swing UI on two threads
tagged with: java
has comment: http://stackoverflow.com/comment/32292164
score: 0
linked to: http://stackoverflow.com/q/20569780
tagged with: swingutilities
has comment: http://stackoverflow.com/comment/32291819
has comment: http://stackoverflow.com/comment/32290988
has answer: http://stackoverflow.com/a/21407099
has answer: http://stackoverflow.com/a/21407051
answer count: 4
has comment: http://stackoverflow.com/comment/32291473
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
has answer: http://stackoverflow.com/a/35608426
type: Question
has body: I have a scenario where I need my swing UI to run on two different threads. I have a laptop where I will my application will run. There is a Button on clicking which an presentation should start at the other Screen that is attached to my laptop. Now I have made a class presentation which is extending SwingWorker and reads the images from a folder and displays it on screen. class Presenatation extends SwingWorker&lt;Integer, Integer&gt; { @Override protected Integer doInBackground() throws Exception { SwingUtilities.invokeLater(new Runnable() { public void run() { start(outputFolder, screenVO);/*Creates a JFrame to be displayed on new screen and sets a JPanel to it. Reads the file images sets it into JLabels every 2 seconds and updates it to Japnel*/ } }); return null; } Inside my start method I have the code to read images and show them on the UI What I feel is this approach is wrong since my SwingWorker shouldn't be calling invokeLater in doInBackground() From what little knowledge I have, it should be something like this: @Override protected Void doInBackground() throws Exception { return null; } @Override protected void process(List&lt;Integer&gt; chunks { } I am not able to decide which part should be placed where ? I have the following things to do : Start a new Frame to be displayed on a new screen Load Images into the frame every 2 seconds reading the image from a folder Extending Presentation class to SwingWorker, is this approach Correct ? Because externally I have an Executor object in whose exec() I am passing the object of Presentation Please help me !
has comment: http://stackoverflow.com/comment/32291711
has answer: http://stackoverflow.com/a/21436175

http://stackoverflow.com/q/21438137
score: 1
linked to: http://stackoverflow.com/q/9222822
accepted answer: http://stackoverflow.com/a/21566558
tagged with: tomcat
has body: I have my Geoserver running at a Tomcat on address http://localhost:8888 and I have a JSP Application running at a Tomcat on address http://localhost:8080 with OpenLayers API. I need to make WFS request with OpenLayers to Geoserver that is hosted at Tomcat in port 8888, given that my application is on port 8080. Its possible make CrossDomain request? Because my requests are denied by the Geoserver.
favorite count: 0
tagged with: openlayers
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21566558
tagged with: java
has title: Geoserver cross domain in Tomcat
tagged with: geoserver
tagged with: cross-domain
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/21440848
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21438645
score: -1
has body: sounds like you might want to get familiar with Java Properties. Take a look at this tutorial:Java Properties Tutorial You can save key/values to a file, and then when your application starts up you can read the file. So this way you can save (to file) all your settings, and then later read the settings from the file.

http://stackoverflow.com/q/21502859
upvote count: 8
tagged with: char
answer count: 3
has comment: http://stackoverflow.com/comment/32462638
tagged with: compare
has body: Code: public void placeO(int xpos, int ypos) { for(int i=0; i&lt;3;i++) for(int j = 0;j&lt;3;j++) { // The line below does not work. what can I use to replace this? if(position[i][j]==' ') { position[i][j]='0'; } } }
accepted answer: http://stackoverflow.com/a/21502884
favorite count: 0
has answer: http://stackoverflow.com/a/21502881
type: AnsweredQuestion
tagged with: java
tagged with: charat
possible better answer: http://stackoverflow.com/a/21502935
tagged with: loops
has answer: http://stackoverflow.com/a/21502884
has answer: http://stackoverflow.com/a/21502935
type: Question
score: 8
downvote count: 0
has title: How can I check if the char array has an empty cell so I can print 0 in it?

http://stackoverflow.com/q/21403383
upvote count: 0
has answer: http://stackoverflow.com/a/21404957
has title: Installing Simple GUI Extension on Bluej
has comment: http://stackoverflow.com/comment/32285213
has comment: http://stackoverflow.com/comment/32290119
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
tagged with: bluej
has comment: http://stackoverflow.com/comment/32285012
answer count: 1
tagged with: user-interface
downvote count: 1
has body: I am planning on creating a simple GUI design for my project (Room Booking System) but one problem... I'm no good with GUI's, I have found an Extension for the program i use (Bluej) the extension being 'Simple GUI Extension' I have downloaded the Extension but having problems on getting the extension on bluej, I have searched videos on how to install but can't find any and also thought they might be a tutorial on how to install the extension on the website i downloaded it from but there isn't so if there is anyone who possibly knows how to install this extension it would be much appreciated. Thank you
accepted answer: http://stackoverflow.com/a/21404957
favorite count: 0

http://stackoverflow.com/comment/32383997
comment on: http://stackoverflow.com/q/21459553
type: QuestionComment
type: Comment
score: 1
has text: How about debugging it?

http://stackoverflow.com/a/21399192
has comment: http://stackoverflow.com/comment/32277851
has comment: http://stackoverflow.com/comment/32311384
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32277926
answers question: http://stackoverflow.com/q/21399001
upvote count: 3
has body: number of times to add=n double sum=0; for(int i=0;i&lt;n;i++) { sum=sum+3.5; }
accepted answer of: http://stackoverflow.com/q/21399001
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/32277864

http://stackoverflow.com/comment/32475027
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21510093
has text: You open the file TimestampType.java, which is part of the open-source Hibernate code. Then you copy all the text and paste it into your DateTimeType.java source file. Then you adapt the code to make it use DateTime instead of Date, until it compiles and does what you want.

http://stackoverflow.com/q/21450519
tagged with: draw
type: Question
has title: Rectangle won't display in JFrame
answer count: 1
score: 0
has body: So I've been trying for the last two hours to get this program to draw a simple rectangle in a frame but nothing gets displayed in the frame when i run the program. I've looked through textbooks and old notebooks and everything in my program seems to be fine, yet nothing is displayed. Help? This is the class that creates the frame and is supposed to draw the rectangle. import javax.swing.JFrame; public class FrameViewer { public static void main(String[] args) { //creates an empty frame. JFrame frame = new JFrame(); frame.setSize(300,400); frame.setTitle("Empty Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //draws the rectangle within the frame. RectangleComponent component = new RectangleComponent(); frame.add(component); frame.setVisible(true); } } And here is the RectangleComponent import javax.swing.JComponent; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; public class RectangleComponent extends JComponent{ public void paintCOmponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; Rectangle box = new Rectangle(5,10,20,30); g2.draw(box); } }
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21450675
tagged with: java

http://stackoverflow.com/a/21479285
type: Answer
has comment: http://stackoverflow.com/comment/32420275
has comment: http://stackoverflow.com/comment/32419144
downvote count: 0
score: 1
upvote count: 1
has body: I suggest to change your implementation the following way: Build Regular Expressions for both patterns of input you allow Build the string that would result from the user's input with the information from source, start, end, dest, dtsart and dend Check if this string matches one of your two regular expressions, if not return "" That should do it more or less. I've done something similar a few month ago. If you're lucky, I can find the code and paste it here, when I'm home this evening :) But in general this should be pretty straight forward. If you're unsure about the values of source, start, end, dest, dstart and dend, check them in the debugger, to get a better understanding. -- Update -- The good thing is, I found my code in a question I once posted here ;) public class MoneyFilter implements InputFilter { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { // The regex to test the string String testRegex = "^\\d+\\,?\\d{0,2}$"; String s = source.toString(); String d = dest.toString(); // Build the string that would return from the user's input String r = d.substring(0, dstart) + s.substring(start, end) + d.substring(dend); // And check it if (r.matches(testRegex)) { return null; } else { return ""; } } } You'll off course need different regular expressions to match the string, but the rest of the code should work. hope this helps, regards, Hans
answers question: http://stackoverflow.com/q/21478662
has comment: http://stackoverflow.com/comment/32419020

http://stackoverflow.com/q/21368971
type: Question
answer count: 2
has body: SomeClass { while(itr.hasNext() { if (MDS.contains(subj)) { } else { listOfLme.add(new LME(subj.getName(), promptBuilder.toString(), cobBuilder.toString(), openInt)); } } } //end class Hi, I have a loop that adds LME object to a LinkedList. As LME objects are being added to the List, I need multiple threads iterating over what's already in the List and add those objects to database. I have a class that implements Runnable with constructor parameter LME object. Can someone please show me a simple technique how i can use two threads two iterate over listOfLme. If this is possible with an Executor, then I would like to see how this can be achieved.
possible better answer: http://stackoverflow.com/a/21369114
downvote count: 0
accepted answer: http://stackoverflow.com/a/21369160
has comment: http://stackoverflow.com/comment/32223872
has title: Multiple thread to process contents of List
has answer: http://stackoverflow.com/a/21369160
favorite count: 0
linked to: http://stackoverflow.com/q/2332537
has comment: http://stackoverflow.com/comment/32224417
upvote count: 2
has answer: http://stackoverflow.com/a/21369114
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32224076
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: concurrency

http://stackoverflow.com/comment/32335027
has text: That is right, but the clean alone does not solve this issue. I found a better solution that works for me, which i put in here. However, I must admit that I do not understand this effect.
type: Comment
comment on: http://stackoverflow.com/a/21408362
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32405396
type: QuestionComment
comment on: http://stackoverflow.com/q/21470827
has text: what i am hard time to find is that why each batch execution time is exponential when connection is auto-commit!
score: 0
type: Comment

http://stackoverflow.com/a/21391194
downvote count: 0
has body: Here is one nice tutorial SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMM dd"); Calendar calendar = new GregorianCalendar(2013,7,1); System.out.println("Date : " + sdf.format(calendar.getTime())); //add one month calendar.add(Calendar.MONTH, 1); System.out.println("Date : " + sdf.format(calendar.getTime()));
upvote count: 2
has comment: http://stackoverflow.com/comment/32264317
answers question: http://stackoverflow.com/q/21391130
type: Answer
has comment: http://stackoverflow.com/comment/32264934
score: 2

http://stackoverflow.com/comment/32473426
score: 0
type: QuestionComment
has text: @user2921254 **Please.** Read carefully your question and you'll see that there is no information at all to help you. Include valid code and then maybe we will able to help.
type: Comment
comment on: http://stackoverflow.com/q/21509622

http://stackoverflow.com/q/21374649
tagged with: android
has body: new to android programming. I have 2 objects that must be Parcelable called Book and Author. I am fairly certain I prepared them correctly. I was hoping for some help with: Creating a Book sending them to a new activity public class Book implements Parcelable { public int id; public String title; public ArrayList&lt;Author&gt; authors = new ArrayList&lt;Author&gt;(); public int Aflags; public String isbn; public String price; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(id); out.writeString(title); out.writeTypedList(authors); out.writeString(isbn); out.writeString(price); } private Book(Parcel in) { id = in.readInt(); title = in.readString(); in.readTypedList(authors, Author.CREATOR); isbn = in.readString(); price = in.readString(); } public static final Parcelable.Creator&lt;Book&gt; CREATOR = new Parcelable.Creator&lt;Book&gt;() { public Book createFromParcel(Parcel in) { return new Book(in); } public Book[] newArray(int size) { return new Book[size]; } }; @Override public String toString() { return title + " Price: " + price; } } Now Author: public class Author implements Parcelable { // TODO Modify this to implement the Parcelable interface. // I think I was able to accomplish this // NOTE: middleInitial may be NULL! public String firstName; public String middleInitial; public String lastName; @Override public void writeToParcel(Parcel out, int flags) { out.writeString(firstName); if (middleInitial.length() == 0) out.writeString(middleInitial); out.writeString(lastName); } private Author(Parcel in) { firstName = in.readString(); if (in.dataSize() &gt; 2) middleInitial = in.readString(); lastName = in.readString(); } public static final Parcelable.Creator&lt;Author&gt; CREATOR = new Parcelable.Creator&lt;Author&gt;() { public Author createFromParcel(Parcel in) { return new Author(in); } public Author[] newArray(int size) { return new Author[size]; } }; @Override public int describ…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21374809
tagged with: java
has title: Create a user-defined Parcelable object and implement functionality
has comment: http://stackoverflow.com/comment/32234060
tagged with: parcelable
type: Question
has comment: http://stackoverflow.com/comment/32234129
answer count: 2
has answer: http://stackoverflow.com/a/21374775
accepted answer: http://stackoverflow.com/a/21374775
score: 0
has answer: http://stackoverflow.com/a/21374809

http://stackoverflow.com/q/21487838
upvote count: 1
has answer: http://stackoverflow.com/a/21487911
type: Question
score: 1
tagged with: java
tagged with: eclipse
has title: Attempting to set JLabel icon to image directory, null pointer exception instead
downvote count: 0
tagged with: icons
has answer: http://stackoverflow.com/a/61411385
favorite count: 0
tagged with: nullpointerexception
tagged with: imageicon
has body: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.(ImageIcon.java:205) JLabel background = new JLabel(new ImageIcon(getClass().getResource("/resources/splashscreen.jpeg"))); The above line is the exact line throwing the exception, and it makes me believe that the location of the file is not correct, but I have tried numerous things but to no success. The folder structure seems to be correct, the image is within the resources folder which is within the project folder, and the folder(with the image) is next to the src folder not within. This application has to have the ability of being used offline otherwise I would just use the URL. Is there a known bug with this in the Eclipse IDE? Figured it out. It seems that I was putting the file in the wrong location, putting it with the .class files solved the problem. Not sure if this was a proper solution or just a work around unfortunately. I had to go back to the basics .java files are compiled and the .class files are actually running, and I need to backtrack from the current working directory.
has answer: http://stackoverflow.com/a/21487997
answer count: 4
has answer: http://stackoverflow.com/a/21487935
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32435745

http://stackoverflow.com/comment/32435211
comment on: http://stackoverflow.com/a/21488259
has text: In the same way you got from `document` to `analysis`. Calling `getChildNodes()`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/48480974
comment on: http://stackoverflow.com/a/21390156
score: 0
type: AnswerComment
type: Comment
has text: @CommonsWare But I don't know what links I can provide for this? How do I prove that the people who make encryption algorithms such as RSA, are actually paid by NSA to add back doors.The only thing I can think of is that I have watched some documentaries on YouTube about this. If you search for things like "rsa backdoor for nsa" on YouTube, you will see. Also check out other channels like "The Alex Jones Channel" - it also has some videos about the NSA.

http://stackoverflow.com/comment/32295467
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21409329
has text: if (counter % 3 ==0){ i ++; System.out.println(counter); }
score: 0

http://stackoverflow.com/a/36443814
score: 0
answers question: http://stackoverflow.com/q/21478905
type: Answer
has body: package Pictures; import javax.swing.JOptionPane; /** * * @author denc18 */ public class Main extends javax.swing.JFrame { /** * Creates new form Main */ public Main() { 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() { lblDisplay = new javax.swing.JLabel(); btnShow = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); lblScore = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); btnShow.setFont(new java.awt.Font("Yu Gothic UI", 1, 18)); // NOI18N btnShow.setText("show"); btnShow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnShowActionPerformed(evt); } }); jLabel2.setText("impala elephant lion tiger cat dog"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(145, 145, 145) .addComponent(btnShow)) .addGroup(layout.createSequentialGroup() .addGap(108, 108, 108) .addComponent(lblDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(44, 44, 44) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(15, 15, 15) .addComponent(lblScore, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRE…

http://stackoverflow.com/comment/32332155
type: QuestionComment
comment on: http://stackoverflow.com/q/21430325
score: 0
has text: or this: http://stackoverflow.com/questions/1619403/how-do-i-populate-a-jcombobox-with-information-from-a-mysql-database
type: Comment

http://stackoverflow.com/a/21424414
score: 1
upvote count: 1
has body: try this way with ShortcutListener: ShortcutListener skEnterListener = new ShortcutListener("Enter", ShortcutAction.KeyCode.ENTER, null){ @Override public void handleAction(Object sender, Object target) { if (target instanceof VerticalLayout) { // VerticalLayout or other // sending fileds here } } }; addShortcutListener(skEnterListener); change focus of TextField using Enter instead Tab: final TextField tf1 = new TextField("tf1"); tf1.setId("tf1"); final TextField tf2 = new TextField("tf2"); tf2.setId("tf2"); ShortcutListener skEnterListener = new ShortcutListener("Enter", ShortcutAction.KeyCode.ENTER, null){ @Override public void handleAction(Object sender, Object target) { if (target instanceof TextField) { TextField field = (TextField) target; if ("tf1".equals(field.getId())) { tf2.focus(); } if ("tf2".equals(field.getId())) { tf1.focus(); } } } }; addShortcutListener(skEnterListener);
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21387842
type: Answer
answers question: http://stackoverflow.com/q/21387842

http://stackoverflow.com/comment/32406067
comment on: http://stackoverflow.com/a/21470561
type: AnswerComment
has text: I know you are right but the problem is that the crawler is run on a server and this is a very big project I dont have access to crawler the only part that I have access is database and UI so if any method is in the database that when new row is added it can signal that is great but apparently there is no such a thing
score: 0
type: Comment

encoding
tags question: http://stackoverflow.com/q/21485817
tags question: http://stackoverflow.com/q/21481125
type: Tag
tags question: http://stackoverflow.com/q/21378122
tags question: http://stackoverflow.com/q/21440920
tags question: http://stackoverflow.com/q/21508787
tag name: encoding
tags question: http://stackoverflow.com/q/21409752

http://stackoverflow.com/q/21472063
accepted answer: http://stackoverflow.com/a/21472517
type: Question
possible better answer: http://stackoverflow.com/a/21472653
type: AnsweredQuestion
tagged with: java
tagged with: try-catch
answer count: 2
has answer: http://stackoverflow.com/a/21472653
has title: Avoid actually/logically unreachable code in catch clause
has comment: http://stackoverflow.com/comment/32407123
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/32407706
has body: I have an interface : public interface FileRepository { String insert(File file) throws IOException; // other methods ... } My implementation of insert(File file) uses local (to avoid concurrency problem) java.security.MessageDigester which throws checked exception java.security.NoSuchAlgorithmException from its factory method. public FileRepositoryImpl(String digestAlgo) throws NoSuchAlgorithmException { this.digestAlgo = digestAlgo; MessageDigest.getInstance(digestAlgo); } @Override public String insert(File file) throws IOException { // initialize message digest MessageDigest messageDigest = null; try { messageDigest = MessageDigest.getInstance(digestAlgo); } catch (NoSuchAlgorithmException e) { LOGGER.fatal(MD_INIT_ERROR, e); return null; } // other code .... } // other methods (may contain local MessageDigest) My practice: As NoSuchAlgorithmException always be a fatal error (which makes the module totally unavailable), I try to initialize a MessageDigest in my constructor to test the parameter digestAlgo, so the exception can be thrown by the constructor, other (earlier) than from insert(File). Another reason is the interface don't allow throwing NoSuchAlgorithmException by definition. My question: in my implementation, the code } catch (NoSuchAlgorithmException e) { LOGGER.fatal(MD_INIT_ERROR, e); return null; } will never be reached, so I think there should be better solutions, which allows to avoid the (logically and practically) unreachable code. Any solution/suggestion will be welcome, thanks. Edit: It is not really an issue when running the code. But in test, as the code is unreachable, together with some "try-catch with resources", quality analyzation tool (sonar,pmd) will consider the code "Insufficient branch coverage by unit tests", and this is a major issue in the analyze report, that's why I want to avoid this piece of code. Another question, is it a good practice to test MessageDigest.getInstance(digestAlgo); in my constructor? Or it's better to le…
has answer: http://stackoverflow.com/a/21472517
tagged with: unreachable-code

http://stackoverflow.com/a/38150477
answers question: http://stackoverflow.com/q/21362484
type: Answer
has body: The default charset is unicode (utf-8) in java ,The below code uses the unicode representation of a character and checks if the unicode of a character is speicial character; The solution given below is of the Time complexity = O(n); public class RemoveSpecialCharacters { /** * @param args the command line arguments */ private static boolean isSpecialCharacter(int b) { if((b&gt;=32 &amp;&amp; b&lt;=47 )||(b&gt;=58 &amp;&amp; b&lt;=64)||(b&gt;=91 &amp;&amp; b&lt;=96) ||(b&gt;=123 &amp;&amp; b&lt;=126)||b&gt;126) return true; return false; } public static String removeSpecialCharacters(String a) { StringBuffer s=new StringBuffer(a); int lenvar=s.length(); String myString=""; for(int i=0;i&lt;lenvar;i++) { if(!isSpecialCharacter(s.charAt(i))) { myString+=s.charAt(i); } } return myString; } public static void main(String[] args) { System.out.println(removeSpecialCharacters("fleCKHE)_+_+")); } } o/p:fleCKHE
score: 0

http://stackoverflow.com/q/21380575
tagged with: swing
has body: I am trying to display part of a resultset in a JTable (Two columns), I can only manage to see one row. The JTable is in an existing GUI and the resultset is passed to a method in the GUI class. When I do a Vector size() it is returning one. This is telling me there is only one entry in the list. I should be seeing at 4 entries The entry I am seeing is the last one of what I expect would be 4. Please see the method below: Any help would be much appreciated. public static void getResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); //JTable name is resultsTable includes Scrollpane // names of columns Vector&lt;String&gt; columnNames = new Vector&lt;String&gt;(); int columnCount = 2; for (int column = 1; column &lt;= columnCount; column++) { columnNames.add(metaData.getColumnName(column)); System.out.println("ColumnNames "+columnNames ); } // data from the table // Vector&lt;Vector&lt;Object&gt;&gt; data = new Vector&lt;Vector&lt;Object&gt;&gt;(); Vector&lt;Vector&lt;String&gt;&gt; data = new Vector&lt;Vector&lt;String&gt;&gt;(); while (resultSet.next()) { Vector&lt;String&gt; vector = new Vector&lt;String&gt;(); for (int columnIndex = 1; columnIndex &lt;= columnCount; columnIndex++) { vector.add(resultSet.getString(columnIndex)); } data.add(vector); System.out.println("Vector Value = "+ data); System.out.println("Vector Size =" + data.size()); //Returning 1 - Should see 4 entries DefaultTableModel datamodel = new DefaultTableModel(data,columnNames); resultsTable.setModel(datamodel); }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21380775
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21380775
tagged with: jtable
upvote count: 1
answer count: 1
has title: JTable only displaying 1 row
favorite count: 0

gdata
tags question: http://stackoverflow.com/q/21474941
tag name: gdata
type: Tag

http://stackoverflow.com/comment/32456058
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21499937
has text: I have added a space, but that doesn't seem to fix it.

http://stackoverflow.com/a/21500668
score: 8
downvote count: 0
answers question: http://stackoverflow.com/q/21500339
has body: While it's not a good idea to store very large binary objects in the database, the Microsoft research paper "To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem" indicates it's an efficient approach if object sizes are less than 256K. So it sounds like you've hit the sweet spot for database storage with 30K images. You can load your image as a buffered image from a URL using: BufferedImage imm = ImageIO.read(url); Then convert it to a byte array with: byte[] immAsBytes = ByteArrayOutputStream baos = new ByteArrayOutputStream(); //use another encoding if JPG is innappropriate for you ImageIO.write(imm, "jpg", baos ); baos.flush(); byte[] immAsBytes = baos.toByteArray(); baos.close(); Then store the byte array as recommended by this article as a VARBINARY in the database. In your JDBC code, you should wrap the byte array in a ByteArrayInputStream and set the PreparedStatement parameter as a BinaryStream: PreparedStatement pstmt = commection.prepareStatement("INSERT INTO IMAGES (image) VALUES(?)"); ByteArrayInputStream bais = new ByteArrayInputStream(immAsBytes); pstmt.setBinaryStream(1, bais, immAsBytes.length); pstmt.executeUpdate(); pstmt.close(); To get the image out of the database, use ResultStatement.getBlob(): Blob immAsBlob = rs.getBlob(); byte[] immAsBytes = immAsBlob.getBytes(1, (int)immAsBlob.length())); Finally, convert the byte array to a BufferedImage and do something with it: InputStream in = new ByteArrayInputStream(immAsBytes); BufferedImage imgFromDb = ImageIO.read(in);
accepted answer of: http://stackoverflow.com/q/21500339
upvote count: 8
has comment: http://stackoverflow.com/comment/32457394
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32261618
comment on: http://stackoverflow.com/a/21389029
score: 0
type: AnswerComment
has text: @yshavit I´ve already solved it. It was a problem with the Pair and extends Asyntask. Thanks!
type: Comment

http://stackoverflow.com/comment/32393563
type: Comment
has text: I must study static and non-static variables i think for understand that fundamental. Also instances.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21462653

http://stackoverflow.com/comment/32431754
type: QuestionComment
has text: I actually found out when using userRoot(), that the program indeed makes the key. It just throws a warning because java tries to make it in systemRoot() too, incase you ever need it in systemroot, but since you are using userRoot() you never will.
comment on: http://stackoverflow.com/q/21486464
score: 0
type: Comment

http://stackoverflow.com/a/21367493
has comment: http://stackoverflow.com/comment/32221002
accepted answer of: http://stackoverflow.com/q/21367424
has comment: http://stackoverflow.com/comment/32220732
has comment: http://stackoverflow.com/comment/32220994
has comment: http://stackoverflow.com/comment/39634888
has body: You are required to add lines in your sbt file. libraryDependencies ++= Seq( jdbc, anorm, cache, "mysql" % "mysql-connector-java" % "5.1.18" ) And after that change into your application.config by uncommenting # db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://127.0.0.1:3306/test" db.default.user="root" db.default.password=""
has comment: http://stackoverflow.com/comment/32220882
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32220867
downvote count: 0
type: Answer
score: 13
answers question: http://stackoverflow.com/q/21367424
upvote count: 13

http://stackoverflow.com/a/21369858
has comment: http://stackoverflow.com/comment/32226209
has body: You Could... Try using a OverlayLayout, but I'm not sure it will meet your requirements. You Could Set use a GridBagLayout on the JLayeredPane, placing each component at the same gridx/gridy and then filling with GridBagConstraints.BOTH and a weightx/weighty of 1 You Could Use the frame's "glass pane" as the top layer. Which will allow you to place controls over the top the frame's "content pane" See How to use root panes for more details.
has comment: http://stackoverflow.com/comment/32226048
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21369670
answers question: http://stackoverflow.com/q/21369670
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/32460108
type: QuestionComment
type: Comment
has text: I confirmed that there's no reason to keep the 1.6 (and I understand old java versions present security issues anyway) so I just uninstalled the 11.6 and now everything is fine. Thanks!
score: 0
comment on: http://stackoverflow.com/q/21502003

http://stackoverflow.com/q/21390643
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/32265332
has answer: http://stackoverflow.com/a/21748192
tagged with: glassfish
type: Question
has comment: http://stackoverflow.com/comment/32269984
has comment: http://stackoverflow.com/comment/32266841
has comment: http://stackoverflow.com/comment/32279385
answer count: 1
has comment: http://stackoverflow.com/comment/32263624
has body: i'm building some restful webservices and try to secure them by using JAAS. but i get the following error: javax.servlet.ServletException: Login failed I created a realm with the following attributes: JAAS-Context: jdbcDigestRealm DIGEST-Algorithm: SHA-512 Encoding: Hex password encryption: none I try to log in by using HttpServletRequest: request.login(email, password); //email = test@test.tld, password=&lt;SHA512HEX('testPasswprd')&gt; Here is the StackTrace: WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: null SEVERE: javax.servlet.ServletException: Login failed at org.apache.catalina.authenticator.AuthenticatorBase.doLogin(AuthenticatorBase.java:959) at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:939) at org.apache.catalina.connector.Request.login(Request.java:2245) at org.apache.catalina.connector.Request.login(Request.java:2224) at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113) Do you have some ideas? EDIT: Sometimes I get a NullPointerException at request.login(email, password); //both variables and request are set. WARNING: StandardWrapperValve[de.AuthTest.core.ApplicationConfig]: Servlet.service() for servlet de.AuthTest.core.ApplicationConfig threw exception java.lang.NullPointerException at org.apache.catalina.connector.Request.login(Request.java:2229) at org.apache.catalina.connector.Request.login(Request.java:2224) at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1113)
has title: JAAS Error: Login failed
tagged with: security
tagged with: jaas
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/32275518
has text: its not mention any class which i created.then i'm unable to get idea about it.there are many classes in my web service project
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21397388
type: QuestionComment

http://stackoverflow.com/comment/32376278
type: AnswerComment
has text: @assylias i am accessing the server through JSch library.
type: Comment
comment on: http://stackoverflow.com/a/21454971
score: 0

http://stackoverflow.com/a/21375359
has body: These file names are fixed so you can just check for the name if the file is in the project root folder. org.eclipse.core.resources.IProjectDescription.DESCRIPTION_FILE_NAME is the standard constant for .project and org.eclipse.jdt.core.IJavaProject.CLASSPATH_FILE_NAME for .classpath.
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21373137

http://stackoverflow.com/a/21730319
answers question: http://stackoverflow.com/q/21460074
has body: I would use a SequenceGenerator. Check this answer for more details. You will have to make one seq. generator per entity in order to make sure you do not get concurrency problems. Also make sure that you set a good/not existent initial value.
type: Answer
has comment: http://stackoverflow.com/comment/32895048
score: 0

http://stackoverflow.com/a/21454019
score: 5
upvote count: 5
type: Answer
downvote count: 0
has body: This was my final solution: XYDataset dataset1 = createXYVoltageDataset(); XYDataset dataset2 = createXYCurrentDataset(); XYLineAndShapeRenderer r1 = new XYLineAndShapeRenderer(); r1.setSeriesPaint(0, new Color(0xff, 0xff, 0x00)); r1.setSeriesPaint(1, new Color(0x00, 0xff, 0xff)); r1.setSeriesShapesVisible(0, false); r1.setSeriesShapesVisible(1, false); XYLineAndShapeRenderer r2 = new XYLineAndShapeRenderer(); r2.setSeriesPaint(0, new Color(0xff, 0x00, 0x00)); r2.setSeriesPaint(1, new Color(0x00, 0xff, 0x00)); r2.setSeriesShapesVisible(0, false); r2.setSeriesShapesVisible(1, false); JFreeChart chart = ChartFactory.createXYLineChart("Profile", "Set Current", "Voltage", null); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDataset(0, dataset1); plot.setRenderer(0, r1); plot.setDataset(1, dataset2); plot.setRenderer(1, r2); plot.setRangeAxis(1, new NumberAxis("Actual Current")); plot.mapDatasetToRangeAxis(1, 1); //2nd dataset to 2nd y-axi plot.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF)); plot.setDomainGridlinePaint(new Color(0x00, 0x00, 0xff)); plot.setRangeGridlinePaint(new Color(0xff, 0x00, 0x00)); return chart;
answers question: http://stackoverflow.com/q/21427762

http://stackoverflow.com/q/21495834
has body: I am relatively new to Java, and I have never dealt with sound before, but as a school project we need to code a program (Major project for the year) and I need to process a song, and output certain words on certain frequency hitmarkers (so if it hits a beat, output "beat", if it hits like 13596Hz on the spectrum, output "high sound" and so on). How is this possible? I have had a look at JTransforms an jMIR, but they do not make sense to me. Any advice would be greatly appreciated.
downvote count: 0
has title: Java - Analizing Spectrum of a song - output on certain peaks
favorite count: 0
tagged with: spectrum
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: audio
tagged with: java
type: Question

http://stackoverflow.com/comment/32351873
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21440934
type: Comment
has text: Perhaps I make it harder than what it is? Perhaps there is a better solution? I need a list that can store personal information, account numbers - with balance. Then I shall be able to add new account (account number) to "personal profile".

http://stackoverflow.com/q/21404159
tagged with: datetime
accepted answer: http://stackoverflow.com/a/21404160
favorite count: 0
score: 6
tagged with: java-8
upvote count: 6
type: AnsweredQuestion
has title: Calculate Modified Julian Day in JSR-310
tagged with: java
tagged with: java-time
type: Question
has answer: http://stackoverflow.com/a/21404160
answer count: 1
downvote count: 0
has body: How can I calculate the Modified Julian day from a JSR-310 class such as LocalDate? (in JDK 8) Specifically, this is the calculation of the continuous count of days known as "Modified Julian day", not the date in the Julian calendar system. For example: LocalDate date = LocalDate.now(); long modifiedJulianDay = ???

http://stackoverflow.com/a/38580855
type: Answer
has body: Each time you open a database(readable or writable) and cursor which uses memory resources has to be deallocated by using ".close();" after its usage ends in each database function.. by your_database object.close(); and cursor object.close();
downvote count: 1
has comment: http://stackoverflow.com/comment/78756277
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/21496221

http://stackoverflow.com/comment/32312933
type: QuestionComment
has text: Non-static Inner **class instances** know about the enclosing outer **class instance**, because they carry an implicit reference to it. I doubt that interfaces can do that, as they are not permitted to contain state. That also explains, why your code cannot work as intended - there is no reference to an instance of `Outer` on which `get()` could be invoked.
comment on: http://stackoverflow.com/q/21418802
score: 0
type: Comment

http://stackoverflow.com/a/21458954
has body: Without digging too much into the design with regards to the method signature and what goal this code is accomplishing [why is it subtracting 0? screenWidth - (screenWidth / 2) will always simply equal screenWidth / 2], I think something like the following would be clearer with less duplication: public void checkChance(final String spawnX, final int chance, final int value) { int intermediary; if (player.getX() &gt; screenWidth / 2) { if (chance &gt; value) { intermediary = random.nextInt(screenWidth - (screenWidth / 2)) + (screenWidth / 2); } else { intermediary = random.nextInt((screenWidth / 2) - 0); } } else { if (chance &gt; value) { intermediary = random.nextInt((screenWidth / 2) - 0); } else { intermediary = random.nextInt(screenWidth - (screenWidth / 2)) + (screenWidth / 2); } } if (spawnX.equals("smallX")) { smallX = intermediary; } else if (spawnX.equals("mediumX")) { mediumX = intermediary; } else if (spawnX.equals("largeX")) { largeX = intermediary; } }
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32383414
has comment: http://stackoverflow.com/comment/32383039
type: Answer
has comment: http://stackoverflow.com/comment/32383924
has comment: http://stackoverflow.com/comment/32383225
accepted answer of: http://stackoverflow.com/q/21458654
upvote count: 1
answers question: http://stackoverflow.com/q/21458654
has comment: http://stackoverflow.com/comment/32382916

http://stackoverflow.com/comment/32269489
type: QuestionComment
comment on: http://stackoverflow.com/q/21393999
has text: You should first manage to be able to run java, javac and jar from the command line. Then edit your eclipse.ini and edit the -vm entry. This way, you can just run eclipse without arguments. I don't know where your -Dosgi.requiredJavaVersion=1.6 is coming from or if this hurts you.
score: 0
type: Comment

http://stackoverflow.com/a/21480644
answers question: http://stackoverflow.com/q/21479931
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/32421460
downvote count: 0
has body: -803 means that you're trying to insert a row that violates the Unique Constraints of the table. If you're on DB2 Linux/Unix/Windows, you can take that number from SQLERRMC and apply it to this query to get the index you're violating: SELECT INDNAME, INDSCHEMA FROM SYSCAT.INDEXES WHERE IID = &lt;index-id&gt; AND TABSCHEMA = 'schema' AND TABNAME = 'table'
type: Answer
has comment: http://stackoverflow.com/comment/32421560

http://stackoverflow.com/q/21504680
answer count: 4
downvote count: 0
type: UnansweredQuestion
has body: I have a 2.67 GHz processor, 4 GB of RAM on a x64 Windows 8 core i7 machine . My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all the instructions in setting up the IDE, SDKs, JDKs and such and have had some success in starting the emulator quickly but that is very rare. How can I, if possible, fix this problem?
has answer: http://stackoverflow.com/a/21504706
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32477084
has title: My Android application is working very slowly
tagged with: eclipse
has answer: http://stackoverflow.com/a/21504730
type: Question
has answer: http://stackoverflow.com/a/54722568
has answer: http://stackoverflow.com/a/53225513
has comment: http://stackoverflow.com/comment/32464965
favorite count: 0
upvote count: 3
tagged with: sdk
has comment: http://stackoverflow.com/comment/32464825
has comment: http://stackoverflow.com/comment/32464758
tagged with: android

getpixel
type: Tag
tag name: getpixel
tags question: http://stackoverflow.com/q/21437417
tags question: http://stackoverflow.com/q/21353150

http://stackoverflow.com/q/21392994
type: Question
tagged with: arrays
tagged with: jackson
has comment: http://stackoverflow.com/comment/32267419
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/21393528
tagged with: deserialization
favorite count: 0
has title: Jackson JSON how to deserialize date from object-array
accepted answer: http://stackoverflow.com/a/21393528
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32267809
has body: I would serialize/deserialize a Object-Array with mixed objects. Therefor I created a MyList class und fill the items-array with strings, int and date-objects. Serialization with jackson works well. The json-string looks like this: {"objects":["string",123,1390859948022]} But on deserialize the json-string date is parsed as an integer. So I created a own class MyDate to wrap the date as a json-object with fieldname "date". The new result was: {"objects":["string",123,1390859948022,{"date":1390859948022}]} Now the result is a LinkedHashMap. Here are my code-samples: Maven-Dependencies: com.fasterxml.jackson.core jackson-core 2.3.0 com.fasterxml.jackson.core jackson-databind 2.3.0 com.fasterxml.jackson.core jackson-annotations 2.3.0 MyList.java public class MyList { private Object[] objects; public MyList() { } public MyList(Object[] objects) { this.objects = objects; } // getter and setter } MyDate.java: public class MyDate { private Date date; public MyDate() { } public MyDate(Date date) { this.date = date; } // Getter and Setter } Serialize-Example: public static void serializeTest() throws JsonGenerationException, JsonMappingException, IOException{ ObjectMapper mapper = new ObjectMapper(); Object[] objects = {"string", 123, new Date(), new MyDate(new Date())}; MyList liste = new MyList(objects); mapper.writeValue(System.out, liste); } Deserialize-Example: public static void deserializeTest() throws JsonParseException, JsonMappingException, IOException { String input = "{\"objects\":[\"string\",123,1390858928698,{\"date\":1390858928698}]}"; ObjectMapper mapper = new ObjectMapper(); MyList list = mapper.readValue(input, MyList.class); System.out.println("#list:" + list); System.out.println("#list.getObjects:" + list.getObjects()); for (Object i : list.getObjects()) { System.out.println("\t value=" + i + ", type=" + i.getClass()); } } I have search for a possible solution, but nothing worked. I hope someone can help me. Thanks a lot for all your answers. With your he…
score: 1
has comment: http://stackoverflow.com/comment/32267558
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32267775
possible better answer: http://stackoverflow.com/a/21393653
has answer: http://stackoverflow.com/a/21393563
upvote count: 1
has answer: http://stackoverflow.com/a/21393653

http://stackoverflow.com/comment/32325438
type: Comment
comment on: http://stackoverflow.com/a/21402528
has text: In this case the `volatile` keyword is actually needed. Reason is there is a case where `shutdown` can be accessed concurrently from two threads, where there's no other defense mechanism. This happens on the first line in the `run()` function. If all accesses to `shutdown` were within synchronized code, this wouldn't have been necessary.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/72960477
has text: hm not sure why I got wrong current time with this method though. EX: Current time : 1:33 AM -> It displays 1:49 Any solutions?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21473060

http://stackoverflow.com/q/21474246
has title: Java/PHP - Chat session got refresh on window refresh or opening new window in application
type: UnansweredQuestion
tagged with: php
has body: In web application, i have a chat gadget embedded in web page (.HTML). The back end code of my application Java and the chat gadget communicates with .PHP. I do not have access to .PHP environment. I can only code in java to handle HTML requests using Java. Issue: When i click refresh on browser, the new chat session begins every time. Even when i jump from one page to other the chat session refreshes and new chat begins. I am not suppose to do any changes in .PHP environment but need to change code in Java Question: I want to mold program in such a way that .PHP environment thinks that page has not been refreshed and does not break the session. I think proxy might be solution but how to implement those? Any other solution for same.
tagged with: java
has comment: http://stackoverflow.com/comment/32410533
type: Question
has answer: http://stackoverflow.com/a/21474467
tagged with: session
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32410698
has comment: http://stackoverflow.com/comment/32410627

printers
tag name: printers
tags question: http://stackoverflow.com/q/21383853
type: Tag

http://stackoverflow.com/a/21478112
answers question: http://stackoverflow.com/q/21477905
type: Answer
upvote count: 7
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21477905
has body: Oh I did it! This code is working for the doSomething method: public static void doSomething(List&lt;? extends Parent&gt; list) { ... }

http://stackoverflow.com/comment/32367207
score: 0
comment on: http://stackoverflow.com/q/21449399
type: Comment
has text: No, the assertTrue was successful also. Only the expected exception `DuplicateCardException` wasn't thrown I think.
type: QuestionComment

http://stackoverflow.com/a/21457480
has body: I think your CreateItemRequestConverter class signature should be like this : interface CreateItemRequestConverter&lt;CIR extends CreateItemRequest&gt; extends ItemRequestConverter&lt;CIR&gt; { } Test : interface ItemRequestConverter&lt;IR extends ItemRequest&gt; { Target convert(IR request); } interface CreateItemRequestConverter&lt;CIR extends CreateItemRequest&gt; extends ItemRequestConverter&lt;CIR&gt; { } class CreatePartRequestConverter implements CreateItemRequestConverter&lt;CreatePartRequest&gt; { @Override public Target convert(CreatePartRequest request) { return null; } } class ItemRequest { } class CreateItemRequest extends ItemRequest { } class CreatePartRequest extends CreateItemRequest { } class Target { }
upvote count: 1
has comment: http://stackoverflow.com/comment/32380207
answers question: http://stackoverflow.com/q/21457226
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21457226
type: Answer
score: 1

http://stackoverflow.com/a/21358756
downvote count: 0
answers question: http://stackoverflow.com/q/21357517
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32215899
has body: Your code seems to have several erros, such as properties, what properties is that? SQL is wrong next time provide the table structure print stacktrace instead of exception message and provide it for us do not print in the catch clause that you're connected when you're maybe not how the method throws an exception that is caught? do not use a string as primary key, this is not efficient below there's a sample that works (although the table structure is probably too poor to be used outside an example like this) import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class RegisterUser { public static void main(String[] args){ new RegisterUser().getConnection(); } public Connection getConnection(){ Connection conn = null; Properties props = new Properties(); try { conn = DriverManager.getConnection( "jdbc:derby:derbyDB;create=true",props); Statement stmt = conn.createStatement(); // stmt.executeUpdate("create table users (userid int not null primary key,username varchar(200), password varchar(200), sex varchar(200), birth date, death date)"); int nbUpdatedResult = stmt.executeUpdate("INSERT INTO USERS (USERID, USERNAME, PASSWORD, SEX, BIRTH, DEATH) VALUES (2, 'salems24', 'Twisted1@', 'M', '2014-01-24', '2014-01-25')"); System.out.println(nbUpdatedResult); } catch (SQLException e) { e.printStackTrace(); } return conn; } }
has comment: http://stackoverflow.com/comment/32215847

http://stackoverflow.com/a/21403367
score: 0
has body: I don't think there is a way to keep the thread alive since the JVM is restarted. However, you could have a servlet with load-on-startup set to 1 (or some other non-zero value). The init() function will then be executed when Tomcat starts. You could have the rest of the commands in there. Of course, this would run no matter how Tomcat was restarted. More on load-on-startup: http://tutorials.jenkov.com/java-servlets/web-xml.html#load-on-startup
type: Answer
answers question: http://stackoverflow.com/q/21403220

http://stackoverflow.com/q/21365009
answer count: 5
has answer: http://stackoverflow.com/a/21365139
type: UnansweredQuestion
tagged with: interface
has body: I've tried different ways of creating different interfaces and applets. One of the main things I'm trying to do is to get these gui's to display text and show multiple buttons with different text leading to different outcomes. What I'm asking is, what code is necessary to create an applet or an interface (because I fail at telling the difference between the two) and how should I approach building and structuring that.
tagged with: java
has title: How do I create an interface with buttons and text?
has answer: http://stackoverflow.com/a/21370051
has answer: http://stackoverflow.com/a/21365088
type: Question
tagged with: eclipse
score: 0
tagged with: user-interface
tagged with: applet
has answer: http://stackoverflow.com/a/21365219
has answer: http://stackoverflow.com/a/21365059

http://stackoverflow.com/comment/32281529
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21401167
has text: i've been trying to connect the objects for the past week i just don't understand how objects work together.
score: 0

http://stackoverflow.com/a/21505632
has body: If you want to go down the route of disabling individual combo box items you might want to refer to this thread. Otherwise you could add an event handler to your combo box that would remove the selected item from the component's model. Here's some admittedly inelegant code that does that. You'll need to write a line or two more if you want to stop the user from deleting the 'None' option. comboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox dropdown = (JComboBox)e.getSource(); DefaultComboBoxModel model = (DefaultComboBoxModel)dropdown.getModel(); model.removeElement(dropdown.getSelectedItem()); } });
score: 1
answers question: http://stackoverflow.com/q/21505454
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/21365321
type: Question
has answer: http://stackoverflow.com/a/21367832
has title: GAE asks for XG transaction on root entity
tagged with: transactions
score: 1
tagged with: java
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21366170
tagged with: google-app-engine
has body: I'm trying to add a new root entity with the following code: try { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Key eventKey = datastore.allocateIds("Event", 1).getStart(); String keyString = KeyFactory.keyToString(eventKey); //TransactionOptions options = TransactionOptions.Builder.withXG(true); Transaction txn = datastore.beginTransaction(); Entity eventEntity = new Entity("Event", keyString); datastore.put(eventEntity); txn.commit(); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage(), e); throw new InternalServerErrorException(e); } It's a simple transactional datastore insert that according to the documents suppose to work - each root entity belongs to a separate entity group, so a single transaction cannot create or operate on more than one root entity unless it is an XG transaction My 'Event' entity doesnt have any ancestor And i'm only handling it inside the transaction. But for some reason i get the following exception : java.lang.IllegalArgumentException: cross-group transaction need to be explicitly specified, see TransactionOptions.Builder.withXGfound both Element { type: "Event" id: 4 } and Element { type: "Event" name: "ahBldmVudHNmaW5kZXIyMDEzcgsLEgVFdmVudBgEDA" } Any idea whats wrong here ?
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/21356237
downvote count: 0
has answer: http://stackoverflow.com/a/21356272
accepted answer: http://stackoverflow.com/a/21356272
has answer: http://stackoverflow.com/a/21356298
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32200974
score: 1
tagged with: java
has body: I am very new to Java, and am working out a simple program showing inheritance. I am having issues accessing a method in a derived class, since it seems my variable definition does not use the subclass name, but the superclass name (Accounts). Why is it when I call the deposit method, a cannot find symbol error occurs? import java.util.*; import java.text.*; public class Accounter { static Scanner input = new Scanner(System.in); static Accounts myAccount; public static void main(String[] args) { int result; //holder for user input double amount; //holder for desposits and withdrawals System.out.println("What kind of account would you like to setup?"); System.out.println("Checking[1] or Savings[2]"); result = input.nextInt(); if(result == 1) { myAccount = new Checking(); } else { myAccount = new Savings(); } myAccount.deposit(199.99); } } class Accounts { double balance; public String accountName; public Date dateOpened; public Date today = new Date(); public Accounts() { dateOpened = today; } public Date getDateOpened() { return dateOpened; } public double getBalance() { return balance; } } class Checking extends Accounts { public void deposit(double amount) { this.balance = this.balance + amount; } } class Savings extends Accounts { public void deposit(double amount) { this.balance = this.balance + amount; } }
answer count: 3
has comment: http://stackoverflow.com/comment/32200596
upvote count: 1
has answer: http://stackoverflow.com/a/21356411
possible better answer: http://stackoverflow.com/a/21356298
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/32200575
has title: Why isn't my subclass method (symbol) found?

http://stackoverflow.com/comment/32235215
type: QuestionComment
has text: @PeterMmm , can I execute the file from the jar? If yes, How?
comment on: http://stackoverflow.com/q/21374719
score: 0
type: Comment

http://stackoverflow.com/q/21367424
answer count: 3
tagged with: playframework
downvote count: 0
favorite count: 0
has body: I am trying to connect to a mysql database using the play framework. From my own searching, I know I need to add this line somewhere: "mysql" % "mysql-connector-java" % "5.1.18" However, in every documentation/similar question it says that this line either goes into the Build.scala file or the build.sbt file and I have neither of those files. When I created my application (as a java app) it only gave me a build.properties and plugins.sbt which are inside the project folder. Does anyone know how where to add this line? Do I need to create one of those files? My build.properties file: sbt.version=0.13.0 And plugins.sbt // Comment to get more information during initialization logLevel := Level.Warn // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1") UPDATE: After adding addSbtPlugin("mysql" % "mysql-connector-java" % "5.1.18") to my plugins file:
has answer: http://stackoverflow.com/a/21376718
has answer: http://stackoverflow.com/a/21367493
tagged with: playframework-2.2
type: AnsweredQuestion
has title: Adding MySql to playframework 2.2.1
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21367593
tagged with: mysql
upvote count: 7
type: Question
possible better answer: http://stackoverflow.com/a/21367593
accepted answer: http://stackoverflow.com/a/21367493
has comment: http://stackoverflow.com/comment/32228172

http://stackoverflow.com/comment/32394386
comment on: http://stackoverflow.com/q/21464596
type: Comment
has text: @nhahtdh : Oh i can see where you are getting at. Good to know. Is there any other way to get the above output?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32226096
has text: I found a workaround of using the normal popup factory's existing window and then setting my stuff onto that window to paint the border and drop shadow. :) But I'm still pretty curious why naively creating a window of my own results in one that doesn't work.
type: QuestionComment
comment on: http://stackoverflow.com/q/21369981
score: 0
type: Comment

http://stackoverflow.com/a/21397186
has comment: http://stackoverflow.com/comment/32274947
has comment: http://stackoverflow.com/comment/32276011
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21397087
has body: You can use findFragmentByTag DetailsFragment df = getFragmentManager().findFragmentByTag("details"); if (df != null) { df.setShownIndex(getSelectedIndex()); } else { df = DetailsFragment.newInstance(getSelectedIndex()); } fragmentTransaction.replace(R.id.frame, df, "details").commit();

http://stackoverflow.com/a/21405222
has body: I was in fact able to use the linked iOS code to create the following function. I didn't realize that a String that contains, for example, a single emoticon will have a length of 2. So you can check if a character is in fact a surrogate. I'm not entirely sure how to handle else if (substring.length &gt; 1) from the iOS code but I think Character.isHighSurrogate(myChar) does the same job in that instance. private boolean containsIllegalCharacters(String displayName) { final int nameLength = displayName.length(); for (int i = 0; i &lt; nameLength; i++) { final char hs = displayName.charAt(i); if (0xd800 &lt;= hs &amp;&amp; hs &lt;= 0xdbff) { final char ls = displayName.charAt(i + 1); final int uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; if (0x1d000 &lt;= uc &amp;&amp; uc &lt;= 0x1f77f) { return true; } } else if (Character.isHighSurrogate(hs)) { final char ls = displayName.charAt(i + 1); if (ls == 0x20e3) { return true; } } else { // non surrogate if (0x2100 &lt;= hs &amp;&amp; hs &lt;= 0x27ff) { return true; } else if (0x2B05 &lt;= hs &amp;&amp; hs &lt;= 0x2b07) { return true; } else if (0x2934 &lt;= hs &amp;&amp; hs &lt;= 0x2935) { return true; } else if (0x3297 &lt;= hs &amp;&amp; hs &lt;= 0x3299) { return true; } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || hs == 0x2b50) { return true; } } } return false; }
answers question: http://stackoverflow.com/q/21392969
downvote count: 2
type: Answer
upvote count: 7
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21392969

http://stackoverflow.com/a/21512169
accepted answer of: http://stackoverflow.com/q/21511992
answers question: http://stackoverflow.com/q/21511992
has comment: http://stackoverflow.com/comment/32483208
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32478074
upvote count: 3
has body: From the manual Please note that " classpath*:" when combined with Ant-style patterns will only work reliably with at least one root directory before the pattern starts, unless the actual target files reside in the file system. This means that a pattern like " classpath*:*.xml" will not retrieve files from the root of jar files but rather only from the root of expanded directories. This originates from a limitation in the JDK’s ClassLoader.getResources() method which only returns file system locations for a passed-in empty string (indicating potential roots to search).

http://stackoverflow.com/comment/32317943
score: 0
type: Comment
type: QuestionComment
has text: @Radiodef Ok, that makes perfect sense. Thanks for this answer.
comment on: http://stackoverflow.com/q/21421697

http://stackoverflow.com/comment/32212231
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21362773
has text: +1 : reference : http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html?utm_source=twitterfeed&utm_medium=twitter
score: 1

http://stackoverflow.com/a/23263627
score: 1
has body: How I fixed it was Shut down Eclipse IDE Remove the workspace/.metadata/.plugins/org.eclipse.core.resources directory Start Eclipse IDE (with -clean to be super-safe) . Reimport all projects . You may face the same issue if your git plugin has crashed . Do a simple check by using git log command on your repository . If its the problem with the git files , you may have to backup your .git files and refresh your repository.
answers question: http://stackoverflow.com/q/21396964
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/21461020
has answer: http://stackoverflow.com/a/21483068
type: UnansweredQuestion
tagged with: servlets
type: Question
tagged with: maven
answer count: 1
has body: I'm trying to get all these disparate things working together for some unit testing. So the basic program structure is simple Servlet 3.0 running on TomCat as a WebApp maven archetype. Using Weld as an implementation of CDI to inject service objects into the Servlets. Which is all running. My problem currently is in the unit tests. I don't want to be running Integration Tests so I want to use the dependency injection to add some mock Service objects to the Service and fake some API calls. So I've tried some approaches like this: https://community.jboss.org/wiki/CreatingUnitTestsWithWeldAndJunit4 For making a custom runner for JUnit to run the CDI, however this always failed to actually inject anything into the Servlet object I instantiated, it could inject into the Test class itself though. So I'm trying Arquillian having gone over the documentation: http://arquillian.org/guides/getting_started/?utm_source=cta However I can't get this to run as it either can't find the container or I get Error could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunner Maven: org.jboss.arquillian.junit arquillian-junit-container test org.jboss.arquillian arquillian-bom 1.1.2.Final import pom junit junit 4.11 test jar org.mockito mockito-all 1.9.5 test jar org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven 2.0.2 test org.jboss.shrinkwrap.descriptors shrinkwrap-descriptors-impl-javaee 2.0.0-alpha-5 test org.jboss.shrinkwrap.resolver shrinkwrap-resolver-api-maven 2.1.0-alpha-1 org.jboss.weld.arquillian.container arquillian-weld-ee-embedded-1.1 test 1.1.2.Final org.jboss.weld weld-core 2.1.2.Final test org.jboss.weld.servlet weld-servlet 2.1.2.Final org.apache.tomcat tomcat-servlet-api 7.0.30 provided javax.servlet javax.servlet-api 3.0.1 provided Test code: @RunWith(Arquillian.class) public class TestSessionServlet { @Deployment @OverProtocol("Servlet 3.0") @TargetsContainer("weld") public static WebArchive createDeployment() { return ShrinkWrap.crea…
score: 0
tagged with: java
has title: Combining Arquillian, JUnit, Servlet 3.0 and Weld
tagged with: jboss-arquillian
tagged with: jboss-weld

relative-path
type: Tag
tags question: http://stackoverflow.com/q/21499733
tag name: relative-path
tags question: http://stackoverflow.com/q/21426093

http://stackoverflow.com/a/21384645
has body: This is not a direct answer to your question, but only a few corrections to your code: 1. You can replace the code that you consider "ugly": List&lt;WebElement&gt; elements = select.findElements(By.xpath(".//*[starts-with(@id,'135')]")); With a code that finds the elements using their class attribute: List&lt;WebElement&gt; elements = select.findElements(By.xpath("//span[@class='pagename']")); 2. Since non of these elements has a value attribute, you should replace the following line: String elementsValue = elements.get(i).getAttribute("value"); With: String elementsValue = elements.get(i).getAttribute("innerHTML");
has comment: http://stackoverflow.com/comment/32252967
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21384220
upvote count: 1
score: 1

http://stackoverflow.com/a/21401138
has comment: http://stackoverflow.com/comment/32343474
upvote count: 8
has comment: http://stackoverflow.com/comment/32281262
type: Answer
score: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/32281290
has body: You should do: for (int i = 0; i &lt; 1000; i++) { if (i % 3 == 0 || i % 5 ==0) { temp += i; } } This will add each number only one time. In your code, you will add 15 twice, since it'll be satisfied in both conditions in both loops. Also note that according to the requirements, you should loop to &lt; 1000, not &lt;=.
answers question: http://stackoverflow.com/q/21401082

http://stackoverflow.com/comment/32219450
has text: Do you use this function http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html ? If yes you need to set the JAVA_TOOL_OPTIONS var http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-VM/html/envvars.html
comment on: http://stackoverflow.com/a/21366460
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21391448
accepted answer of: http://stackoverflow.com/q/21388255
answers question: http://stackoverflow.com/q/21388255
score: 4
has body: An approach, maybe it is useful for someone: package stackoverflow; import java.awt.GridLayout; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class ConnectedSliders { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JSlider s0 = new JSlider(0, 100, 30); JSlider s1 = new JSlider(0, 100, 40); JSlider s2 = new JSlider(0, 100, 30); SliderGroup sliderGroup = new SliderGroup(); sliderGroup.add(s0); sliderGroup.add(s1); sliderGroup.add(s2); JPanel panel =new JPanel(new GridLayout(0,2)); panel.add(s0); panel.add(createListeningLabel(s0)); panel.add(s1); panel.add(createListeningLabel(s1)); panel.add(s2); panel.add(createListeningLabel(s2)); panel.add(createListeningLabel(s0, s1, s2)); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(panel); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } private static JLabel createListeningLabel(final JSlider ... sliders) { final JLabel label = new JLabel(""); for (JSlider slider : sliders) { slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int sum = 0; for (JSlider slider : sliders) { sum += slider.getValue(); } label.setText("Sum: "+sum); } }); } return label; } private static JLabel createListeningLabel(final JSlider slider) { final JLabel label = new JLabel(""); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { label.setText(String.valueOf(slider.getValue())); } }); return label; } } class SliderGroup { private final Map&lt;JSlider, Integer&gt; values; private final LinkedList&lt;JSlid…
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32277077
type: Answer

http://stackoverflow.com/comment/32303476
comment on: http://stackoverflow.com/a/21385613
type: Comment
score: 0
type: AnswerComment
has text: http://postimg.org/image/sjd3w6skh/ Thank you again to spend some time with me. @Mohammad S.

http://stackoverflow.com/comment/32299773
type: Comment
has text: Thank you very much. Your answer is very helpful. My problem is solved now, and also the API is a very good idea.
comment on: http://stackoverflow.com/a/21410307
score: 0
type: AnswerComment

http://stackoverflow.com/a/22229499
has body: While adding something to map, you use key value pair. map.put(key, value); when you want to get string you should use; map.get(key);
type: Answer
answers question: http://stackoverflow.com/q/21395762
score: 0

http://stackoverflow.com/comment/32290119
comment on: http://stackoverflow.com/q/21403383
score: 0
has text: That's cool man, learn at your own pace. But try to avoid becoming dependent on it. You want to be able to visualise that on your own, without the need for visual cues.
type: Comment
type: QuestionComment

marshalling
tags question: http://stackoverflow.com/q/21384550
tag name: marshalling
tags question: http://stackoverflow.com/q/21488119
tags question: http://stackoverflow.com/q/21477934
type: Tag

http://stackoverflow.com/q/21481016
type: Question
tagged with: jboss-arquillian
tagged with: ant
has answer: http://stackoverflow.com/a/21511840
has body: Details: Ant Build (with a maven extension, this is a solution at my company can't change) JBoss 7 Container will be started independently Setup: I have a test as follows: @RunWith(Arquillian.class) public class ArquillianArqTest { @Deployment @TargetsContainer("jbossas_remote") public static WebArchive create() { return ShrinkWrap.create(WebArchive.class); } @Test public void testMyDummy() { Assert.assertTrue(Boolean.TRUE); } } I have an arquillian.xml as follows: REMOTE jnp://127.0.0.1:15090 </container> To my surprise if i try to use the property managementAddress arquillian would simply ignore it. Where as if i use the providerUrl it would try to connect to the defined host:port. => How is this possible? Should it not try to use managementAddress for JBoss 7? Problem: The arquillian.xml seems to be picked up the @TargetsContainer also seems to take effect. But nothing happens when i try to run the test. What i mean is that the deploy is not happening it's just hanging there. I am now to be unsure if i use the correct management port. Please see an extract of conf/standalone-dev.xml: <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> <any-address/> <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/> <socket-binding name="management-native" interface="management" port="15199"/> <socket-binding name="management-http" interface="management" port="15190"/> <socket-binding name="management-https" interface="management" port="15143"/> <socket-binding name="ajp" port="15009"/> <socket-binding name="http" port="15080"/> <socket-binding name="https" port="15043"/> <socket-binding name="jacorb" interface="unsecure" port="15028"/> <socket-binding name="jacorb-ssl" interface="unsecure" port="15029"/> <socket-binding name="messaging" port="15045"/> <socket-binding name="messaging-throughput" port="15055"/> <socket-binding name="remoting" port="15047"/> <socket-binding name="txn-recovery-environment" port="15012"/> <socket-binding name="txn-status-…
score: 0
answer count: 1
has title: How to configure arquillian for remote JBoss 7 container
tagged with: jboss7.x
accepted answer: http://stackoverflow.com/a/21511840
type: AnsweredQuestion
tagged with: java
tagged with: integration-testing

http://stackoverflow.com/comment/32234129
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21374649
has text: After I have the book I'd send it to a new activity and it would be added to a list of books that have already been created.

http://stackoverflow.com/comment/32264934
has text: @user3183193 You can use your IDE to assist you with the necessary imports. Use Eclipse or Netbeans to import. java.text is the package you need to import for SimpleDateFormat.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21391194
type: Comment

http://stackoverflow.com/a/21418215
has comment: http://stackoverflow.com/comment/32311595
type: Answer
has comment: http://stackoverflow.com/comment/32311475
upvote count: 4
has body: As has been pointed out to you, there is almost never a good reason to do this and I agree that you should be using polymorphism instead. However, if you "need" to do this or just want to know how to go about doing something like this, you can use instanceof on this inside of the method: class A { public void aMethod() { if (this instanceof B) { System.out.println("I'm a B!"); } } } public class B extends A { public static void main(String[] args) { B b = new B(); b.aMethod(); } }
score: 4
accepted answer of: http://stackoverflow.com/q/21418122
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21418122

http://stackoverflow.com/q/21505249
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21506255
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/32465908
has answer: http://stackoverflow.com/a/21505307
has answer: http://stackoverflow.com/a/21506255
upvote count: 1
type: Question
tagged with: graphics
tagged with: alpha
answer count: 2
has comment: http://stackoverflow.com/comment/32465940
score: -1
has title: Java - Rubber alpha function
accepted answer: http://stackoverflow.com/a/21505307
has comment: http://stackoverflow.com/comment/32469905
tagged with: graphics2d
favorite count: 0
has body: I am currently making a paint program, and am currently implementing a rubber tool (a version which works with alpha colors). The problem is, I can't paint invisible lines via mouseDragged event because they will just go on top of the painting that was there before... I have considered setRGB on bImg, but it would need to be supported by mouseDragged and also make the thickness of the line variable. Anyone got any ideas? EDIT: Why down votes?

http://stackoverflow.com/comment/32472772
has text: restart the eclipse ..
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21509270
type: QuestionComment

http://stackoverflow.com/q/21360244
has comment: http://stackoverflow.com/comment/32207917
has comment: http://stackoverflow.com/comment/32207873
has body: I am going to explain this as best I can.. I have a user input data in the main to add information. It goes through the bankparser class to split up the data which inevitably passes through a third class irrelevant to this code. However, I get an error when trying to print the banks. I am 95% positive it is because my return in the BankParser class is null. I am not sure what return type it requires since the type is actually another class. Does anyone know how to resolve this? Thanks! I want the output when I print the bank information to look something like this: Bank name: BankName Bank ID: 12345 Bank address: Boston, MA MAIN case 'A': //Add Bank System.out.print("Please enter the bank information:\n"); inputInfo = scan.nextLine(); bank1 = BankParser.bankParser(inputInfo); accounts[index] = bank1; index++; break; case 'B': //Display banks for (int i=0; i&lt; index; i++) System.out.print(accounts[i].toString()); break; BankParser public class BankParser { public static Bank bankParser(String lineToParse) { Address AddressSetter = new Address(); Bank BankSetter = new Bank(); //Take in user data and segregate by bankName/bankID/city,state String bankInfo = lineToParse; String[] bankInfoArray = lineToParse.split("/"); //split array data String bankName = bankInfoArray[0]; String bankID = bankInfoArray[1]; String bankCity = bankInfoArray[2]; String bankState = bankInfoArray[3]; AddressSetter.setCity(bankCity); AddressSetter.setState(bankState); BankSetter.setBankAddress(bankCity, bankState); BankSetter.setBankID(bankID); BankSetter.setBankName(bankName); System.out.println(bankInfoArray[0]); return null; } }
has comment: http://stackoverflow.com/comment/32207950
tagged with: java
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/32207945
has answer: http://stackoverflow.com/a/21360285
tagged with: arrays
has comment: http://stackoverflow.com/comment/32207911
score: 0
has title: Extracting data from other methods in java and finding proper return types
tagged with: types
answer count: 1
tagged with: return
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32207912

http://stackoverflow.com/q/21489582
has body: Need to check if the logged in user is a Developer, Owner or Viewer in google appengine in java. This page explains about putting constraint such that the user have to be Administrator but I did not find any Java API whcih can give me the role .
type: Question
tagged with: java
score: 0
has title: Checking User's role in Google appengine
answer count: 2
has answer: http://stackoverflow.com/a/21495223
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/21490048

http://stackoverflow.com/a/21445121
type: Answer
answers question: http://stackoverflow.com/q/21444973
upvote count: 3
score: 3
downvote count: 0
has body: As an ArrayList doesn't initially contain any elements, it can't default the value of those elements to null or any other value.

http://stackoverflow.com/a/43597199
has body: use paragraph.getCTP().getPPr().getRPr().isSetB()
upvote count: 0
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/74245764
has comment: http://stackoverflow.com/comment/74245552
score: -1
answers question: http://stackoverflow.com/q/21425176

http://stackoverflow.com/q/21374285
has comment: http://stackoverflow.com/comment/32233857
type: Question
has comment: http://stackoverflow.com/comment/32236306
has comment: http://stackoverflow.com/comment/32234779
tagged with: android-adapter
has title: onListItemClick() error: it must override or implement a supertype method
answer count: 2
has comment: http://stackoverflow.com/comment/32233364
upvote count: 1
has comment: http://stackoverflow.com/comment/32235752
has comment: http://stackoverflow.com/comment/32234320
has comment: http://stackoverflow.com/comment/32236645
has answer: http://stackoverflow.com/a/21375763
has comment: http://stackoverflow.com/comment/32234127
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/32234591
tagged with: java
has comment: http://stackoverflow.com/comment/32234279
has comment: http://stackoverflow.com/comment/32234487
possible better answer: http://stackoverflow.com/a/21374373
has answer: http://stackoverflow.com/a/21374373
type: AnsweredQuestion
has body: I am a beginner in both Android and Java. I searched for an answer to this error, but nothing in stackOverflow worked for my situation. I am following a book that says we need to use a onListItemClick() method that is from a class (CrimeListFragment) we created that extends ListFragment (using the method and the class are mandatory). However, I keep getting the error with: @Override public void onListItemClick(ListView 1, View v, int position, long id) { Crime c = (Crime)(getListAdapter()).getItemViewType(position); Log.d(TAG, c.getTitle() + " was clicked"); } The error says "The method on onListItemClick of type CrimeListFragment must override or implement a supertype method." It also has a problem with the List View 1 argument. That shows an error too. This project is complicated with many classes, but here is the main code for this page: package com.bignerdranch.android.criminalintent; import java.util.ArrayList; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.widget.ArrayAdapter; import android.widget.ListView; public class CrimeListFragment extends ListFragment { private static final String TAG = "CrimeListFragment"; private ArrayList&lt;Crime&gt; mCrimes; @Override public void onListItemClick(ListView 1, View v, int position, long id) { Crime c = (Crime)(getListAdapter()).getItemViewType(position); Log.d(TAG, c.getTitle() + " was clicked"); } @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); getActivity().setTitle(R.string.crimes_title); mCrimes = CrimeLab.get(getActivity()).getCrimes(); ArrayAdapter&lt;Crime&gt; adapter = new ArrayAdapter&lt;Crime&gt;(getActivity(), android.R.layout.simple_list_item_1, mCrimes); setListAdapter(adapter); } } HOW do I get rid of these 2 errors? Thank you.
downvote count: 0
has comment: http://stackoverflow.com/comment/32235756
score: 1
accepted answer: http://stackoverflow.com/a/21375763
favorite count: 0
has comment: http://stackoverflow.com/comment/32234412
has comment: http://stackoverflow.com/comment/32234634

http://stackoverflow.com/q/21416180
has comment: http://stackoverflow.com/comment/32420997
has body: In Java, I'm able to do the following: Java public class Button { private Callback callback; public Button(Callback callback) { this.callback = callback; } public void update() { // Check if clicked.. callback.onClick(this); } public interface Callback { public void onClick(Button Button); } } And use it like: Button b = new Button(new Callback() { @Override public void onClick(Button b) { System.out.println("Clicked"); } }); And I'm wondering, if the same is possible in (Unity) C#. Currently I have the same setup, with the correct syntax C#: public class Button { private Callback callback; public Button(Callback callback) { this.callback = callback; } public void Update() { // Check if clicked.. callback.OnClick(this); } public interface Callback { void OnClick(Button button); } } However, when I try to do the same when creating a button, Button b = new Button(new Button.Callback() { void OnClick(Button button) { Debug.Log("Clicked"); } }); I get errors like: Unexpected symbol 'void' error CS1526: A new expression requires () or [] after type error CS8025: Parsing error I've tried making the method 'virtual' or 'abstract' in the interface, or adding the 'new' keyword before void OnClick(.. when I create the button, but no luck so far. It seems that the unexpected symbol 'void' error dissapears if I remove the '()' from 'new Button.Callback' I would appreciate some help here.
linked to: http://stackoverflow.com/q/13804804
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21416574
score: 1
linked to: http://stackoverflow.com/q/9824435
tagged with: java
has title: How to use an anonymous interface callback method as parameter in C#?
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/32308128
duplicate of: http://stackoverflow.com/q/13804804
has answer: http://stackoverflow.com/a/21416246
has answer: http://stackoverflow.com/a/21416459
accepted answer: http://stackoverflow.com/a/21416459
answer count: 3
possible better answer: http://stackoverflow.com/a/21416574
upvote count: 1
downvote count: 0
duplicate of: http://stackoverflow.com/q/9824435
tagged with: callback
favorite count: 0
tagged with: unity-game-engine

http://stackoverflow.com/q/21363745
favorite count: 0
tagged with: spring-data-neo4j
has answer: http://stackoverflow.com/a/21367313
accepted answer: http://stackoverflow.com/a/21367313
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Usages of Neo4j ResultConverter Interface
downvote count: 0
has body: I recently bumped into the ResultConverter interface in Neo4j when examining the following method on the RestAPIFacade class... org.neo4j.rest.graphdb.RestAPIFacade.query(String statement, Map&lt;String, Object&gt; params, ResultConverter resultConverter) Thinking it might be involved in the conversion of a query result to a specified java class as the code below suggests.. public interface ResultConverter&lt;T, R&gt; { R convert(T value, Class&lt;R&gt; type); ResultConverter NO_OP_RESULT_CONVERTER = new ResultConverter() { @Override public Object convert(Object value, Class type) { return null; } }; } I started digging around for documentation on usage of the interface and what the types T and R(I'm kind of suspecting that the R might be the class to convert to) but I've come up short so far. Can anyone give me a heads up on what this is supposed to do in the context of the query method? Examples would really help. Thanks.
answer count: 1
tagged with: neo4j

http://stackoverflow.com/a/21403071
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/21402697
answers question: http://stackoverflow.com/q/21402697
type: AcceptedAnswer
downvote count: 0
has body: This delta, aka as deltaTime, is the time your last frame took to render. Let's assume that your app has 60 frames per second (FPS), then your deltaTime should roughly be 0.01666... which is your case as well. Usually you will use it like this: float speed = 10f; float positionX = positionX + (speed * deltaTime); If this is part of your render routine, which runs in every frame, your positionX will increase by 10 every second. Without deltaTime your speed will totally depend on the speed of your device.

http://stackoverflow.com/a/21450526
answers question: http://stackoverflow.com/q/21450509
type: Answer
has comment: http://stackoverflow.com/comment/32369201
score: 3
upvote count: 3
has body: String text = "I think it is better to go"; int number = text.split(" ").length;
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21450509
has comment: http://stackoverflow.com/comment/32369160

http://stackoverflow.com/comment/32340959
comment on: http://stackoverflow.com/a/21434257
type: AnswerComment
has text: @assylias I have substantially changed my answer.
type: Comment
score: 0

http://stackoverflow.com/a/21449398
has comment: http://stackoverflow.com/comment/32367282
has comment: http://stackoverflow.com/comment/32366985
has comment: http://stackoverflow.com/comment/32367209
has comment: http://stackoverflow.com/comment/32367127
score: 0
has comment: http://stackoverflow.com/comment/32367152
has comment: http://stackoverflow.com/comment/32367010
type: Answer
has comment: http://stackoverflow.com/comment/32367187
has body: Your error Warning: Activity not started, its current task has been brought to the front shows that in your emulator your application is already running and you are again trying to run it. First of all just close the application and then again try to run it. Or it may be running in background so from your settings first just forceclose it and then again install it, it should work. It will always run application without closing if you did make any changes in your application after once installation. If you do not make any changes and then try to run application without closing it in that case it will show such kind of errors. Once try to clean and Build your project and then run it again.
answers question: http://stackoverflow.com/q/21449252
has comment: http://stackoverflow.com/comment/32367591

http://stackoverflow.com/a/21378073
upvote count: 2
score: 2
downvote count: 0
has body: Class B declares variables in B scope, public void display() is part of A class and knows only about its own scope variables.
type: Answer
answers question: http://stackoverflow.com/q/21377859

http://stackoverflow.com/a/37404916
has comment: http://stackoverflow.com/comment/109838168
upvote count: 1
score: -1
answers question: http://stackoverflow.com/q/21399472
downvote count: 2
has body: You can get domain name from your environment. String domainname = System.getenv("USERDOMAIN");
type: Answer
has comment: http://stackoverflow.com/comment/109820097

http://stackoverflow.com/comment/32280693
has text: Can you please explain it a bit more. Would be great if we can have some pseudocode or code. Thanks.
comment on: http://stackoverflow.com/a/21400767
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21447801
has comment: http://stackoverflow.com/comment/32404333
has body: So I asked this question concerning how to combine 3 different applications into 1 Combining Processing Applications into 1 Big Executable? From lurking I have learned the following methods I could go about to do this: use Java and embed my sketches in a Swing interface (rewrite programs into some complicated Java monstrosity) Rewitre code to launch separate windows using G4P http://www.lagers.org.uk/g4p/ex-windows/index.html (seems better than option 1 but still a pain in the ass because trying to write functions to get the LEAP motion api calls to work in the separate windows wont be easy) Use Open() at the end of each program to run the next program (quick and dirty, just the way I like it!) Combine all 3 into a batch file. (I dont really understand how to go about doing this but seems similar to previous option). Now theoretically I could get more functionality from 1 and 2 (in terms of program flow and better user interface) and would probably learn more and be better off in my future efforts, however time is of the essence at the moment. Each of the programs creates csv data files from user input that I will use to create a visualization so the manner in which I get the programs to run is somewhat irrelevant at this point. Only problem is I cant get open() to work correctly. See below: void setup() { size(200, 200); } void draw() { // draw() must be present for mousePressed() to work } void mousePressed() { open("C:/Users/corbett2/Documents/Processing/test/application.windows64/test.bat"); //doesn't work open(new String[] { "cmd", "/c", "start", "/w", "C:/Users/corbett2/Documents/Processing/test/application.windows64/test.bat"}); //also doesn't work } I've tried a bunch of different ways to use open() but it wont run the program. I'm using windows 8. I exported the application "test" which created the "test.bat" located in C:/Users/corbett2/Documents/Processing/test/application.windows64. I believe you have to export your sketch before you can try to use open(…
has comment: http://stackoverflow.com/comment/32389395
linked to: http://stackoverflow.com/q/21437922
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21457238
tagged with: swing
answer count: 1
tagged with: leap-motion
tagged with: processing
tagged with: windows-8
type: UnansweredQuestion
has title: Open() in Processing Code Not Working
type: Question
has comment: http://stackoverflow.com/comment/32364534

http://stackoverflow.com/a/21417493
upvote count: 3
has body: The problem is this line. while (in.read()!= -1); This is kind of a "degenerate loop" because of the semicolon at the end. It continues to read from the file until there's nothing left to be read. After that, there are no double values to parse.
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/32310120
downvote count: 0
has comment: http://stackoverflow.com/comment/32310520
has comment: http://stackoverflow.com/comment/32311423
answers question: http://stackoverflow.com/q/21417407
has comment: http://stackoverflow.com/comment/32310066
has comment: http://stackoverflow.com/comment/32310197
has comment: http://stackoverflow.com/comment/32310265

http://stackoverflow.com/q/21463674
has answer: http://stackoverflow.com/a/21463741
answer count: 2
tagged with: arrays
has title: Double cannot be derefereced Java compiler error
score: 0
has comment: http://stackoverflow.com/comment/32391569
has answer: http://stackoverflow.com/a/21463749
tagged with: double
has comment: http://stackoverflow.com/comment/32391688
has comment: http://stackoverflow.com/comment/32391573
has comment: http://stackoverflow.com/comment/32391682
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21463741
has body: public void additionHW() { for(Subject y: sub) { for (double s: s.getHomeworkMark()) { homeworkAddition += s; } } s.addToTotalHW.add(homeworkAddition); } I'm getting an error saying double cannot be dereferenced... ANy ideas??
tagged with: java
tagged with: methods
possible better answer: http://stackoverflow.com/a/21463749
type: Question
has comment: http://stackoverflow.com/comment/32391993

http://stackoverflow.com/comment/38835671
type: Comment
score: 0
has text: using menu.clear clears the item of `main.xml` due to whuch nothing is shown in the acctionbar of fragment but according to my implementation searchview is visible in activity not in the fragment
comment on: http://stackoverflow.com/a/24981409
type: AnswerComment

http://stackoverflow.com/comment/32472250
type: QuestionComment
has text: Thank you for the hint concerning the returnvalue of the `login`-method. I'll try to start from a "clean" Wildfly-installation using the quickstarts from JDF to find out what is the difference.
score: 0
comment on: http://stackoverflow.com/q/21475229
type: Comment

http://stackoverflow.com/q/21492334
has comment: http://stackoverflow.com/comment/32443284
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/21492404
upvote count: 1
has comment: http://stackoverflow.com/comment/32443163
has comment: http://stackoverflow.com/comment/32442852
has answer: http://stackoverflow.com/a/21492374
possible better answer: http://stackoverflow.com/a/21492455
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21492455
downvote count: 0
has body: as I understand it private fields can only be accessed in the class that they are defined. I have this code for a rudimentary singly linked list: public class LinkedList { private class Node { private String data; private Node next; private Node(String data, Node nextNode) { this.data = data; this.next = nextNode; } } private Node head; public LinkedList(String data) { // Create head node, set next node null head = new Node(data, null); } public void add(String data){ Node currentNode = head; while(currentNode.next != null){ currentNode = currentNode.next; } currentNode.next = new Node(data, null); } public void printList(){ Node currentNode = head; System.out.println(currentNode.data); while(currentNode.next != null){ currentNode = currentNode.next; System.out.println(currentNode.data); } } } It appears to run and work just fine, but I am trying to figure out why I can access the 'data' and 'next' fields of class Node in my functions in class LinkedList. Adding onto this, is a nested class the same thing as a subclass defined with the 'extends' keyword? Cheers, thanks for the help. edit: just adding onto this question, in other implementations of linked lists I see people defining two separate classes for node, and list. It made more sense to me for node to be a nested class of linkedlist. If this is not entirely correct please let me know...
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21492374
has title: Java - Can a class access a private field of its nested class?

http://stackoverflow.com/q/21432626
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11115381
score: 3
tagged with: android
favorite count: 0
has title: google api androidpublisher error code 403
type: Question
tagged with: google-api
answer count: 2
tagged with: google-play
has comment: http://stackoverflow.com/comment/37485170
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22975868
has body: I am stucking with the following problem like one month already, I am trying to verify an inapp purchase by using the following api :https://developers.google.com/android-publisher/authorization I followed every step from the documentation(doing everthing with Postman Rest Client from Chrome), I can retrieve an accesstoken and a refresh token, but whenever when I try to query a purchase it results in error code 403 access not configured, BUT I CONFFIGURED IT IN THE SETTINGS! anybody with an idea maybe?
has answer: http://stackoverflow.com/a/23954002
downvote count: 0

http://stackoverflow.com/a/21449042
answers question: http://stackoverflow.com/q/21447466
has body: I think you should define the type of numbers your array will handle, if I use float numbers I can have some code like the class bellow to do the type of operations you are asked for. You can also add some decimal formatting. public class Test { public static void main(String[] args) { new Test(); } public Test() { float myarray[][]= { {45.24f, 54.67f, 32.55f, 25.61f}, {65.29f, 49.75f, 32.08f, 26.11f}, {25.24f, 54.33f, 34.55f, 28.16f} }; float row[] = new float[3]; float column[] = new float[4]; for (int i=0; i &lt; 3; i++) { float rowvalue = 0f; for (int j=0; j &lt; 4; j++) { System.out.print(myarray[i][j]+" "); rowvalue+=myarray[i][j]; } row[i]=rowvalue; System.out.println(""); } System.out.println(""); for (int i=0; i &lt; 4; i++) { float colvalue = 0f; for (int j=0; j &lt; 3; j++) { System.out.print(myarray[j][i]+" "); colvalue+=myarray[j][i]; } column[i]=colvalue; System.out.println(""); } System.out.println("Rows answer:"); for (int i=0; i &lt; 3; i++) { System.out.println(row[i]); } System.out.println("Columns answer:"); for (int i=0; i &lt; 4; i++) { System.out.println(column[i]); } } }
score: 0
type: Answer

http://stackoverflow.com/comment/32486005
score: 0
type: AnswerComment
type: Comment
has text: Mmm, I have no idea if that would work,but , the graphics that android system is not choosing right is on : <?xml version="1.0" encoding="utf-8"?><RelativeLayout ......android:background="@drawable/bgm" ..>
comment on: http://stackoverflow.com/a/21506088

http://stackoverflow.com/comment/32285646
type: Comment
comment on: http://stackoverflow.com/a/21402007
has text: I suggest you to create custom seek bar instead
type: AnswerComment
score: 0

http://stackoverflow.com/a/74956387
has body: Taken from a great book Programming in Scala by Martin Odersky (creator of Scala) and others. Java's switch integer-type, enum and constants can be used can be used in case break at the end of each alternative fall through from one alternative to the next without break doesn't result in a value Scala's match any kind of constant, as well as other things, can be used in case no break at the end of each alternative no fall through from one alternative to the next results in a value Exampes of the same logic programmed in Java and Scala: Scala firstArg match case "salt" => println("pepper") case "chips" => println("salsa") case "eggs" => println("bacon") case _ => println("huh?") Java switch (firstArg) { case "salt": System.out.println("pepper"); break; case "chips": System.out.println("salsa"); break; case "eggs": System.out.println("bacon"); break; default: System.out.println("huh?"); } Scala's match can results in a value, Java's switch cannot: friend match case "salt" => "pepper" case "chips" => "salsa" case "eggs" => "bacona" case _ => "huh?"
type: Answer
answers question: http://stackoverflow.com/q/21355060
score: 0

http://stackoverflow.com/comment/32436344
score: 1
has text: You realize that if you have 15 characters, and can choose all 26 standard letters + 10 numbers as possibilities that that means you'll have 36^15 possible combinations, right?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21488438

http://stackoverflow.com/comment/32289789
has text: Thank you, I'm looking for that dependency but I really don't see it.
comment on: http://stackoverflow.com/a/21406037
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21506364
has answer: http://stackoverflow.com/a/21506404
has body: I have to count the length of strings in a text file and figure out the frequency of which they appear. I'm able to count the length but my frequency counter is always off and I don't know why. Say I'm passing in a file with these words: reinflates, misorders, discontinuations, gastness, and grousers My program registers 2 instance of strings of length 8 (correct) and 2 instances of string of length 16 (which is wrong there's only one) and it doesn't even recognize the 10 letter word and the 9 letter word. We're also not allowed to use ArrayList so we have to keep resizing the array ourselves. Here's my code: int [] histogram = new int[0]; // while loop to read all words into your String[] // and update all the freq counter for word lengths while(infile.ready()) { String word = infile.readLine(); if (word.length() &gt;= histogram.length){ int [] newHistogram = new int [word.length()+1]; for (int p=0;p&lt;histogram.length;p++){ histogram[p]=newHistogram[p]; } newHistogram[word.length()]++; histogram=newHistogram; } if (word.length() &lt; histogram.length){ histogram[word.length()]++; } }
possible better answer: http://stackoverflow.com/a/21506404
answer count: 2
has title: Unable to get my Histogram to Count Correctly
downvote count: 0
tagged with: histogram
score: 1
has answer: http://stackoverflow.com/a/21506441
favorite count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21506441
upvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/21493128
has comment: http://stackoverflow.com/comment/32444306
has comment: http://stackoverflow.com/comment/32444334
has comment: http://stackoverflow.com/comment/32444437
accepted answer of: http://stackoverflow.com/q/21493062
has comment: http://stackoverflow.com/comment/32444406
upvote count: 5
answers question: http://stackoverflow.com/q/21493062
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32444364
has comment: http://stackoverflow.com/comment/32444371
has body: The problem with your code is that you're reading the value of a and reassigning it with a -= 1 in the same expression, but the order of these operations is not specified. The statement: return a * do(a -= 1); could be implemented as: temp = a; a -= 1; return temp * do(a); which will do what you were probably expecting, or: a -= 1; return a * do(a); which will multiply by the decremented value of a rather than its original value. The correct way to write your function is: public int do(int a){ if(a==0){ return 1 ; }else{ return a * do(a-1); } } Just pass the result of the subtraction as an argument, don't reassign the variable at the same time.
has comment: http://stackoverflow.com/comment/32444338
has comment: http://stackoverflow.com/comment/32444346
type: Answer
downvote count: 1

http://stackoverflow.com/a/51152724
has body: You can also use skip() function as below... long count = data.careas.count(); CArea last = data.careas.stream().skip(count - 1).findFirst().get(); it's super simple to use.
has comment: http://stackoverflow.com/comment/94003565
downvote count: 2
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/114271894
score: -1
answers question: http://stackoverflow.com/q/21426843
has comment: http://stackoverflow.com/comment/104854499

http://stackoverflow.com/q/21432476
has answer: http://stackoverflow.com/a/21742086
type: Question
has comment: http://stackoverflow.com/comment/32352619
has comment: http://stackoverflow.com/comment/32354077
score: 1
tagged with: java
has body: java.lang.VerifyError: Expecting a stackmap frame at branch target 11 in method tests.FieldTest.<init>()V at offset 4 at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) anybody got an idea? build.xml <?xml version="1.0" encoding="UTF-8"?> <property name="src.dir" value="${basedir}/src" /> <property name="src.dir.tests" value="${src.dir}/tests" /> <property name="lib.dir" value="${basedir}/lib" /> <property name="lib.dir.compile" value="${lib.dir}/compile" /> <property name="lib.dir.test" value="${lib.dir}/test" /> <property name="target.dir" value="${basedir}/target" /> <property name="target.dir.classes" value="${target.dir}/classes" /> <property name="target.dir.test.classes" value="${target.dir}/test-classes" /> <property name="target.dir.test.reports" value="${target.dir}/test-reports" /> <property name="target.dir.test.coverage" location="${target.dir}/coverage" /> <property name="target.dir.test.coverage.meta" location="${target.dir}/coverage/metadata" /> <property name="target.dir.test.instrumentation" location="${target.dir}/instr-classes" /> <property name="target.dir.doc" value="${target.dir}/doc" /> <delete dir="${target.dir}" /> <mkdir dir="${target.dir}" /> <mkdir dir="${target.dir.classes}" /> <mkdir dir="${target.dir.classes}" /> <mkdir dir="${target.dir.doc}" /> <mkdir dir="${target.dir.test.classes}" /> <mkdir dir="${target.dir.test.reports}" /> <mkdir dir="${target.dir.test.coverage}" /> <mkdir dir="${target.dir.test.coverage.meta}" /> <mkdir dir="${target.dir.test.instrumentation}" /> <javac srcdir="${src.dir}" destdir="${target.dir.classes}" excludes="${src.dir.tests}" classpathref="project.classpath" includeantruntime="false" /> <javac srcdir="${src.dir.tests}" destdir="${target.dir.test.classes}" classpathref="path.classes.run" includeantruntime="false" /> <property name="emma.dir" value="/home/tebbje/emma/lib" /> <property name="emma.enabled" value="true" /> <pathelement location="${emma.dir}/emma.jar" /> <pa…
has title: Jenkins: EMMA Verify Error
tagged with: junit
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21742086
tagged with: verifyerror
favorite count: 0
has comment: http://stackoverflow.com/comment/32337731
has comment: http://stackoverflow.com/comment/32337693
linked to: http://stackoverflow.com/q/15122890
type: AnsweredQuestion
tagged with: jenkins
has comment: http://stackoverflow.com/comment/32349595
upvote count: 1
tagged with: emma

http://stackoverflow.com/comment/32367587
type: QuestionComment
comment on: http://stackoverflow.com/q/21448248
has text: Have you set the path and classpath ??
score: 0
type: Comment

http://stackoverflow.com/comment/32467133
type: AnswerComment
type: Comment
has text: @Bohemian 5.18.1 explicitly states that string concatenation causes a conversion and points at 5.1.11. They literally violate the spec the way they're doing it, heh.
comment on: http://stackoverflow.com/a/21505559
score: 0

http://stackoverflow.com/q/21359107
has answer: http://stackoverflow.com/a/21359274
has comment: http://stackoverflow.com/comment/32206082
has comment: http://stackoverflow.com/comment/32205986
type: Question
has comment: http://stackoverflow.com/comment/32206125
has body: I have a class structure in Java where one class extends another, and the subclass can have more variables than the super class does. In a function I created, I accept the super class as a parameter, and so I don't know if the object I am passing in is an instance of the subclass (and I cannot test to see if it is for a few reasons). I still want to access those variables in the subclass though, so is there anyway to search for variables in an object? I know the exact name of the variable, I just don't know if the object I will be passing in actually contains the variable, if that makes any sense. @Override public void received(Connection connection, Object object) { if (object instanceof Packet) { if(packet.contains(variable)) { //don't know how to test for this } } } Packet is the superclass, I have another class called PacketMessage which extends Packet. I have variables in PacketMessage that aren't present in Packet. I cannot test for PacketMessage because I'm trying to create a flexible API. I want the end user to be able to add in different classes that extend Packet, but don't necessarily have the same variables as other packets. I need to be able to test all the packet types, so I can't hard code the function to only check for one packet type.
has comment: http://stackoverflow.com/comment/32206108
has comment: http://stackoverflow.com/comment/32206068
has comment: http://stackoverflow.com/comment/32206114
has comment: http://stackoverflow.com/comment/32206236
answer count: 2
has comment: http://stackoverflow.com/comment/32205983
has answer: http://stackoverflow.com/a/21359230
has comment: http://stackoverflow.com/comment/32206279
has title: See if object contains a value
has comment: http://stackoverflow.com/comment/32206038
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32206057
score: 0
tagged with: java

http://stackoverflow.com/a/22856797
score: 2
upvote count: 2
has body: Note that your algorithm is entirely wrong. The example from Wikipedia uses 32-bit variables. It is a 128-bit state generator, and the shifts you are using will give a maximal period ONLY for such a generator. The DSI utilities (http://dsiutils.di.unimi.it/) contain several implementation of xorshift*/xorshift+ generators, which are 64-bit variant of xorshift that do not exhibit linear artifacts. I suggest you to start from there.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21460561

http://stackoverflow.com/a/21406953
answers question: http://stackoverflow.com/q/21406853
type: AcceptedAnswer
type: Answer
has body: If you want to perform a menu update, you must call invalidateOptionsMenu(). It will call onCreateOptionsMenu(Menu menu) back, were you can update (re-create) a menu depending on the state your activity is in. Runtime changes in menu are explained here in more details.
accepted answer of: http://stackoverflow.com/q/21406853
score: 0

http://stackoverflow.com/a/21496153
has comment: http://stackoverflow.com/comment/32449450
has body: use following code: import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.app.Activity; import android.webkit.WebView; public class TopRatedFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false); WebView engine = (WebView) rootView.findViewById(R.id.web_engine); // `web_engine` must be in `fragment_top_rated` engine.loadUrl("http://www.google.com/"); return rootView; } }
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/21495778
answers question: http://stackoverflow.com/q/21495778
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21407551
downvote count: 0
has body: To wake a thread you need a reference to it directly, like so: Minute min = new Minute(); min.run(); // later min.notify(); How you get that reference into your 'Wake' class code is up to you. For example, via the constructor: class Waker { Minute towake; public Waker(Minute m) { towake = m; } public void wakeUp { towake.notify(); } } So the original example becomes: Minute min = new Minute(); min.run(); Waker waker = new Waker(min); // later waker.wakeUp(); Or you can just call 'notifyAll()' as Batty suggests, but that's very crude.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21407409
has comment: http://stackoverflow.com/comment/32293029
accepted answer of: http://stackoverflow.com/q/21407409
has comment: http://stackoverflow.com/comment/32292599
type: AcceptedAnswer

http://stackoverflow.com/a/21460143
upvote count: 1
has comment: http://stackoverflow.com/comment/53627904
has comment: http://stackoverflow.com/comment/53639540
type: AcceptedAnswer
downvote count: 0
has body: The second example is correct. ${header.id} == 1 <to uri="bean:processorBean?method=process" /> <to uri="bean:finalizerBean?method=shutdown" /> If finalizerBean is "outside" the , it will get executed for every message that comes from direct:starter - which isn't what you want ;)
type: Answer
answers question: http://stackoverflow.com/q/21457909
score: 1
accepted answer of: http://stackoverflow.com/q/21457909

http://stackoverflow.com/q/21414782
accepted answer: http://stackoverflow.com/a/21417187
tagged with: java
has answer: http://stackoverflow.com/a/21416183
tagged with: eclipse
answer count: 2
downvote count: 0
has title: wsdl2java Invalid endpoint address in port when the address exists
score: 1
favorite count: 0
has body: I would like to connect to eBay API. I downloaded the WSDL from their site I can see that the address exists: <wsdl:service name="FindingService"> <wsdl:documentation> 1.12.0 </wsdl:documentation> <wsdl:port name="FindingServiceSOAPPort" binding="tns:FindingServiceSOAPBinding"> <soap12:address xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" location="https://svcs.ebay.com/services/search/FindingService/v1"/> </wsdl:port> </wsdl:service> However, when I try to create a new Web Service Client project in Eclipse I get: IWAB0399E Error in generating Java from WSDL: java.io.IOException: Emitter failure. Cannot find endpoint address in port FindingServiceSOAPPort in service FindingServiceLocator What could be the problem?
has answer: http://stackoverflow.com/a/21417187
type: AnsweredQuestion
upvote count: 1
tagged with: web-services
type: Question
possible better answer: http://stackoverflow.com/a/21416183

http://stackoverflow.com/q/21375485
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/21375777
tagged with: jdbc
has comment: http://stackoverflow.com/comment/32236925
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/21375840
tagged with: java
has answer: http://stackoverflow.com/a/21375575
tagged with: mysql
has title: is it possible to get the url or server info from java.sql.Connection
type: Question
has answer: http://stackoverflow.com/a/21375652
has comment: http://stackoverflow.com/comment/32235798
duplicate of: http://stackoverflow.com/q/5718952
accepted answer: http://stackoverflow.com/a/21375652
has answer: http://stackoverflow.com/a/21375777
has body: I am getting java.sql.Connection from DriverManager.getConnection(...) and want to know what is the server host+port. If its relevant, I know its MYSQL server. What is the best way to do that?
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21375748
linked to: http://stackoverflow.com/q/5718952

http://stackoverflow.com/a/21510424
type: Answer
answers question: http://stackoverflow.com/q/21469472
has body: Are you sure that readObject method works on that binary data? For example don't i.e. StreamCorruptedException occur and your post-processor stops working. As per How to use BeanShell guide As Beanshell is executed within Rhino engine there is no other option to see what’s wrong apart from inspecting jmeter.log file for something like: Error invoking bsh method and using System.out.println(“something”) or log.info(“something”) to get to the bottom of where the script fails. you don't have a way to verify whether your post-processor is successful, you'll have to look into the logs and/or add some debug output statement to the end. Another technique which can be useful is surrounding your code with try/catch See example below on how to use. In case of "everything is fine" the post processor will print Successfully read data into myObj into STDOUT. In opposite case you'll see a relevant error stacktrace there. import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; try { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); Object myObj = ois.readObject(); ois.close(); System.out.println("Successfully read data into myObj"); } catch (Exception ex) { ex.printStackTrace(); } Hope this helps.
has comment: http://stackoverflow.com/comment/32513791
upvote count: 1
has comment: http://stackoverflow.com/comment/32476962
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32475641

http://stackoverflow.com/q/21415413
score: 4
tagged with: servlet-3.0
has answer: http://stackoverflow.com/a/21416040
has body: I trying to access the html files inside the WebContent/alerts folder using its relative path from servlet. But i unable to access it using its relative path, Access the file inside WebContent from Servlet using relative path: protected Element getSummary(String value) throws IOException { Element element=null; Summary summary = Summary.valueOf(value); switch(summary) { case rtp_summary: element=parseDIV(new File("../../WebContent/alerts/rtp_bcklg_mail.html"),"rtp_summary"); break; case ffu_summary: element=parseDIV(new File("/../../WebContent/alerts/ffu_comp_bcklg_mail.html"),"ffu_summary"); break; default: System.out.println("Enter a valid choice"); break; } return element; } Access the file inside WebContent from Java Thread using relative path: public class WriteJSONFile implements Runnable{ WriteJSONFile(){ } @Override public void run() { try { createJSONFile(); } catch (IOException e) { e.printStackTrace(); } } @SuppressWarnings("unchecked") private static void createJSONFile() throws IOException { String path="C:/Users/Thiru/Documents/Website Design/Macaw/"; JSONArray jsonArray=new JSONArray(); JSONObject rtpStatus=new JSONObject(); rtpStatus.put("name","RTP"); rtpStatus.put("status",parseDIV(new File(path+"WebContent/alerts/rtp_bcklg_mail.html"),"rtp_health")); jsonArray.add(rtpStatus); JSONObject proposalattribStatus=new JSONObject(); proposalattribStatus.put("name","PROPOSAL ATTRIBUTE"); proposalattribStatus.put("status",parseDIV(new File(path+"WebContent/alerts/prpsl_txtsrch.html"),"prpsl_attrb_health")); jsonArray.add(proposalattribStatus); writetoFile(jsonArray); } private static void writetoFile(JSONArray jsonArray) { try { String path="C:/Users/Thiru/Documents/Website Design/Macaw/"; FileWriter file = new FileWriter(path+"WebContent/properties/status.json"); file.write(jsonArray.toJSONString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } } protected static String parseDIV(File input, String divElement) throws IOExcept…
linked to: http://stackoverflow.com/q/19786142
answer count: 4
favorite count: 0
tagged with: vs-web-application-project
possible better answer: http://stackoverflow.com/a/21416044
has answer: http://stackoverflow.com/a/21416044
accepted answer: http://stackoverflow.com/a/21416040
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32306604
has title: Access file inside WebContent from servlet
linked to: http://stackoverflow.com/q/3309022
tagged with: servlets
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/46563106
tagged with: jsoup
has answer: http://stackoverflow.com/a/48605105
downvote count: 0

http://stackoverflow.com/comment/32436902
score: 0
has text: What you mean with "when the users access to settings activity "?
type: QuestionComment
comment on: http://stackoverflow.com/q/21489212
type: Comment

http://stackoverflow.com/comment/32298960
has text: Graphics processor may be an intersting idea, I tried a naive approach a while back with that but found that data transfer to the GPU was the main bottleneck. However, I didn't really know what I was doing then (whether I know what I'm doing now is yet to be seen)
comment on: http://stackoverflow.com/a/21411245
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32197810
comment on: http://stackoverflow.com/q/21354501
type: Comment
has text: this means i have to put the Typed Array dot recycle that means `obtainTypedArray.recycle();` ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32257491
type: AnswerComment
comment on: http://stackoverflow.com/a/21387544
type: Comment
has text: You need to focus perticular view.. Please follow the link http://stackoverflow.com/questions/6831671/is-there-a-way-to-programmatically-scroll-a-scroll-view-to-a-specific-edit-text
score: 0

http://stackoverflow.com/comment/32371521
has text: @chalo1970 Is it a code of an *Java* applet?
comment on: http://stackoverflow.com/q/21436446
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21508311
has body: You need to add the camel-jpa component JAR to the classpath of the ActiveMQ broker. And as well what additional JARs you may need for JPA such as the JPA implementation and JDBC drivers and whatnot.
upvote count: 3
answers question: http://stackoverflow.com/q/21504764
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21504764

embeddable
type: Tag
tag name: embeddable
tags question: http://stackoverflow.com/q/21384768

http://stackoverflow.com/q/21471061
has comment: http://stackoverflow.com/comment/32405664
has comment: http://stackoverflow.com/comment/32405679
has body: I want to build a java program that will take a python file and drop it into a .exe, thus starting that .exe and running the python file in it. I have converted the whole python library into a .exe and I have build a boot system on it that just needs the python file to be dropped onto it. I have made this file so I can run python on PCs that don't have python installed. I would go with the .BAT method but so 32 bit systems have a hard time with batch drag and drop. So I am asking for some code that would allow me to take a file and run it through another file. I hope this is the information you needed, if you need any more i will answer it!
has title: drag and drop files into a exe java
favorite count: 0
has comment: http://stackoverflow.com/comment/32405737
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32405712
type: Question
upvote count: 1

http://stackoverflow.com/q/21499862
answer count: 1
has comment: http://stackoverflow.com/comment/32457688
favorite count: 0
has answer: http://stackoverflow.com/a/21501298
has comment: http://stackoverflow.com/comment/32456125
has body: This app keeps on crashing inside the emulator (for which I have allocated 700 MB for RAM, and is a Nexus 4), and when I try loading it onto my Nexus 10, and Galaxy S3. I think it is because of several errors in Java on how to switch Android activities, for which I'm warnings from, but not errors. This is the code: package com.example.ldsm2; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; public class Instructions extends Activity { /** Called when the user clicks the Send button */ public void Ldsm (View view) { Object Intent = startActivity(Ldsm.class); } private com.example.ldsm2.intent startActivity( Class&lt;Ldsm&gt; class1) { // TODO Auto-generated method stub return null; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_instructions); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.instructions, menu); return true; } } Because the other activities just have a different activity to switch to, I simply copied the code to the other activities' Java source code files, but changed the activities to switch to (the students will click on a button and it will send them to another problem to solve). However, this seems like this is not the only problem in the app. The app is supposed to display images, but there is another warning that comes up for that function as well. This is the XML code, once again copied to the other activities files because they just need to display another image. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRigh…
tagged with: android
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: android-emulator
type: Question
has title: Android app keeps crashing in emulator and Nexus 10
upvote count: 2
accepted answer: http://stackoverflow.com/a/21501298

http://stackoverflow.com/a/21457648
downvote count: 0
answers question: http://stackoverflow.com/q/21457105
upvote count: 3
has body: The problem is after navigating back the elements found previously will be expired. Hence we need to update the code to refind the elements after navigate back. Update the code below : WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.get("http://www.adspapa.com/"); WebElement catBox = driver.findElement(By.xpath("html/body/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table")); List&lt;WebElement&gt; catValues = catBox.findElements(By.tagName("a")); for(int i=0;i&lt;catValues.size();i++) { catValues.get(i).click(); System.out.println(driver.getTitle()); driver.navigate().back(); catBox = driver.findElement(By.xpath("html/body/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table")); catValues = catBox.findElements(By.tagName("a")); } driver.quit(); I have tested above code at my end and its working fine.You can improve the above code as per your use.
type: Answer
score: 3

http://stackoverflow.com/comment/32435488
has text: The instance of *what*, exactly? You'll get an instance of it when you create one... it doesn't get created automatically for you. Maybe if you showed the code you'd already got, we'd be able to pinpoint it...
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21488509

http://stackoverflow.com/comment/32386750
type: Comment
comment on: http://stackoverflow.com/a/21461044
score: 0
type: AnswerComment
has text: This has complexity N*M, not N+M

properties
tags question: http://stackoverflow.com/q/21434380
type: Tag
tag name: properties
tags question: http://stackoverflow.com/q/21412457
tags question: http://stackoverflow.com/q/21413938
tags question: http://stackoverflow.com/q/21386630
tags question: http://stackoverflow.com/q/21352462
tags question: http://stackoverflow.com/q/21386783

http://stackoverflow.com/comment/32447476
type: QuestionComment
comment on: http://stackoverflow.com/q/21493560
type: Comment
has text: Is there any reference telling that transaction will roll back when exception other than MyException occurs?
score: 0

http://stackoverflow.com/q/21471423
possible better answer: http://stackoverflow.com/a/21481876
has answer: http://stackoverflow.com/a/21481876
has comment: http://stackoverflow.com/comment/32408115
has title: Extract contents from Scene
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/32463932
accepted answer: http://stackoverflow.com/a/21504539
has comment: http://stackoverflow.com/comment/32406468
has comment: http://stackoverflow.com/comment/32479084
has comment: http://stackoverflow.com/comment/32489745
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/32421092
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21504539
has comment: http://stackoverflow.com/comment/32463963
has body: I am trying to extract the contents from a scene and put in a pane. The problem is that nothing appears in the pane if I get the root component from the scene and add it to the pane. Note: the scene is not added to a stage or to any other component. The following is my (messy, for now) code: public class JanelaPrincipalController extends Controller implements Initializable { @FXML private ResourceBundle resources; @FXML private URL location; @FXML private StackPane conteudo; @FXML private MenuItem miBolsas; @FXML private MenuItem miCorretoras; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { miBolsas.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent t) { System.out.println("Action performed"); conteudo.getChildren().clear(); SceneData sceneData = MainClass.getInstance().getScene(SceneType.LISTA_BOLSAS); Parent root = sceneData.scene().getRoot(); conteudo.getChildren().add(root); //conteudo.getChildren().add(new Label("Teste")); } }); } @Override public void open() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void process(Action action) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void close() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
score: 0

http://stackoverflow.com/q/21352551
has answer: http://stackoverflow.com/a/21352569
possible better answer: http://stackoverflow.com/a/21352591
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/32193945
has comment: http://stackoverflow.com/comment/32193977
accepted answer: http://stackoverflow.com/a/21352569
type: AnsweredQuestion
has body: How can I write a formula for this expression: boolean showAd = (position == 3 || position == 11 || position == 19 || position == 27 || position == 35 || position == 43|| position == 51); if (showAd) {..... I tried position % 8 ==0 but this doesnt produce the same sequence as above
type: Question
has title: How can I target every n-th element in a list but only after 3
score: 0
has comment: http://stackoverflow.com/comment/32193995
answer count: 2
has answer: http://stackoverflow.com/a/21352591

http://stackoverflow.com/a/21431730
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: It looks like that your JMeter isn't capable for establishing connection. If you can access this site with a browser you're behind a proxy. There are 2 options on how to record scripts from behind a proxy: Run JMeter specifying proxy host, port, username and password as follows: jmeter -H (IP address or hostname of your proxy server) -P (port of your proxy server) -u (username, if required) -a (password, if required) Example: jmeter -H 10.10.10.1 -P 3128 Use JMeter Extension for Google Chrome. In this case you won't need to care about proxies, certificates, headers, etc. and will be able to record tests to .jmx files right from browser.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21397715
answers question: http://stackoverflow.com/q/21397715

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/21361042
type: Tag
tags question: http://stackoverflow.com/q/21481277
tags question: http://stackoverflow.com/q/21400479

http://stackoverflow.com/a/21379168
has body: When you are using replace function it identifies the escape symbols differently and add another \\ and call the replaceAll method with correct way. if you do s.replace("'", "\\'") it will automatically call s.replaceAll("\\'", "\\\\'") But if you call replaceAll function directly It doesn`t have any clue to identify special charactors like ' \ by its own. If you go into replace function you will see that additional \ will be added to this escape characters by quoteReplacement method in replaceall function . so if you want to use replace all function use it withy extra escape charactors like s.replaceAll("\\'", "\\\\'") cheers
answers question: http://stackoverflow.com/q/21378609
score: 0
type: Answer

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/21419098
tags question: http://stackoverflow.com/q/21396452
tags question: http://stackoverflow.com/q/21478074
tag name: osx-mavericks

http://stackoverflow.com/q/21474640
answer count: 1
has answer: http://stackoverflow.com/a/21474816
favorite count: 0
type: UnansweredQuestion
tagged with: hudson
tagged with: jenkins
downvote count: 0
has title: How to install jenkins plugin by java program
type: Question
score: 1
tagged with: java
tagged with: jenkins-plugins
linked to: http://stackoverflow.com/q/4205980
upvote count: 1
has body: I want to install jenkins plugin programmatically using java. can any one help me on this?

http://stackoverflow.com/comment/32388538
has text: You want to roll your own dependency injection framework instead of using a tried and tested existing one?
comment on: http://stackoverflow.com/q/21461773
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21492326
answer count: 1
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/38903703
type: UnansweredQuestion
tagged with: jersey-client
tagged with: java
type: Question
has title: Jersey Client: adding Cookies does not change Builder
tagged with: jersey-2.0
has body: My first implementation using the Jersey client code with cookies does not successfully maintain session to next call. What is suspicious to me is that the method Builder javax.ws.rs.client.Invocation.Builder.cookie(String s, String s1) does not return a different instance of the builder. Shouldn't it? Either way, my login request is denied with message "Your session expired due to inactivity.", which seems to imply to me that the request isn't arriving with the same session id as previous. See anything wrong with this code? The culprit in question is method #applyCookies(Builder) which does not return anything different after the cookies have been set. import java.io.Serializable; import java.util.HashMap; import java.util.Map; import javax.ws.rs.HttpMethod; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Cookie; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.NewCookie; import javax.ws.rs.core.Response; import org.apache.log4j.Logger; import org.glassfish.jersey.client.filter.HttpBasicAuthFilter; /** * A JAX-RS connector that uses * Jersey as the API to create a client that * will connect to a remote REST service. */ public class JerseyConnector extends WebServiceConnector { /** Debug logger. */ protected static final Logger logger = Logger.getLogger(JerseyConnector.class); /** * Simple test execution method. * * @param args * @throws MessageException */ public static void main(String[] args) throws MessageException { JerseyConnector conn = new JerseyConnector(); conn.setProviderURL("http://somehost.somewhere.com:7203/rest"); conn.open(); String sessConf = (String)conn.send("initiateSession"); HashMap<String,String> content = new HashMap<String,String>(3); content.put("sessionConfirmation", sessConf); content.put("password", "password"); content.put("login", "joe"); String body = JSONMapF…
has answer: http://stackoverflow.com/a/21537344
score: 0

http://stackoverflow.com/comment/32266634
score: 2
comment on: http://stackoverflow.com/q/21392550
has text: When I do it, I do it for readability, not performance.
type: Comment
type: QuestionComment

collections
tags question: http://stackoverflow.com/q/21350098
tags question: http://stackoverflow.com/q/21365422
tags question: http://stackoverflow.com/q/21508058
tags question: http://stackoverflow.com/q/21394041
tags question: http://stackoverflow.com/q/21414009
tags question: http://stackoverflow.com/q/21470534
tags question: http://stackoverflow.com/q/21501808
tags question: http://stackoverflow.com/q/21464067
tags question: http://stackoverflow.com/q/21368559
tags question: http://stackoverflow.com/q/21387457
tags question: http://stackoverflow.com/q/21452388
tags question: http://stackoverflow.com/q/21474608
tags question: http://stackoverflow.com/q/21453978
tags question: http://stackoverflow.com/q/21354494
tags question: http://stackoverflow.com/q/21451658
type: Tag
tags question: http://stackoverflow.com/q/21374028
tags question: http://stackoverflow.com/q/21497751
tags question: http://stackoverflow.com/q/21512596
tags question: http://stackoverflow.com/q/21478622
tags question: http://stackoverflow.com/q/21482363
tags question: http://stackoverflow.com/q/21493497
tags question: http://stackoverflow.com/q/21465574
tag name: collections
tags question: http://stackoverflow.com/q/21481490
tags question: http://stackoverflow.com/q/21415017
tags question: http://stackoverflow.com/q/21457469
tags question: http://stackoverflow.com/q/21433497
tags question: http://stackoverflow.com/q/21450191
tags question: http://stackoverflow.com/q/21498112
tags question: http://stackoverflow.com/q/21508295

http://stackoverflow.com/comment/133248065
comment on: http://stackoverflow.com/a/32797064
type: AnswerComment
has text: This appears to fix the problem for me, but I don't understand why it fixes it, can you explain?
score: 0
type: Comment

http://stackoverflow.com/comment/32518295
has text: Wildfly master is using [Infinispan 6.0.1](https://github.com/wildfly/wildfly/blob/master/pom.xml#L161). You could just build that ;)
comment on: http://stackoverflow.com/q/21490744
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21377571
has comment: http://stackoverflow.com/comment/32239145
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has body: Trying to build a gcm app that will receive push notification from server.but when I execute the code on emulator or real device this is what I get on LogCat I/===GCMIntentService===(6977): Device registered: regId = reg number here V/GCMBaseIntentService(6977): Releasing wakelock V/GCMBroadcastReceiver(6977): onReceive: com.google.android.c2dm.intent.REGISTRATION V/GCMBroadcastReceiver(6977): GCM IntentService class: com.my.app.GCMIntentService V/GCMBaseIntentService(6977): Acquiring wakelock V/GCMBaseIntentService(6977): Intent service name: GCMIntentService-303034343665-2 D/GCMBaseIntentService(6977): handleRegistration: registrationId = null, error = null, unregistered = com.my.app D/GCMRegistrar(6977): resetting backoff for com.my.app V/GCMRegistrar(6977): Saving regId on app version 2 D/dalvikvm(6977): GC_FOR_ALLOC freed 247K, 12% free 3168K/3580K, paused 29ms, total 34ms I/===GCMIntentService===(6977): unregistered = reg number here V/GCMBaseIntentService(6977): Releasing wakelock Anyone can help me with this please! &lt;!-- GCM connects to Google Services. --&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/&gt; &lt;!-- GCM requires a Google account. --&gt; &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt; &lt;permission android:name="com.my.app.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="com.my.app.permission.C2D_MESSAGE" /&gt; &lt;receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND"&gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt…
has comment: http://stackoverflow.com/comment/32243746
answer count: 0
has comment: http://stackoverflow.com/comment/32239797
type: Question
tagged with: android
tagged with: google-cloud-messaging
has comment: http://stackoverflow.com/comment/32244837
has comment: http://stackoverflow.com/comment/32244324
has comment: http://stackoverflow.com/comment/32239460
has comment: http://stackoverflow.com/comment/32239693
has comment: http://stackoverflow.com/comment/32239241
linked to: http://stackoverflow.com/q/12051253
has comment: http://stackoverflow.com/comment/32239326
score: 0
has title: Gcm devices registration ERROR
has comment: http://stackoverflow.com/comment/32239196

http://stackoverflow.com/a/21390160
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21390079
has comment: http://stackoverflow.com/comment/32262637
type: Answer
has comment: http://stackoverflow.com/comment/32262945
upvote count: 4
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/21390079
has body: The zustand variable is changed every time the getZustand function is called. zustand = (zustand == false); This line of code is the same as zustand = !zustand. And notice that zustand is a class member field, so its value is kept across function calls.

http://stackoverflow.com/a/21589005
type: AcceptedAnswer
has body: I didn't find a lot of information about this, but at least here are some configuration parameters: http://jigsaw.w3.org/css-validator/manual.html
type: Answer
answers question: http://stackoverflow.com/q/21424860
accepted answer of: http://stackoverflow.com/q/21424860
score: 0

http://stackoverflow.com/q/21393747
answer count: 2
downvote count: 0
tagged with: mybatis
has answer: http://stackoverflow.com/a/22130965
has body: I'm new to IBatis/Mybatis and ORM and Java in general. I have a java mapper interface and the respective mapper xml. The domain object type that the query method should return is called SourceStatus. This object contains several attributes and getters/setters etc. I really only want to populate the date field of the SourceStatus domain object. Am I wiring my mybatis mapper file properly? Java Mapper file containing method definition: public interface SupportSourceStatusMapper extends TPBMapper { SourceStatus getSupportStatus(); } MyBatis XML mapper file: &lt;mapper namespace="com.dealersInc.dao.mapper.SupportSourceStatusMapper"&gt; &lt;select id="getSupportStatus" resultType="Date"&gt; SELECT MAX(s_valid_frm_dat) FROM deals.supports_contracts &lt;/select&gt; &lt;/mapper&gt; The SourceStatus domain object: public class SourceStatus { private long contextKey; private String serviceName; private String contextName; private String contextRunType; private String contextLabel; private String contextStatus; private Date cobDate; getters/setters ().... } Thank you in advance for any help you can provide.
has answer: http://stackoverflow.com/a/21403417
score: 1
favorite count: 0
tagged with: ibatis
has title: Need to return SINGLE column Date value in mybatis query
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: java
type: Question

http://stackoverflow.com/comment/32418403
type: QuestionComment
type: Comment
has text: @Pshemo i am using JEP library for parsing and evaluating expressions it does not have factorial method.. and so i created it but the problem is my method factorial(int) in it so i want those values which are with "!" in my string
score: 0
comment on: http://stackoverflow.com/q/21478873

http://stackoverflow.com/comment/32267330
type: QuestionComment
has text: thanks. My problem at the moment is how to configure a plugin though I'm using annotation based configuration without mybatis-config.xml http://stackoverflow.com/questions/21392919/how-to-configure-a-mybatis-plugin-in-annotation-based-configuration
score: 0
comment on: http://stackoverflow.com/q/21379568
type: Comment

http://stackoverflow.com/comment/32285744
has text: Isn't this a homework question?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21403782

http://stackoverflow.com/comment/32345753
has text: Also `fi.close()` and `out.close()`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21437896

http://stackoverflow.com/comment/84908148
comment on: http://stackoverflow.com/a/21434465
type: Comment
has text: i verfiy this , compersion is only apply on port 8080 , even if you open more connectors .. , i think bug should be open on this to spring boot ??.. , so only work solution for me was programmatic config for each connector , not application.properties
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32308894
has text: It sounds like you don't quite understand the basic workings of Android or Java yet. It's good to jump in feet first and learn by doing, but your time might be better spent with a little more research first.
type: QuestionComment
comment on: http://stackoverflow.com/q/21416617
type: Comment
score: 1

http://stackoverflow.com/comment/32422751
type: Comment
type: QuestionComment
has text: I'm using an SQL database, and I could resolve my problem importing the model from the dataset loaded from database. Thank you.
comment on: http://stackoverflow.com/q/21428418
score: 0

http://stackoverflow.com/q/21433510
has answer: http://stackoverflow.com/a/54768113
has answer: http://stackoverflow.com/a/21433576
has comment: http://stackoverflow.com/comment/32341339
has comment: http://stackoverflow.com/comment/32342753
has title: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
has comment: http://stackoverflow.com/comment/32339979
has answer: http://stackoverflow.com/a/21436541
favorite count: 0
has comment: http://stackoverflow.com/comment/32342683
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32341667
tagged with: android
has comment: http://stackoverflow.com/comment/32343173
answer count: 4
tagged with: android-fragments
tagged with: java
has body: I am trying to inflate a layout into a fragment and i have #8: Error inflating class fragment my View does not even creating it fall on the inflate how to inflate correctly the layout ? my XML large: <?xml version="1.0" encoding="utf-8"?> <fragment android:id="@+id/first_page" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" class = "com.project.places.First_Page" /> <fragment android:id="@+id/map" android:layout_weight="2" android:layout_width="0dp" android:layout_height="match_parent" android:name="com.project.places.Map_fragment" /> my container : </FrameLayout> my fragment layout: android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="10sp" > <ImageButton android:id="@+id/search_By_Location" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/location" /> <TextView android:id="@+id/search_By_Location_TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="Search By Your Current Location" android:textAppearance="?android:attr/textAppearanceLarge" /> <ImageButton android:id="@+id/search_By_City" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/city_icon" /> <TextView android:id="@+id/search_By_City_TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="Search By City" android:textAppearance="?android:attr/textAppearanceLarge" /> <ImageButton android:id="@+id/favorits" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/location_star" /> <TextView android:id="@+id/favorits_TextView" android:layout_width="wrap_content" android:layout_he…
downvote count: 1
has comment: http://stackoverflow.com/comment/32343003
type: Question
has comment: http://stackoverflow.com/comment/32342694
has comment: http://stackoverflow.com/comment/32338709
tagged with: android-layout
has comment: http://stackoverflow.com/comment/32340766
upvote count: 5
has comment: http://stackoverflow.com/comment/104966863
linked to: http://stackoverflow.com/q/3988788
score: 4
has answer: http://stackoverflow.com/a/39361424

http://stackoverflow.com/q/21355853
has body: Let the following be a class in my problem: class MyClass { String name() { return toString(); } } I want to create an instance of MethodType which describes a method with a return that is "any" object. I am trying the following: MethodType genericTypeWithObjectReturn = MethodType.methodType(Object.class, new Class[] {}); then try to find a method using MethodHandle mh = lookup.findVirtual(MyClass.class, "name", genericTypeWithObjectReturn); Using the above line, I get an exception: Caused by: java.lang.NoSuchMethodError: MyClass.name()Ljava/lang/Object; My observation is that the method return type should be exactly the same type; namely I should have used String.class in the above statement to define MethodType. Is this correct? Is there a way so that I can do this in the way I described and preferrably not using reflection API?
has answer: http://stackoverflow.com/a/31492569
answer count: 3
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/50948413
has comment: http://stackoverflow.com/comment/32214451
upvote count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/22323064
tagged with: java-8
type: Question
has comment: http://stackoverflow.com/comment/32200132
has comment: http://stackoverflow.com/comment/32200611
has comment: http://stackoverflow.com/comment/32200956
has comment: http://stackoverflow.com/comment/32199911
tagged with: java
has answer: http://stackoverflow.com/a/24473558
score: 4
tagged with: methodhandle
has title: Express a general `MethodType` with return type as any object

http://stackoverflow.com/comment/32361810
score: 4
type: Comment
type: QuestionComment
has text: It wouldn't work since that's wholly invalid syntax. I would encourage you to look at the [Java Trails](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html) for this.
comment on: http://stackoverflow.com/q/21446481

http://stackoverflow.com/comment/38120447
type: AnswerComment
has text: Thanks @AlexR. Can you please provide an example for case 1? I keep getting "Method doesn't override method from it superclass" error
type: Comment
comment on: http://stackoverflow.com/a/21365161
score: 0

http://stackoverflow.com/comment/32387710
type: Comment
score: 0
type: AnswerComment
has text: Thank you for your help The first option is the solution
comment on: http://stackoverflow.com/a/21459278

http://stackoverflow.com/q/21490577
type: AnsweredQuestion
tagged with: 2d
tagged with: opengl
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32456650
upvote count: 1
has body: I am currently trying to create a simple lighting engine for my game developed in JAVA. I am using a framebuffer object to draw images of the light sources onto an ambient color and combine it with the previously rendered scene to get a simple lighting. Everything works nicely except that the framerate gets cut in half, from a steady 60 FPS to a fluctuating 30 FPS. Here is my current approach: (This is done in my main display loop) int[] params1 = new int[1]; gl2.glGenTextures(1, params1, 0); int textureID = params1[0]; gl2.glBindTexture(GL.GL_TEXTURE_2D, textureID); gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl2.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA8, Game.RES_WIDTH, Game.RES_HEIGHT, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, null); int[] params2 = new int[1]; gl2.glGenFramebuffers(1, params2, 0); int frameBufferID = params2[0]; gl2.glBindFramebuffer(GL2.GL_DRAW_FRAMEBUFFER, frameBufferID); gl2.glClear(0); gl2.glFramebufferTexture2D(GL2.GL_DRAW_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_TEXTURE_2D, textureID, 0); DrawUtils.fillRect(0, 0, Game.WIDTH, Game.HEIGHT, getAmbientLight()); gl2.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_DST_ALPHA); //Code for drawing the light sources here... gl2.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); gl2.glBlendFunc(GL2.GL_DST_COLOR, GL2.GL_ONE_MINUS_SRC_ALPHA); gl2.glEnable(GL2.GL_TEXTURE_2D); gl2.glPushMatrix(); gl2.glColor3f(1.0F, 1.0F, 1.0F); gl2.glBindTexture(GL2.GL_TEXTURE_2D, textureID); gl2.glBegin(GL2.GL_QUADS); gl2.glNormal3i(0, 0, 1); gl2.glTexCoord2i(0, 0); gl2.glVertex2i(0, 0); gl2.glTexCoord2i(1, 0); gl2.glVertex2i(0 + Game.WIDTH, 0); gl2.glTexCoord2i(1, 1); gl2.glVertex2i(Game.WIDTH, Game.HEIGHT); gl2.glTexCoord2i(0, 1); gl2.glVertex2i(0, Game.HEIGHT); gl2.glEnd(); gl2.glPopMatrix(); gl2.glDisable(GL2.GL_TEXTURE_2D); gl2.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA); gl2.glDeleteTextures(1, params1, 0…
has comment: http://stackoverflow.com/comment/32455876
type: Question
tagged with: framebuffer
downvote count: 0
accepted answer: http://stackoverflow.com/a/21503810
has comment: http://stackoverflow.com/comment/32462700
has comment: http://stackoverflow.com/comment/32449807
has comment: http://stackoverflow.com/comment/32462806
answer count: 1
has comment: http://stackoverflow.com/comment/32463111
favorite count: 0
tagged with: jogl
has title: OpenGl framebuffer performance problems
has comment: http://stackoverflow.com/comment/32456508
has comment: http://stackoverflow.com/comment/32445705
has answer: http://stackoverflow.com/a/21503810

http://stackoverflow.com/a/21488504
type: Answer
accepted answer of: http://stackoverflow.com/q/21488419
answers question: http://stackoverflow.com/q/21488419
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: You can use Apache POI to do this: http://poi.apache.org Use the HSSFWorkbook as an abstraction of a .xls workbook. There's also a XSSF format for the newer XML-based Excel files (.xlsx, etc).

http://stackoverflow.com/comment/32367245
has text: Java changes. I wrote a couple of new methods and variables.
type: Comment
comment on: http://stackoverflow.com/a/21449429
type: AnswerComment
score: 0

http://stackoverflow.com/a/21390376
type: Answer
accepted answer of: http://stackoverflow.com/q/21390187
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/32267064
answers question: http://stackoverflow.com/q/21390187
has body: I would suggest an interface that each object implements: interface Bagable { public String getType(); } Then each object can be done in this fashion: class Creature implements Bagable { public String getType() { return "Creature"; } // Normal Creature Class methods... } class Building implements Bagable { public String getType() { return "Buidling"; } // Normal Building Class methods... } class Magic implements Bagable { public String getType() { return "Magic"; } // Normal Magic Class methods... } public static void main(String args[]) { ArrayList&lt;Bagable&gt; bag = new ArrayList&lt;Bagable&gt;(); bag.add(new Creature()); bag.add(new Building()); bag.add(new Magic()); for (int i = 0; i &lt; bag.size(); i++ ) { System.out.println(bag.get(i).getType()); } } Or you could have the types as built in values int ITEM_TYPE_MAGIC = 0; int ITEM_TYPE_CREATURE = 1; int ITEM_TYPE_BUILDING = 2; and check them against these built in values
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21352807
upvote count: 3
tagged with: java
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21353130
favorite count: 0
type: Question
tagged with: android-listview
score: 3
tagged with: android
has title: How to not load all ListView items again?
has body: I am using Parse.com framework and i've recently added a load-more (onScroll) ListView to my code. But I found out that whenever the load-more process starts, even the previous items load again. When I add query.setSkip(someCustomSkip);, after the load-more process it just drops items without the number of (someCustomSkip) number. Do you have any idea, how can I use query.setSkip(); method and also conserve the provious ones? 1) ListView's first position, before scrolling to 5th position query.setLimit(mListView.getCount + 5) 2) ListView after scrolling to limit-position. It throws me to this position and sets skip - hides first 5 items And also part of my code, which is important for this question: public class Fragment1 extends Fragment { static ListView mListView; static AnimalAdapter mAdapter; static ProgressBar mProgressBar; static EditText mEditText; static LayoutInflater inflater; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.animalsfrag, container, false); mListView = (ListView)rootView.findViewById(R.id.animal_list); View header = getActivity().getLayoutInflater().inflate(R.layout.header, null); header.setPadding(2, 8, 4, 2); mListView.setVisibility(View.INVISIBLE); mListView.requestFocus(); mListView.addHeaderView(header); View footie = getActivity().getLayoutInflater().inflate(R.layout.footer, null); mListView.addFooterView(footie); footie.setVisibility(View.INVISIBLE); mProgressBar = (ProgressBar) rootView.findViewById (R.id.loading_animals); mProgressBar.setVisibility(View.VISIBLE); RemoteDataTask task = new RemoteDataTask(); task.execute(); return rootView; } public void updateData() { //method, which updates my data mListView = (ListView)getView().findViewById(R.id.animal_list); final ParseQuery&lt;Animal&gt; query = ParseQuery.getQuery(Animal.class); query.setCachePolicy(CachePolicy.NETWORK_ONLY); query.orderByAscending("animal"); query.set…
tagged with: parse-platform
accepted answer: http://stackoverflow.com/a/21353130
answer count: 2
possible better answer: http://stackoverflow.com/a/25253494
has answer: http://stackoverflow.com/a/25253494
tagged with: onscrolllistener

http://stackoverflow.com/q/21477607
has body: Today I'm playing with a method, which crop and resize an image with resolution of 3264x2448. The JVM's heap space length is only 64mb. I always get the "memory leak" when I load this image using the method: BufferedImage bImage = ImageIO.read( stream ); There are other way to resize it without go in memory leak, or the only problem is the little size of heap space? This image's size is 3mb, why it take 50mb in heap space? Thanks in advance, sorry if my question is stupid but it's strange for me Byee
has answer: http://stackoverflow.com/a/21477699
tagged with: java
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/15847231
possible better answer: http://stackoverflow.com/a/21477699
has title: java image manipulation with limited heap space
has answer: http://stackoverflow.com/a/21477828
accepted answer: http://stackoverflow.com/a/21477828
linked to: http://stackoverflow.com/q/9125593
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21477885
tagged with: tomcat
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/8091428
linked to: http://stackoverflow.com/q/5374455
tagged with: memory-leaks

http://stackoverflow.com/comment/32441145
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21488724
has text: use auto-config=false on http. And empty <sec:form-login />. Also, how are you passing the userid and password? Is it something like a post method?(curl?)
score: 0

http://stackoverflow.com/comment/32426723
type: QuestionComment
comment on: http://stackoverflow.com/q/21482969
has text: I did use that and solved the problem.Thanks.But still want to know what's the problem in this code snippet as others say this is working fine.
score: 0
type: Comment

http://stackoverflow.com/comment/32389708
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21462330
has text: exact, i dont wont an open arraylist, it should be an array with size 10
score: 0

http://stackoverflow.com/q/21498874
has title: Change the least significant bit (LSB) in java
has comment: http://stackoverflow.com/comment/32454166
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/21498893
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32454174
accepted answer: http://stackoverflow.com/a/21498893
has comment: http://stackoverflow.com/comment/32454385
has answer: http://stackoverflow.com/a/21498930
answer count: 2
has body: I am trying to change the LSB of a numerical value, say 50 which LSB is 0 because 50 % 2 is 0 (remainder operator) to a value of 1. Thus change the LSB from 0 to 1 in this case. The code is below: //Get the LSB from 50 using the modulas operator lsb = 50 % 2; //if the character equals 1 //and the least significant bit is 0, add 1 if(binaryValue == '1' &amp;&amp; lsb ==0) { //This clearly does not work. //How do I assign the altered LSB (1) to the value of 50? 50 = lsb + 1; } I am having problems inside the if statement, where I am tying to assign the altered LSB, which in this case is 1 to the value of 50. This is not the full code, thus all values are different. Thanks
score: 1
possible better answer: http://stackoverflow.com/a/21498930
has comment: http://stackoverflow.com/comment/32454136
favorite count: 0
has comment: http://stackoverflow.com/comment/32455407

http://stackoverflow.com/comment/32214921
has text: Attempting to add a user with a duplicate username will throw an exception. You can catch this and provide appropriate feedback. As for searching on the DB, use `WHERE`.
comment on: http://stackoverflow.com/q/21364204
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32229153
type: Comment
comment on: http://stackoverflow.com/q/21351046
has text: Yeah I want to show category name and when a node is selected i want category object to be selected. But the reference of object is being displayed and when i select node it only selects the text that is displayed.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32298847
comment on: http://stackoverflow.com/a/21410758
score: 0
type: AnswerComment
has text: And a startActivity() doesn't work ? Is your onItemClick() method called ?
type: Comment

http://stackoverflow.com/q/21368936
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21369350
favorite count: 0
has title: Java interface and class organization convention within packages
tagged with: package
accepted answer: http://stackoverflow.com/a/21369350
has body: I've seen the organization below, but was wondering if there are any established conventions or helpful advice for organizing classes and interfaces? [domain].[name] foo impl (contains classes with abstract and concrete implementations) intf (contains interfaces)
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: conventions
type: Question
upvote count: 4

http://stackoverflow.com/comment/62135534
score: 0
type: Comment
has text: Can I provide 2 different runnables to same worker ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21437170

http://stackoverflow.com/a/21450470
has comment: http://stackoverflow.com/comment/32368995
has comment: http://stackoverflow.com/comment/32369058
answers question: http://stackoverflow.com/q/21450374
score: 1
accepted answer of: http://stackoverflow.com/q/21450374
type: Answer
upvote count: 1
has body: I'm not sure what your problem really is, but I think you might want to use Maven GWT plugin to build your project.
has comment: http://stackoverflow.com/comment/32368751
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21352488
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21352598
has comment: http://stackoverflow.com/comment/32194044
possible better answer: http://stackoverflow.com/a/21352543
has title: java edit textfield in another class
has answer: http://stackoverflow.com/a/21352543
has answer: http://stackoverflow.com/a/21352608
favorite count: 0
has body: I have class A and class B. Class A calls class B here: public void onClick(View v){ //respond to clicks new MyTask().execute(); In this new task, I do some network junk, and end up finding a string that I want to pass back to class A. But I can't seem to do it. I tried to do something like classA.textfield.setText(text), but that didn't work. And it looks like classes can't return values, either. I've seen a few of the thing marked as similar, but I don't think they solve my issue, and if they do, I didn't understand how to implement them. I feel like this must have a super simple way to do it, but the only thing I've seen suggested that sound even remotely similar is making a new version of Class A, but that sounds horribly wrong...
has answer: http://stackoverflow.com/a/21352633
tagged with: android
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/21352633

http://stackoverflow.com/a/21407860
answers question: http://stackoverflow.com/q/21407751
has body: Do not use lower level XML techniques (either SAX or DOM) unless you really need them. I believe that this is not the case. Use JAXB. Create class that represents your events. Every time you get event create instance of this class and populate fields. Every time you have to create XML just marshal the instance(s) to any stream you want (file, socket, whatever).
type: Answer
has comment: http://stackoverflow.com/comment/32293413
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32293817
upvote count: 1

http://stackoverflow.com/comment/32423329
score: 3
comment on: http://stackoverflow.com/q/21481910
has text: `public static void main(String[] args) { }` is how your method begins...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21390990
has body: You need to somehow associate the session of the client with the random number. You can access the jsessionid generated by web application containers. Map it with your random number.
score: 0
answers question: http://stackoverflow.com/q/21390809
type: Answer
has comment: http://stackoverflow.com/comment/32555367
has comment: http://stackoverflow.com/comment/32284817
has comment: http://stackoverflow.com/comment/32272405

http://stackoverflow.com/comment/32336603
has text: Im using latest jocl libraries but they may be old. Setting up a custom JNI-based(using latest Khronos cl 1.2 C++ bindings) can get more time than making this raytracer an iterative version :D Im sure next version of jocl will be better but I dont know when. CPU compiler works ok for now. But at least 3x to 20x slower with different depth settings.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21430496

http://stackoverflow.com/comment/32428027
comment on: http://stackoverflow.com/a/21483560
type: AnswerComment
score: 0
type: Comment
has text: Incidentally, the [SkipList](http://en.wikipedia.org/wiki/Skip_list) (the backing data structure for the ConcurrentSkipListMap) is my favorite data structure when you sit down and think about how it works and what that implies.

http://stackoverflow.com/comment/32253299
type: AnswerComment
has text: This is regex, the pattern `[0-9]+` means any digit from 0-9 repeated one or more times. So here I'm looking for any number value (0 to infinity) followed by zero or more times (hence the `*` character) the pattern `\.[0-9]+` which is `.number` with number from 0 to infinity.
type: Comment
comment on: http://stackoverflow.com/a/21384599
score: 0

http://stackoverflow.com/q/21372458
accepted answer: http://stackoverflow.com/a/21388131
has answer: http://stackoverflow.com/a/21372700
has answer: http://stackoverflow.com/a/21373296
has answer: http://stackoverflow.com/a/21372746
has title: How to switch views via buttons in Android
answer count: 6
has answer: http://stackoverflow.com/a/21372945
has body: I am a novice to android programming and I am trying to create a simple button that switches the view from activity_main_menu.xml to info_menu.xml on the click of a button. Here is the source and XML, respectively. MainMenu.java package us.wi.k12.cadottschools; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; public class MainMenu extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_menu); final Button infoButton = (Button) findViewById(R.id.InfoButton); infoButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setContentView(R.layout.info_menu); }; }); } @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, menu); return true; } } avtivity_main_menu.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="16dp" android:paddingRight="16dp" android:orientation="vertical" android:gravity="center" &gt; &lt;Button android:id="@+id/CalendarButton" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/calendar_button" /&gt; &lt;Button android:id="@+id/InfoButton" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/info_button" /&gt; &lt;Button android:id="@+id/ContactButton" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/contact_button" /&gt; &lt;/LinearLayout&gt; Both run without any errors thrown, but when I click on the button InfoButton, nothing happens.
tagged with: android
has answer: http://stackoverflow.com/a/21388131
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/21372750
score: 0
has answer: http://stackoverflow.com/a/21372750
has comment: http://stackoverflow.com/comment/32230165
has comment: http://stackoverflow.com/comment/32255291
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21442292
has body: You might have to edit the permissions in your JVM. Edit the file java.policy in the lib/security/ directory of the JVM of Lotus Domino. For instance C:\Program Files\IBM\Lotus\Notes\jvm\lib\security\java.policy For testing you can grant all permissions like this: grant { permission java.security.AllPermission; }; You have to restart the JVM. Most simple is to restart the server. But perhaps restarting http will do.
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21433927
has comment: http://stackoverflow.com/comment/32361875
type: Answer

http://stackoverflow.com/comment/32436256
has text: It is not that I don't want the kids touching the accessor methods; on the contrary, that's what I want them to use. I don't want them playing with the variable **directly** (as in propertyMap = null or some other such nonsense). Improper manipulation of that var can lead to alot of problems in alot of places (again, not my design).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21488828

http://stackoverflow.com/comment/32259034
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21388576
has text: I don't know how to use map + we are not supposed to use it.
score: 0

http://stackoverflow.com/q/21475799
has title: run jprogress bar on jframe load
accepted answer: http://stackoverflow.com/a/21478401
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32420791
tagged with: java
tagged with: jprogressbar
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32413186
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11399971
has answer: http://stackoverflow.com/a/21478401
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32420681
has body: I am creating swing application. I am using netbeans, I have added jprogress bar on container but I have no idea how to start. I need jprogressbar to show loading. I have created a jframe which contains jprogressbar. on jframe load I want to start jprogressbar and run for say 5 seconds. close that frame and want to open new jframe.

http://stackoverflow.com/a/21516882
upvote count: 1
has comment: http://stackoverflow.com/comment/47198536
answers question: http://stackoverflow.com/q/21507053
has body: A search algorithm needs 2 things: Data (A connected graph) A way to compare data (nodes in the graph) Each node knows about its connected nodes, representing a graph. And nodes are comparable to one another. This satisfies the 2 things a searching algorithm needs. So, in our design, it's pretty natural for nodes to give this information to the searching algorithm. All other node state should be hidden from the searching algorithm to keep with good OO principals (encapsulation.) For these reasons, I suggest refactoring to this simpler design. //Comparable interface satisfies measuring a node's value. //getAdjacentNodes abstract method exposes graph structure. abstract class StateNode implements Comparable&lt;StateNode&gt;{ abstract StateNode[] getAdjacentNodes(); } //StateSearch can perform any search algorithm it needs StateNode. class StateSearch&lt;E extends StateNode&gt; //StateQueue is probably unnecessary. Consider replacing with a PriorityQueue. class StateQueue&lt;E extends StateNode&gt; queue; Whether a StateNode uses internal state at all is the implementing code's decision. In the example below, GameNode does keep game state, but the search algorithm is ignorant of this. All it knows is the minimum it needs to know; what StateNode exposes. If I'd left state out completely, the searching algorithm would be unaffected. public class GameNode extends StateNode{ String state; public GameNode(String state){ this.state = state; } public StateNode[] getAdjacentNodes(){ //return adjacent nodes. } public String getGameState(){ return state; } public int compareTo(StateNode other){ //comparison code } }
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/32308275
has text: Oh, I see! Thank you, that makes much more sense. Clearing it makes it work now, thanks!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21415984

http://stackoverflow.com/comment/32238586
score: 0
has text: Is your testcase working??
type: QuestionComment
comment on: http://stackoverflow.com/q/21377236
type: Comment

http://stackoverflow.com/comment/52052110
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25254794
type: AnswerComment
has text: mDrawer.addView(contentView, 0); giving error... What do I need to change to make it work ?

http://stackoverflow.com/a/21352930
score: 3
upvote count: 3
downvote count: 0
has body: The System.in stream is the key here. You need to read each byte coming in and run it through an explicit cast to a char. char n = (char)System.in.read(); char a = (char)System.in.read(); // And so on. Reading Material so you understand this Using the System.in functionality in Java. Click here. A lesson in Explicit Casts. Click here.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21352751
type: Answer
answers question: http://stackoverflow.com/q/21352751

http://stackoverflow.com/q/21364994
answer count: 2
tagged with: while-loop
has answer: http://stackoverflow.com/a/21365042
favorite count: 0
possible better answer: http://stackoverflow.com/a/21365062
has title: Java while loop won't break
has answer: http://stackoverflow.com/a/21365062
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21365042
has comment: http://stackoverflow.com/comment/32216064
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I'm writing a simple game that uses a loop while(game = true). I set game = false in the code during the loop. When I run the game, it stops at that point but does not terminate. However, if I use break instead at the same spot the program terminates. Why can't I use game = false?
score: 0

base64
tags question: http://stackoverflow.com/q/21378122
tag name: base64
tags question: http://stackoverflow.com/q/21420624
tags question: http://stackoverflow.com/q/21444078
tags question: http://stackoverflow.com/q/21494053
type: Tag

http://stackoverflow.com/a/21495799
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: You need two loops to check values. Other wise it will only compare values of same index. Try this: for (int x=0;x&lt;A.length;x++){ for (int y=0;y&lt;B.length;y++){ if (A[x]==B[y]) score++; } } Use A.length instead if x&lt;6, it will avoid hardcoding.
answers question: http://stackoverflow.com/q/21495773

http://stackoverflow.com/comment/32398088
type: Comment
comment on: http://stackoverflow.com/a/21466442
score: 0
has text: Thanks for your reply! I assumed OpenShift was using 32 bit Java as is shown by the java -version output. Could that be the problem? I can't really see how it should affect it but I'll try using a 32 bit version on my testing machine. I've also attached the code you asked for, it is using Scribe though, so might not be much use
type: AnswerComment

http://stackoverflow.com/comment/32391388
comment on: http://stackoverflow.com/q/21463443
has text: I would escape the dot (and the spaces, but not necessary). `"\\./\\ ADD\\ name="`
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32282844
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21401614
has text: It is a mistake, the code is wrong. I've just spent the last week combing through a massive project and fixing errors just like this because the thing was leaking resources like a sieve.
type: AnswerComment

http://stackoverflow.com/comment/32353988
comment on: http://stackoverflow.com/q/21440583
has text: That actually does sound awesome. I converted one app to Maven and it was kind of a pain to get building correctly because I had to move so much stuff around to match the Maven convention. Thanks for the tip.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32389988
has text: my app quits but i dont know why
comment on: http://stackoverflow.com/a/21460508
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21446918
accepted answer of: http://stackoverflow.com/q/21360396
type: Answer
answers question: http://stackoverflow.com/q/21360396
has body: You solve it somehow does not recognize the table name in uppercase, but if you recognize the attributes of the table in uppercase, so rename the tables in lowercase temporarily after he change in the EJB annotations, at least it works somehow.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21398383
has comment: http://stackoverflow.com/comment/32407671
upvote count: 3
downvote count: 1
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/32292512
has answer: http://stackoverflow.com/a/21931839
tagged with: java
has comment: http://stackoverflow.com/comment/32364317
has body: I am new to jasper report,i have two beans,one is main and another is sub bean,i am passing sub bean list to main bean and fetching the values from main bean which contains list of sub bean and two attributes college and address fields,in that i am getting college and address correctly from main bean but occurring error fetching values from sub-bean list. Error: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : age at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:123) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:96) at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:100) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1356) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1257) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1233) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1577) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:149) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:932) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969) My Code: List&lt;StudentTransactionDTO&gt; studentTransactionDTOList = firstDTO.getStudentTransactionDTOList(); firstDTO.setStudentTransactionDTOList(studentTransactionDTOList); reports.add((Object) firstDTO); //when i print this on console it prints jasperDesign = JRXmlLoader.load(getReportFile()); jasperReport = JasperCompileManager.compileReport(jasperDesign); //It load and compile report successfu…
has title: JasperReport: JRException: Error retrieving field value from bean(Nested Bean Issue)
answer count: 1
tagged with: javabeans
favorite count: 0
accepted answer: http://stackoverflow.com/a/21931839
linked to: http://stackoverflow.com/q/12209300
linked to: http://stackoverflow.com/q/18119754
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32371795

http://stackoverflow.com/comment/32376499
type: Comment
comment on: http://stackoverflow.com/a/21455009
has text: Right, so either place a location step where one is missing, or remove the `/` or `//` where the location step is missing.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32474706
score: 0
has text: While I was about to send you the link, I have noticed that the page has changed. It no longer says it is deprecated.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21494674

http://stackoverflow.com/a/21464887
has comment: http://stackoverflow.com/comment/32393711
has comment: http://stackoverflow.com/comment/32393869
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32394350
has comment: http://stackoverflow.com/comment/32395898
has body: Like most performance questions, the best answer is; worry about simple, clear coding first and it usually will performance well enough. Only worry about performance issues if you have measured that you have a concern otherwise you are just guessing (even if you have ten years experience tuning Java applications) The first example is the simplest and possibly the clearest, though I am not sure why you have a Year class at all given you are happy to pass in an int for a year. The second is faster but more open to errors potentially. If you just want the most efficient, use an int. Best practice might be to use Year as an immutable everywhere e.g. public void setYear(Year year) { this.year = year; } For example JodaTime has a variety of immutable classes to represent different time periods.
accepted answer of: http://stackoverflow.com/q/21464840
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/21464840
score: 6

http://stackoverflow.com/a/24981409
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21431856
has body: At that line a NullPointerException means the MenuItem with the id R.id.action_share cannot be found. This is normal because your IntroductionFragment, in its onCreateOptionsMenu() method, calls: menu.clear() which will remove all items from the menu(including the previously added main R.id.action_share MenuItem) making the findItem() method to return null. The solution would be to remove that line menu.clear()(you should explain why are you using clear()).
answers question: http://stackoverflow.com/q/21431856
has comment: http://stackoverflow.com/comment/38835782
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38835542
type: Answer
has comment: http://stackoverflow.com/comment/38838026
has comment: http://stackoverflow.com/comment/38837646
score: 3
has comment: http://stackoverflow.com/comment/38835671

http://stackoverflow.com/comment/32290897
comment on: http://stackoverflow.com/q/21405713
has text: Since your app is running on Tomcat, it's not possible to save this data using ServletContextListener.contextDestroyed()?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32425579
comment on: http://stackoverflow.com/a/21482712
score: 0
type: Comment
type: AnswerComment
has text: I don't understand. The output is at the bottom of my answer. Just paste the into a new document and compile it. It should work for you. Then, on your own computer, feel free to tweak as you like! :)

http://stackoverflow.com/q/21378534
downvote count: 0
has body: I need to extract data in key and value format.. I have stuck how to split this html into key and value using Jsoup.please guide me Flamingnet Student Book Reviewer LGen080812 Aine (pronounced Ah-nee) has always thought of herself as a normal teenager in Depression-Era Alabama. With her blind brother Spenser, she lives in her grandmother's farmhouse, playing in the woods, reading books, and going to school--but never going outside the farmhouse other than school. But on the one day that their grandmother lets them go to town, Aine and Spenser return only to find that the person they call grandmother isn't actually their grandmother at all, and that she's been murdered. Not to mention that they've actually been living in a book all along. Soon Aine and Spenser are on the run from their grandma's killer, Biblos, with the legendary Gilgamesh. The two siblings hop from novel to novel as they embark on a quest to find three objects to save their world. There were a number of things that hindered me from enjoying The Toadhouse Trilogy: Book One. First of all, the narrative was told in the present tense and in the third person. This is not automatically a bad thing for a book, but the style of the prose constructed really awkward sentences at times, eg. "The size of her failure feels epic." The premise for the book felt incredibly uninspired at times; I truly had a lot of trouble getting into and finishing the book. We also never find out what book Aine and Spenser were living in. Speaking of Aine and Spenser, I thought that their characters could be developed a bit better. However, Jess Lourey did do a wonderful job creating Gilgameshs character and using her vivid imagery. The Toadhouse Trilogy: Book One is not a bad book, but I wouldnt recommend it to my friends. Reviewer Age:13 Expected output: "id":"LGen080812" "text":"Aine (pronounced Ah-nee) has always thought of herself as a normal teenager in Depression-Era Alabama. With her blind brother Spenser, she lives in her…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32240885
type: Question
has title: Split value as key and value using Jsoup
score: 1
has comment: http://stackoverflow.com/comment/32242119
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21379846
answer count: 1
has comment: http://stackoverflow.com/comment/32241373
has comment: http://stackoverflow.com/comment/32241913
tagged with: java
has comment: http://stackoverflow.com/comment/32240859
tagged with: jsoup
has comment: http://stackoverflow.com/comment/32241451

http://stackoverflow.com/comment/32381256
score: 0
has text: Please see edit to my answer, thanks!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21457615

http://stackoverflow.com/a/21418763
accepted answer of: http://stackoverflow.com/q/21418735
answers question: http://stackoverflow.com/q/21418735
score: 2
has body: How many threads are created and is there a problem in maintaining sequential execution in order of calls to the executor? I'm not sure I'm understanding whether or not you are asking about the pool threads or the threads forked each time through the loop. So if you are creating a new ExecutorService each of the 50 times then you cannot tell how many threads are actually created. If all of the 49 previous jobs are still running then the 50th will create another thread. If each of the jobs finish before the next one is executed then only one thread will be created. This doesn't take into account the number of futures and other stuff down by each thread. If it is already a background thread do you really need multiple futures, etc.? Without more details, it seems to be me that the right thing to do here is to use a single ExecutorService for all 50 jobs. Then you can determine if you want a fixed number of threads or make it dynamic. I think that a single thread is created for each of the 50 distinct code instances and will maintain sequential order of execution of calls to the executor. There will be no "sequential order" because you are creating a new executor service each time. If you were using a single one then the only way to guarantee sequential order of execution is to only have one thread in the pool. For example, what happens if a user presses the UI button an hundred times very fast? Will I get a hundred threads finishing at different times based on when the database futures complete? Yes, you will get a 100 different threads. If you want to control the max number of threads forked then again, use a single thread-pool for all of the tasks. Btw, you must always shutdown an executor service after you submit the last job: ExecutorService threadPool = Executors.newSingleThreadExecutor(); threadPool.execute(new Runnable() { ... }); // this must be done to properly quit the threads threadPool.shutdown();
has comment: http://stackoverflow.com/comment/32312711
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32369924
type: Comment
comment on: http://stackoverflow.com/a/21451192
has text: do you think this is what he is asking?
type: AnswerComment
score: 0

http://stackoverflow.com/a/21392645
answers question: http://stackoverflow.com/q/21390040
type: Answer
has body: averageVector[i]=averageVector[i]+(FeatureVector.featureAt(i)); You're attempting to invoke featureAt() as a static method. That isn't how you have it declared. Instead of invoking it against the FeatureVector class, invoke it against an instance of that class. (Note that the FeatureVector.this.featureAt(i) syntax is a different kettle of worms entirely. That's a special syntax used from an inner class to reference the outer-class object that owns it.)
score: 0

http://stackoverflow.com/q/21408602
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21431884
has title: Swipe detection on Listview not working for custom Listview Adapter
possible better answer: http://stackoverflow.com/a/21410416
has body: I implemented a gesture detector to find out when the user will fling my listview (and when the last element of the list is in view) so that I may add more data to the list. The list has a custom adapter that I've built. Each row has a few textviews in it and an image button. I was using the imagebutton (which is an arrow) with a click listener in my adapter to open another activity related to the pressed row. Management wants the user to be able to click anywhere on the row in order to activate it. So: @Override public View getView(final int position, View convertView, ViewGroup parent) { View v = convertView; final ViewHolder viewHolder; ..... //viewHolder.ibShipmentDetails.setOnClickListener(new OnClickListener() v.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { .... } } But now, my fling detector won't work correctly. Sometimes it responds and afterwards works correctly; restart the activity, again it doesn't work. Here is my gesture detector: class MyGestureDetector extends GestureDetector.SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if((e1.getY() - e2.getY() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityY) &gt; SWIPE_THRESHOLD_VELOCITY)) { if(!loading &amp;&amp; ((totalItemCount - visibleItemCount) &lt;= firstVisibleItem)) { if(allTabSelected) { allPageNo++; } else { openPageNo++; } new GetShipmentPreviews().execute(1); } } } And in my activity: gestureDetector = new GestureDetector(this, new MyGestureDetector()); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; listView.setOnTouchListener(gestureListener); What should I do to keep v.setOnClickListener and the onFling() command intact?
score: 0
answer count: 2
tagged with: java
tagged with: gesture
accepted answer: http://stackoverflow.com/a/21431884
linked to: http://stackoverflow.com/q/7137742
tagged with: listview
has comment: http://stackoverflow.com/comment/32326762
type: AnsweredQuestion
tagged with: adapter
has answer: http://stackoverflow.com/a/21410416

http://stackoverflow.com/a/21507380
has body: There is difference between an object and a reference to an object. All SledDogs are Dogs but all Dogs are not SledDogs. So according to this logic (as far as compiler understands), following code is fine. Dog myDog = new SledDog(); // This compiles while SledDog myDog = new Dog(); // Error does not work. So in the first line, the tricky part is that you have an object of SledDog class but you are referring to it by a reference of Dog class. (Since all SledDogs are Dogs, this is perfectly fine) But while doing this, you are ignoring it's SledDogness. You will be able to access features of SledDog that are inherited from Dog, but SledDog specific features will be unavailable. Remember that object is still a SledDog but you are acknowledging it as a mere Dog. So in order to access them, you'll have to refer it using a reference of SledDog class. ---> Hence the typecast is required. SledDog typeCastedMyDog = (SledDog) myDog; Now you can access the pullSled() method. The same logic applies when you put all of them in an array of Dogs. Hope this helps.
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21507247

http://stackoverflow.com/comment/32352974
comment on: http://stackoverflow.com/q/21441701
has text: @user3245026: "Write a static method" Nope, you didn't write that yet. Read between the lines. You need just a static method outside of main.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21456331
linked to: http://stackoverflow.com/q/6261990
has comment: http://stackoverflow.com/comment/32378781
tagged with: java
type: Question
has body: I want one constant value in all activities so I have written it in string.xml file. Now, to get that value in .java file, I am writing code as below : getResources().getString(R.string.my_website); - This is 18 line of Splash Class I am calling this code in main class as below : public class Splash extends Activity { final String WebsiteURL = getResources().getString(R.string.my_website); } but it is giving me java.lang.NullPointerException. Am I writing anything wrong? This is the correlating strings.xml: <?xml version="1.0" encoding="utf-8"?> http://www.mytestbuddy.com Logcat: 01-30 17:57:15.853: E/AndroidRuntime(1553): FATAL EXCEPTION: main 01-30 17:57:15.853: E/AndroidRuntime(1553): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Mobile.mytestbuddy/com.Mobile.mytestbuddy.Splash}: java.lang.NullPointerException 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.os.Handler.dispatchMessage(Handler.java:99) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.os.Looper.loop(Looper.java:130) 01-30 17:57:15.853: E/AndroidRuntime(1553): at android.app.ActivityThread.main(ActivityThread.java:3683) 01-30 17:57:15.853: E/AndroidRuntime(1553): at java.lang.reflect.Method.invokeNative(Native Method) 01-30 17:57:15.853: E/AndroidRuntime(1553): at java.lang.reflect.Method.invoke(Method.java:507) 01-30 17:57:15.853: E/AndroidRuntime(1553): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 01-30 17:57:15.853: E/AndroidRuntime(1553): at com.android.in…
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/21456357
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21456367
accepted answer: http://stackoverflow.com/a/21456367
favorite count: 0
has title: java.lang.NullPointer Exception in getResources().getString(R.string.value);
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/31536656
upvote count: 4
possible better answer: http://stackoverflow.com/a/21456357
type: AnsweredQuestion

http://stackoverflow.com/a/21428262
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/21428204
has body: Directly accessing b, is equivalent to this.b. In that context, this reference holds reference to the inner class instance. You need a reference to the enclosing instance, to access it's instance variable. Which you can do using A.this. So, to access b of class A, you can use A.this.b: System.out.println("b of outer class is" + A.this.b);
downvote count: 0

http://stackoverflow.com/comment/32349260
score: 0
has text: How can a String represent an icon?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21439707

http://stackoverflow.com/comment/32365070
type: Comment
has text: File --> New --> Java Project
comment on: http://stackoverflow.com/q/21448248
score: 1
type: QuestionComment

http://stackoverflow.com/a/22584464
answers question: http://stackoverflow.com/q/21486826
has body: The following will open both files and executables (.exe): Java 1.6 and above: try { Desktop.getDesktop().open(new File("notepad.exe")); } catch (Exception e) { e.printStackTrace(); } Java 1.5 and under, without external library (windows only): try { Runtime.getRuntime().exec("cmd /c \"notepad.exe\""); } catch (Exception e) { e.printStackTrace(); } I only tested the 1.5 solution with opening excel files but not with opening executable files, but I'm guessing it could work to.
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/32201823
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21356817
has text: You can use double.class or int.class or what ever primitive you want
type: Comment

http://stackoverflow.com/comment/46794664
type: Comment
has text: Tried this. But getting a warning also, Warning: No -tsa or -tsacert is provided and this jar is not timestamped. Without a times tamp, users may not be able to validate this jar after the signer certificate's expiration date (2042-07-31) or after any future revocation date.
comment on: http://stackoverflow.com/a/21457585
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32469871
comment on: http://stackoverflow.com/a/21507227
type: AnswerComment
has text: sorry, about my english! i try to say that I actually use the debugger to ensure where the exception iS made, and unfortunately, it is made on the execution or the "exist" method.
score: 0
type: Comment

http://stackoverflow.com/q/21418802
has comment: http://stackoverflow.com/comment/32312973
has answer: http://stackoverflow.com/a/21420600
has comment: http://stackoverflow.com/comment/32313528
has comment: http://stackoverflow.com/comment/106267961
has comment: http://stackoverflow.com/comment/32312933
downvote count: 0
has answer: http://stackoverflow.com/a/60041459
has comment: http://stackoverflow.com/comment/106155139
tagged with: java-8
has comment: http://stackoverflow.com/comment/32312511
type: Question
score: 14
tagged with: java
has comment: http://stackoverflow.com/comment/32312566
has comment: http://stackoverflow.com/comment/32313019
has comment: http://stackoverflow.com/comment/32313028
has comment: http://stackoverflow.com/comment/32312520
upvote count: 14
answer count: 2
has title: Fundamental impediments for non-static access from inner classes to outer interfaces
favorite count: 0
has body: Example: interface Outer { default String get() { return "hi"; } class Inner { String got() { return get(); } } } This yields the error java: non-static method get() cannot be referenced from a static context. The inner interface/class is always static; unlike with an outer class where it's non-static unless declared static. This is how things are today and in the upcoming java 8. Is there a fundamental reason for this difference between outer classes and outer interfaces? Update: After reading @Radiodef´s comment I changed the inner interface to be an inner class. An outer class can't contain a non-static inner interface so the example was confusing. An inner class is really what I would like anyway. Update: For reference. This is perfectly legal: class Outer { String get() { return "hei"; } class Inner { String got() { return get(); } } }
tagged with: static
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32313815
has comment: http://stackoverflow.com/comment/32312607

http://stackoverflow.com/comment/32238216
has text: actually the error is shown in line 36 jasonarrayobject.put's definition is not being detected
comment on: http://stackoverflow.com/q/21377014
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21354652
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32197696
has comment: http://stackoverflow.com/comment/32201106
has comment: http://stackoverflow.com/comment/32198011
has comment: http://stackoverflow.com/comment/42699531
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21354611
answers question: http://stackoverflow.com/q/21354611
has comment: http://stackoverflow.com/comment/32199210
has comment: http://stackoverflow.com/comment/32201736
has body: I would usually recommend against using a switch at all when you have the option, but if you have to stick with it, you probably want the break with label. WhileLoop: while (timesLeveled &gt; 0) { ... case n: // do stuff break WhileLoop; ... } Note that this usage usually means that your code needs more than one significant cleanup (Replace Conditional with Polymorphism, loop improvement, etc.).
has comment: http://stackoverflow.com/comment/42699128
score: 6
has comment: http://stackoverflow.com/comment/32199387
has comment: http://stackoverflow.com/comment/32199256

http://stackoverflow.com/comment/32396508
score: 0
type: Comment
type: AnswerComment
has text: I understand how to get the "max" populated zip, but that just gets updated to get the max value every time
comment on: http://stackoverflow.com/a/21465940

http://stackoverflow.com/q/21369608
score: 0
type: UnansweredQuestion
tagged with: luajava
has answer: http://stackoverflow.com/a/21379882
type: Question
tagged with: luaj
tagged with: java
answer count: 1
has body: Im trying to load the json module in Java code. The example in the Doc shows that it should go like this but it doesnt work. Does it require the module to be in the project or it loads it from LUA_PATH. does anyone have any experience with this issue? Globals globals = JsePlatform.standardGlobals(); globals.get("require").call( LuaValue.valueOf("json") ); Exception in thread "main" org.luaj.vm2.LuaError: module 'json' not found: json no field package.preload['json'] json.lua no class 'json' It looks like it is trying just within the LuaJ package.
tagged with: lua
has title: LuaJ require json module in java

http://stackoverflow.com/comment/32244872
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21380782
has text: See my Example in the Question. It must perform different actions according to the no. of KeyEvents.
score: 0

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/21360191
tag name: dayofweek

http://stackoverflow.com/a/21611986
has body: I had the same issue in Android when calling the socket.disconnect(). Here is how it was fixed. Checkout the socket.io-java-client project from https://github.com/Gottox/socket.io-java-client; Download the Java-WebSocket-1.3.0.jar; Replace the WebSocket.jar in the lib file of socket.io project with java-websocket-1.3.0.jar; Use ant to build the socket.io-java-client to jar; Then replace the socketio.jar with the new one you just build. Hope this helps.
has comment: http://stackoverflow.com/comment/47943064
has comment: http://stackoverflow.com/comment/36590541
has comment: http://stackoverflow.com/comment/36585033
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21433750
answers question: http://stackoverflow.com/q/21433750
type: Answer

http://stackoverflow.com/q/21392822
linked to: http://stackoverflow.com/q/14393423
answer count: 1
tagged with: countdown
tagged with: timer
has comment: http://stackoverflow.com/comment/32267170
has body: I'm new to Java and I'm taking grade 11 computer science. For our final project, we have to make a game and I'm doing JEOPARDY. When you click on the question you want, a new form comes up showing that questions and the 4 choices for the answer (I'm doing multiple choice for simplicity) On that form, I want there to be a countdown from 20 to 0. Once the timer runs out, I want the form to close. The user needs to be able to see the timer.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21392899
accepted answer: http://stackoverflow.com/a/21392899
type: Question
has title: Using a countdown timer
score: 0

http://stackoverflow.com/q/21484549
score: 0
has body: String s1; int a, b, c = 0; s1 = t1.getText(); a = Integer.parseInt(s1); while (a &gt; 0) { b = a % 10; c = c * 0 + b; a = a / 10; } t2.setText("" + c); here t1,t2 are text fields. Please let me know where did i go wrong because i am just getting the first digit of the number which I enter in the output and not the whole number.
answer count: 1
has answer: http://stackoverflow.com/a/21484620
accepted answer: http://stackoverflow.com/a/21484620
has comment: http://stackoverflow.com/comment/32428219
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32428121
has title: number reversal program gives only the first digit in output instead of the whole number
has comment: http://stackoverflow.com/comment/32428156

http://stackoverflow.com/a/21433104
type: Answer
accepted answer of: http://stackoverflow.com/q/21432911
has comment: http://stackoverflow.com/comment/32337625
has comment: http://stackoverflow.com/comment/32338973
answers question: http://stackoverflow.com/q/21432911
has comment: http://stackoverflow.com/comment/32337112
has comment: http://stackoverflow.com/comment/32337824
has body: Use toCharArray() method of String class char[] values = value.toCharArray(); EXAMPLE String value = "Hello"; char[] values = value.toCharArray(); for(char c: values){ System.out.println(" "+ c); } OUTPUT H e l l o FOR SPLITTING INTO STRING Use split(String regex) method EXAMPLE String value = "Hello My Friends"; String[] values = value.split(" "); for(String c: values){ System.out.println(" "+ c); } OUTPUT Hello My Friends
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32338926

http://stackoverflow.com/a/21521205
score: 0
answers question: http://stackoverflow.com/q/21511189
has comment: http://stackoverflow.com/comment/32509312
type: Answer
has body: I think you should have a look at Lucene if you haven't done yet.

http://stackoverflow.com/q/21449825
has body: How can I do something like this while I'm using multiple LAFs: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
downvote count: 0
tagged with: look-and-feel
tagged with: swing
tagged with: jmenu
has answer: http://stackoverflow.com/a/21531631
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32372763
linked to: http://stackoverflow.com/q/9198530
tagged with: jmenuitem
type: Question
has title: Preventing JMenuItem from closing JMenu upon a click
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32371305
accepted answer: http://stackoverflow.com/a/21531631

http://stackoverflow.com/a/21501244
score: 0
type: Answer
has body: In your eclipse there is a Red Button. You can press that for terminating the program.
answers question: http://stackoverflow.com/q/21501173
has comment: http://stackoverflow.com/comment/32458492

http://stackoverflow.com/a/21427718
has comment: http://stackoverflow.com/comment/32328349
type: Answer
accepted answer of: http://stackoverflow.com/q/21427586
has comment: http://stackoverflow.com/comment/32328239
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21427586
has comment: http://stackoverflow.com/comment/32328534
type: AcceptedAnswer
downvote count: 0
has body: public void setPositionToView (Context ctx, List addresses,View mainview) { try { String street = addresses.get(0).getAddressLine(0); String city = addresses.get(0).getAddressLine(1); String country = addresses.get(0).getAddressLine(2); Log.i(AppHelper.APP_LOG_NAMESPACE, street); // display toast message with success state Toast.makeText(ctx, "TEST", Toast.LENGTH_LONG).show(); // change state text to success and colorize text green TextView eanTv = (TextView) mainview.findViewById(R.id.street); eanTv.setText("Test"); //stateTv.setTextColor(getResources().getColor(R.color.green)); } catch (Exception e) { Log.e(AppHelper.APP_LOG_NAMESPACE, "getAndSavePosition method cannot be processed", e); e.printStackTrace(); } } and call like this setPositionToView (ctx, addresses,(ViewGroup)view.getParent());

http://stackoverflow.com/a/21492374
accepted answer of: http://stackoverflow.com/q/21492334
has body: but I am trying to figure out why I can access the 'data' and 'next' fields of class Node in my functions in class LinkedList. Because the Java Language Specification says so [...] if the member or constructor is declared private, then access is permitted if and only if it occurs within the body of the top level class (§7.6) that encloses the declaration of the member or constructor. The top level class in your case is LinkedList. The class Node is a member of LinkedList. It therefore makes sense for it (LinkedList to be able to access any part of it (Node). Adding onto this, is a nested class the same thing as a subclass defined with the 'extends' keyword? No. For details on nested classes, see the Java tutorials. The extends keyword is used in inheritance. See the corresponding Java tutorial. It made more sense to me for node to be a nested class of linkedlist. If this is not entirely correct please let me know... No, what you are doing is fine. Someone using your LinkedList class is not interested in how it's implemented as long as it follows the rules of the data structures or of your specification. Your Node class being nested and private hides those details. This is known as information hiding and encapsulation, which are considered good practice. Note that your nested class is also considered an inner class. You can read about that in the previous links as well.
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32443096
type: Answer
answers question: http://stackoverflow.com/q/21492334
has comment: http://stackoverflow.com/comment/32443052

http://stackoverflow.com/q/21494128
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32446216
tagged with: java
has answer: http://stackoverflow.com/a/21494138
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21494159
tagged with: image
score: 0
has body: I'm trying to read an image and store it as an integer array so I can display it to the screen. I've no idea what is causing my code to return this null pointer exception and I was hoping someone could shed some light on it. Here's the code for the load method: import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; public class TextureUI { private int width = 800, height = 600; public int[] pixels = new int[width*height]; public void load(String path) { try { BufferedImage image = ImageIO.read(TextureUI.class.getResource(path)); int w = width; int h = height; image.getRGB(0, 0, w, h, pixels, 0, w); } catch (IOException e) { e.printStackTrace(); } } } and I'm using it here: private Render ui; private TextureUI texui; public Screen(int width, int height) { super(width, height); ui = new Render(width, height); //Here is where my code is null pointing texui.load("ui/hands.png"); // &lt; That function call for (int i = 0; i &lt; (width * height); i++) { ui.pixels[i] = texui.pixels[i]; } } Could anyone shed some light on why it might be that this error is occurring?
has comment: http://stackoverflow.com/comment/32446347
has title: Trying to read an image and getting a null pointer exception

http://stackoverflow.com/comment/32501879
comment on: http://stackoverflow.com/a/21481374
has text: Hey actually got it now..+1 for explaining about static methods.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32370304
has text: Setting maxpermsize very low may result in oom error as permsize doesnt change dynamically.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21445249

http://stackoverflow.com/q/21414596
linked to: http://stackoverflow.com/q/6636262
tagged with: java
has title: ExactTarget SOAP Client Using CXF
tagged with: exacttarget
type: Question
has answer: http://stackoverflow.com/a/21414597
score: 0
answer count: 1
has body: I am looking to build a stand-alone ExactTarget SOAP client using CXF. I was able to create a client using Glassfish Metro, but due to future support considerations we would like to use CXF. I found an old example and associated project, but it is too old to be useful. Currently I am trying to understand how can I set a handler on the stub/port object and to pass dynamic username and password to it. By dynamic I mean: the app gets username and password from the user at the time of running. Here is the code that I currently have for the Metro implementation: PartnerAPI service = new PartnerAPI(); Soap stub = service.getSoap(); Map&lt;String, Object&gt; outProperties = new HashMap&lt;String, Object&gt;(); Map ctx = ((BindingProvider) stub).getRequestContext(); requestContext.put(BindingProvider.USERNAME_PROPERTY, user); requestContext.put(BindingProvider.PASSWORD_PROPERTY, password); List&lt;Handler&gt; chain = new ArrayList&lt;Handler&gt;(); chain.add(new SecurityHandler()); ((BindingProvider) stub).getBinding().setHandlerChain(chain); I am trying to reuse the first 4-6 lines for the CXF implementation, but I cannot use the handlers I have since they depend on com.sun.xml.wss.XWSSProcessor.
type: UnansweredQuestion
tagged with: soap

http://stackoverflow.com/q/21361243
tagged with: servlets
answer count: 2
has body: Previously I thought Google does not index pages returned from Servlets. However, I suddenly found some urls that confused me. Just take the url of this page as example, it has the following pattern: Reference Link where p1 is some number, and p2 is the title of this question. Imagine the website is built in Java (JSP), I guess there is a servlet mapping to /questions/p1/p2. However, this page is indeed indexed by Google. So, does Google index pages returned from servlets? Or where am I wrong? Extended question: How to dynamically create a webpage? Taking 4shared.com as an example, when a user uploads a file, a new page is dynamically created, and url ends with ".html". e.g.: Link How is this done? Anyone knows the mechanism? Thanks!
downvote count: 0
tagged with: url
tagged with: jsp
has answer: http://stackoverflow.com/a/21361299
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/21361299
has answer: http://stackoverflow.com/a/21361317
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/21361317
type: Question
has title: Does Google index page returned from Servlet?

executorservice
type: Tag
tags question: http://stackoverflow.com/q/21435115
tags question: http://stackoverflow.com/q/21359691
tag name: executorservice
tags question: http://stackoverflow.com/q/21482733

http://stackoverflow.com/a/21405431
has comment: http://stackoverflow.com/comment/32289156
has comment: http://stackoverflow.com/comment/32288766
score: 4
has comment: http://stackoverflow.com/comment/32290029
accepted answer of: http://stackoverflow.com/q/21405134
has comment: http://stackoverflow.com/comment/32289645
upvote count: 4
has comment: http://stackoverflow.com/comment/32289858
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32288646
has comment: http://stackoverflow.com/comment/32291318
has comment: http://stackoverflow.com/comment/32289377
has comment: http://stackoverflow.com/comment/32288703
type: Answer
has body: Here it is! char[][] array = new char[letterLines.length][]; You are only initializing one axis. When you pass this array to init() and set this.letterArray = letterArray;, the letterArray is also not fully initialized. Try adding a length to both axes: char[][] array = new char[letterLines.length][LENGTH];
answers question: http://stackoverflow.com/q/21405134
has comment: http://stackoverflow.com/comment/32289238

http://stackoverflow.com/a/21476466
score: 3
has comment: http://stackoverflow.com/comment/76982729
type: AcceptedAnswer
downvote count: 0
has body: System class provide you a way to dump output in different stream which is System#setOut(PrintStream out) Using this method you can pass you FileInputstream to System.setOut and you can save the console output. PrintStream printStream = new PrintStream(new FileOutputStream(file)); System.setOut(printStream); One interesting part of this question is though out is declared as final in System class but still you reassign this by System#setOut.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/76992913
accepted answer of: http://stackoverflow.com/q/21476423
answers question: http://stackoverflow.com/q/21476423

http://stackoverflow.com/q/21499318
downvote count: 0
tagged with: javascript
linked to: http://stackoverflow.com/q/13997424
favorite count: 0
has title: How to make SPA Ajax Applications without #! crawlable?
has body: When you have a single page application (SPA) which contains mostly of JavaScript content that is loaded via Ajax google propose a guide on how to make such applications crawlable. You have to use #! in your page fragments to make the fragments visible to the search engine. www.example.com/ajax.html#!mainpage Now, if you use the HTML5 PushState History API you can change the url to www.example.com/ajax.html/mainpage This url looks must nicer than the first one. Search engines can easily access the page since there is no hash bang # in the url. The problem is that it is still a JavaScript page the must be interpreted which search engines do not do. How can this ajax page be accessible to search engines? How does my server know if a search engine or a user browser tries to access the page? I have the following ideas but no idea how to implement it or if there are any solutions. you can make a html snapshot of each ajax page that can be accessed by the search engine you can use some kind of ui less browser is accessed by the search engine, the ui less browser interprets the page and then returns the html content to the search engine
tagged with: http://stackoverflow.com/tag/html
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21511865
tagged with: gwt
tagged with: java
tagged with: web-crawler
type: Question
answer count: 1

http://stackoverflow.com/comment/32461901
comment on: http://stackoverflow.com/q/21492821
has text: in reality , what i made is removing all component of the parent component of the panel (in this case the parent component is the right side of the main Jsplitpane ) and than i added the top and the bottom split like i made in first time i launch my Main Frame :) , Now it works very well :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32298255
comment on: http://stackoverflow.com/q/21410699
has text: Why will it only display the cats type?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21375049
type: Answer
has body: Use generic DAO instead see for example http://yanuar7199.wordpress.com/2013/03/30/hibernate-generic-dao-for-generic-purpose/ Define mapping for One-To-Many e.g. List of contacts in UserEntity. http://www.dzone.com/tutorials/java/hibernate/hibernate-example/hibernate-mapping-one-to-many-using-annotations-1.html
score: 1
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/21374550

http://stackoverflow.com/q/21354311
has body: When creating test cases for setters and getters of instance variables within the object. What is the best approach? Here I use the get and set methods within my tests. Would this be poor testing strategy? /** * Test of setFlightNumber method, of class Flight. */ @Test public void testSetFlightNumber() { System.out.println("setFlightNumber"); int flightNumber = 1000; Flight instance = new Flight(); instance.setFlightNumber(flightNumber); // TODO review the generated test code and remove the default call to fail. assertEquals(instance.getFlightNumber(), flightNumber); } /** * Test of getFlightNumber method, of class Flight. */ @Test public void testGetFlightNumber() { System.out.println("getFlightNumber"); Flight instance = new Flight(); int expResult = 1000; instance.setFlightNumber(1000); int result = instance.getFlightNumber(); assertEquals(expResult, result); }
has comment: http://stackoverflow.com/comment/32197070
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/137181545
has answer: http://stackoverflow.com/a/39176037
has title: Junit Test of Setters and Getters of Instance Variables
favorite count: 0
has answer: http://stackoverflow.com/a/58739246
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21387238
score: 16
upvote count: 16
has answer: http://stackoverflow.com/a/44292670
tagged with: unit-testing
has answer: http://stackoverflow.com/a/21355383
tagged with: java
linked to: http://stackoverflow.com/q/7437705
has comment: http://stackoverflow.com/comment/32198546
type: Question

http://stackoverflow.com/q/21513637
has answer: http://stackoverflow.com/a/63759804
has title: dot product of two quaternion rotations
answer count: 4
score: 14
has answer: http://stackoverflow.com/a/33893119
type: AnsweredQuestion
tagged with: quaternions
tagged with: java
type: Question
tagged with: rotation
has body: I understand that the dot (or inner) product of two quaternions is the angle between the rotations (including the axis-rotation). This makes the dot product equal to the angle between two points on the quaternion hypersphere. I can not, however, find how to actually compute the dot product. Any help would be appreciated! current code: public static float dot(Quaternion left, Quaternion right){ float angle; //compute return angle; } Defined are Quaternion.w, Quaternion.x, Quaternion.y, and Quaternion.z. Note: It can be assumed that the quaternions are normalised.
tagged with: math
upvote count: 16
tagged with: dot-product
downvote count: 2
has answer: http://stackoverflow.com/a/22229235
has answer: http://stackoverflow.com/a/21513697
accepted answer: http://stackoverflow.com/a/21513697
favorite count: 0
possible better answer: http://stackoverflow.com/a/63759804

http://stackoverflow.com/comment/32207264
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21359774
has text: What is the purpose of the `ArrayList<Tile>` when you already have all of the `Tile`s stored in an array?

http://stackoverflow.com/comment/32474993
type: AnswerComment
has text: Sure I'll check it! +Ivan
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21503632

http://stackoverflow.com/comment/32281269
comment on: http://stackoverflow.com/a/21401176
has text: BTW, note that `temp += i` is a cleaner way of saying `temp = temp + i`
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/21381305
has answer: http://stackoverflow.com/a/31687599
tagged with: web-services
type: Question
tagged with: grizzly
accepted answer: http://stackoverflow.com/a/21389115
tagged with: java
tagged with: servlets
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21389115
possible better answer: http://stackoverflow.com/a/31687599
has body: I'm try to create a Grizzly web service engine but some elements are missing. Here is what I would like to do: Create a Grizzly server as an executable jar (this is ok) This server would must be able to look into a folder for web service archives (contained in a jar or a war or other) The server should expose this web services. What I already know : web services can be built as servlet (It seems that Grizzly is able to run servlets but I did not find anything about how to load an external serlvet contained in a ".war" or other) I tried to use a ClassLoader to load a JAX-RS2 webservice exported in a ".jar" but the @path binding did not work (I might have missed something) What I would like to know : Which type of archive should I use for the web service archives ? Should the web services be servlets ? In these case, how to dynamicaly load a servlet with Grizzly ? Am I going in the wrong direction ? Here is what I have done with the classloader File file = new File("c:\\Users\\User\\Desktop\\myresource.jar"); URL url = file.toURI().toURL(); URL[] urls = new URL[]{url}; ClassLoader cl = new URLClassLoader(urls); URLClassLoader child = new URLClassLoader (urls, this.getClass().getClassLoader()); Class&lt;?&gt; classToLoad = Class.forName ("Test.ExternalWS.MyResource", true, child); Method method = classToLoad.getDeclaredMethod ("getIt"); Object instance = classToLoad.newInstance (); Object result = method.invoke (instance); this.WSInstance = classToLoad.newInstance(); Here is the webservice @Path("myresource") public class MyResource { @GET @Produces(MediaType.TEXT_PLAIN) public String getIt() { return "Got it!"; } } Nothing happens when I try to reach localhost:8080/....../myresource. I tried all possible urls and put a breakpoint... never reached.
downvote count: 0
has title: Use Grizzly as a web service engine
favorite count: 0
tagged with: rest
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/21463468
has comment: http://stackoverflow.com/comment/32391242
has comment: http://stackoverflow.com/comment/32394756
has comment: http://stackoverflow.com/comment/32395592
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21463331
type: Answer
accepted answer of: http://stackoverflow.com/q/21463331
has body: One advantage of Java is that you have a compiler, so usually this is a non-issue. If you compile your code properly and then, for some reason, drop a required jar file from the runtime environment, you'll get a java.lang.ClassNotFoundException, so that should be enough. If you want to be super-extra-safe, you could try calling Class.forName: @Test public void testClassExists { try { Class.forName("org.mypackage.Car"); } catch (ClassNotFoundException e) { Assert.fail("should have a class called Car"); } }
has comment: http://stackoverflow.com/comment/32395016

http://stackoverflow.com/q/21417710
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21418082
score: 0
tagged with: java
tagged with: tomcat5.5
has answer: http://stackoverflow.com/a/21418233
type: Question
has title: Can we mutualize a jsp into a jar deployed in shared folder of Tomcat 5.5?
possible better answer: http://stackoverflow.com/a/21418233
accepted answer: http://stackoverflow.com/a/21418082
answer count: 2
tagged with: jar
tagged with: jsp
linked to: http://stackoverflow.com/q/9596801
has body: We would like to have an header with same image, same css. The only thing which is needed is the name of application which would be provided into the model in order to load a different logo. Is it possible to put that jsp into a jar which would be deployed on shared folder of a Tomcat 5.5 ? How to do that ? Thank you.
linked to: http://stackoverflow.com/q/3796815

http://stackoverflow.com/comment/32278070
has text: possible duplicate of [Deleting a file using delete() - Java](http://stackoverflow.com/questions/3809418/deleting-a-file-using-delete-java)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21398959
score: 0

http://stackoverflow.com/comment/32344390
has text: Is some exception being thrown? Also, why two `Robot` objects?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21437242

http://stackoverflow.com/comment/32555877
type: AnswerComment
has text: Literally the code i have to put where you have put the comments.
type: Comment
comment on: http://stackoverflow.com/a/21457899
score: 0

http://stackoverflow.com/q/21417407
has comment: http://stackoverflow.com/comment/32310012
has body: Here is my code after changes suggested by stackoverflow members. The code compiles with no errors but when I run "java Realtor11", I get the following errors. I am importing the correct libraries so not sure what the issue is. The goal of the program is to read two values (first line is a string (John) and the second line is a double (100)) and output them with some calculations to a JOption message. Exception in thread "main" java.lang.NullPointerException at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at Realtor11.main(Realtor11.java:49) // java class for keyboard I/O import java.util.Scanner; // java class for JOption GUI import javax.swing.JOptionPane; // File reader import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; public class Realtor11 { public static void main(String[] args) { // Keyboard and file input Scanner console = new Scanner(System.in); Scanner inputStream = null; // price of the house, the cost to sell the house and the commission double price = 0; double cost, commission; // seller's name String seller = "name"; // GUI diplay message declaration String display_message = "This program calculates the cost to sell a home\n" + "and the commission paid to an individual sales agent.\n\n" + "The user is asked for the last name of the seller and the\n" + "sales price.\n\n"; // Output descriptive messages JOptionPane.showMessageDialog(null, display_message, "Lab 1 Description", JOptionPane.INFORMATION_MESSAGE); // Read Realtor11.txt try { BufferedReader in = new BufferedReader(new FileReader("Realtor11.txt")); while (in.read()!= -1); seller = in.readLine(); price = Double.parseDouble(in.readLine()); in.close(); } catch (IOException e) {} // calculate the cost and the commission cost = 0.06 * price; commission = 0.015 * price; // display the input and results String out1 = String.format("%nThe " + seller + "'s" + " home sold for …
has answer: http://stackoverflow.com/a/21417493
tagged with: java
has comment: http://stackoverflow.com/comment/32310152
has comment: http://stackoverflow.com/comment/32311542
has answer: http://stackoverflow.com/a/21417461
has answer: http://stackoverflow.com/a/21417534
has title: java program compiles with no error but does not run
has comment: http://stackoverflow.com/comment/32310006
has comment: http://stackoverflow.com/comment/32309906
type: Question
possible better answer: http://stackoverflow.com/a/21417493
has comment: http://stackoverflow.com/comment/32309892
has comment: http://stackoverflow.com/comment/32310034
score: 0
has comment: http://stackoverflow.com/comment/32310128
has comment: http://stackoverflow.com/comment/32310107
has answer: http://stackoverflow.com/a/21417564
has comment: http://stackoverflow.com/comment/32309978
has comment: http://stackoverflow.com/comment/32309987
has comment: http://stackoverflow.com/comment/32309985
answer count: 4
has comment: http://stackoverflow.com/comment/32309924
accepted answer: http://stackoverflow.com/a/21417564
type: AnsweredQuestion

http://stackoverflow.com/a/21481172
answers question: http://stackoverflow.com/q/21470293
downvote count: 0
score: 1
has body: When I make the following changes to your grammar, it works for me: Move COLORTYPE to the end, since as others have mentioned, it matches before your keywords. Change your 'condition' rule to: atom EQUALS QUOTE? (assignment | atom) QUOTE? Add this at the end: QUOTE : '\'' ;
upvote count: 1
type: Answer

http://stackoverflow.com/q/21410908
tagged with: repaint
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1097366
upvote count: 1
downvote count: 1
has title: What's the difference between setVisible(true), repaint() and validate()?
has comment: http://stackoverflow.com/comment/32298408
tagged with: java
has body: I create a little program that load a frame in which I added some panels. When I click on some button it should show some panels and hide other. I'm experiencing some difficult to do it, even because I don't really figure out the diference between setVisible(true), repaint() and validate() (that some friends of mine suggested to me). I hope you can make me to understand! Thank you.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32298229
has answer: http://stackoverflow.com/a/21411092
has comment: http://stackoverflow.com/comment/128226051
has answer: http://stackoverflow.com/a/21411057
favorite count: 0
score: 0

http://stackoverflow.com/comment/109820097
score: 0
type: Comment
has text: this property contains name of computer
comment on: http://stackoverflow.com/a/37404916
type: AnswerComment

http://stackoverflow.com/comment/32423568
comment on: http://stackoverflow.com/q/21481671
type: QuestionComment
has text: I have updated the code. The break has always been there.
score: 0
type: Comment

http://stackoverflow.com/a/21423105
downvote count: 0
score: 3
has body: Normally, Class instances are created by a ClassLoader. So you could have 2 Class instances for the same class from different ClassLoader instances. This is not true for primitive types. There is only one Class instance for each primitive type per JVM. It is created and returned from a native method in the Class class. static native Class getPrimitiveClass(String name); This is assigned directly to Byte.TYPE public static final Class&lt;Byte&gt; TYPE = (Class&lt;Byte&gt;) Class.getPrimitiveClass("byte"); or returned when you do byte.class You can't use Class.forName(..) to get it.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21422898
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21422898
type: Answer

http://stackoverflow.com/comment/32380836
type: Comment
type: QuestionComment
has text: u should use thread time that's depends on u ....10000,etc seconds
score: 0
comment on: http://stackoverflow.com/q/21457851

http://stackoverflow.com/comment/32426666
has text: You can still `goto` to them, I think
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21483682

http://stackoverflow.com/q/21427862
has comment: http://stackoverflow.com/comment/32328576
tagged with: java
linked to: http://stackoverflow.com/q/14626977
upvote count: 3
answer count: 2
favorite count: 0
has title: GCM no receive messages in 2.3.6 but it's ok in 4.1.2
tagged with: android
tagged with: google-cloud-messaging
has comment: http://stackoverflow.com/comment/32328932
downvote count: 0
has answer: http://stackoverflow.com/a/21428444
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21428708
has body: The problem is only with android 2.3.6 . With 4.x, there isn't any problem, the receiver it's ok. I have received the registration ID with 2.3.6 but the messages are never received. My Manifest is: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.arte.biluna” android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <permission android:name="net.arte.biluna.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="net.arte.biluna.permission.C2D_MESSAGE" /> <!-- android:theme="@style/Theme.Sherlock" > --> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <service android:name="net.arte.biluna.GcmIntentService" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="net.arte.biluna" /> My receiver: public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCo…
type: Question
score: 3

http://stackoverflow.com/comment/32284472
comment on: http://stackoverflow.com/a/21401876
has text: Well, as I have said, it is a matter of taste, but in my times, building a set of projects with dynamic DLL dependencies in Visual Studio 6.0 felt like making a sudoku while riding a mad tiger by its tail. However, trying to do this in .NET or Java felt much more intuitive and easy - but I admit it could only mean a difference of ability by my part since a lot of time had past :P
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/32365444
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21448304
type: AnswerComment
has text: @HovercraftFullOfEels : It should be handle Question owner as per his requirement.

http://stackoverflow.com/comment/32288646
type: AnswerComment
score: 0
has text: Still getting the NPE after addidng both axis Correectin it is working now . Thank you for your help!
type: Comment
comment on: http://stackoverflow.com/a/21405431

http://stackoverflow.com/comment/32342663
type: AnswerComment
has text: tnks for your warning this solved the problem as ZouZou
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21436294

http://stackoverflow.com/comment/32205555
score: 0
type: Comment
type: QuestionComment
has text: I clarify it.. hope its better now..
comment on: http://stackoverflow.com/q/21358804

http://stackoverflow.com/comment/32247949
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21381532
has text: The change will be automatically reflected in your `httprequest` object. To submit it call the `send()` method in the request. To check that the target application read the variable you need to receive the expected result. You can debug the application in server side if you have access to it.
score: 0

http://stackoverflow.com/q/21365432
has answer: http://stackoverflow.com/a/21365540
linked to: http://stackoverflow.com/q/9554636
answer count: 1
has body: Some related questions: The Use of Multiple JFrames: Good or Bad Practice? Java Open a new window by clicking a button I want to open a second JFrame window from the first. The first has a main() method, and button click handler which would open the second JFrame. (Beware of typos, I condensed it). What is good practice for creating the second JFrame? (It has to be a JFrame I think.) I will want to be able to close the first JFrame and leave the second one running, as they don't talk to each other after the first instantiates the second with some data. public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MyMainClass window = new MyMainClass(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public MyMainClass() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 697, 416); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //... JButton btnNewButton = new JButton("Open Second Window"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // Would this be the correct thing to do? // If this first window is closed, would it // close the second one as well? (not what I want) new SecondFrame(); } }); //... } public class SecondFrame extends JFrame { private JPanel contentPane; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SecondFrame frame = new SecondFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public SecondFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); } } I don't understand why it is said to be important to use the event dispatch thread. I'm guessing the code in the main() function of Sec…
score: 0
accepted answer: http://stackoverflow.com/a/21365540
tagged with: event-dispatch-thread
tagged with: jframe
has title: Open another instance of JFrame (from a JFrame): use EventQueue.invokeLater? (event dispatch thread)
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/11273267
type: Question

http://stackoverflow.com/q/21394421
has comment: http://stackoverflow.com/comment/32295595
has comment: http://stackoverflow.com/comment/32278575
type: Question
tagged with: symbols
tagged with: maven
answer count: 1
has body: I have a pom.xml file that has the following structure: <?xml version="1.0" encoding="UTF-8" standalone="no"?> 4.0.0 someParentGroupId someParentArtifactId someParentVersionId ... ... war <aspectj.version>1.6.12</aspectj.version> <roo.version>1.2.2.RELEASE</roo.version> <spring.version>3.1.0.RELEASE</spring.version> <camel.version>2.10-SNAPSHOT</camel.version> <spring-security.version>3.1.0.RELEASE</spring-security.version> someRepoId someRepoName someRepoURL somePluginRepoId somePluginRepoName somePluginRepoURL someDependencyGroupId someDependencyArtifactId someDependencyVersion someDependencyScope somePluginGroupId somePluginArtifactId somePluginVersionId When I have the tag commented, I can run mvn install without problems, but Eclipse goes coconuts with errors in my pom.xml! Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.2:compile (execution: default, phase: process-sources) Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.2:test-compile (execution: default, phase: process-test-sources) If however, I add the tag I have no errors in any of my Eclipse projects, but I cannot run mvn install ! Here is part of the output from running mvn -e install /home/pedro/dss-project/dss/dss-server/src/main/java/net/jnd/thesis/domain/SessionCondition.java:[79,9] cannot find symbol symbol : method getValue() location: class net.jnd.thesis.domain.SessionCondition /home/pedro/dss-project/dss/dss-server/src/main/java/net/jnd/thesis/web/AdminController.java:[61,5] cannot find symbol symbol : method setValueRaw(java.lang.String) location: class net.jnd.thesis.domain.Event [INFO] Trace org.apache.maven.BuildFailureException: Compilation failure at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) at org.apache.maven.lifecycle…
has comment: http://stackoverflow.com/comment/32286971
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21417889
tagged with: eclipse
has title: <pluginManagement> tag causes "cannot find symbol" on Maven2
has comment: http://stackoverflow.com/comment/32286333
type: UnansweredQuestion

http://stackoverflow.com/q/21404102
has title: How to inject session scope bean in interceptor using java config with Spring
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/21407191
tagged with: java
upvote count: 7
possible better answer: http://stackoverflow.com/a/21405252
has answer: http://stackoverflow.com/a/21405252
has body: I'm developping a full Spring 3.1 and servlet 3.0 application. But my interceptor has a private properties scoped as proxy: public class MyInterceptor extends HandlerInterceptorAdapter { @Ressource private UserSession userSession; } The user session is defined as: @Component @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) public class UserSession implements Serializable { .... } When using this user session in the interceptor, java throws a NullPointerException for userSession. I think the problem comes from my javaconfig oriented spring configuration: @EnableWebMvc @ComponentScan(basePackages = {"com.whatever"}) @Configuration public class WebAppConfig extends WebMvcConfigurerAdapter { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new MyInterceptor()); } ... } The problem is that interceptor is manually instantied, so without instrumentation for the session proxy mechanism. Thus, the question is: "how can I let Spring detect and instance the scope session proxy bean in the java config of my application ?
tagged with: session
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: interceptor
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21407191
answer count: 2
tagged with: spring

http://stackoverflow.com/comment/32225143
score: 0
type: QuestionComment
has text: `String response = JOptionPane.showInputDialog(…); int chosen = Arrays.asList(options).indexOf(response);`
type: Comment
comment on: http://stackoverflow.com/q/21369460

http://stackoverflow.com/comment/32259203
has text: how can i store all mostFrequent numbers into an array. so i can go through the array and find the most 4 frequent char
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21388576

http://stackoverflow.com/q/21381173
has comment: http://stackoverflow.com/comment/32245395
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32245267
type: AnsweredQuestion
upvote count: 3
linked to: http://stackoverflow.com/q/13729625
accepted answer: http://stackoverflow.com/a/21383530
has comment: http://stackoverflow.com/comment/32249696
has title: updated xml data not updated in the xml file
has body: i have made a method for updating my xml in the xml file by a using a GUI.. but when I update it everything seem to be working fine and the console is printing out the correct things. But when I open the xml file and press refrah nothing is updated. What is my problem? public void updateObjType(String newTxt, int x) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { System.out.println("String value : " + newTxt); System.out.println("Index value : " + x); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse("xmlFiles/CoreDatamodel.xml"); XPath xPath = XPathFactory.newInstance().newXPath(); // Go thru the Object_types in the XML file and get item x. NodeList nodeList = (NodeList) xPath.compile("//OBJECT_TYPE/text()") .evaluate(xmlDocument, XPathConstants.NODESET); // Set new NodeValue nodeList.item(x).setNodeValue(newTxt); String value = nodeList.item(x).getTextContent(); System.out.println(value); } this is the output from the console : Original data : IF150Data Incoming String value : Data Index value : 4 updated data : Data
type: Question
tagged with: java
tagged with: dom
score: 3
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32245681
favorite count: 0
has answer: http://stackoverflow.com/a/21383530
has comment: http://stackoverflow.com/comment/32246720

http://stackoverflow.com/comment/32217754
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21362275
has text: I ended up modifying klinworks a bit to process thousands of images in place, and worked with only two errors, on images I don't really care about. Thanks for the help everyone!
score: 0

http://stackoverflow.com/comment/32464761
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21504063
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/q/21415630
has comment: http://stackoverflow.com/comment/32311689
has comment: http://stackoverflow.com/comment/32309625
tagged with: android
answer count: 1
has body: I programmed a simple App an I alway get the Logcat message (system.err): java.io.FileNotFoundException: /data/cust/xml/hw_launcher_load_icon.xml: open failed: ENOENT (No such file or directory) I do not try to open the file. I do not have the problem on Nexus 4, only on the Huawei P6 (4.2.2). This is very annoying, because I can't see something in the LogCat-box, beause of this message. I tried to see more with DDMS, but no success. Thanks
has title: Android / Huawei: java.io.FileNotFoundException: /data/cust/xml/hw_launcher_load_icon.xml: open failed: ENOENT (No such file or directory)
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/28602073
type: Question
has comment: http://stackoverflow.com/comment/32311283
downvote count: 0
has comment: http://stackoverflow.com/comment/32311338

http://stackoverflow.com/comment/32257921
score: 2
has text: The safest/best way to implement it? To not. Something to think about: by asking for the 3/5/9 characters for a password, you're essentially reducing their password to three characters.
comment on: http://stackoverflow.com/q/21387935
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32257123
comment on: http://stackoverflow.com/a/21386786
has text: Thanks very much for your time. This is don't simply for me, because usually on the left side is statement and on the left side is reference. In this code you change statement (Graphics2D g) and next to statement change reference. I must thinking more time on this clue.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32341498
has text: It works now, thank you. I also forget the method next() and I was going crazy looking for a solution. Thanks for all.
type: Comment
comment on: http://stackoverflow.com/a/21430650
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32412891
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21475613
has text: What sort of tasks do you want to do? It's unusual because the point of a war is that it can run in any appserver and shouldn't know about it.
score: 0

http://stackoverflow.com/q/21512738
type: Question
has answer: http://stackoverflow.com/a/21513040
has answer: http://stackoverflow.com/a/21538128
has comment: http://stackoverflow.com/comment/32478971
has comment: http://stackoverflow.com/comment/32478897
has comment: http://stackoverflow.com/comment/32479247
score: 0
has title: How to test method that only print out message
has answer: http://stackoverflow.com/a/21525977
has body: I have method that print winner in the class Game: public void getWinner(String winner){ System.out.println("WINNER IS " + winner); } How can I test this method so far I have: Game gm = new Game(); // it is declared in @before @test public void test(){ ByteArrayOutputStream outContent = new ByteArrayOutputSystea(); System.setOut(new PrintStream(outContent)); gm.getWinner(Bob); assertEquals("WINNER IS Bob",outContent.toString()); } I have an error message that say org.unit.ComparisonFailuter expected:&lt;WINNER IS Bob[]&gt; but was: &lt;WINNER IS Bob[ ]&gt; Well could you please give me a tip on how to test getWinner method
has comment: http://stackoverflow.com/comment/32479410
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32478935
answer count: 4
has comment: http://stackoverflow.com/comment/32479124
tagged with: java
has comment: http://stackoverflow.com/comment/32478913
has answer: http://stackoverflow.com/a/21512808
tagged with: unit-testing

http://stackoverflow.com/q/21388972
tagged with: jpa
score: 0
possible better answer: http://stackoverflow.com/a/21389252
accepted answer: http://stackoverflow.com/a/21389763
has answer: http://stackoverflow.com/a/21389252
has answer: http://stackoverflow.com/a/21389763
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: How to figure out 2 tables situation
has body: I am trying to learn hibernate+spring, and now I faced with (maybe common) problem. Imagine I have 2 models: @Entity @Table(name="cars") public class Cars { @Column(name="averageSpeed") private double speed; /?? private List&lt;Type&gt; types; // setters and getters } and Type model: @Entity @Table(name="types") public class Type{ // some variables //?// private Cars car; } In this case where you find " //?//" I do not know how to figure it out. What I want to do is to make that car has many Types. It should be OneToMany, but how can I adapt it to this situation? My current solution: add to Cars class: @OneToMany(mappedBy="cars") private List&lt;Type&gt; types; add to Type class: @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="Typeid") Cars car; Is this ok? I want to get that Car can have many types. For example If I have car hybrid, so it can be related with 2 types of car.
type: Question
answer count: 2

http://stackoverflow.com/comment/32265620
type: Comment
has text: "to embed in all 3 colour components `(pp<3)`. Otherwise, we embed in as many components required to reach a count of 8 `(pp<(9-count))`.", BUT i thought we just need embed in to 3 color components, but why need another `(pp<(9-count))`. And sorry still cant really understand why need minus 3, as you said because embed in 3 components, but why minus 3??
score: 0
comment on: http://stackoverflow.com/a/21365300
type: AnswerComment

http://stackoverflow.com/a/21473416
has comment: http://stackoverflow.com/comment/32410125
has comment: http://stackoverflow.com/comment/32409326
score: 0
has comment: http://stackoverflow.com/comment/32409709
has comment: http://stackoverflow.com/comment/32410057
type: Answer
answers question: http://stackoverflow.com/q/21473086
has body: I'm going to assume that there is a reason why you are doing this the long way. To start with, removing the leading 0 of your int values when checking the month, they convert the value to octal, which you don't need... if (monthInt == 1) { month = January; } else if (monthInt == 2) { month = February; } else if (monthInt == 3) { month = March; } else if (monthInt == 4) { month = April; } else if (monthInt == 5) { month = May; } else if (monthInt == 6) { month = June; } else if (monthInt == 7) { month = July; } else if (monthInt == 8) { month = August; } else if (monthInt == 9) { month = September; } else if (monthInt == 10) { month = October; } else if (monthInt == 11) { month = November; } else if (monthInt == 12) { month = December; } else { System.out.println("Invalid Month"); } This... String months = input.substring(0, 1); Will get the first character of the input, but you've asked the user for mm/dd/yyyy, which suggests that you want a two digit value for the month and day...besides, what happens if they type in 12? Instead you could use String[] parts = input.split("/"); to split the input String on the / delimiter, this (if the input is valid) will give you three elements, one each part of the date value. Then you can use... int monthInt = Integer.parseInt(parts[0]); //... int daysInt = Integer.parseInt(parts[1]); //... int yearInt = Integer.parseInt(parts[2]); To convert the individual elements. This raises the question that you should probably validate the input value in some meaningful way BEFORE you try and split it. The month values are all null String January, February, March, April, May, June, July, August, September, October, November, December, month; January = February = March = April = May = June = July = August = September = October = November = December = month = null; Which basically means you output will always start with null. You actually need to assign these some meaningful value. I'll also parrot what every body else has said, unless you h…

http://stackoverflow.com/comment/32382272
type: AnswerComment
comment on: http://stackoverflow.com/a/21458363
score: 0
type: Comment
has text: Yes. That's why I removed the weak references. However there are cases where it might be useful. If you have business objects that are being used elsewhere and are also listeners then you might want to add them to listen to things but still have them GCd. Even that isn't ideal though as you could drop all references to something but it would still be receiving events for an unknown time afterwards and wasting resources. Basically in the end I decided that weak references just aren't useful for listeners.

http://stackoverflow.com/comment/32209213
score: 0
type: Comment
type: QuestionComment
has text: @venergiac See edit. I dont have MaxPermSize set (didn't know what it was)
comment on: http://stackoverflow.com/q/21361042

http://stackoverflow.com/a/21370272
answers question: http://stackoverflow.com/q/21370246
type: Answer
upvote count: 4
has body: indPay is a double and you are trying to store a string in it; try String str = myFormat.format(indPayment[q]);
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21370246

http://stackoverflow.com/comment/32237742
has text: what kind of application you are developing? B/S or C/S? if B/S, maybe you could achieve this by `javascript`, but Im not sure. else, you could develop a client side app to create file on client
score: 0
comment on: http://stackoverflow.com/q/21376738
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21513961
type: Question
has comment: http://stackoverflow.com/comment/32481249
tagged with: readfile
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32482526
has body: I'm attempting to pass a File object to the Scanner constructor. File file = new File("in.txt"); try{ Scanner fileReader = new Scanner(file); } catch(Exception exp){ System.out.println(exp.getMessage()); } I have an in.txt in the root of the project, src and bin directories in case I'm getting the location wrong. I have tried giving absolute paths as well. This line Scanner fileReader = new Scanner(file); always fails. Execution jumps to the end of main. If I misspell the name of the file, I get a FileNotFoundException. I'm on an Ubuntu 12.10 Java 1.7 with OpenJDK
has answer: http://stackoverflow.com/a/21711484
tagged with: java
possible better answer: http://stackoverflow.com/a/21514033
has answer: http://stackoverflow.com/a/21514033
has comment: http://stackoverflow.com/comment/32481271
type: AnsweredQuestion
has title: Unable to read file with Scanner in Java
has comment: http://stackoverflow.com/comment/32481279
accepted answer: http://stackoverflow.com/a/21711484

http://stackoverflow.com/q/21371447
tagged with: hashmap
tagged with: java
score: 0
tagged with: client-server
has title: Java and HashMap - how to add to existing values?
has answer: http://stackoverflow.com/a/21371496
has comment: http://stackoverflow.com/comment/32228268
has body: I am currently working on a client/server application, and I am using a HashMap to identify each client. The client passes in two values to the server - id and x. I am using id as my key, and for each element in the HashMap, I would like to use the value of x to add to the value the specific element with the matching key id. I have the following code: HashMap&lt;Integer, Integer&gt; clients = new HashMap&lt;Integer, Integer&gt;(); int x; sock = serv.accept(); in = new ObjectInputStream(sock.getInputStream()); in2 = sock.getInputStream(); out = new ObjectOutputStream(sock.getOutputStream()); int id = in2.read(); System.out.println("id = " + id); Object o = in.readObject(); System.out.println("Server received " + o); if (o instanceof Integer) { x = ((Integer) o).intValue(); clients.put(id, 0 + x); //doesn't work, I need to be able to add to the existing value instead of overwriting the value } else if (o instanceof String) { clients.put(id, 0); } out.writeObject(clients.get(id)); out.flush(); Could anyone help me here?
has comment: http://stackoverflow.com/comment/136800298
answer count: 5
has answer: http://stackoverflow.com/a/21371509
has answer: http://stackoverflow.com/a/21371515
has answer: http://stackoverflow.com/a/21371992
has comment: http://stackoverflow.com/comment/32228291
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21371509
possible better answer: http://stackoverflow.com/a/53619717
has answer: http://stackoverflow.com/a/53619717
type: Question

http://stackoverflow.com/comment/32476365
has text: Not use if regex is the best solution here. Please take a look at this: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags?rq=1
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21511321
type: QuestionComment

http://stackoverflow.com/a/21598370
accepted answer of: http://stackoverflow.com/q/21474634
upvote count: 1
has body: I don't believe your question has been fully answered so I will give it a try. As far as I can tell you are really asking 4 questions: Where to begin? Is there a plugin for eclipse? Is Flex 3 a paid app? Where to download Flex 3? First let me start off by clarifying a few things. Flex used to be both a framework and an IDE to program in said framework, both produced by Adobe. So we had the Adobe Flex framework and the Eclipse based Adobe Flex Builder IDE. The Flex framework was donated to Apache and thus becoming Apache Flex. The Flex Builder application was re-branded to Flash Builder so it is now Adobe Flash Builder. And of course Flex applications are compiled to code that runs on the Flash Player. Now that we got that out of the way, I will answer you questions in reverse order. 4 - You can download the latest version of the Apache Flex SDK at their website (http://flex.apache.org/). You can download the latest version of Flash Builder from the Adobe site. However the latest version of Flash Builder (4.7) has design view removed from it so to use drag and drop design view you will have to download version 4.6 for which you can find links at this Adobe forum post: http://forums.adobe.com/message/4908407 Adobe software will typically give you a 30 day trial. You mention Flex Builder 3 (Flash Builder was known as Flex Builder a the time of this release) in your questions. That version is no longer available through legitimate means. I would also not recommend using it since it is really outdated and most likely does not support the latest versions of the Flex framework. 3 - Yes, Flex Builder 3 was a paid app and Flash Builder 4.6 is a paid app. Note that you can purchase Flash Builder 4.7 and get a downgrade key from adobe to also use 4.6 at the same time. The reason you would want to use 4.7 is to take advantage of the latest Flex related mobile development. 2 - There was a plugin for eclipse for Flex Builder 3, you had the option to install it as a plugin, which …
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21474634
has comment: http://stackoverflow.com/comment/32673552
score: 1

http://stackoverflow.com/comment/32377275
type: Comment
type: QuestionComment
has text: @icbytes no i use different sockets
comment on: http://stackoverflow.com/q/21455679
score: 0

http://stackoverflow.com/a/21351566
score: 1
has body: From the code, all the centers of your hexagon indeed lie on the line C(t) = (x/2+3*u*t*c, y/2+u*t*s). In your outer loop, you need to generate hexagon centers coordinates that actually lie on a spiral.
answers question: http://stackoverflow.com/q/21351490
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/105268949
type: Comment
score: 2
has text: that is not correct, ACL has no builtin hierarchical check for permissions, so if you do not grant READ, then CREATE Does not imply READ..
comment on: http://stackoverflow.com/a/21415534
type: AnswerComment

http://stackoverflow.com/comment/32225467
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21369921
has text: I wonder how this compile. `split` returns an array. But to answer your question, you need to escape the `.`
score: 0

http://stackoverflow.com/q/21489779
has answer: http://stackoverflow.com/a/60145762
answer count: 5
has answer: http://stackoverflow.com/a/21490427
possible better answer: http://stackoverflow.com/a/21489916
type: AnsweredQuestion
tagged with: list
score: -3
downvote count: 3
has answer: http://stackoverflow.com/a/28391449
has answer: http://stackoverflow.com/a/21489916
type: Question
has comment: http://stackoverflow.com/comment/32438083
has title: modify an array list
has comment: http://stackoverflow.com/comment/32437986
tagged with: java
has comment: http://stackoverflow.com/comment/32438742
has comment: http://stackoverflow.com/comment/32437951
has body: i've been struggling modify an array list that is passed into a method. i can only modify that array list without creating any new array list in that method. here is the problem: Write a method stutter that takes an ArrayList of Strings and an integer k as parameters and that replaces every string with k copies of that string. For example, if the list stores the values ["how", "are", "you?"] before the method is called and k is 4, it should store the values ["how", "how", "how", "how", "are", "are", "are", "are", "you?", "you?", "you?", "you?"] after the method finishes executing. If k is 0 or negative, the list should be empty after the call. One way to do it with creating new array list: public static void stutter(ArrayList&lt;String&gt; list, int k) { ArrayList&lt;String&gt; a = new ArrayList&lt;String&gt;(); String s = ""; if(k &gt; 0) { for(int i = 0; i &lt; list.size(); i++) { s = list.get(i); for(int j = 0; j &lt; k; j++) { a.add(s); } } } } What is one way to modify that ArrayList&lt;String&gt; list only without creating new array list? thanks
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/21490078
accepted answer: http://stackoverflow.com/a/21490078
has comment: http://stackoverflow.com/comment/32437914
favorite count: 0

http://stackoverflow.com/comment/32446470
type: QuestionComment
comment on: http://stackoverflow.com/q/21494053
has text: Code is fine for commons.codec version 1.8 and 1.6, but fails for version 1.3. Anyway there is a method getBytes() in String class, could be used to get byte array of the response String.
score: 0
type: Comment

http://stackoverflow.com/comment/32443393
type: QuestionComment
has text: not sure about the solution you're using, but you may find this somewhat useful http://commons.apache.org/proper/commons-fileupload/using.html
comment on: http://stackoverflow.com/q/21491551
score: 0
type: Comment

http://stackoverflow.com/q/21433767
has answer: http://stackoverflow.com/a/21433867
has body: I'm very new to java and I have two List&lt;String&gt;. When I do : list1.equals(list2) is giving me false. Eventhough the list are same. Is it the right way to check the equality?
linked to: http://stackoverflow.com/q/15608667
has comment: http://stackoverflow.com/comment/32338190
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32338321
duplicate of: http://stackoverflow.com/q/1075656
tagged with: java
has comment: http://stackoverflow.com/comment/32338046
has answer: http://stackoverflow.com/a/21433871
type: Question
has title: How to compare two List String?
has answer: http://stackoverflow.com/a/21433939
has comment: http://stackoverflow.com/comment/32338217
linked to: http://stackoverflow.com/q/1075656
score: 0
answer count: 3

http://stackoverflow.com/comment/41062351
score: 0
comment on: http://stackoverflow.com/a/26064823
type: Comment
has text: Including 4 spaces in front of your code sample causes the code to be shown in a code block. In the case of HTML tags if you do not include the tag is a code block it will not be visible and your answer may be deleted if it appears to have no code in it.
type: AnswerComment

http://stackoverflow.com/q/21358440
score: 0
tagged with: swing
has answer: http://stackoverflow.com/a/21358645
type: Question
has comment: http://stackoverflow.com/comment/32204697
has title: Java Swing--- No errors or exceptions, but program doesn't seem to be working
tagged with: java
has comment: http://stackoverflow.com/comment/32204781
has comment: http://stackoverflow.com/comment/32205818
answer count: 1
has body: Before I start, I've looked over my code for literally 4 hours till I couldn't look any more, and coming here was a last resort, don't want to waste anyones time with dumb questions, but, anyways; Working on my simon game to help teach myself Java, and several problems. First off, the showPattern method seems to be all wonky. Notably, it doesn't seem to be showing the same pattern with one new color each time as intended. Also, when the correct button is clicked, the current/high score is not updating. These are the only errors I've detected so far, there may be others. I'm only posting the entire program so that you can copy and test it. Sorry if it's a little long. I really appreciate any help, please don't be cynical like some of the other people. package simon; import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Color.*; import javax.swing.Timer; /** * Main Class * @author Chris Mailloux */ class Simon { public static void main (String[] args) { window.setBackground(Color.BLACK); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } // Static object creations. public static GameWindow window = new GameWindow(); // Variable declarations. public static final String[] colors = {"Green", "Red", "Yellow", "Blue"}; public static ArrayList&lt;String&gt; pattern = new ArrayList&lt;String&gt;(); public static int currentScore = 0; public static int iterator = 0; public static boolean isPlayerTurn = false; public static int highScore = 0; // TEMPORARY } /** * Class for main game window. * @author Chris */ class GameWindow extends JFrame { GameWindow() { // Set basic properties of frame. setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); setTitle("Simon"); setResizable(true); setLocation(DEFAULT_HORIZONTAL_LOCATION, DEFAULT_VERTICAL_LOCATION); // PLACEHOLDER FOR IMAGE ICON // Adding Border layout helper panel. BorderPanel borderPanel = new BorderPanel(); add(borderPanel); } // Declaring window positioning c…
has comment: http://stackoverflow.com/comment/32204725
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32204786
has comment: http://stackoverflow.com/comment/32204815

http://stackoverflow.com/comment/32231632
comment on: http://stackoverflow.com/a/21372398
score: 1
type: AnswerComment
type: Comment
has text: this is not working, all it copies is "text to clip"

http://stackoverflow.com/comment/32222454
score: 0
type: Comment
has text: OP, if your data structure is not sorted, the time complexity will be O(N) regardless what library or syntax sugar you use.
comment on: http://stackoverflow.com/a/21368216
type: AnswerComment

http://stackoverflow.com/comment/32246507
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21381820
has text: [how-to-convert-java-util-date-to-java-sql-date](http://stackoverflow.com/questions/530012/how-to-convert-java-util-date-to-java-sql-date)
score: 0

http://stackoverflow.com/a/21456334
answers question: http://stackoverflow.com/q/21452039
type: Answer
has body: Manual configuration is required as previously mentioned, as transactions are not persisted in Spring test contexts. Spring reference for this topic can be found here
score: 0

war
tags question: http://stackoverflow.com/q/21420471
tags question: http://stackoverflow.com/q/21387077
tags question: http://stackoverflow.com/q/21361960
tags question: http://stackoverflow.com/q/21350862
tags question: http://stackoverflow.com/q/21462094
tags question: http://stackoverflow.com/q/21464813
type: Tag
tag name: war
tags question: http://stackoverflow.com/q/21458479

http://stackoverflow.com/comment/32398683
comment on: http://stackoverflow.com/q/21467322
score: 0
type: Comment
type: QuestionComment
has text: How to get those constraints deferred? Thanks for the library - I'll try it out in the next project - I must stick to DBUnit in this one.

http://stackoverflow.com/comment/32384284
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21459277
score: 0
has text: @codeMagic - this didn't help it won't let me invoke .size() on an int.

http://stackoverflow.com/comment/32353922
comment on: http://stackoverflow.com/q/21354075
type: Comment
has text: The error message says Attempted to unregister already unregistered input channel. Here are some links discussing similar error as yours: http://stackoverflow.com/questions/16564068/android-activity-dialog-dialog-disappears-unexpectedly http://forums.xamarin.com/discussion/6966/win-death-channel-is-unrecoverably-broken-and-will-be-disposed http://stackoverflow.com/questions/11562161/app-crashes-on-android-4-0-but-not-2-3-strange-exception
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32194451
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21352740
score: 1
has text: Inside my arraylist they do have the value inside..but there's an exception...

http://stackoverflow.com/q/21476039
has comment: http://stackoverflow.com/comment/32414016
tagged with: java
has comment: http://stackoverflow.com/comment/32413505
type: Question
has title: Insertion in Heap in java
tagged with: data-structures
has body: Here is an implementation of a Heap in java without using array but I have some problem in inserting data in it for example when i insert 1,3,2,5,8 it inserts 5,8 two times one as subtree of 3 and another one as subtree of 2. public class Heap { private class Node { private Node left, right,parent; private int key; private Node(int key) { this.key = key; } } private Node root; public void insert(int key) { root = insert(root,key,null); } private Node insert(Node x, int key,Node parent) { if(x == null){ x = new Node(key); x.parent = parent; return x; }if(x.left == null){ x.left = insert(x.left, key,x); }else if (x.right == null) { x.right = insert(x.right, key,x); }else{ x.left = insert(x.left, key,x); x.right = insert(x.right, key,x); } return x; } }
score: 0
answer count: 2
tagged with: heap
has answer: http://stackoverflow.com/a/21476270
has comment: http://stackoverflow.com/comment/32413711
has answer: http://stackoverflow.com/a/21476275
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32413638

http://stackoverflow.com/a/21367809
type: Answer
answers question: http://stackoverflow.com/q/21367778
has body: If you want to pass an Student instance to signUp() method, it should be: public void signUp(Student inStudent) { if(studentRoster.size() == maximumStudents) { studentWaitList.add(inStudent); return; } studentRoster.add(inStudent); } then you will have to call the method like: signUp(new Student(...)); or Student lastStudent = new Student(...); signUp(lastStudent); Note that doing this, the Student instance is being initialized before it is passed to the method signUp. In other words, the constructor is being called before it is passed to the method. Also, you have to declare studentRoster and studentWaitList as fields of the class Section. In public Section(String inName, int inMaximum) { name = inName; maximumStudents = inMaximum; List&lt;Student&gt; studentRoster = new ArrayList&lt;Student&gt;(); List&lt;Student&gt; studentWaitList = new ArrayList&lt;Student&gt;(); } they are being declared as local variables. You may want to do this instead: public class Section { List&lt;Student&gt; studentRoste; List&lt;Student&gt; studentWaitList; public Section(String inName, int inMaximum) { name = inName; maximumStudents = inMaximum; studentRoster = new ArrayList&lt;Student&gt;(); // INITIALIZE studentWaitList = new ArrayList&lt;Student&gt;(); } }
score: 0
has comment: http://stackoverflow.com/comment/32221521

http://stackoverflow.com/comment/32341830
type: Comment
has text: Look Sotirios, I wrote an open source here (https://code.google.com/p/advanced-suggest-select-box/), the java code is compiled to many javascripts versions (one for each browser). Do you really think I went to look into the Google compiler code to understand how it works? it works, and you must rely on it
comment on: http://stackoverflow.com/a/21435019
type: AnswerComment
score: 0

http://stackoverflow.com/a/21494138
answers question: http://stackoverflow.com/q/21494128
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: If the path ui/hands.png is relative to the root of your classpath, then you should change it to /ui/hands.png If you provide a path without a leading / to the Class#getResource(String) method, it uses the package of the Class it's called on. For example, if TextureUI was in package com.graphics, then Java would look for the resource in com/graphics/ui/hands.png relative to the root of the classpath. The javadoc explains it in more detail.

http://stackoverflow.com/q/21486683
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32431918
favorite count: 0
has answer: http://stackoverflow.com/a/21486802
has body: I am trying to implement a TO-DO List an when I click on an item on the list-view I need it to go to another activity. This is my code: TextView tvItem = (TextView) findViewById(R.id.tvItem); tvItem.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent it = new Intent(new Intent(MainActivity.this, ItemView.class)) ; startActivity(it); } Please Help
tagged with: android
has title: Change from one Activity to another
type: AnsweredQuestion
tagged with: list
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/21486802
type: Question
has comment: http://stackoverflow.com/comment/32432637
score: -3
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32437718

http://stackoverflow.com/comment/32445171
type: Comment
type: QuestionComment
has text: It would probably be easier to deploy this using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info). Put the natives in the root of a Jar(s one for each platform) then add the Jars in an appropriate `resources` section in the JNLP. They will be downloaded automatically and added to the run-time native path of the app.
score: 0
comment on: http://stackoverflow.com/q/21455863

http://stackoverflow.com/a/21432924
type: Answer
score: 3
upvote count: 3
has body: JTree.scrollPathToVisible is designed to scroll the minimum amount necessary to bring the path into view, so it is probably desirable to use this default behavior. However, assuming you have specific needs to keep the horizontal scrolling constant, you could implement your own version of scrollPathToVisible: private void scrollPathToVisible(TreePath treePath) { if (treePath != null) { tree.makeVisible(treePath); Rectangle bounds = tree.getPathBounds(treePath); if (bounds != null) { bounds.x = 0; tree.scrollRectToVisible(bounds); } } } This is simply a copy of the default implementation with the additional line to set bounds.x to 0.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21432517
answers question: http://stackoverflow.com/q/21432517

http://stackoverflow.com/comment/32439054
type: QuestionComment
has text: Have you still the stacktrace on screen / some file? It at least tells where it failed on that case.
comment on: http://stackoverflow.com/q/21490123
score: 0
type: Comment

http://stackoverflow.com/comment/32314546
type: Comment
comment on: http://stackoverflow.com/a/21419249
has text: This is a little bit of a hack, but still not a bad idea. It seems a bit funny to change the unit test data itself, though, I understand why. Ideally, something like this would be integrated in to the junit plugin(s). +1
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32425289
type: Comment
score: 0
has text: Now I tried to run but it come up with another problem, eclipse now tell me that 'Selection does not have main type'. Is my eclipse proyect corrupt?
type: AnswerComment
comment on: http://stackoverflow.com/a/21479865

http://stackoverflow.com/comment/32260332
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21389223
has text: I assume by "TUI" you mean "textual user interface"? Other than the phrase "this exercise is far more about writing an interactive application", I see nothing in the code or in your instructions about an interactive application at all. If this is all your teacher gave you, I think you've pretty much done all that you can do already.

http://stackoverflow.com/comment/32392007
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21463906
has text: @TeresaCarrigan is correct. A List can be thought of as an abstraction while an Array is more of an implementation.

http://stackoverflow.com/comment/32262209
type: QuestionComment
score: 2
has text: It seems like you have a common supertype here. Whatever you want to call it: GameObject, BagItem, whatever. There are many games that have this type of thing. For example trading card games like Magic and Pokemon have cards that have pretty distinct purposes but get thrown in a deck together. Also basically any game that has the kind of inventory where the player can put anything in it and move stuff around.
comment on: http://stackoverflow.com/q/21390187
type: Comment

http://stackoverflow.com/q/21352851
upvote count: 1
has comment: http://stackoverflow.com/comment/32194891
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21353132
has comment: http://stackoverflow.com/comment/32195340
has body: I have tried to figure out what the problem is , but seems like I am just getting more n more hopeless by time. The class "Promillekalkulator" is working fine, but the other class "Beregning" is not even opening. The error says I have to fix setCurrentTimeOnView method, but I have exactly the same method on the class "Promillekalkulator". Any help would be really appreciated ://// import java.util.Calendar; import android.app.Activity; import android.app.Dialog; import android.app.TimePickerDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.TimePicker; public class Beregning extends Activity{ TextView pil, klokkeslett; Button btnFerdig; TimePicker timePicker1; private int hour1; private int minute1; private int hour2; private int minute2; Calendar c; static final int TIME_DIALOG_ID = 999; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_beregn); initCommonGui(); setCurrentTimeOnView(); initListeners(); } public void initCommonGui(){ pil = (TextView) findViewById(R.id.pil); klokkeslett = (TextView) findViewById(R.id.klokkeslett); btnFerdig = (Button) findViewById(R.id.btnFerdig); } private void setCurrentTimeOnView() { // TODO Auto-generated method stub c = Calendar.getInstance(); hour1 = c.get(Calendar.HOUR_OF_DAY); minute1 = c.get(Calendar.MINUTE); klokkeslett.setText(new StringBuilder().append(pad(hour1)).append(":") .append(pad(minute1))); timePicker1.setVisibility(View.INVISIBLE); } private void initListeners() { // TODO Auto-generated method stub pil.setOnClickListener(new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View v) { showDialog(TIME_DIALOG_ID); } }); btnFerdig.setOnClickListener(new OnClickListener(){ public void onClick(View v) { otherActivity("resultat_promille"); } }…
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21353132
tagged with: java
has title: I have made 2 android app. with Timepickers, I have written same code but one is working, the other is not
type: Question
has comment: http://stackoverflow.com/comment/32194947
score: -1
has comment: http://stackoverflow.com/comment/32194894
downvote count: 2

testing
tags question: http://stackoverflow.com/q/21458103
tag name: testing
tags question: http://stackoverflow.com/q/21466542
tags question: http://stackoverflow.com/q/21418265
tags question: http://stackoverflow.com/q/21391990
type: Tag
tags question: http://stackoverflow.com/q/21381258
tags question: http://stackoverflow.com/q/21406265
tags question: http://stackoverflow.com/q/21374552
tags question: http://stackoverflow.com/q/21414946
tags question: http://stackoverflow.com/q/21410930
tags question: http://stackoverflow.com/q/21425638

http://stackoverflow.com/q/21475229
has comment: http://stackoverflow.com/comment/32418359
upvote count: 4
tagged with: security
has comment: http://stackoverflow.com/comment/32821465
tagged with: jaas
downvote count: 0
has comment: http://stackoverflow.com/comment/32415483
favorite count: 0
has comment: http://stackoverflow.com/comment/32847837
has comment: http://stackoverflow.com/comment/32420097
has comment: http://stackoverflow.com/comment/32417435
type: Question
has title: Cannot get password in custom LoginModule
has body: I'm trying to write my own LoginModule named CustomLoginModule for Wildfly 8.0.0.CR1 which is registered for a security-domain in the standalone.xml: &lt;security-domain name="other" cache-type="default"&gt; &lt;authentication&gt; &lt;login-module code="Remoting" flag="optional"&gt; &lt;module-option name="password-stacking" value="useFirstPass"/&gt; &lt;login-module&gt; &lt;login-module code="com.someExample.CustomLoginModule" flag="required"&gt; &lt;module-option name="password-stacking" value="useFirstPass"/&gt; &lt;/login-module&gt; &lt;/authentication&gt; &lt;/security-domain&gt; In my remote client I'm using the following jboss-ejb-client.properties: endpoint.name=client-endpoint remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.host=[...] remote.connection.default.port=[...] remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false remote.connection.default.username=myUserName remote.connection.default.password=abcde Obtaining the InitialContext in the client looks like: Properties props = new Properties(); props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); InitialContext ctx = new InitialContext(props); Basically this works fine and my login-module is invoked when accessing an EJB via the remote-interface which is annotated with the correct @SecurityDomain. In the login-module, I can read the username using the callback or the sharedState which is passed to the initialize method. But I was not able to get the provided password (in this example I would expect to get shomewhere the string abcde). I have already tried several things to get the password. Via the callback (like I did on JBoss 5), via the given sharedState, ... Even if I derive from the org.jboss.security.auth.spi.UsernamePasswordLoginModule or when using code from the JBoss-Quickstart examples, I cannot see the password which has been set at the client. Instead, I always …
score: 4
has comment: http://stackoverflow.com/comment/32413686
has comment: http://stackoverflow.com/comment/32472250
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/21556194
answer count: 1
tagged with: ejb
has comment: http://stackoverflow.com/comment/32416172
type: UnansweredQuestion

http://stackoverflow.com/a/21429970
answers question: http://stackoverflow.com/q/21429749
score: 0
has comment: http://stackoverflow.com/comment/32364691
has body: Use do while loop and by using some condition you can terminate the loop like you can prompt user for "Do you want to continue(y/n)" and depending upon value you can iterate again. EDIT do { //your code goes here System.out.println("Do you want to continue(y/n)?"); isContinue = console.next(); }while(isContinue = "Y" || isContinue = "y") you can use break statement after checking firstname is -1 in if condition
has comment: http://stackoverflow.com/comment/32331968
has comment: http://stackoverflow.com/comment/32332265
has comment: http://stackoverflow.com/comment/32332636
type: Answer
has comment: http://stackoverflow.com/comment/32332132
has comment: http://stackoverflow.com/comment/32331779

http://stackoverflow.com/q/21438701
favorite count: 0
has title: How to make a JSP page NOT to forward to servlet without user's input?
has comment: http://stackoverflow.com/comment/32347193
possible better answer: http://stackoverflow.com/a/21439028
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21439028
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32347285
has comment: http://stackoverflow.com/comment/32347263
has comment: http://stackoverflow.com/comment/32347369
has answer: http://stackoverflow.com/a/21438846
tagged with: jsp
accepted answer: http://stackoverflow.com/a/21438846
score: -1
has comment: http://stackoverflow.com/comment/32347316
tagged with: servlets
answer count: 2
downvote count: 2
has body: Consider the following JSP : <%@ page language="java" contentType="text/html; charset=windows-1256" pageEncoding="windows-1256" %> Bank application Web Bank application Login Page - please enter your Username and Password * Username: * Password : Visual look : How can I make the JSP to stay put and not forward to the Login servlet (to check the correctness of the input) , until the user had entered both Username and Password ?
upvote count: 1

http://stackoverflow.com/a/26055361
score: 18
downvote count: 0
answers question: http://stackoverflow.com/q/21493634
type: Answer
has body: You need to set the content: .text-area .content{ -fx-background-color: black; } ... Or see this answer maybe: Transparent background of a textarea in JavaFX 8
upvote count: 18

http://stackoverflow.com/q/21488252
tagged with: java
has comment: http://stackoverflow.com/comment/32435429
has body: I am trying to use servletcontext.getRealPath in my Util class to load a file resource (Not part of unit testing) but it does not work. I tried both to use "implements ServletContextAware": @Component public class Utils implements ServletContextAware{ private ServletContext servletContext; @Override public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; System.out.println("**** "+servletContext); } } Which throws NPE since servletcontext is not assigned by spring. And the @Autowired route: @Component public class Utils{ @Autowired private ServletContext servletContext; Which throws NoSuchBeanDefinitionException when tomcat is being starting: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.servlet.ServletContext] found for dependency: expected at le ast 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} I am adding the my initialization code in case I am doing something wrong which prevents Spring to inject the right bean. public class WebAppInitializer implements WebApplicationInitializer { private static Logger LOG = LoggerFactory.getLogger(WebAppInitializer.class); @Override public void onStartup(ServletContext servletContext) { WebApplicationContext rootContext = createRootContext(servletContext); configureSpringMvc(servletContext, rootContext); FilterRegistration.Dynamic corsFilter = servletContext.addFilter("corsFilter", CORSFilter.class); corsFilter.addMappingForUrlPatterns(null, false, "/*"); // configureSpringSecurity(servletContext, rootContext); } private WebApplicationContext createRootContext(ServletContext servletContext) { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); // rootContext.register(CoreConfig.class, SecurityConfig.class); rootContext.register(CoreConfig.class); rootContext.ref…
has answer: http://stackoverflow.com/a/21488914
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 3
has comment: http://stackoverflow.com/comment/32435556
tagged with: spring
accepted answer: http://stackoverflow.com/a/21488914
tagged with: spring-mvc
has title: Can not assign ServletContext spring 3
linked to: http://stackoverflow.com/q/10042734
upvote count: 3
tagged with: autowired
answer count: 1
has comment: http://stackoverflow.com/comment/32435230
linked to: http://stackoverflow.com/q/5739491

http://stackoverflow.com/comment/32410201
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21466095
type: Comment
has text: Thanks Peter for the answer. I will try jmap -histo to dig more into the reason, and also see if any tools I can use as suggested by you. However I would like to understand if NGC = NGCMX and OGC = OGCMX (as in my current case), is it a matter of concern and increasing memory, can be likely bring down NGC and OGC less than NGCMX and OGCMX values respectively ? Note : I have got these values with execution of jstat -gccapacity <PID>.

http://stackoverflow.com/comment/32277624
type: QuestionComment
comment on: http://stackoverflow.com/q/21399001
score: 1
has text: You could always add it to itself `3` times and then add anothe `1/2` of it
type: Comment

http://stackoverflow.com/q/21481034
favorite count: 0
has title: How do I transform events in Flume and send them to another channel?
type: Question
upvote count: 2
answer count: 1
tagged with: flume
linked to: http://stackoverflow.com/q/21524300
tagged with: java
has answer: http://stackoverflow.com/a/21488032
has body: Flume has some ready components to transform events before pushing them further - like RegexHbaseEventSerializer you can stick into an HBaseSink. Also, it's easy to provide a custom serializer. I want to process events and send them to the next channel. Most close to what I want is Regex Extractor Interceptor , which accepts a custom serialiser for regexp matches. But it does not substitute event body, just appends new headers with results to events, thus making output flow heavier. I'd like to accept big sized events, like zipped html > 5KB, parse them and put many slim messages, like urls found in pages, to another channel. channel1 channel2 HtmlPagesSource -----------&gt; PageParser -----------&gt; WhateverSinkGoesNext html urls Do I have to write a custom sink for that, or is there some type of component that accepts custom serializers, like HBaseSink? If I write a sink, do I just use Flume client SDK and call append(Event) or appendBatch(List) when processing incoming events?
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21488032
type: AnsweredQuestion

http://stackoverflow.com/q/21361492
has answer: http://stackoverflow.com/a/72482537
has comment: http://stackoverflow.com/comment/32209944
type: Question
has comment: http://stackoverflow.com/comment/32210007
has comment: http://stackoverflow.com/comment/32210174
has body: So I'm writing a small program but my while-loop does not seem to work, I've looked all over the internet for tutorials and I know that I need to increase J but I can't seem to figure out where because when I get one thing fixed another part stops working! Could someone please tell me what I have to do to fix this? int j=0;//which group we're checking while(response==0){ { if(inArray(quote.toLowerCase(),greetings[j*2])) { response=2; int r=(int)Math.floor(Math.random()*greetings[(j*2)+1].length); addText("\n--&gt;Miku:\t"+greetings[(j*2)+1][r]); try (BufferedReader br = new BufferedReader(new FileReader("mikuname.txt"))) { String name; while ((name = br.readLine()) != null) { addText(name +"!"); } } catch (IOException e1) { // Do something with the IO problem that occurred while reading the file } } } if(response==0) { if(inArray(quote.toLowerCase(),chatBot[j*2])) { response=2; int r=(int)Math.floor(Math.random()*chatBot[(j*2)+1].length); addText("\n--&gt;Miku:\t"+chatBot[(j*2)+1][r]); } } if(response==0) { response=1; } }
has title: Java loop not working
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32209936
type: UnansweredQuestion
answer count: 2
tagged with: while-loop
has comment: http://stackoverflow.com/comment/32209932
has answer: http://stackoverflow.com/a/21361529

http://stackoverflow.com/a/21403121
has comment: http://stackoverflow.com/comment/32348478
answers question: http://stackoverflow.com/q/21370135
score: 0
type: AcceptedAnswer
has body: I usually work with strings on the backend side and then JSONObject json = new JSONObject(s); would create a json obj from that s (you don't need to decode). On the client side I believe you just need to escape the " with something like a replaceAll function applied on that string
type: Answer
accepted answer of: http://stackoverflow.com/q/21370135

http://stackoverflow.com/comment/32317627
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21388819
has text: Now it's clear to me that `getObjectCopy()` really does need to return `Copyable` everywhere.

http://stackoverflow.com/a/21485529
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21485361
type: Answer
accepted answer of: http://stackoverflow.com/q/21485361
score: 1
upvote count: 1
has body: You basically just add one and send either a Message or a Runnable. private final Handler mUiThreadHandler = new Handler(Looper.getMainLooper()); void fromAnyThread() { final String importantDataFromBackGroundThread = "!!!"; mUiThreadHandler.post(new Runnable() { @Override public void run() { System.out.println("Hi from Ui Thread:" + importantDataFromBackGroundThread); } }); } The Handler handles all messages / runnables within the Thread it runs in. If you specify Looper.getMainLooper() you are guaranteed that this is the main thread.

http://stackoverflow.com/a/21353329
answers question: http://stackoverflow.com/q/21353113
type: Answer
has body: What you see is the fact that floating point values are not very accurate and you should not for example compare them using == operator. For comparisons you should use epsilon compares, ie. for two floating point values f1 and f2 if (Math.abs(f1 - f2) &lt; EPSILON ) { // they are equal } Where EPSILON is some very small floating point value
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32195400

http://stackoverflow.com/comment/32415894
has text: well i'm glad i could provide a little help!!! now with working gps you certainly will find your way around!!!
type: AnswerComment
comment on: http://stackoverflow.com/a/21472933
score: 0
type: Comment

http://stackoverflow.com/q/21491111
has comment: http://stackoverflow.com/comment/32440450
score: 0
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21491608
tagged with: java-6
has body: I just got a java project from a friend of mine but whenever i go to open it in net beans i get an error message saying that "Problem: the project uses the java platform called JDK_1.6 but this platform was not found solution: click resolve and create new platform called JDK_1.6" can anyone help me open the project?
tagged with: netbeans
type: Question
answer count: 2
has title: Error message when opening a file
has answer: http://stackoverflow.com/a/21492279

http://stackoverflow.com/comment/105337113
comment on: http://stackoverflow.com/a/21415534
type: AnswerComment
has text: @Levancho, once again you are wrong, RoleHierarchyImpl IS the implementation, not an interface, there is nothing additional to implement. Yes, it needs to be configured just like the rest of Spring security, if you don’t configure yours, that’s on you.
score: 0
type: Comment

http://stackoverflow.com/a/21413591
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21392674
has body: I updated my App#Main's third unit of work to call transaction.commit() and session.close() per koitoer's and Andrei I's suggestions. Additionally, I modified my @GeneratedValue annotation (shown below). // Third unit of work Session thirdSession = HibernateUtil.getSessionFactory().openSession(); Transaction thirdTransaction = thirdSession.beginTransaction(); ... thirdTransaction.commit(); // &lt;---- added thirdSession.close(); // &lt;---- added //Shutting down the application HibernateUtil.shutdown(); Then, I changed my Message.java's's @GeneratedValue annotation to use Identity per this answer: https://stackoverflow.com/a/10628341/409976. public class Message { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "MESSAGE_ID") private Long id; When I tested out this change, I got an error: rg.postgresql.util.PSQLException: ERROR: value too long for type character varying(25) As a result, I updated my CreateTable.sql script: DROP TABLE IF EXISTS messages; create table messages( message_id serial, message_text varchar(50) NOT NULL, next_message_id int ); Finally, I re-ran the Main method of App.java successfully: messages=# select * from messages; message_id | message_text | next_message_id ------------+--------------------------------+----------------- 2 | take me to your leader(please) | 1 | greetings Earthling | 2 (2 rows)
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21392674

http://stackoverflow.com/comment/32270495
type: Comment
type: QuestionComment
has text: Use `String`'s `equals` method to compare string values, not the `==` operator.
score: 1
comment on: http://stackoverflow.com/q/21394716

http://stackoverflow.com/q/21362680
has comment: http://stackoverflow.com/comment/32212046
has comment: http://stackoverflow.com/comment/32212050
favorite count: 0
has comment: http://stackoverflow.com/comment/32212097
duplicate of: http://stackoverflow.com/q/20797012
has body: private String boundaries = "(x &gt; 750) &amp; (x &lt; 900)"; if (boundaries) { //Do stuff } I wanted to be able to use the string as the variable in the if clause, and then change the string independently without having to edit the code itself. The example idea doesn't work, I was wondering if there is a mistake in it or another way to do this without using strings. Thank you.
upvote count: 4
duplicate of: http://stackoverflow.com/q/935175
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21362721
downvote count: 0
linked to: http://stackoverflow.com/q/935175
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32212251
linked to: http://stackoverflow.com/q/20797012
accepted answer: http://stackoverflow.com/a/21362773
has title: Using a string as a variable clause in an if statement
score: 4
has comment: http://stackoverflow.com/comment/32211997
has answer: http://stackoverflow.com/a/21362721
has answer: http://stackoverflow.com/a/21362773
answer count: 2

http://stackoverflow.com/comment/32420753
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21477540
has text: -1 and voted to close: sorry, but without further details of what you _really_ want to achieve this question isn't answerable (though it attracts answers in all shades of wrongness ;-)

http://stackoverflow.com/a/33959081
downvote count: 0
has body: I got the same error, and this worked for me I configured path variable in.bashrc. export HADOOP_HOME=/opt/hadoop export PATH= $PATH:$HADOOP_HOME/bin Sometime restarting your machine can resolve the issue ,only if you have configured everything correct.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21369102

http://stackoverflow.com/q/21409854
has title: Changing the Typeface of Text String
tagged with: android
accepted answer: http://stackoverflow.com/a/21409944
type: AnsweredQuestion
tagged with: java
type: Question
has body: I created a class, which extends drawable class and has a custom text in it. Now, I want to change the Typeface of the text, and has a *.ttf file in assests/fonts. But I can't use createFromAsset() method, because of the method getContext().getAssets() couldn't be called. is there any way to change the typeface of the text?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21409944

http://stackoverflow.com/comment/32207441
score: 0
has text: Thanks Erwin for the suggestion.. Customer can pass different values from different thread to `TestingClient` class which means they need to use `ClientKey` class to make the input parameters always as userId will keep on changing for each call they are passing and same with ParameterMap as well.. And `LinkedHashMap` code was an example how customer will call us from there application. They can have ConcurrentHashMap at that place as it there code how they are making a call to us..
type: QuestionComment
comment on: http://stackoverflow.com/q/21359770
type: Comment

http://stackoverflow.com/q/21375150
has body: In an application, user can upload any pdf file and which has dimensions of 8.46" x 10.97". As per our application dimensions should be 8.5" x 11". Question is, How to re-size the existing pdf page size to set 8.5" x 11"? I have to fix by code, not manually or commend line or external software. Please let me know which java supporting jar (free version) providing functionality to achieve this or through simple java fix also fine.
has answer: http://stackoverflow.com/a/21378162
favorite count: 0
possible better answer: http://stackoverflow.com/a/21375232
accepted answer: http://stackoverflow.com/a/21378162
has answer: http://stackoverflow.com/a/21375232
has comment: http://stackoverflow.com/comment/32235425
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/21608598
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/32237614
has title: How to resize existing pdf page size
type: Question
has comment: http://stackoverflow.com/comment/32242605
upvote count: 5
linked to: http://stackoverflow.com/q/17685132
has comment: http://stackoverflow.com/comment/32235363
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf

http://stackoverflow.com/a/21425863
upvote count: 4
has body: Java File IO library is based on Decorator pattern. Java Collections sort() uses Strategy pattern. There is inbuilt support for Observer Pattern in JDK, By using Observable class and Observer interface, you can have Observer Pattern Singleton Pattern in used in Runtime class, where you can have only one object of type 'Runtime', by accessing getRuntime() method.
downvote count: 0
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/21425709
answers question: http://stackoverflow.com/q/21425709
type: Answer

http://stackoverflow.com/comment/32409346
has text: except that if you would remove it that i have already checked is working fine just need the logic which can replace these question marks. Question mark is to map the part for which i need the logic.
comment on: http://stackoverflow.com/q/21473394
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21387134
downvote count: 1
has comment: http://stackoverflow.com/comment/32991466
score: 1
answers question: http://stackoverflow.com/q/21386371
has body: Solution to the particular problem 0) Turn on Gradle plugin in Preferences -> Plugins 1) Create any Java project (Groovy, Maven, plain Java) 2) Create build.gradle file in base directory 3) Open JetGradle view and click Add. Then select your build file 4) When you do this first time, IDEA will prompt you to locate your local Gradle distribution (you may also change it later in Preferences -> Gradle settings) As for project structure, Gradle follows Maven conventions, so in the build file you just write: apply plugin: 'java' and everything just works. Create a "Gradle" project and add "Groovy" module to it I can manage dependencies and plugins, but the file structure is screwed up. The code goes into a sub-folder of the project (aka the name of the module) I cannot directly add folders to the "src" of the module. When I copy them into the src folder they are considered package names. Explanation of what is the reason for this paradigm/structure shift in IDEA? The main reason is to provide possibility of logical decomposition of your application into separate modules, e.g. app-core, app-web, app-ear etc. Each of this modules produces an artifact: jar, war, ear. Compare this with other IDEs, say Eclipse, where you would have several different projects (perhaps dependent on each other) to accomplish the same thing. So basically, you may think of IDEA module as of Eclipse project (roughly). Also this greatly simplifies usage of Maven multi-module projects. As for the src folder: IDEA lets you mark directories inside the module "content root" (base directory of the module) as Source, Test Source or Excluded. If src is marked as Source directory, then obviously everything inside is treated as packages and sources.
type: Answer
has comment: http://stackoverflow.com/comment/32262617
upvote count: 2
has comment: http://stackoverflow.com/comment/32263702

http://stackoverflow.com/comment/32411306
type: Comment
score: 0
type: AnswerComment
has text: :Buddy Thanks for the answer , I have tried one link and it is working but it is not with the .pls file link which I want to be be used for my application. Is there any parsing mechanism needed ?
comment on: http://stackoverflow.com/a/21474264

http://stackoverflow.com/q/21356632
accepted answer: http://stackoverflow.com/a/21356724
favorite count: 0
answer count: 5
tagged with: double
has answer: http://stackoverflow.com/a/21356708
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21356826
possible better answer: http://stackoverflow.com/a/21356678
downvote count: 0
has title: How to Average Numbers from Command Line in Java
has answer: http://stackoverflow.com/a/21356678
tagged with: java
has body: This is a school assignment. I truly want to understand what I am doing. We are instructed to make a program in Java that runs from the command line. After a user enters numbers the program should then start, send a welcome message, and then tell the user what the average of his numbers is. I believe the point of this is to illustrate how args is used in the program and to help familiarize us with Java. This is the explanation I have currently. I can run this from the command line, I know how to add a welcome message as well... But I do not understand the code well enough to be able to add in the ability to average the numbers when a user adds the arguments. public class ArgumentExample { public static void main(String[] args) { if( args.length == 1 || args.length &gt; 1 ){ System.out.println( args[0]); } if( args.length &gt; 1 ) { for( int i = 1; i &lt; args.length; i++ ){ System.out.println(args[i]); } } } }
tagged with: average
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21356787
has answer: http://stackoverflow.com/a/21356724

textfield
tags question: http://stackoverflow.com/q/21495886
type: Tag
tags question: http://stackoverflow.com/q/21431254
tags question: http://stackoverflow.com/q/21368895
tags question: http://stackoverflow.com/q/21375554
tags question: http://stackoverflow.com/q/21459636
tag name: textfield
tags question: http://stackoverflow.com/q/21416741

http://stackoverflow.com/q/21398325
has answer: http://stackoverflow.com/a/21399779
accepted answer: http://stackoverflow.com/a/21399779
answer count: 3
has answer: http://stackoverflow.com/a/21398495
has comment: http://stackoverflow.com/comment/32276565
linked to: http://stackoverflow.com/q/355167
type: AnsweredQuestion
downvote count: 0
score: 6
type: Question
has answer: http://stackoverflow.com/a/25215671
has title: Is this necessary to make two class of this java program?
tagged with: java
upvote count: 6
possible better answer: http://stackoverflow.com/a/21398495
has comment: http://stackoverflow.com/comment/32282164
favorite count: 0
has body: Is it important to save all class code as individual .java files like following way? Outer.java, Inner.java, Test.java Or can I make a single java file as Test.java. Please explain anonymous class, how can we create anonymous class in java, and what is the advantage/disadvantage over normal class? class Outer { private int data = 50; class Inner { void msg() { System.out.println("Data is: " + data); } } } class Test { public static void main(String args[]) { Outer obj = new Outer(); Outer.Inner in = obj.new Inner(); in.msg(); } }
has comment: http://stackoverflow.com/comment/32276793
has comment: http://stackoverflow.com/comment/32276521

http://stackoverflow.com/q/21432137
answer count: 2
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/21440719
has answer: http://stackoverflow.com/a/21440719
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2639018
tagged with: junit
has body: I've got strange problem: during developing Spring MVC app I've properly configured hibernate and can make different CRUD operations. But then I try write little JUnit test for checking correctness of queries and got confusing situation: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:155) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:100) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:326) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCa…
has answer: http://stackoverflow.com/a/21432612
has title: Spring MVC Hibernate JUnit Test failed Caused by: java.net.ConnectException: Connection timed out: connect
type: Question
accepted answer: http://stackoverflow.com/a/21432612
tagged with: spring
tagged with: spring-mvc
score: 0

web-services
tags question: http://stackoverflow.com/q/21433146
tags question: http://stackoverflow.com/q/21444720
type: Tag
tags question: http://stackoverflow.com/q/21441124
tags question: http://stackoverflow.com/q/21392170
tags question: http://stackoverflow.com/q/21484221
tags question: http://stackoverflow.com/q/21414782
tags question: http://stackoverflow.com/q/21495212
tags question: http://stackoverflow.com/q/21461504
tags question: http://stackoverflow.com/q/21458417
tags question: http://stackoverflow.com/q/21352392
tags question: http://stackoverflow.com/q/21380475
tags question: http://stackoverflow.com/q/21389134
tags question: http://stackoverflow.com/q/21492255
tags question: http://stackoverflow.com/q/21471542
tags question: http://stackoverflow.com/q/21383373
tags question: http://stackoverflow.com/q/21362370
tags question: http://stackoverflow.com/q/21498367
tags question: http://stackoverflow.com/q/21391347
tags question: http://stackoverflow.com/q/21431677
tags question: http://stackoverflow.com/q/21453879
tags question: http://stackoverflow.com/q/21389346
tags question: http://stackoverflow.com/q/21360005
tags question: http://stackoverflow.com/q/21483141
tags question: http://stackoverflow.com/q/21414522
tags question: http://stackoverflow.com/q/21364698
tags question: http://stackoverflow.com/q/21450165
tags question: http://stackoverflow.com/q/21385197
tags question: http://stackoverflow.com/q/21402346
tags question: http://stackoverflow.com/q/21460131
tags question: http://stackoverflow.com/q/21421793
tags question: http://stackoverflow.com/q/21490885
tags question: http://stackoverflow.com/q/21398760
tags question: http://stackoverflow.com/q/21438221
tag name: web-services
tags question: http://stackoverflow.com/q/21429873
tags question: http://stackoverflow.com/q/21403378
tags question: http://stackoverflow.com/q/21381305
tags question: http://stackoverflow.com/q/21373885
tags question: http://stackoverflow.com/q/21453887
tags question: http://stackoverflow.com/q/21417907

http://stackoverflow.com/q/21364446
type: UnansweredQuestion
tagged with: android
has title: Can OAuth be implemented with two factor authentication using a mobile device and QRCodes?
score: 1
tagged with: java
tagged with: oauth-2.0
has answer: http://stackoverflow.com/a/21364974
has body: I've been looking into OAuth to see if it can be used in a project I'm working on. I'm starting to doubt if its possible. It's based on two factor authentication with a mobile device. Essentially I'll have a login page where upon successful login a QRCode will appear on screen. The user will be prompted to scan this code with their android device (An app I'm making myself) which will authenticate them with the server. I'm not sure if this fits with the OAuth paradigm so I'm thinking I may need to design my own protocol instead. Any advice appreciated.
upvote count: 1
type: Question
tagged with: qr-code
answer count: 1
downvote count: 0
favorite count: 0
tagged with: oauth

drawtext
tags question: http://stackoverflow.com/q/21363394
tag name: drawtext
type: Tag

http://stackoverflow.com/comment/32444306
comment on: http://stackoverflow.com/a/21493128
score: 1
has text: While it is true that using the `-=` operator in the example is pointless (hardly a reason to get 0 points), the statement that the order of evaluation is unspecified is false. The code in the question is actually correct according to the JLS. See http://stackoverflow.com/questions/6800590/what-are-the-rules-for-evaluation-order-in-java
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32377121
type: QuestionComment
has text: Do You use the same socket for both ports?
type: Comment
comment on: http://stackoverflow.com/q/21455679
score: 0

http://stackoverflow.com/comment/32473442
type: AnswerComment
has text: thanks a lot for the detailed answer, I am a bit confused here, in the DateTime dateTime step we already have the date in ISO8601 Format as shown from the println, so why we did the String iso8601String step to retrieve the date in ISO8601 format again?
type: Comment
comment on: http://stackoverflow.com/a/21506744
score: 0

http://stackoverflow.com/comment/32344808
type: QuestionComment
has text: but aren’t there exceptions were the largest 2x2 grid may not lead to the largest 3x3 grid?
comment on: http://stackoverflow.com/q/21437362
score: 0
type: Comment

http://stackoverflow.com/q/21502124
has comment: http://stackoverflow.com/comment/32490479
tagged with: groovy
tagged with: sql
has comment: http://stackoverflow.com/comment/32480114
has title: Using Derby from Groovy
favorite count: 0
has body: I'm writing some Groovy scripts to parse my bank statements and load them into a derby db. I'm stuck trying to get a connection to my derby db from Groovy. I'm using documentation found here. I'm attempting to add derby to the class path dynamically but it's failing. import java.sql.* def env = System.getenv() def sql try{ DriverManager.getConnection('jdbc:derby:;shutdown=true') } catch (SQLException se){ def derbyURL = new File("${env['JAVA_HOME']}/db/lib/derby.jar") println "Loading derby: ${derbyURL.exists()}" this.class.classLoader.rootLoader.addURL(derbyURL.toURL()) def sqlClass = Thread.currentThread().contextClassLoader.loadClass('groovy.sql.Sql') sql = sqlClass."newInstance"("jdbc:derby:cliffdb;") } From this I get Loading derby: true Exception thrown Feb 01, 2014 10:47:38 AM org.codehaus.groovy.runtime.StackTraceUtils sanitize WARNING: Sanitizing stacktrace: java.sql.SQLException: No suitable driver found for jdbc:derby:cliffdb; at java.sql.DriverManager.getConnection(DriverManager.java:596) at java.sql.DriverManager.getConnection(DriverManager.java:233) at groovy.sql.Sql.newInstance(Sql.java:232) at groovy.sql.Sql$newInstance.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at BankStatementReader.run(BankStatementReader.groovy:13) I've tried all variations of Sql.newInstance from directly calling it to loading the Sql class from the root class loader to now loading the Sql class from the current thread context classloader. What am I missing and why does this not work when the Derby jar is indeed present? ** Update ** I just moved my Sql loading code into a separate callable class and have transformed my original script into a full IntelliJ Groovy project. The code below is working thanks to the answer provided in the comm…
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/41352314
has comment: http://stackoverflow.com/comment/32460112
tagged with: java
tagged with: derby
has comment: http://stackoverflow.com/comment/32460832
has comment: http://stackoverflow.com/comment/32490393
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/a/70051695
type: Answer
answers question: http://stackoverflow.com/q/21457546
score: 0
has body: Gradle installDebug menu has disppared, manual add Gradle configuration can work!

http://stackoverflow.com/comment/32691610
has text: Hi Reti, I got some problem with decode part. Could you help me with this, because i could find the problem is. [link](http://stackoverflow.com/questions/21633505/exception-in-thread-thread-java-lang-outofmemoryerror-requested-array-size-ex)
score: 0
comment on: http://stackoverflow.com/a/21365300
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21408565
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21437918
has body: I am using a MassIndexer to index my documents. I have a method annotated with @Transient that references a lazily initialized @OneToMany collection like this: @OneToMany @JoinColumns({ @JoinColumn(name = "insertForeignKeyHere", referencedColumnName = "insertPrimaryKeyHere"),... }) @NotFound(action = NotFoundAction.IGNORE) public Set&lt;AdditionalOption&gt; getAdditionalOptions() { return this.additionalOptions; } @Transient @IndexedEmbedded public Set&lt;AdditionalOption&gt; getActiveAdditionalOptions() { Set&lt;AdditionalOption&gt; ret = new HashSet&lt;&gt;(); //the next line produces the error for (AdditionalOption addOpt : this.getAdditionalOptions()) { //do stuff. } return ret; } Whenever I try to Index this document with a MassIndexer and with no @OneToMany(fetch = FetchType.EAGER) I get this Exception: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: &lt;...>, could not initialize proxy - no Session Any thoughts on how to do this without the EAGER fetching? (I have 4 or 5 collections that would need eager fetching if this didn't work differently -> HUGE performance problems) Thanks in advance. btw: I am using &lt;hibernate.version&gt;4.3.1.Final&lt;/hibernate.version&gt; &lt;hibernate.search.version&gt;4.5.0.Alpha2&lt;/hibernate.search.version&gt; &lt;lucene.version&gt;3.6.2&lt;/lucene.version&gt;
type: Question
tagged with: hibernate-search
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21437918
has title: Transient method in Hibernate Search referencing proxy while MassIndexing
has answer: http://stackoverflow.com/a/21411611
possible better answer: http://stackoverflow.com/a/21411611

http://stackoverflow.com/a/21362509
type: Answer
score: 2
downvote count: 0
has body: This is a code (Java 7 style, try-with-resources, more laconic style) to connect and retrieve data from your DB. public static final String SELECT_QUERY = "SELECT * FROM your_table_name"; public static void main(String[] args) { String host = "jdbc:derby://localhost:1527/Employees"; String uName = "root"; String uPass = "password"; try (Connection conn = DriverManager.getConnection(host, uName, uPass); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT_QUERY)) { while (rs.next()) { //read your lines one ofter one int id = rs.getInt("id"); String somePropertyValue = rs.getInt("some_column_name"); // etc. } } catch (SQLException e) { e.printStackTrace(); } } Also, add JDBC driver (*.jar file) in your classpath if you are running from command line, or add this jar to your project, if you are working in IDE (Eclipse, IDEA etc. It is a little bit different for each one). BTW, How your code compiled if variable declaration is after they using? That code can not be compiled even.
answers question: http://stackoverflow.com/q/21361781
upvote count: 2

http://stackoverflow.com/comment/32218453
type: Comment
comment on: http://stackoverflow.com/a/21357198
score: 0
type: AnswerComment
has text: So I downloaded `Android Studio`, I set `classpath 'com.android.tools.build:gradle:0.8.+'`, I set the `gradle` to `gradle 1.10`, but I get this message `Can't find org.gradle.api.artifacts.result.ResolvedModuleVersionResult`. What can I do ?

http://stackoverflow.com/a/21467750
downvote count: 0
has body: @Override public void onBackPressed() { if (! layout.isEmpty() ) { saveAndFinish(); } } I made up this method layout.isEmpty(). Change layout.isEmpty() with the appropriate check.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21467708

http://stackoverflow.com/a/21397064
has body: Your class works perfectly! Just made some fixes import java.util.HashMap; import java.util.Map; public class Building { String buildingName = null; private static Map&lt;String, Classroom&gt; rooms = new HashMap&lt;String, Classroom&gt;(); public Building() { } public Building(String name) { buildingName = name; } /** * @return the rooms */ public Map&lt;String, Classroom&gt; getRooms() { System.out.println("room size from building.java:" + rooms.size()); return rooms; } public Classroom getRoom(String roomName) { if (rooms.containsKey(roomName)) { return rooms.get(roomName); } return new Classroom("null"); } /** * @param rooms the rooms to set */ public void setRooms(Map&lt;String, Classroom&gt; rooms) { this.rooms = rooms; // did you use this method to initialize map? } public void addRoom(String roomNumber) { rooms.put(roomNumber, new Classroom(roomNumber)); System.out.println("Room added: " + roomNumber + " to " + buildingName + " size:" + rooms.size()); // print info after action } } and usage public static void main(String[] args) { Building building = new Building("first building"); building.addRoom("1"); // add room 1 building.addRoom("2"); // add room 2 building.addRoom("3"); // add room 3 System.out.println(building.getRooms().size()); } ouput Room added: 1 to first building size:1 Room added: 2 to first building size:2 Room added: 3 to first building size:3 room size from building.java:3 3 Nevertheless, your class works as expected, the problem can be in class usage, how do you handle reference to Building class, may be you want it to be static?
type: Answer
answers question: http://stackoverflow.com/q/21396775
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/21458088
tagged with: android
has answer: http://stackoverflow.com/a/21459008
has body: Lets say I have a database with a few hundred blobs stored in separate files I want to move to the SD card, what is the best way of programatically doing this ensuring nothing gets left behind? I realize I can only copy files across different mounts. So can I copy all the files to a subdirectory in "cache" and then move the subdirectory to the correct spot atomically? Or can I write all to the files to a directory with a "temp" prefix, and rename it in place when verified?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21462923
tagged with: java
has title: Android: Move large number of files to SD card transactionally?
tagged with: android-file
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32385204
has comment: http://stackoverflow.com/comment/32382668
accepted answer: http://stackoverflow.com/a/21459008
score: 0
has answer: http://stackoverflow.com/a/21462923

http://stackoverflow.com/comment/32398963
score: 0
type: Comment
type: QuestionComment
has text: In the above code `(T[])` simply casts to `Object[]`, since the type T is unknown at compile time. Therefore `array` must be of type `Object[]` (or simply `Object`). If you *return* a value typed `T[]` then, at the point of call, the compiler will throw in a hidden cast to the appropriate type, when the method's return value is assigned or used.
comment on: http://stackoverflow.com/q/21467332

http://stackoverflow.com/q/21489938
tagged with: constraint-programming
tagged with: java
has title: Set partitioning with constraints java
has answer: http://stackoverflow.com/a/21496625
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32449314
score: 5
linked to: http://stackoverflow.com/q/9759690
has comment: http://stackoverflow.com/comment/32484374
has body: The what I'm attempting to produce an optimum set of brackets (optimum defined by constraints) for a tournament. The problem I don't know how to approach the problem. This paper is pretty high level but discusses the possibility of solving set partitioning problems with constraint programming. It also states that the majority of set partitioning problems are solved via integer programming. I am mainly looking for an example to emulate. The question is similar to this SO question. The majority of the constraint examples I've seen defined a specific partition total. Is it possible to model a system where the partitions would be determined dynamically by the constraints and the participant set? I would link examples but I am limited to only 2 due to my reputation. A more concrete example Known values The number of participants is N. Each participant has a weight W associated with them. Constraints A bracket (set) is made up of 2,3,4,6,7, or 8 participants. Each participant is only in a single bracket. The must not be more than a 15% difference between the lowest weighted participant and the highest weighted participant in a bracket. Favor creating brackets of size 8 and 4 over all other bracket sizes. So for example say there are 8 participants. { {1, W=100}, {2, W=103}, {3, W=105}, {4, W=106}, {5, W=110}, {6, W=114}, {7, W=120}, {8, W=125} } One possible solution would be: {1, 2, 3}, {4, 5}, {6, 7, 8} A more optimum solution would be: {1, 2, 3, 4}, {5, 6, 7, 8} since this favors 4, 8 sized sets over the previous solution. Is it possible to partition a set into a dynamic number of child sets? Thanks again for your time!
tagged with: dynamic-programming
has answer: http://stackoverflow.com/a/21534684
accepted answer: http://stackoverflow.com/a/21534684
possible better answer: http://stackoverflow.com/a/21496625
favorite count: 0
upvote count: 5
tagged with: integer-programming
type: AnsweredQuestion
downvote count: 0

xpath
tags question: http://stackoverflow.com/q/21502978
tag name: xpath
tags question: http://stackoverflow.com/q/21428016
tags question: http://stackoverflow.com/q/21414237
tags question: http://stackoverflow.com/q/21361594
tags question: http://stackoverflow.com/q/21428734
type: Tag
tags question: http://stackoverflow.com/q/21364127
tags question: http://stackoverflow.com/q/21453840

http://stackoverflow.com/a/21424373
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21424313
accepted answer of: http://stackoverflow.com/q/21424313
score: 2
downvote count: 0
has body: The problem here is that your loop end condition is k&lt;setArray.length , but then you use setArray[k+1] Change the condition to k &lt; setArray.length - 1
has comment: http://stackoverflow.com/comment/32322269

http://stackoverflow.com/comment/32467237
comment on: http://stackoverflow.com/a/21505741
has text: I need to print out the binary input and decimal conversion. This is doing the conversion for me.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21407113
type: Answer
has body: Give a try to this line of code: table1.print(PrintMode.NORMAL);
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21407003
upvote count: 1

http://stackoverflow.com/comment/32299000
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21411245
has text: For the purposes of the test I did the data copy even in the single threaded case (even though that is stupid)

http://stackoverflow.com/comment/32200533
type: Comment
has text: if (rs.next()) { String s1 = rs.getString(1); String s2 = rs.getString(2); String s3 = rs.getString(3); String s4 = rs.getString(4); String s5 = rs.getString(5); model.addRow(new Object[]{s1, s2, s3, s4, s5}); This is static , i want this part to be dynamic , i have add a Vector , but giving me error "The final local variable rowVector cannot be assigned, since it is defined in an enclosing type"
type: AnswerComment
comment on: http://stackoverflow.com/a/21355134
score: 0

http://stackoverflow.com/a/21395009
downvote count: 0
has comment: http://stackoverflow.com/comment/32271341
has comment: http://stackoverflow.com/comment/32271278
accepted answer of: http://stackoverflow.com/q/21394986
has comment: http://stackoverflow.com/comment/32271306
upvote count: 8
has comment: http://stackoverflow.com/comment/32271402
answers question: http://stackoverflow.com/q/21394986
type: AcceptedAnswer
score: 8
has body: There is no implicit sub-type relationship: your observation/conclusion is correct. (In the first case, super has the type of "Object" and "Object.fruit" does indeed not exist.) An inner class (as opposed to "static nested class"), as shown, must be created within context of an instance of the outer class; but this is orthogonal to sub-typing. To access a member of the outer class, use OuterClass.this.member or, if member is not shadowed, just member will resolve; neither super.member nor this.member will resolve to the outer class member. Extending the outer class "fixes" the compiler error, but the code with this.fruit doesn't access the member of the enclosing OuterClass instance - it simply accesses the member of the InnerClass instance inherited from the superclass it extends.
type: Answer

http://stackoverflow.com/comment/32258897
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21380241
has text: there is no new PreferenceScreen() constructor. instead i used prefScreens.add(new PreferenceScreen(getPreferenceManager().createPreferenceScreen(this))); but it also didn't work.

http://stackoverflow.com/q/21497658
score: 0
tagged with: runnable
answer count: 1
has title: Reading from a Java TCP socket in a thread
tagged with: sockets
has comment: http://stackoverflow.com/comment/32452248
accepted answer: http://stackoverflow.com/a/21498206
has comment: http://stackoverflow.com/comment/32452444
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32453137
tagged with: tcp
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/32451984
tagged with: java
has body: i have this TCP socket (i only posted relevant parts and removed exception throwings): static Socket clientSocket; static BufferedReader inFromServer; The connection part (i call it from another class): static Socket clientSocket = new Socket(ip, port); static BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); And to recieve text i have a runnable thread wich i call like this: public static void StartRecievingText(){ TCPScanner.setReader(inFromServer); Thread t1 = new Thread(new TCPScanner()); t1.start(); } The thread: public class TCPScanner implements Runnable { static BufferedReader inFromServer; public static void setReader(BufferedReader reader){ inFromServer = reader; } public void run() { while (true) { String temp = inFromServer.readLine(); System.out.println(temp); } } } The thread runs to the inFromServer.readline() part and appears to recieve nothing. It's my first time working with threads and ...well second time working with tcp connections so i don't know if i've done anything wrong. Thanks for your help (and sorry for spelling mistakes... still learning english)
has answer: http://stackoverflow.com/a/21498206

http://stackoverflow.com/q/21415885
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21415984
tagged with: java
has title: Repaint() not repainting a certain object/updating xy coordinates of a shape
type: Question
tagged with: awt
accepted answer: http://stackoverflow.com/a/21415984
score: 0
answer count: 1
has body: Essentially, in this program bugs move around the screen eating food. The issue that I am having is that graphics "circle" repaints fine and moves around the frame, but none of the bugs are repainted (However they are drawn initially). I've tested it with console outputs and the x and y coordinates of the bugs do update, but the graphic in the frame does not. So my question is, why is it the x/y of the circle is updated and repainted, but the bugs are not? (As far as I can see, I'm approaching the task of changing the bugs x/y in the same way as with the circle) (I've removed some of the things like the world getters and setters, and cut the code down a bit. The actual program has a movebug() method which handles the moving of the bugs in a correct fashion with hit detection.) public class Run extends JPanel implements ActionListener{ double x, y, velX, velY, newx, newy; public Timer t; private static AWorld world1; ArrayList&lt;Ellipse2D&gt; graphicBugArrayList = new ArrayList&lt;Ellipse2D&gt;(); public Run(){ x = 150; y = 150; velX = 2; velY = 2; t = new Timer(5, this); setWorld1(new AWorld()); getWorld1().populatemap(); AWorld.direction directionchecker; repaint(); t.start(); } public void paintComponent(Graphics g){ //Creating circle that move g.setColor(Color.BLACK); super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; Ellipse2D circle = new Ellipse2D.Double(x, y, 10, 10); //creating and drawing the bugs for(int i=0; i&lt;world1.getNumberofbugs(); i++) { Ellipse2D obscircle = new Ellipse2D.Double(getWorld1().bugArrayList.get(i).getHPosition(), getWorld1().bugArrayList.get(i).getVPosition(), 14, 15); graphicBugArrayList.add(obscircle); g2.setPaint(Color.RED); g2.fill(graphicBugArrayList.get(i)); g2.draw(graphicBugArrayList.get(i)); } //Drawing the circle that moves g2.setPaint(Color.BLACK); g2.draw(circle); } public void actionPerformed(ActionEvent arg0) { //Moving the circle if(x&lt;0 || x &gt; 500) { velX = -velX; } if(y&lt;0 || y &gt; 500) { velY = -velY;…
tagged with: repaint

http://stackoverflow.com/q/21412923
tagged with: java
type: Question
score: 0
tagged with: jscrollpane
answer count: 1
tagged with: jtable
has answer: http://stackoverflow.com/a/21412996
has body: When I try to put a vertical scrollpane in the table, the table ctab just disappears. here is the code: ctab = new JTable(); ctab.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ctab.setBounds(15, 97, 780, 347); frmKusinaNiKambal.getContentPane().add(ctab); ctab.setModel(new DefaultTableModel( new Object[][] { {"", "", null, null, null, null, null, null, null}, }, new String[] { "Contract #", "Engager", "Contact #", "Client Address", "Date", "Time", "Event Address", "Contract FilePath", "Referred By" } ) { boolean[] columnEditables = new boolean[] { false, false, false, false, false, false, false, false, false }; public boolean isCellEditable(int row, int column) { return columnEditables[column]; } }); ctab.getColumnModel().getColumn(3).setPreferredWidth(102); ctab.getColumnModel().getColumn(4).setPreferredWidth(62); ctab.getColumnModel().getColumn(5).setPreferredWidth(41); ctab.getColumnModel().getColumn(6).setPreferredWidth(95); ctab.isEnabled(); How can i get this table to be scrollable?
has title: how to make this jtable scrollable
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/21385939
has body: The Java language specification (draft for version 8) §8.3 specifies a "UnannClassType" as UnannClassType: Identifier [TypeArguments] UnannClassOrInterfaceType . {Annotation} Identifier [TypeArguments] Thus, you need the declaration: private transient org.apache.lucene.search.@Nullable Query cached_results; Or in the augmented java 7 compiler of the checker framework: private transient org.apache.lucene.search./*@Nullable*/ Query cached_results; NOTE: normal Java compilers ignore /*@Nullable*/.
score: 18
answers question: http://stackoverflow.com/q/21385938
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21385938
upvote count: 18
type: Answer
downvote count: 0

http://stackoverflow.com/q/21395806
tagged with: java
has comment: http://stackoverflow.com/comment/32272529
has comment: http://stackoverflow.com/comment/32272592
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21395859
has comment: http://stackoverflow.com/comment/32272580
tagged with: conditional-statements
has answer: http://stackoverflow.com/a/21395848
has comment: http://stackoverflow.com/comment/32272542
has answer: http://stackoverflow.com/a/21395884
has comment: http://stackoverflow.com/comment/32272552
possible better answer: http://stackoverflow.com/a/21395838
has answer: http://stackoverflow.com/a/21395838
has title: if and else statement logic confusion
favorite count: 0
has answer: http://stackoverflow.com/a/21395859
has body: I am new to Java and I am practicing doing a java application that loops to ask the user some inputs regarding some items that this person has sold. but I am trying to make my condition of the if statement according to my menu option.. so, if the user inputs something like -1 or any negative number or out of range number this will be grater than 4 the if statement will fail and show the error message that is followed in the else statement. but some how I am missing something that I can't see, so I hope someone of you guys can actually see it and let me know what I am missing.. public static void main(String[] args) { // TODO code application logic here Scanner input = new Scanner(System.in); SalesCal a = new SalesCal(); int select = 1; // menu selection int solds; // sales person input a.displayMessage(); while(select != 0){ System.out.print("Plese enter \t1 for item1($239.99),\n\t\t2 for item2($129.75),\n\t\t3 for item3($99.95),\n\t\t4 for item4($350.89),\n\t\t0 to cancel: "); select = input.nextInt(); //getting user input System.out.print("\n"); if((select &lt;= 4) &amp;&amp; (select &lt;= 0) &amp;&amp; (select &lt; 0)){ System.out.printf("You selected: item%d\n", select); System.out.printf("Plese enter the quantity sold for item%d: ", select); solds = input.nextInt(); //getting user input System.out.print("\n"); a.GrossCal(select, solds); } else { System.err.print("Wrong selectiong, please try again...\n\n"); } } a.displayResults(); } } Thanks I will really appreciate it your help...
has comment: http://stackoverflow.com/comment/32272513
answer count: 4
type: AnsweredQuestion
upvote count: 2
score: 1

http://stackoverflow.com/a/21429891
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21429810
has body: It's hard to advice you without seeing the whole code, but I think you've to use method equals() or something like that. When you use operator == on non-primitive types, you're comparing references, not values.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32353692
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21441108
type: AnswerComment
has text: Java Devil, everything is working fine now, your code really helped me a lot

http://stackoverflow.com/comment/32383289
type: Comment
comment on: http://stackoverflow.com/a/21458469
type: AnswerComment
has text: actually I am using 'UmciAttribute' in my method and its defined as well but i dont know from where does this 'UmciAttributeType' comes!? When i remove "Type" from 'UmciAttributeType' then it shows no error! :D
score: 0

http://stackoverflow.com/q/21417606
possible better answer: http://stackoverflow.com/a/21417730
tagged with: java
upvote count: 10
has answer: http://stackoverflow.com/a/43568211
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21417756
has title: Concatenating to a file name before the ‘.’ Filename extension in Java
has answer: http://stackoverflow.com/a/21417697
favorite count: 0
type: Question
score: 10
has answer: http://stackoverflow.com/a/21417730
answer count: 6
accepted answer: http://stackoverflow.com/a/21417756
has body: I can’t seem to find a way of concatenating to a file name before the “.” extension in Java and I’m not entirely sure how I would go about this. I have already tried: String s = r + "V1"; Where the variable r contains the value of myFile.txt and the output is: myFile.txtV1, but what I need to achieve is myFileV1.txt as I don’t want to overwrite the existing file with the same name but concatenate the V1 before the . filename extension when the file is written. Thanks
has answer: http://stackoverflow.com/a/21417658
has answer: http://stackoverflow.com/a/21417665

http://stackoverflow.com/a/21426290
has comment: http://stackoverflow.com/comment/32342277
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21420495
has body: Here's the problem: You type: "blahblah" followed by the return key. scanf("%s", message) copies all chars up to, but not including the \n char. "blahblah" get copied into the message array. But the \n character is not copied into the message array. "blahblah" gets sent. \n is still left in the input buffer. After the "send" call, your code calls getchar(). This consumes the \n char. Then the server code closes the socket and exits. The client, which is stuck on a "readLine" call, is still waiting for the \n char to arrive on the socket connection. But since the socket connection was closed by the server, readLine has to abort. To fix this, either send a "\n" char after sending "message" or just insure that message has a trailing \n char appended to it prior to sending. Example: strcat(message, "\n"); result = send(new_socket , message , strlen(message) , 0);
answers question: http://stackoverflow.com/q/21420495
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32241128
comment on: http://stackoverflow.com/q/21378607
type: Comment
type: QuestionComment
has text: This is a shopping list question and is not a good question for this platform. You should make use of your favorite search engine. [JXPath](http://commons.apache.org/proper/commons-jxpath/) is something that should have shown up. Also see the [dont-ask](http://stackoverflow.com/help/dont-ask) help page.
score: 0

http://stackoverflow.com/q/21452482
has comment: http://stackoverflow.com/comment/32374990
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32372277
has comment: http://stackoverflow.com/comment/32372116
tagged with: java
tagged with: thread-safety
has body: public class Parser { ExecutorService pool = Executors.newFixedThreadPool(10); public void update() { Item item = new Item(subj.getName(), dateBuilder.toString(), cobBuilder.toString(), interest, count); pool.submit(new ItemDispatcher(item)); } } public class ItemDispatcher implements Runnable { private Item item; public ItemDispatcher(Item someItem) { this.item = someItem; } @Override public void run() { try { new Database(item).writeToDb(); } catch (SQLException e) { e.printStackTrace(); } } } public class Database { private String name; private String date; private String cob; private String interest; private String count; private String _url; private String _userId; private String _password; private String _dbLib; private String _dbFile; private Connection _conn; private PreparedStatement _statement; public Database(Item item) { name = item.get_item(); date = item.get_date(); cob = item.get_cob(); interest = item.get_interest(); count = item.get_count(); } public void writeToDb() { try { //statment.setString(); } } catch (SQLException e) { e.printStackTrace(); } } How can I create a db connection that is thread-safe and not initialse a new connection per thread doing tasks. I've asked a similar question here but the solution uses third party library which I am not looking to use. can someone please show me a simple alternative ?
type: Question
has comment: http://stackoverflow.com/comment/32372506
tagged with: threadpool
score: 0
has answer: http://stackoverflow.com/a/21452708
tagged with: jdbc
answer count: 1
has title: Sharing database connection across fixed number of threads
linked to: http://stackoverflow.com/q/21428512
type: UnansweredQuestion

http://stackoverflow.com/q/21431857
has comment: http://stackoverflow.com/comment/32334690
type: Question
has comment: http://stackoverflow.com/comment/32334954
answer count: 1
has comment: http://stackoverflow.com/comment/32335316
has answer: http://stackoverflow.com/a/21432210
has body: try { BufferedReader br = new BufferedReader(new FileReader(user + ".txt")); String time = t.toString(); while ((line = br.readLine()) != null) { String [] check = line.split(";"); date.add(check[0]); timeIn.add(check[1]); timeOut.add(check[2]); } br.close(); BufferedWriter bw = new BufferedWriter(new FileWriter(user + ".txt")); if (timeOut.contains("not_out")){ indx = timeOut.indexOf("not_out"); timeOut.set(indx, time); } for (int i = 0; i &lt; date.size(); i++) { d =getDate(i); ti = ti(i); to = to(i); bw.write(d + ";" + ti + ";" + to); bw.newLine(); } bw.close(); } catch (Exception e) { System.out.println("Time out error"); e.printStackTrace(); } return true; The content of the text file is: eg. 11/22/13;8:00;8:30 11/23/13;8:00;not_out Then I will replace not_out to the current time because I'm making a time-in and time-out program. But the always output is something like this: 11/22/13;8:00;8:30 11/22/13;8:00;8:30 11/23/13;8:00;8:40 It always copies my first record.
favorite count: 0
has comment: http://stackoverflow.com/comment/32335204
has title: Overwriting a File in Java
has comment: http://stackoverflow.com/comment/32334896
has comment: http://stackoverflow.com/comment/32335171
tagged with: text-files
upvote count: 2
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/32334660
score: 1
tagged with: java

http://stackoverflow.com/a/21406669
has comment: http://stackoverflow.com/comment/32294461
has comment: http://stackoverflow.com/comment/32291299
upvote count: 5
has comment: http://stackoverflow.com/comment/32291961
score: 5
has comment: http://stackoverflow.com/comment/32293957
answers question: http://stackoverflow.com/q/21406537
downvote count: 0
has body: Yes, protobuf is language independent. The java version is provided by google, with multiple C# implementations (I would recommend protobuf-csharp-port if you want very similar code at both ends, and protobuf-net if you prefer the .NET code to look like idiomatic .NET). Re Kryo - I genuinely don't know enough to comment, but the only way to answer the "is it more efficient" question is to test it (also: define what efficiency means to you: is that serialization size? CPU time? resource usage? or...?). Personally, I'd be a little skeptical that it is going to be smaller, but: there's a sure fire way to find out: you try it. I do not know whether Kryo is language agnostic, but I can only see Java mentioned.
has comment: http://stackoverflow.com/comment/32291244
type: Answer

http://stackoverflow.com/comment/32255435
score: 0
type: AnswerComment
type: Comment
has text: I couldnt input anything. Error at all.
comment on: http://stackoverflow.com/a/21386500

http://stackoverflow.com/comment/32418431
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21478662
has text: @HansHohenfeld yes all ordinal, or a time format is allowed.
score: 0

http://stackoverflow.com/comment/32450808
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21496944
type: AnswerComment
has text: @kleopatra:but I just give hint how to get row,column value not copy,paste code and then run the code.. integration is upon OP.. then how do you say that reproducing same error?

http://stackoverflow.com/q/21399540
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21401118
type: Question
has comment: http://stackoverflow.com/comment/32279778
tagged with: sorting
answer count: 2
downvote count: 0
has body: I already saw this question and answer here, but my use case is doing it at creation process. I can create a multimap like that : ImmutableListMultimap&lt;Foo, Bar&gt; indexMultiMap = Multimaps.index(barCollection, new Function&lt;Bar, Foo&gt;() { @Override public Foo apply(Bar bar) { //some works return Foo; } }); I know that Foo elements will be unique, and i want to sort this map by frequency of each Foo element size of Bar collection of each Foo element) in this map, descending. 1) How can i do that with one iteration ? Like doing it when indexing this collection to MultiMap 2) If not so, what is the efficient way to get it ? My objective is at all, when i am iterating this map, i want to see first key has the bigger count of values, like Foo -> 3 (size of bar collection corresponding to this key) Foo -> 3 Foo -> 2 Foo -> 1 Foo -> 1
favorite count: 0
tagged with: multimap
type: UnansweredQuestion
has title: How to sort Guava MultiMap by count of values for each key
linked to: http://stackoverflow.com/q/7881629
has answer: http://stackoverflow.com/a/31203781
score: 3
tagged with: guava
has comment: http://stackoverflow.com/comment/32279992

http://stackoverflow.com/q/21504222
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32463895
tagged with: java
score: -1
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/32463949
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32487926
has answer: http://stackoverflow.com/a/21504269
has comment: http://stackoverflow.com/comment/32655447
has answer: http://stackoverflow.com/a/21504235
accepted answer: http://stackoverflow.com/a/21504269
possible better answer: http://stackoverflow.com/a/21504235
has body: This is my first post here on stack overflow so hopefully I will be spending much more time here! I'm new to java and I'm currently learning how to program Methods into my code. When compiling this code the following error messages are returned: java: dir/src/main.java:24: class, interface, or enum expected java: dir/src/main.java:26: class, interface, or enum expected java: dir/src/main.java:27: class, interface, or enum expected java: dir/src/main.java:28: class, interface, or enum expected I have tried changing the public static to just static and just public but this returns either the same error or more errors. I'm trying to understand the logic behind the language. Here is the source code: public class task_4 { public static void main(String[] args) { double cent = 10; double fahr = 10; double centToFahrResult = centToFahr(10); double fahrToCentResult = fahrToCent(20); System.out.println(fahrToCentResult + " " + centToFahrResult); } public static double fahrToCent(double fahr) { double cent; cent = ((fahr - 32) / 1.8); return cent; } } public static double centToFahr(double cent) { double fahr; fahr = ((cent * 1.8) + 32); return fahr; } } } I'm persevering with the language, so I hope you will be able to help. Thanks for your responses in advance.
has answer: http://stackoverflow.com/a/21504277
downvote count: 1
has title: Java returns the issue 4 times "class, interface, or enum expected"

javasound
tags question: http://stackoverflow.com/q/21507646
type: Tag
tags question: http://stackoverflow.com/q/21421970
tag name: javasound

http://stackoverflow.com/q/21380084
has title: REST Jersey Tomcat 7
tagged with: rest
type: UnansweredQuestion
has body: Getting 404 error, when accessing the Hello.java package de.vogella.jersey.first; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; // Plain old Java Object it does not extend as class or implements // an interface // The class registers its methods for the HTTP GET request using the @GET annotation. // Using the @Produces annotation, it defines that it can deliver several MIME types, // text, XML and HTML. // The browser requests per default the HTML MIME type. //Sets the path to base URL + /hello @Path("/hello") public class Hello { // This method is called if TEXT_PLAIN is request @GET @Produces(MediaType.TEXT_PLAIN) public String sayPlainTextHello() { return "Hello Jersey"; } // This method is called if XML is request @GET @Produces(MediaType.TEXT_XML) public String sayXMLHello() { return "<?xml version=\"1.0\"?>" + " Hello Jersey" + " "; } // This method is called if HTML is request @GET @Produces(MediaType.TEXT_HTML) public String sayHtmlHello() { return " " + " " + "Hello Jersey" + " " + " " + "Hello Jersey" + " " + " "; } } ' web.xml <?xml version="1.0" encoding="UTF-8"?> de.vogella.jersey.first Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages de.vogella.jersey.first 1 Jersey REST Service /rest/* This has been taken from the http://www.vogella.com/tutorials/REST/article.html, but when I run the http://localhost:8080/de.vogella.jersey.first/rest/hello . I get 404 error . Can someone please help me on this.
has answer: http://stackoverflow.com/a/22565877
score: 4
tagged with: java
type: Question
tagged with: restful-architecture
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21382976
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/q/21500452
accepted answer: http://stackoverflow.com/a/21500497
has title: comparable is putting things in descending order instead of ascending
possible better answer: http://stackoverflow.com/a/21500583
has answer: http://stackoverflow.com/a/21500583
type: AnsweredQuestion
tagged with: java
type: Question
has body: So, this is likely just a logic bug on my part but I'm not sure how. @Override public int compareTo( Activity t ) { // currently we're naturally sorting by created, description, uuid int createdComp = t.created.compareTo( created ); // created is an Instant if ( createdComp == 0 ) { int descComp = t.description.compareTo( description ); // description is a String if ( descComp == 0 ) { return t.id.compareTo( id ); // id is a UUID } else { return descComp; } } return createdComp; } here's my debugging code, for the code I haven't put, it uses the same Instant, and the UUID's are being randomly generated. NavigableSet&lt;Activity&gt; ai = new TreeSet( Arrays.asList( i, g, h, f, a, b, c, e, d ) ); assertEquals( ai.size(), 9, "NaviSet Size is 9" ); for ( Activity act : ai ) { System.out.println( act ); } Here's the output 1a8861eb-96c8-44ef-a9a5-ffbbeaf6b09e I 2014-02-01T16:00:42.102Z 3703a83c-04b4-4ed1-bdc6-b1da083900ea H 2014-02-01T16:00:42.102Z 1e68df32-18a5-4ce1-bb12-41dd3be97e3c G 2014-02-01T16:00:42.102Z d73b0e03-fd01-4a70-a20f-500e2cf0b3dd F 2014-02-01T16:00:42.102Z 4aba5877-ed0e-4457-800c-522e3a2b72a3 E 2014-02-01T16:00:42.102Z a90c7dae-ef9f-453b-9416-b7916ace4b5f D 2014-02-01T16:00:42.102Z fdbfbb6b-d39b-4f15-a309-d105f0caa7a5 C 2014-02-01T16:00:42.101Z 2ed80ac0-768e-40c3-b03a-11b417e2893f B 2014-02-01T16:00:42.101Z ef8b27db-6102-4ca5-8803-b63bea405be3 A 2014-02-01T16:00:42.098Z Why are they in descending order? and how can I fix my code so that they're in ascending order by default? (obviously navigable set has asc/desc operations)
tagged with: sorting
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21500497

http://stackoverflow.com/a/21454610
answers question: http://stackoverflow.com/q/21452132
downvote count: 0
score: 1
upvote count: 1
has body: A context in CDI is some span during execution of your program when contextual objects can be used. It defines when CDI container creates, destroys and how it links instances of those objects together. Non-contextual objects are those that are not tied to any CDI context. MDBs are one example, they are managed by EJB container and not intended to be used as ordinary objects. Entities come and go as you interact with a DB via JPA, so they also cannot be tied to a context. Another example is any object whose instances you create manually.
type: Answer

http://stackoverflow.com/comment/32455353
has text: Thanks :) I think this might be useful, I'll need to read it carefully :)
type: Comment
comment on: http://stackoverflow.com/a/21499470
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32390582
comment on: http://stackoverflow.com/a/21439744
type: Comment
score: 0
has text: Just to be clear: It must have been wait(1) or more, since wait(0) wouldn't do the job...
type: AnswerComment

http://stackoverflow.com/q/21376738
has comment: http://stackoverflow.com/comment/32237742
score: 6
has answer: http://stackoverflow.com/a/21376858
has comment: http://stackoverflow.com/comment/32237798
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32238311
has body: i am trying to create a project which create a file in client side . i ave done the coding to create a file .but it obviously will be created in server side.. can any one help to do this. below is the code i have done.. File file = new File("d:/file.txt"); try { String content = "This is the content to write into file"; if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); System.out.println("Done"); } catch (IOException e) { e.printStackTrace(); } I have also tried to create a file using filesysapi, which is done using HTML and javascript. but i got "Error: SECURITY_ERR"
downvote count: 0
has comment: http://stackoverflow.com/comment/32237774
tagged with: java
has title: create client side file using java
has answer: http://stackoverflow.com/a/21380374
type: Question
has comment: http://stackoverflow.com/comment/32237855
upvote count: 6
tagged with: javascript
has answer: http://stackoverflow.com/a/21386856
accepted answer: http://stackoverflow.com/a/21386856
has comment: http://stackoverflow.com/comment/32239816
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/32240163
possible better answer: http://stackoverflow.com/a/21380374
favorite count: 0
linked to: http://stackoverflow.com/q/20877144
has comment: http://stackoverflow.com/comment/32237828

http://stackoverflow.com/comment/32380004
comment on: http://stackoverflow.com/q/21457264
type: Comment
type: QuestionComment
score: 1
has text: Disable + hidden field.

http://stackoverflow.com/comment/32434115
comment on: http://stackoverflow.com/q/21487312
score: 0
type: Comment
has text: don't remove layout_width, just the padding
type: QuestionComment

http://stackoverflow.com/comment/32410698
type: QuestionComment
has text: I'll add an answer with some proxy info
score: 0
comment on: http://stackoverflow.com/q/21474246
type: Comment

http://stackoverflow.com/q/21431529
answer count: 1
has title: Multithreaded JavaChat with gui
linked to: http://stackoverflow.com/q/3244400
has comment: http://stackoverflow.com/comment/32334879
has comment: http://stackoverflow.com/comment/32335525
has comment: http://stackoverflow.com/comment/32334776
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32334704
has body: We just started Network-Programming in School, and now i got a problem with my homework(im not the best programmer). So basically i got a Java Chatroom with 3 Classes. A ClientHandler that gets startet as a thread when a client connects to server, a servermain class, and a clientframe class where my gui is stored. So everytime i connect to the server via terminal(with telnet localhost 10023) a new Thread of ClientHandler gets started and i can chat via terminal with other users. But how does the whole thing work with my gui ? Sry for my bad English btw. Serveclass: import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; public class Server { static Set&lt;ClientHandler&gt; clients = new HashSet&lt;&gt;(); public static void broadcastMessage(String message) throws IOException { for(ClientHandler c: clients) { if(!(clients.equals(c.username))) { c.sendMessage(message); } } } private void startServer() { try(ServerSocket server = new ServerSocket(10023)) { while(true){ Thread thread = new Thread(new ClientHandler(server.accept())); thread.start(); } }catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { new Server().startServer(); } } ClientHandler: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class ClientHandler implements Runnable { private Socket client = null; private Server server = null; BufferedReader reader = null; PrintWriter writer = null; public String username; public ClientHandler(Socket client) throws IOException { this.client = client; this.server = server; this.reader = new BufferedReader(new InputStreamReader(client.getInputStream())); this.writer = new PrintWriter(client.getOutputStream()); } @Override public void run() { try { Server.clien…
has comment: http://stackoverflow.com/comment/32335461
tagged with: java
tagged with: multithreading
tagged with: swing
type: Question
tagged with: chat
score: 0
has answer: http://stackoverflow.com/a/21431798

http://stackoverflow.com/q/21390157
answer count: 1
favorite count: 0
has body: I inherited some code, no clue what it's trying to do (I commented what i think its doing), the original coder left my organization years ago... I'm hoping the great community here can at least point me in some direction as to what this code might be trying to do, and where I can start looking for a solution... Java code //Read java.security file from JDK and create a Security provider from it PropertyFileReader reader = new PropertyFileReader(); Security.addProvider(new IBMJSSEProvider()); Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl"); System.getProperties().putAll( reader.readProperties("security.properties")); //Set some authentication stuff Authenticator.setDefault(new PasswordAuthentication("User", "Password")); // get url to servlet (note, actual application has valid url) url = new URL("Connection URL"); // Set out HTTP URL connection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestProperty("Authorization", "Basic "); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); httpURLConnection.setDefaultUseCaches(false); httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); httpURLConnection.setRequestMethod("POST"); //EXCEPTION IS THROWN HERE! DataOutputStream outputStream = new DataOutputStream( httpURLConnection.getOutputStream()); Stack trace javax.net.ssl.SSLKeyException: RSA premaster secret error at com.ibm.jsse2.fb.&lt;init&gt;(fb.java:38) at com.ibm.jsse2.hb.a(hb.java:200) at com.ibm.jsse2.hb.a(hb.java:70) at com.ibm.jsse2.gb.n(gb.java:223) at com.ibm.jsse2.gb.a(gb.java:170) at com.ibm.jsse2.sc.a(sc.java:595) at com.ibm.jsse2.sc.g(sc.java:284) at com.ibm.jsse2.sc.a(sc.java:200) at com.ibm.jsse2.sc.startHandshake(sc.java:205) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Abstra…
has answer: http://stackoverflow.com/a/22220617
type: UnansweredQuestion
score: 3
downvote count: 0
has title: RSA Premaster secret error
tagged with: java
tagged with: http
type: Question
linked to: http://stackoverflow.com/q/19432051
upvote count: 3

http://stackoverflow.com/comment/32206157
type: AnswerComment
has text: oh haha ya.. my bad. But what if the string sent in is just letters. example: aaaaa
comment on: http://stackoverflow.com/a/21359101
type: Comment
score: 0

http://stackoverflow.com/a/21359415
score: 4
type: Answer
upvote count: 4
has body: split takes a regular expression as its argument. The pipe character | is a meta-character in regular expressions which denotes OR. It needs to be escaped String[] tokens = myString.split("\\|"); otherwise the String is split into its individual characters
has comment: http://stackoverflow.com/comment/32206603
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21359403
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21359403

http://stackoverflow.com/q/21461732
has comment: http://stackoverflow.com/comment/32388025
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21462320
type: Question
has comment: http://stackoverflow.com/comment/32387965
has comment: http://stackoverflow.com/comment/32389008
tagged with: if-statement
has comment: http://stackoverflow.com/comment/32388263
has comment: http://stackoverflow.com/comment/32388954
tagged with: counter
has body: I have an assignment to count the assignments and comparisons in a selection sort. For some reason my assignment counter isn't incrementing. I've tried adding it above the swap and I've tried incorporating into the swap method - to no avail. Any ideas why it's not working? Update: The counter doesn't work for this Integer[] test = {1, 0, 4, 2}; selectionSort(test); But it does work for this: selectionSort(new Integer[] {1, 0, 4, 2}); Anyone know why? public static void selectionSort(Integer[] array) { int assignmentCounter = 0; int comparisonCounter = 0; int i, j; for(i = 0; i &lt; array.length; i++) { int minIndex = i; for(j = i + 1; j &lt; array.length; j++) { comparisonCounter++; if(array[j].compareTo(array[minIndex]) &lt; 0) { minIndex = j; assignmentCounter++; swap(array,minIndex,i); } } } System.out.println("Selection Sort Comparisons: " + comparisonCounter + "\nSelection Sort Assignments: " + assignmentCounter); for(int k = 0; k &lt; array.length; k++) { System.out.print(array[k] + ", "); } System.out.println("\n\n "); } Thank you!
tagged with: selection-sort
score: 0
has comment: http://stackoverflow.com/comment/32388675
answer count: 1
has answer: http://stackoverflow.com/a/21462320
has comment: http://stackoverflow.com/comment/32389042
has title: Counter not incrementing
has comment: http://stackoverflow.com/comment/32388946

http://stackoverflow.com/comment/32213047
type: AnswerComment
comment on: http://stackoverflow.com/a/21363144
score: 0
type: Comment
has text: Yeah it remains same. The program is actually for rotating matrix by 90deg. I guess I can use `int [][] rotatedMatrix = new int[matrix.length][matrix[0].length];` Tx!

http://stackoverflow.com/q/21506270
has answer: http://stackoverflow.com/a/21585381
tagged with: amazon-s3
tagged with: java
has title: listing objects in aws bucket
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/21585381
answer count: 2
has comment: http://stackoverflow.com/comment/32573228
has body: I was trying to print all the objects in a bucket but I am getting an error. Exception in thread "main" com.amazonaws.services.s3.model.AmazonS3Exception: Status Code: 301, AWS Service: Amazon S3, AWS Request ID: 758A7CBF1A29FD74, AWS Error Code: PermanentRedirect, AWS Error Message: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint., S3 At the moment I only have the following code : public class S3Download { /** * @param args */ public static void main(String[] args) { AmazonS3 s3 = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider()); Region usWest2 = Region.getRegion(Regions.US_WEST_2); s3.setRegion(usWest2); String bucketName = "apireleasecandidate1"; ListObjectsRequest listObjectRequest = new ListObjectsRequest().withBucketName(bucketName); ObjectListing objectListing; do{ objectListing = s3.listObjects(listObjectRequest); for(S3ObjectSummary objectSummary : objectListing.getObjectSummaries()){ System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")"); } listObjectRequest.setMarker(objectListing.getNextMarker()); }while(objectListing.isTruncated()); } } I found this solution on amazon's website. Does anyone know what I am missing?
downvote count: 0
has comment: http://stackoverflow.com/comment/33421209
score: 4
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/24060456
has comment: http://stackoverflow.com/comment/32602764
favorite count: 0
accepted answer: http://stackoverflow.com/a/24060456
type: AnsweredQuestion

http://stackoverflow.com/comment/32225072
score: 0
type: QuestionComment
has text: How would i write that into my code?
type: Comment
comment on: http://stackoverflow.com/q/21369460

http://stackoverflow.com/comment/32463241
comment on: http://stackoverflow.com/q/21503640
type: Comment
type: QuestionComment
has text: That would indicate that the session has timed out.
score: 0

http://stackoverflow.com/a/21453460
answers question: http://stackoverflow.com/q/21453308
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32373626
type: Answer
accepted answer of: http://stackoverflow.com/q/21453308
score: 1
has body: Use the Random.nextInt(n) method to select a number between 0 and 2. Use this to choose one of your three values. int index = Random.nextInt(3); int selectedValue = myOptions[index]; The value returned by that method is uniformly distributed. So if you were to repeat this process infinitely, the probability of each number being chosen would approach 1/3. From the docs: All n possible int values are produced with (approximately) equal probability
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32206614
type: QuestionComment
comment on: http://stackoverflow.com/q/21358791
score: 0
has text: @Jayan IMO you were being both a little harsh (referring to the code as 'garbage' as opposed to say.. 'sub-optimal'), and a little quick to judge. The OP seems to have learned a lot during the course of this thread.
type: Comment

http://stackoverflow.com/a/21355644
accepted answer of: http://stackoverflow.com/q/21355625
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21355625
has body: You had a typo: in the second block, you wrote test1 = true, but it should be test2 = true.
type: Answer
has comment: http://stackoverflow.com/comment/32199394
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32199409
has comment: http://stackoverflow.com/comment/32199420
upvote count: 3

http://stackoverflow.com/comment/32222749
type: AnswerComment
has text: Thank you SO MUCH! Worked like a charm.
score: 0
comment on: http://stackoverflow.com/a/21368332
type: Comment

http://stackoverflow.com/a/21369260
answers question: http://stackoverflow.com/q/21367900
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21367900
has body: This portion of code reads a file using Scanner class with a delimiter you specify and store double values into your array. File file = new File("data.txt"); private static final DELIMITER = "YOUR DELIMITER"; double[] doubleArray; try { Scanner scanner = new Scanner(file); int i=0; while (scanner.hasNextLine()) { String[] temp = scanner.nextLine().split(DELIMITER); for(int j=0; i&lt;temp.length;++j){ doubleArray[i] = Double.parseDouble(temp[j]); i++; } } scanner.close(); } catch (FileNotFoundException e) e.printStackTrace(); } Next, you should learn how StdAudio works.

http://stackoverflow.com/a/22407849
upvote count: 1
score: 1
has body: I was able to add a Maven plugin to generate a symbolic link. However, there is a bug I'm trying to track down that clears the content of the files if you have them open in Chrome and then automatically build on the IntelliJ. If you figure out the issue, please post it or edit this post. com.pyx4j maven-junction-plugin 1.0.3 generate-sources link ${project.build.directory}/${project.build.finalName}/js ${basedir}/src/main/webapp/js
answers question: http://stackoverflow.com/q/21413526
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32377651
has text: C:Documents and settings\ArrA\Prac2\build\classes\prac2\Main
comment on: http://stackoverflow.com/a/21455678
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21392049
upvote count: 1
has body: just call reverse(statement) once you've read from Scanner
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21391869

http://stackoverflow.com/comment/62136014
comment on: http://stackoverflow.com/a/21437170
score: 0
type: Comment
has text: @JaydevKalivarapu not sure how you mean that, but you can schedule as many different runnables as you want.
type: AnswerComment

http://stackoverflow.com/comment/32328898
score: 0
type: Comment
type: QuestionComment
has text: Yes, I'm sure. Commenting out the aop:aspectj-autoproxy line, the autowiring happens normally. I did debug the flow to confirm that my autowired variable is indeed set when the action class invoked.
comment on: http://stackoverflow.com/q/21420628

http://stackoverflow.com/q/21397067
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21397280
tagged with: java
has title: How to manage my layers?
tagged with: jpanel
upvote count: 1
type: Question
tagged with: jlayeredpane
downvote count: 0
has body: so I am trying to separate my panels in different layers but it does not work, what I am doing wrong? How to manage the layers? I want the table to be all the way back , and the panel to be in the middle and then the wkp to be on top of all. Thanks in advance. public class Main { private static JFrame frame = new MyFrame(); private static WhiteKingPanel wkp = new WhiteKingPanel(); private static MyPanel panel = new MyPanel(); private static TablePanel table = new TablePanel(); private static JLayeredPane lpane = new JLayeredPane(); public static void main(String[] args) throws InterruptedException{ EventQueue.invokeLater(new Runnable(){ public void run(){ frame.setLayout(new BorderLayout()); frame.add(lpane, BorderLayout.CENTER); wkp.setOpaque(true); wkp.setBounds(0, 0, 50, 50); lpane.add(wkp, new Integer(3), 0); lpane.add(panel, new Integer(2), 0); lpane.add(table, new Integer(1), 0); table.setOpaque(true); frame.setTitle("ImageTest"); frame.setBackground(Color.BLACK); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(150, 100, 512, 512); frame.add(wkp); frame.add(table); frame.pack(); frame.setVisible(true); WindowListener listener = new Terminator(); frame.addWindowListener(listener); } }); } }
accepted answer: http://stackoverflow.com/a/21397280
answer count: 1
score: 1
favorite count: 0
tagged with: swing

http://stackoverflow.com/q/21431177
has answer: http://stackoverflow.com/a/21432094
type: Question
tagged with: jtree
has body: I created a JTree with JLabels as its objects. The JLabel containing HTML. For exmple: new JLabel(" Unknown Http Response Status ") I used this Cell renderer: public class TreeWithJLabelCellRenderer extends DefaultTreeCellRenderer { private JLabel label; public TreeWithJLabelCellRenderer() { label = new JLabel(); } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Object nodeValue = ((DefaultMutableTreeNode) value).getUserObject(); label=(JLabel)nodeValue; return label; } } My problem - when the JFrame containing the JTree appears and I try to expand a tree node I get this exception: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JLabel cannot be cast to javax.swing.text.JTextComponent at javax.swing.text.html.EditableView.paint(EditableView.java:76) at javax.swing.text.BoxView.paintChild(BoxView.java:161) at javax.swing.text.BoxView.paint(BoxView.java:433) at javax.swing.text.BoxView.paintChild(BoxView.java:161) at javax.swing.text.BoxView.paint(BoxView.java:433) at javax.swing.text.ParagraphView.paint(ParagraphView.java:587) at javax.swing.text.html.ParagraphView.paint(ParagraphView.java:233) at javax.swing.text.BoxView.paintChild(BoxView.java:161) at javax.swing.text.BoxView.paint(BoxView.java:433) at javax.swing.text.html.BlockView.paint(BlockView.java:282) at javax.swing.text.BoxView.paintChild(BoxView.java:161) at javax.swing.text.BoxView.paint(BoxView.java:433) at javax.swing.text.html.BlockView.paint(BlockView.java:282) at javax.swing.plaf.basic.BasicHTML$Renderer.paint(BasicHTML.java:481) at com.seaglasslookandfeel.util.SeaGlassGraphicsUtils.paintText(SeaGlassGraphicsUtils.java:162) at com.seaglasslookandfeel.ui.SeaGlassLabelUI.paint(SeaGlassLabelUI.java:163) at com.seaglasslookandfeel.ui.SeaGlassLabelUI.update(SeaGlassLabelUI.java:146) at javax.swing.JComponent.paintComponent(JComponent.java:778) at javax.swing.JComponent.p…
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21432094
favorite count: 0
tagged with: jlabel
tagged with: exception
type: AnsweredQuestion
has title: JTree with JLabel nodes containing HTML code throws exception when expanding nodes
score: 1
tagged with: java
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/32405095
has text: I am sorry but I just realized it's a silly question as I have figured out how to do that. I was implementing my own data structure for Stack using LinkedList. I just iterated through the whole stack using a temporary object and I was able to print the stack. Thank you for the answer :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21470893
score: 1

http://stackoverflow.com/comment/32300495
score: 0
comment on: http://stackoverflow.com/q/21411981
has text: why not split the sting on ":" now you'd have an array with the strings representing the hours, the minutes and the seconds. Parse all of them to ints. multiply the minutes by 60 and the hours by 3600. Sum the three parts and you have the time in seconds (integer).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32228937
score: 1
has text: *"it miss a lot of information"* Many times people give answers that expect you to look up the classes and methods, and read the documentation, by yourself. As programmers we need to read a *lot* of documentation, and it is not usually worth repeating it here. For that reason I urge you to accept the answer of jakson.
type: AnswerComment
comment on: http://stackoverflow.com/a/21370378
type: Comment

http://stackoverflow.com/q/21396964
answer count: 8
has comment: http://stackoverflow.com/comment/32274560
score: 3
has answer: http://stackoverflow.com/a/23213044
has answer: http://stackoverflow.com/a/55047558
has title: Eclipse, ERROR: The file does not exist
has body: So every now and then eclipse glitches on me and says that my files are missing or something like that and the way I usually fix it is by copying my workbench to another location and choosing to use that one instead of the old one and it works again. However this time that did not work and it says my files do not exist. The error log is here: org.eclipse.core.runtime.CoreException: The file does not exist. at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:237) at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112) at org.eclipse.ui.editors.text.TextFileDocumentProvider.createFileInfo(TextFileDocumentProvider.java:559) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createFileInfo(CompilationUnitDocumentProvider.java:978) at org.eclipse.ui.editors.text.TextFileDocumentProvider.connect(TextFileDocumentProvider.java:478) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.connect(CompilationUnitDocumentProvider.java:1242) at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4222) at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:237) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1480) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.internalDoSetInput(JavaEditor.java:2584) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:2557) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1395) at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3209) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1654) at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3227) at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3254) at org.eclipse.ui.internal.Ed…
tagged with: eclipse
has answer: http://stackoverflow.com/a/44794169
has answer: http://stackoverflow.com/a/28593025
has comment: http://stackoverflow.com/comment/32274597
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26838878
has answer: http://stackoverflow.com/a/78752328
has comment: http://stackoverflow.com/comment/32274598
has answer: http://stackoverflow.com/a/23263627
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24523458
type: Question
has comment: http://stackoverflow.com/comment/32278504

http://stackoverflow.com/q/21422658
has body: So I'm working on a school project in which we have to import a list of items from a text file. Here is an example of the file format: I keep getting an input mismatch exception with this section of code (I have gone from a for loop to a while loop). The 3 things I have to import are name, grade, and rank this is what I have so far: File myFile = new File("input.txt"); if (!myFile.exists()) { System.out.println("Can't Find File"); System.exit(0); } Scanner reader = new Scanner(myFile); int i = 0; while (reader.hasNext()) { names[i] = reader.nextLine(); grade[i] = reader.nextInt(); rank[i] = reader.nextInt(); i++; } reader.close(); How do I go about getting the information to their correct arrays? P.S I can't use ArrayLists (even though I wish I could)
favorite count: 0
has comment: http://stackoverflow.com/comment/32319165
has comment: http://stackoverflow.com/comment/32319025
duplicate of: http://stackoverflow.com/q/7056749
answer count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/7056749
has title: Input Mismatch while scanning an input file
has comment: http://stackoverflow.com/comment/32319157
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32319142
downvote count: 0

http://stackoverflow.com/q/21426888
downvote count: 0
has comment: http://stackoverflow.com/comment/32326343
has answer: http://stackoverflow.com/a/21427000
accepted answer: http://stackoverflow.com/a/21427000
tagged with: scope
has comment: http://stackoverflow.com/comment/32326207
has body: I thought that objects only exist in the scope that they've been defined. But in this program, after execution of thtest method, t1 object of thread still exists and I can see both "hi" and "bye" in output. public class apples { public static void main(String args[]){ int b =1; navid n = new navid(); n.thtest(); while (b==1){ System.out.println("bye"); } } } public class navid { int a=1; public void thtest (){ Runnable te = new Runnable() { public void run(){ try{ while (a==1){ System.out.println("hi");} }catch(Exception e){} } }; Thread t1 = new Thread (te); t1.start(); } }
possible better answer: http://stackoverflow.com/a/21426984
favorite count: 0
has title: Why is not the thread object destroyed after scope?
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32326277
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21426984
type: Question
has comment: http://stackoverflow.com/comment/32326217
answer count: 2
has comment: http://stackoverflow.com/comment/32326196

http://stackoverflow.com/a/21445266
answers question: http://stackoverflow.com/q/21445165
accepted answer of: http://stackoverflow.com/q/21445165
upvote count: 2
has body: One way to do this would be to mock both response and its output stream, then verify calls to the write method of your mocked output stream.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32359696
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/21422297
score: 1
has body: I have done some more testing and found out that .setContraints(node, column, row) does not actually add the node the GridPane's children and you will have to add them manually afterwards, whereas .add(node, column, row) do actually set the column and row indexes and also add the node to the GridPane's children.
upvote count: 1
answers question: http://stackoverflow.com/q/21422189
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32322357
type: AnswerComment
score: 4
type: Comment
has text: <T extends Copyable<T>> would be more type-safe.
comment on: http://stackoverflow.com/a/21422719

http://stackoverflow.com/comment/32475005
score: 1
comment on: http://stackoverflow.com/a/21510457
type: AnswerComment
type: Comment
has text: @StephenC Stephen, this is a pretty negative comment on a pretty positive idea. The fact that OP's classes/structures are not perfectly designed does not make the TreeSet/TreeMap idea irrelevant here.

http://stackoverflow.com/comment/32420641
score: 1
type: Comment
has text: One thing that really upsets me in the Spring Framework, is the fact that if the creation of one single bean fails, the whole thing falls apart. I wish there were ways to implement more resilient application contexts...
comment on: http://stackoverflow.com/a/21442082
type: AnswerComment

http://stackoverflow.com/q/21375659
has comment: http://stackoverflow.com/comment/32238564
type: Question
has answer: http://stackoverflow.com/a/21376210
score: 73
has answer: http://stackoverflow.com/a/21375809
has answer: http://stackoverflow.com/a/21375718
has comment: http://stackoverflow.com/comment/32265929
linked to: http://stackoverflow.com/q/1552301
has comment: http://stackoverflow.com/comment/32244162
has answer: http://stackoverflow.com/a/21375710
has answer: http://stackoverflow.com/a/21378321
linked to: http://stackoverflow.com/q/18634966
has answer: http://stackoverflow.com/a/21375818
downvote count: 12
has comment: http://stackoverflow.com/comment/32267253
tagged with: string
has answer: http://stackoverflow.com/a/21377671
has answer: http://stackoverflow.com/a/22088695
favorite count: 0
linked to: http://stackoverflow.com/q/8798403
has comment: http://stackoverflow.com/comment/32256408
accepted answer: http://stackoverflow.com/a/21375718
has answer: http://stackoverflow.com/a/21375728
linked to: http://stackoverflow.com/q/20945049
linked to: http://stackoverflow.com/q/16828237
has body: I've been studying Java String for a while. The following questions are based on the below posts Java String is special Immutability of String in java Immutability: Now, going by the immutability, the String class has been designed so that the values in the common pool can be reused in other places/variables. This holds good if the String was created as String a = "Hello World!"; However, if I create String like String b = new String("Hello World!"); why is this immutable as well? (or is it?). Since this has a dedicated heap memory, I should be able to modify this without affecting any other variable. So by design, was there any other reason why String as a whole is considered immutable? Or is my above assumption wrong? Second thing I wanted to ask was about the common string pool. If I create a string object as String c = ""; is an empty entry created in the pool? Is there any post already on these? If so, could someone share the link?
has answer: http://stackoverflow.com/a/21390042
has answer: http://stackoverflow.com/a/28965709
possible better answer: http://stackoverflow.com/a/21375716
has answer: http://stackoverflow.com/a/21377747
has answer: http://stackoverflow.com/a/21375735
answer count: 15
has answer: http://stackoverflow.com/a/21375716
has title: Is "new String()" immutable as well?
type: AnsweredQuestion
tagged with: immutability
upvote count: 85
tagged with: java
has answer: http://stackoverflow.com/a/21390547
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/32254920
has comment: http://stackoverflow.com/comment/32261365

http://stackoverflow.com/comment/32238311
has text: i want to create a java web app which creates client side file or a html app with js which creates client side file
comment on: http://stackoverflow.com/q/21376738
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/32259413
type: QuestionComment
has text: My apologies, I have _some_ code but struggling to implement the setting of variables, I'll edit the post with more information after attempting to isolate the code. Thanks for the link.
comment on: http://stackoverflow.com/q/21388255
score: 0
type: Comment

http://stackoverflow.com/comment/32345980
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21438078
has text: Use `input.replaceAll()` method and replace whatever you want.
score: 0

http://stackoverflow.com/comment/32440068
type: AnswerComment
has text: 1. Yes the process terminates when the JVM exits. 2. Many servers (like tomcat and jetty) listen on a "shutdown" port and wait for a specific data (like the string 'SHUTDOWN') to get sent on that port, then they execute all the clean-up code an quit.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21475288

http://stackoverflow.com/comment/32444983
score: 1
comment on: http://stackoverflow.com/q/21492712
type: Comment
has text: Do as it says and run with -X option. Then provide the output here.
type: QuestionComment

http://stackoverflow.com/a/21373399
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21373281
answers question: http://stackoverflow.com/q/21373281
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Try this: int code = ((java.net.HttpURLConnection)conn).getResponseCode(); Then check if the code is 404 you know your page did not exist: if (code == 404) { ... }

http://stackoverflow.com/comment/32216115
type: QuestionComment
comment on: http://stackoverflow.com/q/21364962
score: 0
type: Comment
has text: Perhaps you should validate your data before trying to persist it and avoid the exception whatsoever. Have you consider using [Bean Valudation](https://jcp.org/en/jsr/detail?id=349) using [Hibernate Validator Implementation](http://hibernate.org/validator/)?

http://stackoverflow.com/comment/53170099
comment on: http://stackoverflow.com/a/21514423
type: Comment
has text: @ddekany: Nice. Good to know.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21494093
tagged with: java
has comment: http://stackoverflow.com/comment/32446796
has comment: http://stackoverflow.com/comment/32446423
type: Question
has body: Iam doing automation of a ecommerce site, iam facing a click link issue. below is the link http://www.flipkart.com/mobiles/samsung~brand/pr?sid=tyy,4io&amp;otracker=hp_nmenu_sub_electronics_0_Samsung iam not able to click to the Availability Exclude Out of Stock below is the html &lt;input type="checkbox" value="facets.availability%5B%5D=Exclude+Out+of+Stock" class="facetoption" autocomplete="off"&gt; below xpath iam using driver.findElement(By.xpath("/html/body/div/div[2]/div/div/div/div[2]/div[2]/div/div/div[2]/div/div[2]/div[6]/ul/li/a/input")).click(); driver.findElement(By.xpath("//input[@type='checkbox'][contains(@value,'facets.availability%5B%5D=Exclude+Out+of+Stock']")).click(); getting an error. FAILED: FlipkartTest org.openqa.selenium.InvalidSelectorException: The given selector //input[@type='checkbox'][contains(@value,'facets.availability%5B%5D=Exclude+Out+of+Stock'] is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression //input[@type='checkbox'][contains(@value,'facets.availability%5B%5D=Exclude+Out+of+Stock'] because of the following error: [Exception... "The expression is not a legal expression." code: "12" nsresult: "0x805b0033 (SyntaxError)" location: "&lt;unknown&gt;"] Command duration or timeout: 73 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'VALUED-8JGOG5PH', ip: '192.168.1.4', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45' Session ID: f6f56eba-4608-49e0-a0c7-4bd903ae142e my second doubt is how to cut short the Xpath i don't want to use complete xpath like driver.findElement(By.xpath("/html/body/div/div/div[2]/div/div/ul/li/div/div[2]/div/ul/li[4]/a")).click(); driver.findElement(By.xpath("/html/body/div/div/div[2]/div/div/ul/li/di…
score: 0
has answer: http://stackoverflow.com/a/21494281
accepted answer: http://stackoverflow.com/a/21494281
answer count: 1
has title: Unable to select a Link using XPath
tagged with: selenium-webdriver
type: AnsweredQuestion

http://stackoverflow.com/comment/32372459
has text: It has, but the other authentication scheme are done through their respective 3rd party authentication, so there is no need to map it to `@ManyToOne` scheme.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21452306

http://stackoverflow.com/comment/32340987
comment on: http://stackoverflow.com/q/21434881
score: 0
type: Comment
type: QuestionComment
has text: It could be something else than ArrayList, just need to hold all the Cars.

http://stackoverflow.com/a/21419070
has body: Try changing the Person class fields to protected so they can be inherited public class Person { protected String firstName; protected String lastName; ... } Change from PersonContainer to (what it is you want) public class EmployeeContainer { private Employee employee; ... } Hope it helps
answers question: http://stackoverflow.com/q/21418928
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32323794

http://stackoverflow.com/a/21426277
type: Answer
answers question: http://stackoverflow.com/q/21425668
has body: Read here for links and the getting started doc. When you download, you get a zip file, extract contents which has the exe.
score: 0

http://stackoverflow.com/q/21422367
tagged with: paintcomponent
has body: I created a simple "elevator" program (it's still in the beginning stages) that goes up 1 floor when I click UP and vice versa. I messed up pretty badly when I drew all my components into JFrame, and as expected, it flickers every time I click the button (repaints). I know the solution to be draw in the JPanel and put the said panel in the JFrame, but I have a problem translating my JFrame components into JPanel. I've tried extending JPanel, creating a JFrame object and then overriding the paintComponent() method and doing my drawing there, but when I compile it does not draw it at all. It only creates the frame. Can anyone help me or give me tips on how to proceed "transferring" my programming from JFrame based to JPanel based? Thank you in advance! My code is below: import java.awt.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.Timer; import java.math.*; public class MyCanvas extends JFrame { private int up = 0; private int down = 0; private int movefloorup = 0; private int buildingType;//type of building (1 = Residential, 2 = Commercial) private int totnumoffloors; //for the total number of floors private int numofelevators; //for the number of elevators to be generated private int floorlimit = 0; //to determine up until where the elevator will be moving private int currenttime; //determine the time of the day the elevator is operating (1 = Morning, 2 = Lunch, 3 = Afternooon) //For elevator resetting to bottom private int rectX = 190; private int switchmarker = 0; //Lines and stuff private int horizborder = 0; private int bordercount = 0; private class UpAction implements ActionListener //move the elevator up { public void actionPerformed(ActionEvent e) { if(movefloorup&lt;780){ repaint(); up++; movefloorup = movefloorup + 130; //repaint(); } else { switchmarker = 1; movefloorup = 0; repaint(); } } } private class DownAction implements ActionListener //move the elevator down { public void actio…
tagged with: repaint
has answer: http://stackoverflow.com/a/21422622
type: AnsweredQuestion
tagged with: java
tagged with: swing
accepted answer: http://stackoverflow.com/a/21422622
type: Question
tagged with: jpanel
score: 0
has title: Transferring JFrame to JPanel
answer count: 1

bufferedreader
tags question: http://stackoverflow.com/q/21408800
tags question: http://stackoverflow.com/q/21437838
tags question: http://stackoverflow.com/q/21448287
tag name: bufferedreader
tags question: http://stackoverflow.com/q/21466113
type: Tag

http://stackoverflow.com/q/21482479
answer count: 1
has answer: http://stackoverflow.com/a/21483470
upvote count: 1
tagged with: batik
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/svg
has body: I am trying to create a PNG from SVG with batik. In my Proof of Concept it worked smoothly. The code receives and svg escaped, so I have to unescape it before transcoding. But when there is a tag with "&amp;" (ie "O&amp;M") it fails. Error: java.io.IOException: The reference to entity "M" must end with the ';' delimiter. Any ideas?
downvote count: 0
has title: Apache Batik Transcode exception when "&" appears in some text
type: UnansweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/21364253
has body: I've just started programming in java. Recently, however, I haven't been able to load images into my games. I've tried loading them into a separate resource package and read/watched countless tutorials, but nothing seems to be working at all! Can someone tell me what's wrong with the code or provide any suggestions? Any help would be much appreciated. import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; import javax.swing.JFrame; public class Main extends JFrame{ Image dbImage; Graphics dbg; //Variables for screen size int GWIDTH = 800, GHEIGHT = 500; //Dimension of gwidth and gheight Dimension screenSize = new Dimension (GWIDTH, GHEIGHT); public Main (){ //constructor to spawn window this.setTitle ("Pond"); this.setSize(screenSize); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); this.setBackground(Color.cyan); this.addKeyListener(new AL ()); ImageIcon img = new ImageIcon (getClass().getResource("/resources/ninja-png.gif")); } public static void main (String[] args){ Main m = new Main (); } //Double Buffering @Override public void paint (Graphics g){ dbImage = createImage (getWidth(), getHeight()); dbg = dbImage.getGraphics (); draw (dbg); g.drawImage(dbImage, 0, 0, this); } public void draw (Graphics g){ } public void paintComponent (Graphics g){ } //Event Listener Class public class AL extends KeyAdapter { @Override public void keyPressed (KeyEvent e){ } @Override public void keyReleased (KeyEvent e){ } } }
type: Question
accepted answer: http://stackoverflow.com/a/21364738
tagged with: java
has answer: http://stackoverflow.com/a/21364886
tagged with: image
has title: Loading Images into Java
answer count: 2
has answer: http://stackoverflow.com/a/21364738
score: 0
possible better answer: http://stackoverflow.com/a/21364886
tagged with: loading
type: AnsweredQuestion
tagged with: swing

http://stackoverflow.com/comment/32233874
type: Comment
has text: What do you expect to happen when you call: collegeTester.addCommand(); ?
comment on: http://stackoverflow.com/q/21374342
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32449535
comment on: http://stackoverflow.com/q/21444474
score: 0
has text: What are you going to do with these squares? Is it chess like game? Is it grid ruler of the scene? My suggestion is to put some selectable and stylable controls (rectangle, label or even button) into flowpane.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21440290
answers question: http://stackoverflow.com/q/21439445
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32354963
upvote count: 1
has comment: http://stackoverflow.com/comment/32354243
downvote count: 0
has body: When you add components to a visible GUI the basic code is: panel.add(...); panel.revalidate(); panel.repaint(); You are revalidating the wrong panel: video_pnl.revalidate(); // wrong panel add(video_pnl); You should be doing: //video_pnl.revalidate(); add(video_pnl); revalidate(); repaint();

http://stackoverflow.com/comment/59229229
score: 1
type: AnswerComment
has text: Wow, this api is so stupid.. It is obvious that attribute id is what everybody mean as id...
type: Comment
comment on: http://stackoverflow.com/a/21357691

http://stackoverflow.com/comment/32278086
has text: Annotations works well I created the tables by myself using the metadata, It sounds obvious but classes are in the correct packages?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21398794
score: 0

http://stackoverflow.com/q/21501359
tagged with: upnp
favorite count: 0
accepted answer: http://stackoverflow.com/a/22084701
has title: P2P message transfer behind firewalls and NAT
has body: I have two java applications running on two different machines in two different part of the world. The machines can be behind NAT (or not!). The applications are supposed transfer some data (&lt;500kb). We do have a server, which can do everything (like providing ip address of the peers) but the data from the applications must always be transferred peer-to-peer. The data can not be routed through the server. Do I have to deal with firewall mess? Do I have to set port forwarding? Are JXTA or JGroups something that I need? is UPNP something I need to look into? is UDP Hole Punching something I should look into? I know my question is a bit vague, but please don't shoot my question down, I just need a nudge in the right direction. I am going to try and explain better as the comments/answers start coming in!
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/32473447
tagged with: java
type: Question
upvote count: 2
answer count: 1
tagged with: p2p
tagged with: jxta
has answer: http://stackoverflow.com/a/22084701

http://stackoverflow.com/a/21364735
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21364703
score: 1
upvote count: 1
has body: The Math class fits your needs. For instance the following class compute a cosine of an angle. Have a look to all the other methods. public class CosineTest{ public static void main(String args[]){ double degrees = 45.0; // put your value here double radians = Math.toRadians(degrees); // look to the Math class..a lot of nice stuff here System.out.format("The cosine of %.1f degrees is %.4f%n", degrees, Math.cos(radians)); } }

http://stackoverflow.com/comment/32281214
type: Comment
type: AnswerComment
has text: thank you for your quick response, can you please explain how can i create a widget for my service.
score: 0
comment on: http://stackoverflow.com/a/21401063

http://stackoverflow.com/q/21504357
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32464221
linked to: http://stackoverflow.com/q/2416935
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21504420
has comment: http://stackoverflow.com/comment/32464354
has comment: http://stackoverflow.com/comment/32464185
has answer: http://stackoverflow.com/a/21504489
has body: I am trying to do a school project where I am trying to build an application in Java that I have to analise a song, and as the song is playing I need to output certain frequencies when they are hit ie: whenever it hit 1hz it would print to the console "1Hz". I have all the files for the audio-analysis ie: com.badlogic.audio package. This is a very important project, and I am relatively new to Java (I am in high school and this is my major project for the year). Please can someone talk me through how to implement the FFT algorithm into a song? ie: how do I display on screen: "select a song" then when they select the song, play it out loud over a media player or something and while it is playing, whenever it hits certain points, output something (like the 1hz example above). Is there another library that can return the current frequency in the song to me? Thanks in advance for any help or advice!
favorite count: 0
has title: Get current Audio Frequency from song - Java (Maybe use FFT?)
has comment: http://stackoverflow.com/comment/32464499
has answer: http://stackoverflow.com/a/21504586
tagged with: spectrum
has comment: http://stackoverflow.com/comment/32464583
upvote count: 2
has comment: http://stackoverflow.com/comment/32464467
accepted answer: http://stackoverflow.com/a/21504420
possible better answer: http://stackoverflow.com/a/21504463
has answer: http://stackoverflow.com/a/21504463
answer count: 4
has comment: http://stackoverflow.com/comment/32464408
tagged with: audio
type: AnsweredQuestion

http://stackoverflow.com/q/21505934
tagged with: java
has answer: http://stackoverflow.com/a/21506601
has answer: http://stackoverflow.com/a/21506041
type: Question
has comment: http://stackoverflow.com/comment/32467078
has title: Finding a really big number
score: 0
has answer: http://stackoverflow.com/a/21506046
has answer: http://stackoverflow.com/a/21506199
answer count: 4
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11152127
has body: So, I'm trying to find the largest prime factor of 600851475143. I have a simple method that finds the largest one currently which is this: private static void findPrimeFactors(long num) { ArrayList&lt;Long&gt; list = new ArrayList&lt;Long&gt;(); for (long i = 1; i &lt;= num; i++) { int lol = 0; for (int a = 1; a &lt; i; a++) { if (i % a == 0) { lol++; } } if (lol &lt; 2) { if (!list.isEmpty()) list.remove(list.size() - 1); list.add(i); } } System.out.println(list.get(list.size() - 1)); } Excuse me for my bad programming, I'm still learning. I figured that removed a lot of the entries from the list would cut down on the time to calculate it, so I removed the last entry unless it's the last one. I can do it with 100L which outputs the following: 97 Done in 1.0 milliseconds (0.001 seconds) (0.0625622 nano seconds) And 20,000: 19997 Done in 1774.0 milliseconds (1.774 seconds) (177.3702774 nano seconds) As you can see, it takes quite a bit longer to find it in a bigger number. Now I'm supposed to find the number I'm looking for in 600851475143, so I can say it's going to take a while to do. I'm wondering if their is any faster way to calculate this? This is all of my code: import java.util.ArrayList; public class Main { public static void main(String[] args) { try { long num = 600851475143L; long time = System.currentTimeMillis(); long timeNano = System.nanoTime(); findPrimeFactors(20000); double finishTime = System.currentTimeMillis() - time; double finishTimeNano = System.nanoTime() - timeNano; System.out.println("Done in " + finishTime + " milliseconds (" + ((finishTime) / 1000) + " seconds)" + " (" + finishTimeNano / 10000000 + " nano seconds)"); } catch (Exception e) { e.printStackTrace(); } } private static void findPrimeFactors(long num) { ArrayList&lt;Long&gt; list = new ArrayList&lt;Long&gt;(); for (long i = 1; i &lt;= num; i++) { int lol = 0; for (int a = 1; a &lt; i; a++) { if (i % a == 0) { lol++; } } if (lol &lt; 2) { if (!list.isEmpty()) list.remove(list.s…
has comment: http://stackoverflow.com/comment/32467047
linked to: http://stackoverflow.com/q/10580159

http://stackoverflow.com/q/21445616
tagged with: arrays
answer count: 1
has title: Set Method And Get Method Of A Fixed Size Array
score: 0
has answer: http://stackoverflow.com/a/21445705
has body: I'm a bit mixed up on how to apply the 'sets' and 'gets' methods for a fixed array. Here is some of my work in Netbeans: //creating 5 fixed arrays of size 10 private String [] itemnames = new String [10]; private String [] itemcodes = new String [10]; private String [] category = new String [10]; private String [] quantity = new String [10]; private Double [] sellingprice = new Double [10]; //initialising each array to null in the class constructor for (int i = 0; i &lt; 10; i++){ itemnames[i] = ""; } for (int i = 0; i &lt; 10; i++){ itemcodes[i] = ""; } for (int i = 0; i &lt; 10; i++){ category[i] = ""; } for (int i = 0; i &lt; 10; i++){ quantity[i] = ""; } for (int i = 0; i &lt; 10; i++){ (Double.parseDouble(sellingprice[i])) = 0; } Now, i'm stuck in the set method and the get method of each array. Any help please? Thanks :)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32360190
type: Question
accepted answer: http://stackoverflow.com/a/21445705
has comment: http://stackoverflow.com/comment/32360172
tagged with: java

http://stackoverflow.com/comment/32327038
type: Comment
has text: if i execute above code how can i check my job on jenkin dashboard
comment on: http://stackoverflow.com/a/21406254
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32359141
comment on: http://stackoverflow.com/a/21444997
score: 0
type: Comment
has text: @user1988876 You are calling the `toString()` method of the arrayList. Since it's size is 0, the String built by toString is empty (check the source code). That's why you "see" nothing.
type: AnswerComment

http://stackoverflow.com/comment/32474371
has text: @PeterChudinov You are welcome! Since this worked for you, consider accepting the answer by clicking the check mark next to it. This would let other site visitors know that your problem is solved, and earn you a new badge on stack overflow.
type: AnswerComment
comment on: http://stackoverflow.com/a/21509945
score: 0
type: Comment

http://stackoverflow.com/q/21373582
has comment: http://stackoverflow.com/comment/32232043
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21374175
tagged with: java
has comment: http://stackoverflow.com/comment/32232031
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32232204
type: Question
answer count: 2
has title: can't run tomcat java: Permission denied
tagged with: tomcat
score: 0
possible better answer: http://stackoverflow.com/a/21374175
accepted answer: http://stackoverflow.com/a/21428195
has body: When I type sh startup.sh in terminal ubuntu I find below log and my tomcat server doesn't start. I can run server from eclipse ide but I can't run it from terminal.sudo sh startup.sh worked. Thanks to all of you to provide me answer previously It is worked fine. Now another problem is that mvn clean install is not worked previously it is also worked now it told The program 'mvn' can be found in the following packages: * maven * maven2 This also work fine in eclipse ? INFO: Server startup in 5732 ms 20 Jan, 2014 7:39:54 PM org.apache.coyote.http11.AbstractHttp11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-8080 20 Jan, 2014 7:39:54 PM org.apache.coyote.ajp.AjpProtocol pause INFO: Pausing Coyote AJP/1.3 on ajp-8009 20 Jan, 2014 7:39:55 PM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Catalina ./catalina.sh: 1: eval: /opt/jdk1.6.0_23/bin/java: Permission denied ./catalina.sh: 1: eval: /opt/jdk1.6.0_23/bin/java: Permission denied
has comment: http://stackoverflow.com/comment/32242378
has answer: http://stackoverflow.com/a/21428195

http://stackoverflow.com/comment/32391777
comment on: http://stackoverflow.com/q/21463544
has text: See [BufferedImage.getType()](http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html#getType%28%29)
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21511973
answer count: 4
has answer: http://stackoverflow.com/a/21512072
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21512049
tagged with: java
tagged with: methods
possible better answer: http://stackoverflow.com/a/21512000
type: Question
has body: What is the difference between this: T getById(Integer id); And this: &lt;T&gt; T getById(Integer id); Are they not both returning a class with type T?
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/21512000
favorite count: 0
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/32477525
has answer: http://stackoverflow.com/a/21512019
accepted answer: http://stackoverflow.com/a/21512019
has title: When to use <T> in generic method's declaration

http://stackoverflow.com/q/21418358
type: Question
accepted answer: http://stackoverflow.com/a/21420565
has comment: http://stackoverflow.com/comment/32312287
downvote count: 0
answer count: 1
tagged with: os-agnostic
tagged with: linux
has body: Edit: I recognize that FileSystem.getDefault() will give me what I was looking for in my original question statement. I am attempting to use FileSystem.getFileSystem(URI) to get the FileSystem for any given path. I am attempting to develop some code that will give me a java.nio.file.FileSystem object for a given path. Here is some grossly simplified example code to give a better idea of what is being attempted: public FileSystem getCwdFilesystem() { URI cwdUri = null; String delimiter = ""; try { _cwd = System.getProperty("user.dir"); cwdUri = new URI("file", delimiter + _cwd, null); } catch (URISyntaxException ue) { System.out.println("URI Creation failure on URI: " + _cwd); ue.printStackTrace(); System.exit(1); } System.out.println("Filestore data for CWD: " + cwdUri.toString()); return (FileSystems.getFileSystem(cwdUri)); } Upon execution, an exception is throw on the last line of code: Filestore data for CWD: file:/Users/redacted/Documents/Java%20Projects/ExampleCode Exception in thread "main" java.lang.IllegalArgumentException: Path component should be '/' at sun.nio.fs.UnixFileSystemProvider.checkUri(UnixFileSystemProvider.java:77) at sun.nio.fs.UnixFileSystemProvider.getFileSystem(UnixFileSystemProvider.java:92) at java.nio.file.FileSystems.getFileSystem(FileSystems.java:217) at examplecode.FilesystemCapacity.getCwdFilesystem(FilesystemCapacity.java:54) at examplecode.FilesystemCapacity.main(FilesystemCapacity.java:33) Java Result: 1 When I make a small update to the delimiter variable: String delimiter = "/"; I get a different error message thrown from the same place: Filestore data for CWD: file://Users/redacted/Documents/Java%20Projects/ExampleCode Exception in thread "main" java.lang.IllegalArgumentException: Authority component present at sun.nio.fs.UnixFileSystemProvider.checkUri(UnixFileSystemProvider.java:73) at sun.nio.fs.UnixFileSystemProvider.getFileSystem(UnixFileSystemProvider.java:92) at java.nio.file.FileSystems.getFileSystem(FileSystems.java:2…
has comment: http://stackoverflow.com/comment/32312394
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/32312446
has answer: http://stackoverflow.com/a/21420565
has title: Get FileStore object for any given path
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/21399660
has body: I want to change a unique key from one entity object to another in one @Transaction method: Entity oldone=dao.getEntity(oldid); Entity newone=dao.getEntity(newid); oldone.setBarcode(null); dao.update(oldone); //free the unique key "barcode" newone.setBarcode(barcode); dao.update(newone); //set the unique key "barcode" But this code throws: Duplicate entry for key 'barcode' Dubugging I found that after the first dao.update nothing changes in the database. I tryed to set the hibernate flushmode to "always" but didn't change: org.hibernate.dialect.HSQLDialect false false true org.hibernate.dialect.MySQLDialect false org.hibernate.transaction.JDBCTransactionFactory always Why hibernate doesn't flush?
has answer: http://stackoverflow.com/a/21400596
accepted answer: http://stackoverflow.com/a/21401916
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21400596
has comment: http://stackoverflow.com/comment/32280405
tagged with: java
tagged with: hibernate
has title: Hibernate and flush: update throws duplicate key error
tagged with: mysql
answer count: 2
has comment: http://stackoverflow.com/comment/32279447
linked to: http://stackoverflow.com/q/2558536
has comment: http://stackoverflow.com/comment/32282382
has answer: http://stackoverflow.com/a/21401916
score: 0
tagged with: flush

http://stackoverflow.com/q/21395502
has body: I have this JTextArea and it keeps expanding as text is entered. I know this looks like a repeat question but I've followed the answers and they haven't worked for me. I also have a JScrollPane attached to it but no scrollbar is showing up. I want the JTextArea to remain a constant size and to have it scrollable. Please take a look at my code and tell me what's wrong, because I have no idea! Here is my code: package com.robot; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.*; public class GUI extends JFrame implements Runnable { //start of the constructor method for GUI public GUI() { //defines the line break String newline = System.getProperty("line.separator"); //defines objects Toolkit tk = Toolkit.getDefaultToolkit(); Dimension dim = tk.getScreenSize(); //sets the size of the GUI this.setSize(600, 400); //centers the GUI int xPos = (dim.width / 2) - (this.getWidth() /2); int yPos = (dim.height / 2) - (this.getHeight() /2); this.setLocation(xPos, yPos); //makes the program unable to be resized this.setResizable(false); //allows the user to close the program with the x button this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //sets the title of the program this.setTitle("ROBOT Alpha Alfred Version 3.0"); //creates panels to hold the elements of the GUI JPanel mainPanel = new JPanel(); JPanel buttonPanel = new JPanel(); JPanel consolePanel = new JPanel(); //creates buttons JButton runDemo = new JButton("Run Demo"); JButton runLive = new JButton("Run Live"); JButton scan = new JButton("Scan Market"); JButton findPatterns = new JButton("Find Patterns"); JButton cleanFolder = new JButton("Clean Up Folder"); JButton configureSettings = new JButton("Configure Settings"); //creates the console JTextArea console = new JTextArea(6, 40); //sets the default text of the console console.setText("----------------------- ROBOT Console -----------------------" + newline); //makes the console unable to be edited console.setEditable(false); console.append…
has title: JTextArea expands as I enter text even though I have a JScrollPane, but the scrollbar doesn't show up either
tagged with: jscrollpane
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: swing
type: Question
tagged with: jtextarea
has answer: http://stackoverflow.com/a/21395534
tagged with: eclipse

http://stackoverflow.com/comment/32372346
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21435266
has text: Sorry but i'm not able to vote up (because i don't have 15 reputation)

http://stackoverflow.com/q/21451433
downvote count: 0
possible better answer: http://stackoverflow.com/a/21451593
favorite count: 0
has body: This is what I have done till now; Activity Class; traineesListView .setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, final long person_id) { currentTrainee = (Trainee) arg0.getAdapter().getItem( arg2); SharedMemory.getInstance().setCurrentTrainee( currentTrainee); String items[] = { "Edit your information", "Unregister from training" }; Builder alert = new AlertDialog.Builder( TraineeActivity.this); alert.setTitle("Dear!" + " " + currentTrainee.getFormatedName() + "," + " " + "Choose your action!!"); alert.setItems(items, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int selectedItem) { if (selectedItem == 0) { SharedMemory.getInstance() .setCurrentAction( SharedMemory.ACTION_EDIT); SharedMemory.getInstance() .setCurrentTrainee(currentTrainee); Intent intent = new Intent( TraineeActivity.this, FormActivity.class); TraineeActivity.this.startActivity(intent); } else if (selectedItem == 1) { // delete trainee information Builder alert = new AlertDialog.Builder( TraineeActivity.this); alert.setTitle("Dear!" + " " + currentTrainee.getFormatedName()); alert.setMessage("Are you sure want to unregister from training?"); alert.setPositiveButton( "YES", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface arg0, int arg1) { int training_id = SharedMemory .getInstance() .getCurrentTraining() .getId(); // Unregister Trainee currentTrainee .unRegisterFromTraining(training_id); Log.i( "Training ID:"+Integer.toString(training_id), "Person ID:"+Integer.toString(currentTrainee.getId())); // Remove trainee from // ArrayList } }); alert.setNegativeButton( "NO", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface arg0, int arg1) { arg0.cancel(); } }); alert.show(); } } }); alert.show(); return true; } }); My model class: public void unRegisterFromTraining(int training_id) { DatabaseHelper db…
tagged with: android
has answer: http://stackoverflow.com/a/21451593
tagged with: android-alertdialog
score: 1
has answer: http://stackoverflow.com/a/21451543
accepted answer: http://stackoverflow.com/a/21451543
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32370428
tagged with: java
type: Question
answer count: 2
upvote count: 1
has title: Deleting row from database and arraylist
tagged with: sqlite

http://stackoverflow.com/comment/32206619
has text: How do you represent decimal numbers in binary?
score: 0
comment on: http://stackoverflow.com/q/21359426
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21435266
has comment: http://stackoverflow.com/comment/32370936
has body: Finally I found the path to my file in the tablet (to avoid using the assets) : "/storage/sdcard0/Documents/test42.xls" The file is found by the application, but there is still a problem while creating HSSFWorkbook, There is an exception "01-29 16:15:21.329: W/System.err(13127): java.io.IOException: Invalid header signature; read 0x0010000000060409, expected 0xE11AB1A1E011CFD0" I do not understand this exception, but at least I find my file Enplacement My code : try { File file = new File("/storage/sdcard0/Documents/test42.xls"); FileInputStream input = new FileInputStream(file); HSSFWorkbook classeur = new HSSFWorkbook(input); //HSSFSheet feuille = classeur.getSheetAt(0); //Cell cell = feuille.getRow(1).getCell(1); //String value = cell.getStringCellValue(); String path = Environment.getExternalStorageDirectory().getAbsolutePath(); TextView tv = new TextView(this); tv.setText(path ); setContentView(tv); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/32369931
has comment: http://stackoverflow.com/comment/32365136
has comment: http://stackoverflow.com/comment/32365198
has comment: http://stackoverflow.com/comment/32365254
has comment: http://stackoverflow.com/comment/32371030
has comment: http://stackoverflow.com/comment/32369344
has comment: http://stackoverflow.com/comment/32369973
has comment: http://stackoverflow.com/comment/32369668
has comment: http://stackoverflow.com/comment/32370858
has comment: http://stackoverflow.com/comment/32372346
has comment: http://stackoverflow.com/comment/32370187
type: Answer
has comment: http://stackoverflow.com/comment/32370710
answers question: http://stackoverflow.com/q/21403859
has comment: http://stackoverflow.com/comment/32370666
has comment: http://stackoverflow.com/comment/32370882
has comment: http://stackoverflow.com/comment/32371090
has comment: http://stackoverflow.com/comment/32369710
score: 0
has comment: http://stackoverflow.com/comment/32370151
has comment: http://stackoverflow.com/comment/32371739

apache-poi
tags question: http://stackoverflow.com/q/21441702
tags question: http://stackoverflow.com/q/21403859
tags question: http://stackoverflow.com/q/21425176
type: Tag
tags question: http://stackoverflow.com/q/21360950
tags question: http://stackoverflow.com/q/21419783
tags question: http://stackoverflow.com/q/21360220
tag name: apache-poi
tags question: http://stackoverflow.com/q/21488738
tags question: http://stackoverflow.com/q/21392659
tags question: http://stackoverflow.com/q/21475330
tags question: http://stackoverflow.com/q/21430336
tags question: http://stackoverflow.com/q/21418251
tags question: http://stackoverflow.com/q/21502979
tags question: http://stackoverflow.com/q/21386211
tags question: http://stackoverflow.com/q/21372109
tags question: http://stackoverflow.com/q/21470955

http://stackoverflow.com/a/21506116
downvote count: 0
has body: How about String.format("%h", 256)
type: Answer
answers question: http://stackoverflow.com/q/21506060
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32467318

http://stackoverflow.com/comment/32265586
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21391887
has text: If you want to parse xml use something like dom4j (easiest) or stax (better for really large xml documents but more complicated)
type: AnswerComment

http://stackoverflow.com/comment/32493675
type: AnswerComment
has text: Like I said you may need to change the OJDBC jar to match with your Oracle Version. See this Answer for more Information http://stackoverflow.com/questions/9156379/ora-01882-timezone-region-not-found
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21455254

http://stackoverflow.com/comment/32305625
has text: very well said, thank you very much. Could you please give me any example or link for such tutorial.
type: Comment
comment on: http://stackoverflow.com/a/21413822
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32486531
comment on: http://stackoverflow.com/a/21506201
type: AnswerComment
type: Comment
score: 0
has text: Another thing to note: the way you are checking against your array value to 'false' is improper, as single quotes only denote a char and not a String.

http://stackoverflow.com/a/21425832
has body: in short: Set&lt;E&gt; extends a superinterface Iterable&lt;E&gt; and so passes down the methods from Iterable&lt;E&gt; The object keys will thus have access to these methods. Here's the link to the docs.
downvote count: 1
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21425783

http://stackoverflow.com/a/21512586
score: 0
answers question: http://stackoverflow.com/q/21512552
type: Answer
has body: You are consuming the next element in your println. System.out.println("\t" + sectionScan.next()); Instead store the next() value once and reuse it. score = sectionScan.next(); System.out.println("\t" + score);

http://stackoverflow.com/q/21452581
tagged with: exception
type: UnansweredQuestion
has body: I'm using the Apache Commons HTTP Client and I have included all the required jar files (ie commons-httpclient-3.0.1.jar and commons-httpclient-3.1.jar) in the class path. The purpose of this code is to send files (in this case images) to the content management system when a website user creates and saves a new image article. The exception appears in the File Sender window when the filesender attempts to transfer images from the Tomcat temp folder to the CMS. This causes the process to fail and the images remain stuck in the temp folder. What could be the cause of this error? SEVERE: Policy class "uk.co.content.article.MoodboardArticlePolicy" spec ified by input template MoodboardArticle as top policy has a dependency on some class where runtime version is incompatible with the version compiled ag ainst java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEnt ity at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.polopoly.cm.policy.PolicyFactoryDependencyInjecting$DependencyInj ectionPolicyInstantiator.createInstance(PolicyFactoryDependencyInjecting.java:71 ) at com.polopoly.cm.policy.PolicyFactory.createPolicyInstance(PolicyFacto ry.java:141) at com.polopoly.cm.policy.PolicyFactoryDependencyInjecting.createPolicyI nstance(PolicyFactoryDependencyInjecting.java:49) at com.polopoly.cm.policy.PolicyFactory.createPolicy(PolicyFactory.java: 103) at com.polopoly.cm.policy.PolicyCMServerBase.getPolicyFor(PolicyCMServer Base.java:1046) at com.polopoly.cm.policy.PolicyCMServerBase.getPolicyFor(PolicyCMServer Base.java:972) at com.polopoly.cm.policy.PolicyCMServerBase.createNewVersion(PolicyCMSe rverBase.java:177) at com.polopoly.cm.policy.PolicyCMServerBase.createNewVersion(PolicyCMSe rverBase.java:157) at com.polopoly.cm.policy.PolicyCMServerBase.createContentVersion(Policy CMServerBase.java:740) at com.polopoly.cm.policy.PolicyCMServerBase.createContentVersion(Policy CMServerBase.java:754) at uk.co.prestige.…
has comment: http://stackoverflow.com/comment/32373451
has comment: http://stackoverflow.com/comment/32372449
answer count: 0
tagged with: java
tagged with: noclassdeffounderror
type: Question
tagged with: jakarta-ee
has title: Java - Apache Commons HttpClient throws a NoClassDefFoundError
score: 0
has comment: http://stackoverflow.com/comment/32373017
tagged with: apache-commons-httpclient

http://stackoverflow.com/a/24678737
has body: I had the same issue, try changing up the subject with more capital letters. When I was having my trouble with this the subject really defined for me at least if the mail got sent to the junk folder or not. Like I said try playing around with the subject (more capital letters, less words, more words) and see what happens.
upvote count: 0
answers question: http://stackoverflow.com/q/21353029
type: Answer
downvote count: 2
score: -2

http://stackoverflow.com/q/21479973
has comment: http://stackoverflow.com/comment/32420177
answer count: 0
has comment: http://stackoverflow.com/comment/32420606
has comment: http://stackoverflow.com/comment/32420332
type: Question
has body: I am trying to instantiate Google Calendar: Calendar service = new Calendar(httpTransport, jsonFactory, accessProtectedResource); but I get an error nested exception is java.lang.NoSuchMethodError: com.google.api.client.util.Strings.isNullOrEmpty(Ljava/lang/String;)Z I am getting accessProtectedResource: GoogleAccessProtectedResource accessProtectedResource = new GoogleAccessProtectedResource( "access token", httpTransport, jsonFactory, clientId, clientSecret, "refresh token"); tokens I get from OAuth 2 Playground.
tagged with: google-calendar-api
score: 0
tagged with: java
tagged with: calendar
has title: Could not instantiate Google Calendar
has comment: http://stackoverflow.com/comment/32420399
type: UnansweredQuestion

http://stackoverflow.com/a/21645174
type: Answer
score: 11
upvote count: 11
has body: With an EntityGraph definition like this @NamedEntityGraph( name = "post", attributeNodes = { @NamedAttributeNode("title"), @NamedAttributeNode(value = "comments", subgraph = "comments") }, subgraphs = { @NamedSubgraph( name = "comments", attributeNodes = { @NamedAttributeNode("content")} ) } ) the EntityGraph instance can be activated like this on the Querydsl query EntityGraph postGraph = em.getEntityGraph("post"); query.setHint("javax.persistence.fetchgraph", postGraph) source: http://hantsy.blogspot.fi/2013/12/jpa-21-entity-graph.html
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21405897
has comment: http://stackoverflow.com/comment/41915270
answers question: http://stackoverflow.com/q/21405897

http://stackoverflow.com/comment/32311987
type: QuestionComment
comment on: http://stackoverflow.com/q/21412620
has text: In your first example, you do server.start() and then server.join(). I believe that join() blocks the calling thread until the server shuts down. That is a really REALLY bad thing to do in a BundleActivator start method... you steal the thread of the launcher and will actually prevent the OSGi framework from starting properly.
score: 0
type: Comment

http://stackoverflow.com/comment/32374254
type: QuestionComment
score: 0
has text: @DhanaKrishnasamy: it runs, because valueWrapper is a field of ConcurrencyApp
comment on: http://stackoverflow.com/q/21439275
type: Comment

http://stackoverflow.com/q/21372987
type: AnsweredQuestion
has title: Line up images using setCompoundDrawable()
tagged with: android-drawable
has comment: http://stackoverflow.com/comment/32231174
tagged with: java
has answer: http://stackoverflow.com/a/21373730
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21373510
possible better answer: http://stackoverflow.com/a/21373799
score: -1
has answer: http://stackoverflow.com/a/21373799
has comment: http://stackoverflow.com/comment/32231254
answer count: 3
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32231356
accepted answer: http://stackoverflow.com/a/21373510
has comment: http://stackoverflow.com/comment/32231098
tagged with: android
has body: I just learned about TextView.setCompoundDrawables() and I'm using it in a ListView to place an image to the left of my text. The problem is that the thumbnail images are different sizes, so the text wanders all over the place. Is there a simple way to get the text to line up nicely on the left-hand side? Code: TextView machineText = (TextView) v .findViewById(android.R.id.text1); machineText.setCompoundDrawablesWithIntrinsicBounds(thumbnail, null, null, null); Screenshot:

http://stackoverflow.com/a/21490815
has comment: http://stackoverflow.com/comment/32440736
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21490289
answers question: http://stackoverflow.com/q/21490289
has body: It's not harmful, it's just never useful. What can you do in a constructor of a class that has no access to external resources (these may not have been provisioned for the servlet yet), no access to container resources (also may not have been provisioned for the servlet), no access to configuration, no constructor arguments, etc.
has comment: http://stackoverflow.com/comment/32440335
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/21471252
upvote count: 3
has answer: http://stackoverflow.com/a/21472607
tagged with: exist-db
type: Question
score: 3
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/21479435
downvote count: 0
possible better answer: http://stackoverflow.com/a/21472607
accepted answer: http://stackoverflow.com/a/21479435
has title: eXist xml db : java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer
favorite count: 0
has body: I am trying to access an eXist xml db using the embedded method, as described here. That page has a list of jars needed for the classpath, and I have all of them there, but I keep getting this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer Here's what I have in my classpath; I'm using eclipse: antlr-2.7.7.jar commons-collections-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.6.jar exist-modules.jar exist-optional.jar exist.jar jta-1.1.jar log4j-1.2.17.jar pkg-repo.jar quartz-2.1.6.jar slf4j-api-1.7.2.jar slf4j-log4j12-1.7.2.jar sunxacml-1.2.jar xmldb.jar xmlrpc-client-3.1.3.jar xmlrpc-common-3.1.3.jar xmlrpc-server-3.1.3.jar saxonhe-9.4.0.7.jar serializer-2.7.1.jar xalan-2.7.1.jar xercesImpl-2.11.0.jar xml-apis-1.4.01.jar xml-resolver-1.2.jar Here is the relevant code: System.out.println("trying to call class.forname on " + DRIVER); Class cl = Class.forName(DRIVER); System.out.println("creating db instance"); Database database = (Database) cl.newInstance(); database.setProperty("create-database", "true"); System.out.println("register database"); DatabaseManager.registerDatabase(database); System.out.println("getting collection: " + URI + collectionName); Collection collection = DatabaseManager.getCollection(URI + collectionName); //collection.setProperty(OutputKeys.INDENT, "yes"); //System.out.println("getting resource"); //XMLResource xmlRes = (XMLResource)collection.getResource(resourceName); and here is the console output including the error: ****************************************************** reading a doc from xml db ****************************************************** reading doc... trying to call class.forname on org.exist.xmldb.DatabaseImpl creating db instance register database getting collection: xmldb:exist://localhost:8080/exist/xmlrpc/db/test-journal Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer at org.apache.xmlrpc.serial…
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

axis
tags question: http://stackoverflow.com/q/21362370
tag name: axis
tags question: http://stackoverflow.com/q/21453887
tags question: http://stackoverflow.com/q/21409574
type: Tag

http://stackoverflow.com/comment/32214623
type: Comment
has text: dasblinkenlight also said the same stuff but your regex is much simpler :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21364011

performance
tags question: http://stackoverflow.com/q/21478182
tags question: http://stackoverflow.com/q/21476348
tags question: http://stackoverflow.com/q/21374880
tags question: http://stackoverflow.com/q/21431281
tags question: http://stackoverflow.com/q/21428874
tags question: http://stackoverflow.com/q/21434845
tags question: http://stackoverflow.com/q/21489682
tags question: http://stackoverflow.com/q/21492986
tags question: http://stackoverflow.com/q/21486915
tags question: http://stackoverflow.com/q/21360091
tags question: http://stackoverflow.com/q/21419963
tags question: http://stackoverflow.com/q/21430744
tags question: http://stackoverflow.com/q/21445354
tags question: http://stackoverflow.com/q/21481989
tags question: http://stackoverflow.com/q/21432400
tags question: http://stackoverflow.com/q/21445662
tags question: http://stackoverflow.com/q/21373295
tags question: http://stackoverflow.com/q/21433430
tags question: http://stackoverflow.com/q/21440908
tags question: http://stackoverflow.com/q/21407025
tags question: http://stackoverflow.com/q/21425634
tags question: http://stackoverflow.com/q/21473142
tags question: http://stackoverflow.com/q/21404209
tags question: http://stackoverflow.com/q/21410988
tags question: http://stackoverflow.com/q/21358212
tags question: http://stackoverflow.com/q/21481867
tags question: http://stackoverflow.com/q/21428177
tags question: http://stackoverflow.com/q/21465868
tag name: performance
tags question: http://stackoverflow.com/q/21400016
tags question: http://stackoverflow.com/q/21434881
tags question: http://stackoverflow.com/q/21383373
tags question: http://stackoverflow.com/q/21370015
type: Tag
tags question: http://stackoverflow.com/q/21420888
tags question: http://stackoverflow.com/q/21452088
tags question: http://stackoverflow.com/q/21476203
tags question: http://stackoverflow.com/q/21398631
tags question: http://stackoverflow.com/q/21403782
tags question: http://stackoverflow.com/q/21486707

http://stackoverflow.com/comment/32218289
comment on: http://stackoverflow.com/q/21366247
has text: You can 'save" stdin/out in variables and then restore them the way you set the file streams
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21538216
has comment: http://stackoverflow.com/comment/32526815
has comment: http://stackoverflow.com/comment/32568879
has comment: http://stackoverflow.com/comment/32570431
has comment: http://stackoverflow.com/comment/32559185
answers question: http://stackoverflow.com/q/21472245
has comment: http://stackoverflow.com/comment/32528057
has comment: http://stackoverflow.com/comment/32556535
has comment: http://stackoverflow.com/comment/32564359
has comment: http://stackoverflow.com/comment/32561752
has comment: http://stackoverflow.com/comment/32563790
has comment: http://stackoverflow.com/comment/32526357
score: 0
type: Answer
has body: EDIT: I think I may have answered a slightly different question. jarnbjo pointed out something that may be wrong with my solution, and I realized I misunderstood the question. I'm leaving my answer here for posterity, though. I may have a solution to this in Matlab. To find the closest color, I used the weights given by Albert Renshaw in a comment here. I used the HSV colorspace, but all inputs to the code were in standard RGB. Greyscale iamges were converted to 3-channel greyscale images. To select the best colors to use, I seeded kmeans with the test sample palette and then reset the centroids to be the values they were closest to in the sample pallet. function imo = recolor(im,new_colors,max_colors) % Convert to HSV im2 = rgb2hsv(im); new_colors = rgb2hsv(new_colors); % Get number of colors in palette num_colors = uint8(size(new_colors,1)); % Reshape image so every row is a diferent pixel, and every column a channel % this is necessary for kmeans in Matlab im2 = reshape(im2, size(im,1)*size(im,2),size(im,3)); % Seed kmeans with sample pallet, drop empty clusters [IDX, C] = kmeans(im2,max_colors,'emptyaction','drop'); % For each pixel, IDX tells which cluster in C it corresponds to % C contains the centroids of each cluster % Because centroids are adjusted from seeds, we need to select which original color % in the palette it corresponds to. We cannot be sure that the centroids in C correspond % to their seed values % Note that Matlab starts indexing at 1 instead of 0 for i=1:size(C,1) H = C(i,1); S = C(i,2); V = C(i,3); bdel = 100; % Find which color in the new_colors palette is closest for j=1:size(new_colors,1) H2 = new_colors(j,1); S2 = new_colors(j,2); V2 = new_colors(j,3); dH = (H2-H)^2*0.475; dS = (S2-S)^2*0.2875; dV = (V2-V)^2*0.2375; del = sqrt(dH+dS+dV); if isnan(del) continue end % update if the new delta is lower than the best if del&lt;bdel bdel = del; C(i,:) = new_colors(j,:); end end end % Update the colors, this is equal to the following % for i=1:…
has comment: http://stackoverflow.com/comment/32570689
has comment: http://stackoverflow.com/comment/32526140

http://stackoverflow.com/comment/32369581
type: Comment
comment on: http://stackoverflow.com/a/21449156
score: 2
has text: @SketchistGames instead of creating new Vecotr2 you could use myVector = Pools.obtain(Vector2.class) and call Pools.free(myVector) when you don't need it anymore.
type: AnswerComment

http://stackoverflow.com/comment/32556386
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21457899
has text: Has the edit been edited? Would you be able to put code where you have commented so i can work from that? It would be much appreciated
score: 0

http://stackoverflow.com/q/21388466
has answer: http://stackoverflow.com/a/21389131
has answer: http://stackoverflow.com/a/21388505
has answer: http://stackoverflow.com/a/21389077
score: 12
type: Question
has body: I have N numbers in arraylist. To get the indexOf, arraylist will have to iterate maximum N times, so complexity is O(N), is that correct?
answer count: 7
has answer: http://stackoverflow.com/a/21388801
favorite count: 0
upvote count: 14
tagged with: arraylist
has answer: http://stackoverflow.com/a/41791806
tagged with: time-complexity
has answer: http://stackoverflow.com/a/21388632
has comment: http://stackoverflow.com/comment/32260526
has title: Is ArrayList indexOf complexity N?
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21388497
tagged with: java

http://stackoverflow.com/a/21411057
upvote count: 1
has comment: http://stackoverflow.com/comment/32301012
type: Answer
has comment: http://stackoverflow.com/comment/32298800
downvote count: 0
score: 1
has body: Carefully read the API for JComponent. The usages are: setVisible - it will hide or show your component altogether. If you set it as false, you won't see it at all. repaint() - is called when the actual pixels need to be redrawn, this is done automatically. It's used, for example, when you move a window on top of your GUI and then move it away. The part that was covered needs to be redrawn. validate() - you should call this when the layout of your GUI has changed and you need the manager to replace and redraw your GUI. It's a bit more complicated than that, so again, carefully read the API.
has comment: http://stackoverflow.com/comment/32298964
answers question: http://stackoverflow.com/q/21410908

http://stackoverflow.com/comment/32223275
type: AnswerComment
comment on: http://stackoverflow.com/a/21368562
has text: helpful, but can you also tell me how do i dynamically figure out at which tab i am currently at? That's will complete solve my issue
type: Comment
score: 0

http://stackoverflow.com/q/21396766
has answer: http://stackoverflow.com/a/21397041
has body: I am having trouble converting an int to string. I use java to connect to a database (Access). Now I'm trying to retrieve the value from a YES/NO Field Access but it'sa check box jlbABC.setText(rs.getString("RightWrong")); The answer I get is 1 if it is True(YES), and 0 if is False (NO) How do I change the answer from 1 to YES and 0 to NO?
type: UnansweredQuestion
tagged with: string
tagged with: ms-access
type: Question
score: 0
has answer: http://stackoverflow.com/a/21396829
answer count: 2
has title: Read yes/no field from access - Display on java as String
tagged with: java

http://stackoverflow.com/q/21485361
tagged with: java
has title: android threading and handler - Changing UI objects from a background thread
accepted answer: http://stackoverflow.com/a/21485529
type: Question
has comment: http://stackoverflow.com/comment/32429824
score: 0
tagged with: handler
answer count: 1
has answer: http://stackoverflow.com/a/21485529
tagged with: multithreading
tagged with: android
linked to: http://stackoverflow.com/q/11140285
type: AnsweredQuestion
has body: I've recently written a small android application to send and receive UDP messages over a local network. I have a UDP receiver thread that runs to listen for UDP packets, what I want to happen is a button to become enabled on the UI when a packet is received that contains a certain string of data. I know that this has to be done with a handler, the problem being that I have a small amount of knowledge about threads and very little knowledge about handlers. would someone be able to shed some light on how a handler could be put into my code? thanks code: public void startUDPlistener() { // Creates the listener thread LISTEN = true; Thread listenThread = new Thread(new Runnable() { @Override public void run() { try { Log.i(LOG, "Listener started!"); DatagramSocket socket = new DatagramSocket(BROADCASTPORT); socket.setSoTimeout(1500); byte[] buffer = new byte[BUFFERSIZE]; DatagramPacket packet = new DatagramPacket(buffer, BUFFERSIZE); while(LISTEN) { try { Log.i(LOG, "Listening for packets"); socket.receive(packet); String data = new String(buffer, 0, packet.getLength()); Log.i(LOG, "UDP packet received from "+ packet.getAddress() +" packet contents: " + data); } catch(IOException e) { Log.e(LOG, "IOException in Listener " + e); } } Log.i(LOG, "Listener ending"); socket.disconnect(); socket.close(); return; } catch(SocketException e) { Log.e(LOG, "SocketException in Listener " + e); } } }); listenThread.start(); }

http://stackoverflow.com/comment/32450396
type: Comment
score: 0
has text: Hello, thanks for your detailed answer. I, however, start the threads in a similar way. Except that after .start() I have to .join() the threads to prevent any race condition over their input variables. The problem still persists.
type: AnswerComment
comment on: http://stackoverflow.com/a/21458399

http://stackoverflow.com/q/21397554
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32280835
tagged with: forms
tagged with: struts2
has body: I have a struts2 form in which I added a Datepicker as a field. But after adding the DatePicker, when I submit my form, the Tomcat error msg shows.. HTTP Status 404 - No result defined for action com.abc.RecBackupConfigurationAction and result input If I remove datepicker from my form, then everything runs fine. I don't know where I'm doing wrong. My JSP: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <%@taglib prefix="s" uri="/struts-tags" %> <sj:head /> Recording Backup Configuration <s:form theme="simple" action="saveDetailsRecBackupConf" method="post" name="viewConfiguration"> Rule Name : Frequency : 15 minutes 30 minutes 60 minutes 120 minutes 240 minutes 480 minutes Backup Server: Backup Directory: Select Campaign : <s:select id="campaign" headerKey="-1" headerValue="Select Campaign" list="campaignList" name="campname" theme="simple" onchange="grabDispositions(this.value)"/> Select Dispositions : <s:select id="dispositions" list="dispositionList" name="dispositions" multiple="true" theme="simple"/> Status : Active InActive Select Date : <sj:datepicker size="14" theme="simple" id="addedon" name="addedon" label="Select a Date/Time" timepicker="true" timepickerFormat="HH:mm:ss" displayFormat="yy-mm-dd" readonly="true"></sj:datepicker> </s:form> My struts-file mapping: recBackupConfiguration viewRecordingConfiguration contaque/recBackup/dispositions.jsp contaque/recBackup/editConfiguration.jsp How should I add the Datepicker to my form???
tagged with: struts2-jquery
score: 0
has comment: http://stackoverflow.com/comment/32288715
has comment: http://stackoverflow.com/comment/32281009
type: UnansweredQuestion
tagged with: datepicker
has comment: http://stackoverflow.com/comment/32281164
has comment: http://stackoverflow.com/comment/32288303
has title: No result defined for action and result input after adding struts2 JQuery Datepicker
answer count: 0

http://stackoverflow.com/comment/32219235
type: QuestionComment
has text: You can deploy your Java Swing application using [tag:java-web-start].
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21365248

http://stackoverflow.com/comment/32317610
type: Comment
type: QuestionComment
has text: Yea, I ran those kinds of tests and the consecutive numbers are the ones listed above. The initial numbers are worse, but not by a lot. I also actually took a look at the server side latency in DynamoDB console and saw times of about 40ms for a single read, which is pretty crazy high, at least for my use case.
comment on: http://stackoverflow.com/q/21420766
score: 0

http://stackoverflow.com/a/21370378
answers question: http://stackoverflow.com/q/21367939
has body: your answer is good but it miss a lot of information this is the right answer from the doc you give me thank you after all Border Campound,empty,Boveld; empty = BorderFactory.createEmptyBorder(60, 5, 5, 5); Boveld = BorderFactory.createBevelBorder(BevelBorder.RAISED); Campound = BorderFactory.createCompoundBorder(empty,Boveld); JPanel textFiled = new JPanel(); textFiled.setBorder(Campound);
score: 0
has comment: http://stackoverflow.com/comment/32228937
type: Answer

http://stackoverflow.com/comment/32229019
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21371849
has text: Close the TCP socket correctly. Just calling `close` is not sufficient. You need to `shutdown` the sending side, then continue trying to receive until you get a normal close, and then you can call `close` on your side.

http://stackoverflow.com/comment/36680302
has text: http://forum.xda-developers.com/showthread.php?t=2222703 bu site de açiklamalar var, stackoverflow da da bulabilirsin, ben simdilik mms lerle ugrasmiyorum.
comment on: http://stackoverflow.com/a/21887612
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32410453
has text: Try the web based admin console. The default URL is http://localhost:7001/console. Use the IP address if the server isn't local. Of course this URL is available if only your weblogic server is running.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21423698
type: Comment

http://stackoverflow.com/q/21492247
type: Question
tagged with: mockito
answer count: 1
has body: I am working on an Android app which has some pure java based components that i want to test using Mockito. I have some questions about configuring Mockito with my code base. Should I create a test project in my code base? Does Mockito has anything to do with JUnit? Do i need to include JUnit libs as well? How do i run the Mockito test from Eclispe as opposed to JUnit test which is far more easier to run by doing Run As-> JUnit Test. Kindly suggest some tutorial that could demo the setup and running of tests.
tagged with: junit
has title: How to configure and run a Mockito test
favorite count: 0
has answer: http://stackoverflow.com/a/21492331
tagged with: android
upvote count: 6
accepted answer: http://stackoverflow.com/a/21492331
type: AnsweredQuestion
score: 3
tagged with: java
downvote count: 3
tagged with: eclipse

http://stackoverflow.com/q/21459178
tagged with: jsp
possible better answer: http://stackoverflow.com/a/21459241
has answer: http://stackoverflow.com/a/21459241
has answer: http://stackoverflow.com/a/21459281
type: AnsweredQuestion
tagged with: java
has body: i'm creating the Simple CRUD Using Jsp, Servlet and MySQL program and i'm using the eclipse, and i all most done it, finally i'm going to run myself, it can't be run. i will install the jar file of jstl, servlet, mysql connector and finally standard.jar files are installed. but i'm getting exactly this error. i will try to start the server to right click one the tomcat v6.0 server at localhost to find start button, to click and displaying this window. The archive: C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/jtechemployee/WebContent/WEB-INF/lib/jstl-1.2.jar which is referenced by the classpath, does not exist. Any one out of this problem of error, thanks in advance.
type: Question
accepted answer: http://stackoverflow.com/a/21459281
tagged with: eclipse
score: 0
answer count: 2
tagged with: jstl
has title: how to solve this kind of error in Eclipse IDE?
tagged with: jar

http://stackoverflow.com/a/21500049
has comment: http://stackoverflow.com/comment/32457232
answers question: http://stackoverflow.com/q/21499944
downvote count: 0
has body: To get the xml tag name you have to change this: List listAttributrBody = e.getChildren(); String element2 = listAttributrBody.get(0).toString(); To this: List&lt;Element&gt; listAttributrBody = e.getChildren(); String element2 = listAttributrBody.get(0).getName(); If you are using older version (1.1) you are not allowed to use generics () then you have to do this: List listAttributrBody = e.getChildren(); Element el2 = (Element)listAttributrBody.get(0); String element2 = el2.getName(); You can read more about available methods in jdom api
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32457143
has comment: http://stackoverflow.com/comment/32456820
accepted answer of: http://stackoverflow.com/q/21499944
type: Answer

http://stackoverflow.com/comment/32260702
type: Comment
type: QuestionComment
has text: You're using AuthAuction as a type variable, not as a type argument.
comment on: http://stackoverflow.com/q/21389464
score: 0

http://stackoverflow.com/q/21425350
tagged with: guice
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21439626
favorite count: 0
has comment: http://stackoverflow.com/comment/32323894
has body: I know my title is confusing. Im having a hard time to summarize what I want to ask. What I mean is is there a way to use guice to inject classes that implement interface A using a binding method where the annotation is in the class that implements interface A rather than binding it in the configure method or adding a @ImplementedBy annotation in interface A. Update As I read tutorials using guice, in order to dictate that a certain class implements an interface one must use bindings. Now there are many ways to perform bindings. Examples of which are: Linked Binding: bind(AInterface).to(Bclass); This code will be located in the configure method of the class that extends abstract module. This tells guice that if their are dependencies that require AInterface it may inject BClass to handle to dependency. Just in time binding: @ImplementedBy(BClass.class) public interface AInterface { } This example is equivalent to the linked binding example. Now all of the bindings I read require me to declare in either the configure method or interface that a class implements that interface. This will require me to edit existing code every time I implement the interface. What I want is to simply have the class that implements the interface handle the binding itself so as not to modify existing code. Something like @Exports(AInterface.class) public BClass implements AInterface{ }
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6085200
linked to: http://stackoverflow.com/q/3222638
has title: Annotation to bind a class that implements an interface in guice
tagged with: java
accepted answer: http://stackoverflow.com/a/21439626
has comment: http://stackoverflow.com/comment/32325338
type: Question
has comment: http://stackoverflow.com/comment/32328296
score: 4
has comment: http://stackoverflow.com/comment/32324341
upvote count: 4
has comment: http://stackoverflow.com/comment/32325496

http://stackoverflow.com/comment/114271894
score: 1
has text: What if its not a list ? Get wont be available , I had a requirement to take a set and stream it and then the above solution was working. There is no option in linkedhashset to get last or nth element from back without iterating thru elements. I upvoted this to save the author from drowning :D
comment on: http://stackoverflow.com/a/51152724
type: AnswerComment
type: Comment

replaceall
tags question: http://stackoverflow.com/q/21398881
type: Tag
tags question: http://stackoverflow.com/q/21420497
tag name: replaceall

instance
tags question: http://stackoverflow.com/q/21403054
tags question: http://stackoverflow.com/q/21397108
type: Tag
tag name: instance
tags question: http://stackoverflow.com/q/21440748

http://stackoverflow.com/q/21454374
possible better answer: http://stackoverflow.com/a/21454415
tagged with: exit
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/21454395
tagged with: boolean
answer count: 2
upvote count: 0
has body: I've been working on a solution of a problem in Java. I have a store and I need to ask the customer if she/he had bought anything. If he/she types "yes" I want the program to continue to the next question and if he/she types "no" I want a message to appears such as "have a nice day!" and then I want the program to stop. How can I manage this? Thank you! Here's what I've done so far ~Line 17 to 20~ (but it doesn't work very well): import java.util.Scanner; public class Discount { public static void main(String[] args) { String cname; float I_price, drate, discount, dprice; Scanner in = new Scanner(System.in); System.out.println("Enter Costumers Name:"); cname = in.next(); System.out.println("Have you bought anything?"); if (cname == "no") { System.out.println("Have a good day!"); System.exit(0); } System.out.println("Enter Price of Item:"); I_price = in.nextFloat(); System.out.println("Enter Discount Rate:"); drate = in.nextFloat(); discount = (I_price * drate / 100); dprice = (I_price - discount); System.out.println( "Costumer Name:" + cname + "\n" + "Discount Rate:" + discount + "\n" + "Discounted Price:" + dprice + "\n"); } }
favorite count: 0
has title: Java: Yes to continue No to exit
linked to: http://stackoverflow.com/q/513832
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21454395
has answer: http://stackoverflow.com/a/21454415
downvote count: 1
type: Question

http://stackoverflow.com/a/21457502
score: 18
has comment: http://stackoverflow.com/comment/32392392
has comment: http://stackoverflow.com/comment/32430294
answers question: http://stackoverflow.com/q/21457469
has comment: http://stackoverflow.com/comment/32407592
has body: This is a standard part of the Java Collections API: boolean exists = listObject.contains(str);
upvote count: 18
has comment: http://stackoverflow.com/comment/32396347
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32463653
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21503600
has text: Sorry to bother you, but once I add this, how would I call the current location?

http://stackoverflow.com/a/21383288
answers question: http://stackoverflow.com/q/21382726
score: 5
accepted answer of: http://stackoverflow.com/q/21382726
has body: Something may be wrong with your with your String path. What you should do though, instead o reading a file, you should be reading a URL, loading from the class path. At time of deployment, you'll find out that the file path won't work, so it's better to package your image as an embedded resource, putting the image in the class path. I had no problems when doing this. Here's what I did. Change the path to a path relative to my class path World w = new World("Hej", "/resources/stackoverflow5.png", 1024, 768); Changed loading from a file to loading from a URL from my class path background = new ImageIcon(SpritePanel.class.getResource(bgPath)); Put the image in resources package in my class path Everything works fine import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JLabel; import javax.swing.JPanel; public class Implementation { public static void main(String[] args) { World w = new World("Hej", "/resources/stackoverflow5.png", 1024, 768); } } class World extends JFrame { private static final long serialVersionUID = 1L; private SpritePanel spritePanel; private JPanel bottom; private int width; private int height; public World(String windowCaption, String bgPath, int width, int height) { super(windowCaption); spritePanel = new SpritePanel(bgPath); add(spritePanel, BorderLayout.CENTER); System.out.println(spritePanel); bottom = new JPanel(); bottom.add(new JLabel("Hej")); add(bottom, BorderLayout.SOUTH); Dimension size = new Dimension(width, height); setSize(size); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setVisible(true); validate(); repaint(); } class SpritePanel extends JPanel { private static final long serialVersionUID = 1L; private ImageIcon background; //private ArrayList&lt;Sprite&gt; sprites = new ArrayList&lt;Sprite&gt;(); public SpritePanel(String bgPath) { background …
upvote count: 5
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32217767
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21358705
type: Comment
has text: Yea you are right, it would just loop forever by going back to the previous coordinates. I added one more condition in the if statement and it took care of it. You da man! I appreciate it.

http://stackoverflow.com/a/21453290
accepted answer of: http://stackoverflow.com/q/21453254
has body: You can use instanceof: if ( this.ActivityContext instanceof MyActivity ) { /// .... }
answers question: http://stackoverflow.com/q/21453254
type: AcceptedAnswer
upvote count: 71
has comment: http://stackoverflow.com/comment/127268261
has comment: http://stackoverflow.com/comment/97385764
downvote count: 0
has comment: http://stackoverflow.com/comment/83821813
type: Answer
score: 71

http://stackoverflow.com/q/21408401
tagged with: stringbuilder
tagged with: java
has answer: http://stackoverflow.com/a/21408556
has answer: http://stackoverflow.com/a/21408498
type: Question
has title: Java: Remove String from StringBuilder
accepted answer: http://stackoverflow.com/a/21408524
possible better answer: http://stackoverflow.com/a/21408556
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/32294215
has body: I want to remove String from StringBuilder Example String aaa = "sample"; String bbb = "sample2"; String ccc = "sample3"; In another part StringBuilder ddd = new StringBuilder(); ddd.append(aaa); ddd.append(bbb); ddd.append(ccc); I want to check if StringBuilder ddd contains String aaa and remove it if (ddd.toString().contains(aaa)) { //Remove String aaa from StringBuilder ddd } Is that possible? Or is there any other way to do like that?
linked to: http://stackoverflow.com/q/12353273
has answer: http://stackoverflow.com/a/21413278
answer count: 4
duplicate of: http://stackoverflow.com/q/12353273
has comment: http://stackoverflow.com/comment/32294172
upvote count: 14
has answer: http://stackoverflow.com/a/21408524
has comment: http://stackoverflow.com/comment/32293875
has comment: http://stackoverflow.com/comment/32293861
score: 14
type: AnsweredQuestion

http://stackoverflow.com/a/21421762
downvote count: 0
has comment: http://stackoverflow.com/comment/32317506
type: Answer
has comment: http://stackoverflow.com/comment/37011780
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21421608
answers question: http://stackoverflow.com/q/21421608
has body: Simply add a space after 'id' in the private static final String COLUMN_ID = "id"; I always print my db commands constructed in the code in the log to check as I always make mistakes with the space, brackets or commas. Saves a lot of heartache.
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/136190108
score: 0
type: Comment
type: QuestionComment
has text: See [*Does Java define constants for any characters such as SPACE?*](https://stackoverflow.com/q/33183525/642706). I posted source code declaring constants for all of ASCII in [this Answer](https://stackoverflow.com/a/77248280/642706).
comment on: http://stackoverflow.com/q/21437180

http://stackoverflow.com/comment/32455792
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21496764
has text: [searching a bit](http://stackoverflow.com/questions/5180339/how-to-get-resultsetmetadata-from-entity-manager) (hint, hint :-) it looks like there is no way to get the metadata (not those retrieved from a resultSet) from the EntityManager
score: 0

http://stackoverflow.com/comment/32268395
type: QuestionComment
comment on: http://stackoverflow.com/q/21393373
has text: It looks like you are leaking `ResultSet` instances. You could take a heap dump and see where they're being held onto.
score: 4
type: Comment

http://stackoverflow.com/comment/32362971
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21447111
has text: +1 for Actions, nice idea, doesn't quite answer the problem of missing resources though...but that's how I read the question ;)
type: AnswerComment

http://stackoverflow.com/comment/32238958
score: 0
type: Comment
has text: but using `OutputStream out` I get errors on out.size()(`The method size() is undefined for the type OutputStream`) and on out.writeTo(os) (`The method writeTo(OutputStream) is undefined for the type OutputStream`)
comment on: http://stackoverflow.com/a/21377193
type: AnswerComment

http://stackoverflow.com/a/21481329
score: 8
upvote count: 8
accepted answer of: http://stackoverflow.com/q/21480430
has body: Yes, it seems that Message.getFrom() can really return multiple addresses. I had a look at the sources for Apache Geronimo's implementation of the JavaMail API, and it will return multiple addresses if there are multiple From: headers, or multiple addresses inside one header. As to whether this could happen: As explained by Alex K.'s answer, the standard allows multiple "From" addresses if there is a single "Sender". I don't know whether anyone really sends mails with multiple "From" addresses, but it is standards-compliant. Another situation which actually happens in practice: Some spammers apparently send mail with multiple From: headers. This is not standards-compliant, but apparently some mail servers still accept the mail. This is apparently done to get past mail filters that filter by the From: address. The spammers include multiple addresses in the hope that a simple-minded filter will let the message pass if it finds one header with a "From"-address it likes. So in summary: Yes, you should expect Message.getFrom() to return multiple addresses (or none at all). However, you probably don't need to expend a lot of energy for handling that case. Maybe you can even get away with just logging it as an error - that depends on your application.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21480430
type: Answer

http://stackoverflow.com/a/21370349
has comment: http://stackoverflow.com/comment/32236471
answers question: http://stackoverflow.com/q/21368475
upvote count: 3
has comment: http://stackoverflow.com/comment/32236369
downvote count: 0
score: 3
type: Answer
has body: This is common issue with KeyListener. The problem is, KeyListener will only respond to key strokes when the component it is registered to is focusable AND has keyboard focus. This, generally, makes it inappropriate for general use, it's really a specialised listener. Instead, you should use the Key Bindings API, which allows you to control the focus level that the key strokes will be triggered at

http://stackoverflow.com/q/21416683
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21416718
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21416718
score: 0
answer count: 2
has title: Read a text file and assign values to variables
has body: Java beginner here but I am sincerely trying. The goal of this program is to read two values from the Realtor11.txt file and assign them to variables. The contents of Realtor11.txt is (no spaces): John 100 See section // Read Realtor11.txt Not sure what I'm doing wrong but currently the error is Realtor11.java:48: error: incompatible types price = in.readLine(); ^ required: double found: String 1 error Error: Could not find or load main class Realtor11 [Finished in 1.1s] // java class for keyboard I/O import java.util.Scanner; // java class for JOption GUI import javax.swing.JOptionPane; // File reader import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; public class Realtor11 { public static void main(String[] args) { // Keyboard and file input Scanner console = new Scanner(System.in); Scanner inputStream = null; // price of the house, the cost to sell the house and the commission double price, cost, commission; // seller’s name String seller; // GUI diplay message declaration String display_message = "This program calculates the cost to sell a home\n" + "and the commission paid to an individual sales agent.\n\n" + "The user is asked for the last name of the seller and the\n" + "sales price.\n\n"; // Output descriptive messages JOptionPane.showMessageDialog(null, display_message, "Lab 1 Description", JOptionPane.INFORMATION_MESSAGE); // Read Realtor11.txt try { BufferedReader in = new BufferedReader(new FileReader("Realtor11.txt")); while (in.read()!= -1); seller = in.readLine(); price = in.readLine(); in.close(); } catch (IOException e) {} // calculate the cost and the commission cost = 0.06 * price; commission = 0.015 * price; // display the input and results String out1 = String.format("%nThe " + seller + "’s" + " home sold for $%.2f%n", price), out2 = String.format("The cost to sell the home was $%.2f%n", cost), out3 = String.format("The selling or listing agent earned $%.2f%n", commission); JOptionPa…
possible better answer: http://stackoverflow.com/a/21416788
has answer: http://stackoverflow.com/a/21416788

http://stackoverflow.com/q/21474634
tagged with: apache-flex
type: Question
has body: I know this question may be asked 100 times but I haven't got any answer which was fullfiled my requirement. Even I searched on google but I failed to understand. Here is my question. I have developed an JAVA Webapp on Spring 3.0 + Hibernate 3.0 + JBoss AS 7.1 + MySQL. Now for rich UI I want to use flex as front end instead of using jsp pages. So from where to start? Is there any plugin for eclipse so that I can desgin UI and mxml file will be generated?(like we use to do for swing). Is flex builder 3 an paid app? I read somewhere that for flex builder adobe provide 60 days trial version but when I am trying to download nothing is coming up on adobe site. I will be very helpful if somebody helps me, guiding thourgh this very first painful steps.
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/21598370
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32411191
downvote count: 4
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/32411384
possible better answer: http://stackoverflow.com/a/21475260
favorite count: 0
has answer: http://stackoverflow.com/a/21475260
has answer: http://stackoverflow.com/a/21598370
has title: How to get start with flex?
type: AnsweredQuestion
score: -4

http://stackoverflow.com/comment/32392793
type: Comment
type: QuestionComment
score: 1
has text: Can you write the process down on a piece of paper and show us what you have and where you got stuck?
comment on: http://stackoverflow.com/q/21464367

http://stackoverflow.com/q/21420376
tagged with: java
answer count: 2
has body: So I recently was introduced to Points in my class. Right now I am trying to find the difference of X and then the difference of Y and then add them together. I am so lost and cant quite find the right answer. What are some options for this? Just a heads up this is using the Point class. Better put I dont understand the Point class that I was taught in my AP Computer Science class. Not that I don't understand how to subtract x2-x1. What command would I use to accomplish this because I continue to get errors when typing x2-x1. Heres is what I am supposed to do: "In our case, the Manhattan distance is the sum of the absolute values of the differences in their coordinates; in other words, the difference in x plus the difference in y between the points." Exact words from teacher.
has comment: http://stackoverflow.com/comment/32315477
tagged with: point
upvote count: 0
accepted answer: http://stackoverflow.com/a/21420387
has comment: http://stackoverflow.com/comment/32315598
has title: How to get the difference in a point?
favorite count: 0
has comment: http://stackoverflow.com/comment/32315416
possible better answer: http://stackoverflow.com/a/21420415
has comment: http://stackoverflow.com/comment/32315198
has answer: http://stackoverflow.com/a/21420415
downvote count: 2
has answer: http://stackoverflow.com/a/21420387
type: Question
type: AnsweredQuestion
score: -2

http://stackoverflow.com/comment/32464960
comment on: http://stackoverflow.com/q/21499240
score: 0
has text: Use a `JSpinner` as seen [here](http://stackoverflow.com/a/10021773/418556).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21405878
favorite count: 0
has title: NetBeans IDE maven project unable to solve dependencies
tagged with: dependencies
score: 2
has comment: http://stackoverflow.com/comment/32289448
tagged with: netbeans
has answer: http://stackoverflow.com/a/38939693
has answer: http://stackoverflow.com/a/21412135
upvote count: 2
type: UnansweredQuestion
tagged with: maven
has body: After using eclipse for ages I am porting myself to NetBeans IDE. I am opening my existing maven project and all seems ok, but when I am trying to build the project it is throwing error saying "Could not resolve dependencies for project" though the JAR files are present in my .m2 directory. I am using a ubuntu 12.10 and netbeans version 7.3.1 Any suggestions on the same are highly appreciated.
type: Question
has comment: http://stackoverflow.com/comment/32289375
tagged with: java
has answer: http://stackoverflow.com/a/67475858
answer count: 3
has comment: http://stackoverflow.com/comment/32290767
downvote count: 0
has comment: http://stackoverflow.com/comment/32290517

http://stackoverflow.com/comment/32475677
score: 0
type: Comment
has text: This class is inside the mysql connector jar..i use mysql connector 5.2.24...it should be inside...
type: AnswerComment
comment on: http://stackoverflow.com/a/21510597

http://stackoverflow.com/comment/32442900
type: AnswerComment
has text: Not buffers are allowed here, you can't enumerate all the file/directories into an array/list.
type: Comment
comment on: http://stackoverflow.com/a/21491407
score: 0

file-io
tags question: http://stackoverflow.com/q/21484990
tags question: http://stackoverflow.com/q/21386630
tags question: http://stackoverflow.com/q/21375527
tags question: http://stackoverflow.com/q/21499954
tags question: http://stackoverflow.com/q/21511076
type: Tag
tags question: http://stackoverflow.com/q/21384601
tags question: http://stackoverflow.com/q/21428874
tags question: http://stackoverflow.com/q/21486455
tags question: http://stackoverflow.com/q/21505718
tags question: http://stackoverflow.com/q/21353809
tags question: http://stackoverflow.com/q/21361504
tags question: http://stackoverflow.com/q/21421487
tags question: http://stackoverflow.com/q/21382183
tag name: file-io
tags question: http://stackoverflow.com/q/21476423
tags question: http://stackoverflow.com/q/21373098
tags question: http://stackoverflow.com/q/21508545

http://stackoverflow.com/a/21442380
answers question: http://stackoverflow.com/q/21399242
score: 3
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/39282024
has body: You can't load images only using OpenGL. You should always keep in mind that OpenGL is a graphics API, nothing more: Not a game framework, not something that would do IO operations for you, etc. You provide the data and OpenGL does the heavy lifting. To answer your question: I personally use TWL's PNGDecoder for my projects. It's fast, simple and easy to use. The official LWJGL wiki has an article about it, check it out. Here's a quick example on how to use it: try(BufferedInputStream is = new BufferedInputStream(new FileInputStream(filePath))){ //Create the PNGDecoder object and decode the texture to a buffer PNGDecoder decoder = new PNGDecoder(is); int width = decoder.getWidth(), height = decoder.getHeight(); ByteBuffer pixelData = BufferUtils.createByteBuffer(4*width*height); decoder.decode(pixelData, 4*width, Format.RGBA); pixelData.flip(); //Generate and bind the texture int id = GL11.glGenTextures(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, id); //Upload the buffer's content to the VRAM GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixelData); //Apply filters GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); }catch(IOException e){ e.printStackTrace(); } Later on when you want to use the texture just do GL11.glBindTexture(GL11.GL_TEXTURE_2D, id); before you're rendering. I highly suggest to use some kind of data structure to store your textures for reusing them (you should only upload a texture once to the VRAM and use it multiple times later when you need it using it's ID). Personally I use my own Texture class and a TextureBank class with a static HashMap&lt;String, Texture&g…

http://stackoverflow.com/comment/32203103
type: Comment
has text: This still won't compile. He needs one other change too.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21357487

http://stackoverflow.com/a/21365696
downvote count: 0
has body: I do not know if this suits your particular case but how about changing the shape of the JFrame to match the image ? The setShape(Shape shape) lets you use any shape from the geom package. I see that this is a splash screen and will be undecorated, probably, so setting the shape should do the trick.
has comment: http://stackoverflow.com/comment/32217443
type: Answer
accepted answer of: http://stackoverflow.com/q/21364798
answers question: http://stackoverflow.com/q/21364798
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32221274
type: AcceptedAnswer

http://stackoverflow.com/a/21487403
has comment: http://stackoverflow.com/comment/32433456
answers question: http://stackoverflow.com/q/21487325
has body: It looks like you may have smart quotes in your array. Smart quotes are not valid for Java quotes (and I imagine it's very difficult to program Java in Word)... String[] names = {"John", "Matthew", "Luke", "Peter"}; You can iterate over the array and write each name to the file, for (int i = 0; i &lt; names.length; i++) { if (i != 0) bw.write(", "); String name = names[i]; bw.write(name); } but you may prefer to use Arrays#toString like this - bw.write(java.util.Arrays.toString(names));
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32433649
upvote count: 2
has comment: http://stackoverflow.com/comment/32433360
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21487325

http://stackoverflow.com/comment/32290345
comment on: http://stackoverflow.com/q/21385630
type: Comment
type: QuestionComment
score: 2
has text: I think for now you're stuck with this, this will go away as soon as MVCC is fully implemented. But until then raising the issue to push awareness is the best thing you can do. Sorry.

http://stackoverflow.com/a/21458841
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21458749
has body: I don't think there is any difference from a technical point of view. I'd say stick to a strategy and document it as best as you can. Moreover, these are runtime exceptions, so they are not meant to be caught as they should happen in case of bugs or when a client calls a method/service without providing all the required parameters. Let it crash! About the holy war question, I do believe NPE should only happen when a client tries to access a variable they think is not null but is, indeed, null and thus never thrown directly. IAE is more appropriate if a client expects a non null value and receives a null from a caller. This is IMO, don't want to take part in the feud.

http://stackoverflow.com/a/21725510
has body: The real answer to your question is : No, native tooltip style can't be modified. Alternatives are creating your own tooltips: CSS JS (Libraries) Note that if you keep using the title attribute the native tooltip will be shown over your custom tooltip.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21467914
upvote count: 1

http://stackoverflow.com/comment/32394666
score: 0
type: QuestionComment
type: Comment
has text: Hey we all want help, but you should be more specific + show some effort , &where you are . maybe pursue a path, then come back w/ specific problem
comment on: http://stackoverflow.com/q/21465110

http://stackoverflow.com/q/21485488
tagged with: rotation
upvote count: 0
score: -2
favorite count: 0
has body: I was wondering if there might be a way using Java Swing to create a rotated JPanel? I'd read other questions/answers on this topic but I didn't understand if you could create one already rotated or not. It does not need to rotate once it's created, only be created tilted on the x/y axis. Thanks. Thanks, quite helpful!
accepted answer: http://stackoverflow.com/a/21485820
answer count: 3
downvote count: 2
has title: Can you create a JPanel that is rotated?
tagged with: swing
has answer: http://stackoverflow.com/a/75041473
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21485663
has answer: http://stackoverflow.com/a/21485820
has answer: http://stackoverflow.com/a/21485663
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/32429837
type: Question

http://stackoverflow.com/q/21364232
tagged with: c#
has comment: http://stackoverflow.com/comment/32214879
tagged with: arrays
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32215818
has comment: http://stackoverflow.com/comment/32215398
type: UnansweredQuestion
has body: So I have a 1D array representing a 3D grid of numbers, I access individual entries (X,Y,Z) like so: array[x + width * (y + height * z)] Is there a way I can copy out an entire row (for instance, all the Z values for (1,1)) without looping? I'd rather not use a jagged array if possible.
has title: Copy a row of values from a 1D array that represents a three dimensional grid
has answer: http://stackoverflow.com/a/21364602
tagged with: java
type: Question

http://stackoverflow.com/comment/32326097
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21410092
has text: Amazingly, the ChangeListener is the solution! It enables me to modify the user input (if there's a measuring unit string) before it becomes committed. I only have to separate the unit string part and the number string part. In order to detect the locale depending floating point number format I can use: `new DecimalFormat("", DecimalFormatSymbols.getInstance(this.locale)).parse(input);`

http://stackoverflow.com/comment/32299146
type: QuestionComment
comment on: http://stackoverflow.com/q/21411320
has text: HashMap could cause OutOfMemoryErrors
type: Comment
score: 0

http://stackoverflow.com/a/21358645
has body: The Thread will block the UI. You should use Timer. So instead of using Thread try { Thread.sleep(400); } catch(InterruptedException e) { } blueButton.setBackground(Color.BLUE); the code could be: int delay = 400; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... blueButton.setBackground(Color.BLUE); } }; Timer timer = new Timer(delay, taskPerformer); timer.setRepeats(false); timer.start();
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/32205415
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21358440

http://stackoverflow.com/comment/38903703
comment on: http://stackoverflow.com/q/21492326
score: 0
type: Comment
type: QuestionComment
has text: Was that with 'Form' authentication method or BASIC?

http://stackoverflow.com/comment/32356922
score: 0
type: Comment
has text: 1. Correct, this won't work for a static class. 2. It depends on how your format your log output. The line number comes from the source filename. But including the line number is "extremely slow" (http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html). 3. Yeah, you could do this.
comment on: http://stackoverflow.com/a/21443503
type: AnswerComment

http://stackoverflow.com/comment/32322236
type: QuestionComment
has text: @user2115021 `Arrays.sort(array)` can sort arrays
score: 1
comment on: http://stackoverflow.com/q/21424605
type: Comment

http://stackoverflow.com/a/21457145
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21457058
score: 1
has body: You thread is going to sleep for 5 seconds. If another thread tries to wake this thread up (Interrupt). It will end up in the exception block and your stacktrace will be printed.
upvote count: 1

http://stackoverflow.com/comment/32591542
has text: Rida its not working. If you don't believe, give me your mail ID, I will send you full project zipped file. Proper PNR is 6623639027. Check its not working. If its working for you, tell me your mail ID and I will forward you whole project and check its not working.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21433570
type: Comment

http://stackoverflow.com/q/21461120
has comment: http://stackoverflow.com/comment/32388729
has comment: http://stackoverflow.com/comment/32387832
type: Question
linked to: http://stackoverflow.com/q/4472429
has body: I am doing an interface to Android app. This is my view in xml: <SurfaceView android:id="@+id/surface" android:layout_width="match_parent" android:layout_height="match_parent" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="DISTANCIAS TX" android:textSize="16dip" /> <TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="75dip" android:text="COORDENADAS" android:textSize="16dip" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TX 21KHz:" android:textColor="#DB3F3F" android:textSize="20dip" /> <TextView android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="75dip" android:text="X:" android:textSize="20dip" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TX 23KHz:" android:textColor="#EFC745" android:textSize="20dip" /> <TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="75dip" android:text="Y:" android:textSize="20dip" /> <TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TX 25KHz:" android:textColor="#53FF49" android:textSize="20dip" /> <TextView android:id="@+id/textView9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="75dip" android:text="Z:" android:textSize="20dip" /> <TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TX 27KHz:" android:textColor="#496BFF" android:textSize="20dip" /> I want modify params of tablelayout, in concret margintop, because first i do some operations to calculate pixel…
has title: Modify margin params in code
score: 0
has comment: http://stackoverflow.com/comment/32387953
has comment: http://stackoverflow.com/comment/32389089
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32386897
answer count: 0
has comment: http://stackoverflow.com/comment/32388809
tagged with: java
duplicate of: http://stackoverflow.com/q/4472429

http://stackoverflow.com/a/21470561
has comment: http://stackoverflow.com/comment/32404493
has comment: http://stackoverflow.com/comment/32406067
has comment: http://stackoverflow.com/comment/32406484
type: Answer
answers question: http://stackoverflow.com/q/21470480
has comment: http://stackoverflow.com/comment/32404521
score: 1
has comment: http://stackoverflow.com/comment/32405289
has comment: http://stackoverflow.com/comment/32404587
has comment: http://stackoverflow.com/comment/32404671
upvote count: 1
has comment: http://stackoverflow.com/comment/32404480
downvote count: 0
has body: no, this isn't what you want. apps shouldn't be sharing a database this way. a better design would be to put a data service in front of it to manage data access.

http://stackoverflow.com/a/21358731
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21358663
upvote count: 2
has body: When you are creating an OnClickedListener , this actually references to the Listener, so it doesn't work because your newly created OnClickedListener is not a SensorListener.To refer to the Fragment/Activity that you want to register you should use: Activity.this or Fragment.this and replacing Activity/Fragment with the actual name.
score: 2

http://stackoverflow.com/comment/32342826
type: Comment
has text: I've read about it on some JBoss page, that making own threads in webservice is discouraging. It shouldn't been as far as you have control over them (start/stop)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21409456

bloom-filter
type: Tag
tags question: http://stackoverflow.com/q/21448414
tag name: bloom-filter

http://stackoverflow.com/q/21503559
has answer: http://stackoverflow.com/a/21503607
score: 0
linked to: http://stackoverflow.com/q/11986296
answer count: 3
accepted answer: http://stackoverflow.com/a/21503662
has body: I have seen in some servlet programs, System.out.println() statements. Do they work? If so where are they printed? I have checked the Web console in the browser. But I couldn't see it? import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { System.out.println("This is in System.out.println()"); } } Because this program is not executed in command prompt, where will the output be printed? Is there any console in the browser that can print this?
has title: Where is System.out.println() printed in Servlets?
has comment: http://stackoverflow.com/comment/32462608
possible better answer: http://stackoverflow.com/a/21503632
has answer: http://stackoverflow.com/a/21503662
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/11986296
has comment: http://stackoverflow.com/comment/32462733
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/32462824
has comment: http://stackoverflow.com/comment/32462834
has answer: http://stackoverflow.com/a/21503632

http://stackoverflow.com/comment/32317184
score: 1
comment on: http://stackoverflow.com/q/21421253
type: Comment
type: QuestionComment
has text: Hey I thought java first released on 1995. How he could teaching that for 38 years. 1995+38 = 2033

http://stackoverflow.com/a/21466757
type: AcceptedAnswer
upvote count: 2
type: Answer
downvote count: 1
score: 1
has body: You can use build-info plugin, which will work with your SCM (Git and SVN). It will give you the following information: date/time the war file was built Source Control Revision Number (Git and Subversion) application version number grails version grails environment (currently running, not necessarily the environment used to build the war file) plugins installed (and which version) Source: build-info plugin
has comment: http://stackoverflow.com/comment/32397787
accepted answer of: http://stackoverflow.com/q/21466456
answers question: http://stackoverflow.com/q/21466456

http://stackoverflow.com/comment/32444873
has text: If I understand you correctly, then you want set the value with JavaScript, so you would have parse the JSON into a *JavaScript object*. And yes, either of those is possible, search for "JavaScript parse JSON" or "Java parse JSON".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21493459

http://stackoverflow.com/q/21437176
favorite count: 0
has comment: http://stackoverflow.com/comment/32344263
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32344344
tagged with: java
has answer: http://stackoverflow.com/a/21437512
has body: I have roles_perms table as follow id || username || role_name || perms_name 1 root admin page:show:*;folder:show:* 2 user1 editor page:show:editorpage,page1;folder:show:folder45,folder55 but following line of code does not returns expected result. // for user with role "admin" System.out.println("Test 1 :"+SecurityUtils.getSubject().isPermitted("page:show:*")); // false System.out.println("Test 2 :"+SecurityUtils.getSubject().isPermitted("page:show:*;folder:show:*")); // true output: Test1 :false Test2 :true // for user with role "editor" System.out.println("Test 3 :"+SecurityUtils.getSubject().isPermitted("page:show:page1")); // false System.out.println("Test 4 :"+SecurityUtils.getSubject().isPermitted("page:show:page1;folder:show:folder55")); // false output: Test3 :false Test4 :false UPDATE: shiro.ini file [main] ds = org.apache.shiro.jndi.JndiObjectFactory ds.requiredType = javax.sql.DataSource ds.resourceName = jdbc/imgDB ds.resourceRef = true jdbcRealm = com.java.realm.MyRealm # 1000 ms = 1 sec sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager securityManager.sessionManager = $sessionManager securityManager.sessionManager.globalSessionTimeout = 1800000 # password hashing specification sha256Matcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher sha256Matcher.hashAlgorithmName = SHA-256 jdbcRealm.credentialsMatcher = $sha256Matcher jdbcRealm.permissionsLookupEnabled = true jdbcRealm.authenticationQuery = SELECT password FROM shiro_users WHERE username = ? jdbcRealm.userRolesQuery = SELECT role_name FROM shiro_user_roles WHERE username = ? jdbcRealm.permissionsQuery = SELECT perms_name FROM shiro_roles_perms WHERE role_name = ? AND username = ? jdbcRealm.dataSource = $ds jdbcRealm.authorizationCachingEnabled = false # specify login page authc.loginUrl = /login.jsp # redirect after successful login authc.successUrl = /home.jsp # roles filter: redirect to error page if user does not have access rights # perms filter: redirec…
tagged with: shiro
type: UnansweredQuestion
downvote count: 0
score: 1
has title: how check multiple shiro permissions in database table?

http://stackoverflow.com/comment/32345512
has text: I have implemented the logic finally but still it is not working properly , can you pls recheck it
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21411761

http://stackoverflow.com/q/21350768
has answer: http://stackoverflow.com/a/21350815
tagged with: symbol-table
upvote count: 1
answer count: 1
has title: Symbol table implementation
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I want to design an assembler for IBM360 language.so here im implementing the symbol table of pass1. But m getting the 1 error during compilation. I'm not able to deal with that error.can anyone guide me??? my program is here... import java.io.*; import java.lang.*; import java.util.*; class Symbol { int s_no; String s_name; int s_addr; } class Literal { int literal_no; String literal_name[]; int literal_addr; } class Pass1 { static String POT[]={"START","END","EQU","DC","DS","USING"}; static String MOT[]={"L","SR","A","ST"}; static int POTGET(String instr) { int i,t; for(i=0;i&lt;6;i++) { t=instr.compareTo(POT[i]); if(t==0) return(i+1); } return -1; } static int MOTGET(String instr) { int i,t; for(i=0;i&lt;4;i++) { t=instr.compareTo(MOT[i]); if(t==0) return(i+1); } return -1; } public static void main(String args[]) throws Exception { FileReader fr = new FileReader("program1.asm"); BufferedReader br = new BufferedReader(fr); String str,l; String code[][]=new String[50][10]; int N=0,i,LOC=0,n=0,j; System.out.println("Assembly lang program :\n--------------------------"); while((str = br.readLine()) != null) { //System.out.println(s); String codearr[]=str.split(" "); for(i=0;i&lt;codearr.length;i++) { code[N][i]=codearr[i]; System.out.println(codearr[i]); } N++; } fr.close();int k=0; Symbol s[]=new Symbol[10]; boolean flag; for(i=0;i&lt;N;i++) { for(j=0;j&lt;code[i].length;j++) { if(code[i][j]!=null &amp;&amp; code[i][j]!="\t") { flag=false; int p=POTGET(code[i][j]); if(p!=-1) System.out.println( "found IN POT"); else { int m=MOTGET(code[i][j]); if(m!=-1) System.out.println( "found in MOT"); else {System.out.println(code[i][j]); flag=true;} } if(flag) { if((code[i][j]!="=") &amp;&amp; (code[i][j]=",") &amp;&amp; (code[i][j]!="F") &amp;&amp; (code[i][j].startsWith("\'")!=true)) { s[k]= new Symbol(); s[k++].s_name=code[i][j]; } } } } } for(i=0;i&lt;k;i++) System.out.println(s[i].s_name); } } ERROR : G:\programs&gt;javac Pass1.java Pass1.java:86: operator &amp;&amp; can…
type: Question
accepted answer: http://stackoverflow.com/a/21350815
tagged with: assembly

http://stackoverflow.com/comment/32356058
comment on: http://stackoverflow.com/q/21419184
has text: Just where you do it now, just read in the number of visits before (if the client is known) and put that number in the constructor.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32351849
has text: Since this is a large topic to explore, I think the Java tutorials [*Variables*](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html) and [*Returning a value from a method*](http://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html) will be helpful to learn these concepts from the ground up.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21441075
type: QuestionComment

http://stackoverflow.com/q/21429991
accepted answer: http://stackoverflow.com/a/21430361
tagged with: android
type: AnsweredQuestion
has body: I am trying to make a simple contact list app. I tried to edit my contact by clicking on the phone list through activity for result, after editing when I pressed the save button and it gives me null pointer exception by throwing "id=null" at this line long rowId=Long.parseLong(DBHandler.Key_ID) in activity result(...) function. During debugging, when I clicked the contact for editing on the list it gets the id, but when I saved the edit part it gives null to id. Please help me. Here is source code: public class WebpreneurActivity extends ListActivity { private static final int CONTACT_CREATE = 0; private static final int CONTACT_EDIT = 1; public static long id1; //select the second one, Android view menu private static final int INSERT_ID = Menu.FIRST; private static final int DELETE_ID = Menu.FIRST + 1; private DBHandler dbHelper; private Cursor c; ImageButton imageButton; public static long rowId; @Override protected void onCreate(Bundle savedInstanceState) { Log.d("database1" ,"0"); Log.d("Your Location4", "ok4:"); super.onCreate(savedInstanceState); Log.d("database1" ,"1"); setContentView(R.layout.activity_webpreneur); Log.d("database1" ,"2"); dbHelper = new DBHandler(this); Log.d("database1" ,"3"); dbHelper.open(); fillData(); //dbHelper.open(); //addListenerOnButton(); //dbHelper.addContact(); imageButton = (ImageButton) findViewById(R.id.imageButton1); Log.d("database1" ,"button"); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Log.d("database1" ,"b4"); Intent i = new Intent(getApplicationContext(), ContactEdit.class); startActivityForResult(i, CONTACT_CREATE); Log.d("database1" ,"button3"); //fillData(); } }); //dbHelper.close(); } @SuppressWarnings("deprecation") public void fillData() { Log.d("Your Location4", "ok6:"); c = dbHelper.fetchAllRows(); Log.d("Your Location4", "ok8:"); //startManagingCursor(c); Log.d("Your Location4", "ok2:"); NoIdCursorWrapper nc = new NoIdCursorWrapper(c, DBHandler.Key_ID…
tagged with: java
has title: NumberFormatException in Android app
has comment: http://stackoverflow.com/comment/32331616
has answer: http://stackoverflow.com/a/21430361
possible better answer: http://stackoverflow.com/a/21430474
type: Question
has comment: http://stackoverflow.com/comment/32331715
has answer: http://stackoverflow.com/a/21430474
has comment: http://stackoverflow.com/comment/32331518
has comment: http://stackoverflow.com/comment/32331777
score: 0
answer count: 2
tagged with: sqlite
has comment: http://stackoverflow.com/comment/32331463
has comment: http://stackoverflow.com/comment/32331621

http://stackoverflow.com/a/21446975
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21446582
has body: How you are trying to export the data into excel? please post? Simple example with Apache POI- { HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Test Export"); Map&lt;String, Object[]&gt; data = new HashMap&lt;String, Object[]&gt;(); //cell value in double quotes data.put("2", new Object[] {"1", "\"abc\""}); data.put("3", new Object[] {"2", "\"xyz\""}); Set&lt;String&gt; keyset = data.keySet(); int rownum = 0; for (String key : keyset) { Row row = sheet.createRow(rownum++); Object [] objArr = data.get(key); int cellnum = 0; for (Object obj : objArr) { Cell cell = row.createCell(cellnum++); cell.setCellValue((String)obj); } } try { FileOutputStream out =new FileOutputStream(new File("/home/rahul/Desktop/testExport.xls")); workbook.write(out); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/32381141
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32363087

http://stackoverflow.com/q/21372111
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32229733
has comment: http://stackoverflow.com/comment/32229616
score: 2
has body: I'm curious how actually Lombok works with Eclipse (or any other IDE). What I have found is that since version 0.10 they abandon AbstractProcessor for ECJ and stay completely with javaagent and bytecode modification. This works well if I use some editor without syntax checking + javac with -javaagent but for Eclipse it's impossible as if I add -javaagent to build configuration it's no used during incremental build with internal ECJ. And therefore if you for instance use some method which not exist in code (but will after bytecode instrumentation) it simply throws error. My question is: How this is handle that method which do not exist in code are visible in it without any error? UPDATE: Due to chrylis information about methods being taken from .class file my question can be shortened to following I think: How use -javaagent + objectweb.asm/javaassist/etc. with automatic build in Eclipse so generated method/fields/etc. would be available through code completion, method outliner, etc.
tagged with: java
has title: Lombok interactive behaviour in Eclipse IDE
has answer: http://stackoverflow.com/a/21732459
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32229492
type: Question
tagged with: lombok
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21507517
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/32469845
tagged with: variables
favorite count: 0
has body: Why can't my compiler recognize the global value I made? Here is my code: public class decoder_{ public static int c;//counter public static double temp[];//for table upper public static double temp1[];//for table lower public static void main(String [] args) { Then I use it inside main: case 'a': lower = lower + (current_range *la); upper = lower+ (current_range *ha); temp[c]= upper; temp1[c]=lower; c++; break; There is no compilation error, but the following message appears at runtime 1: Exception in thread "main" java.lang.NullPointerException at decoder_.main(decoder_.java:95)
answer count: 1
tagged with: global
has answer: http://stackoverflow.com/a/21507536
downvote count: 1
has comment: http://stackoverflow.com/comment/32469865
type: AnsweredQuestion
tagged with: java
score: -1
has title: Can't recognize the global variable
accepted answer: http://stackoverflow.com/a/21507536

http://stackoverflow.com/q/21510316
has body: what's the most efficient way (best performance and least gc) to store unique sorted values in Java? Currently I use a HashMap to get a collection of unique values then I copy the HashMap values into a ArrayList then use Collections.sort() to sort the values as my objects implement Comparable which finally gives me a unique sorted values. The code will be run thousands of times a second so I want the best approach. Can anyone suggest a better alternative? /The code will only be run in a single thread. My code is below: public class LapRanking { private final Map&lt;String, Car&gt; carsInRace = new HashMap&lt;String,Car&gt;(); public List&lt;Car&gt; processLap(Car car){ carsInRace.put(car.driverName, car); List&lt;Car&gt; lapTimeRankings = new ArrayList&lt;Car&gt;(carsInRace.values()); Collections.sort(lapTimeRankings); return lapTimeRankings; } public static void main(String[] args) { Car one = new Car("DriverOne"); Car two = new Car("DriverTwo"); Car three = new Car("DriverThree"); LapRanking lapRanking = new LapRanking(); for (int i = 0; i &lt; 100; i++) { one = one.setLapTime(); two = two.setLapTime(); three = three.setLapTime(); lapRanking.processLap(one); lapRanking.processLap(two); lapRanking.processLap(three); } } } public class Car implements Comparable&lt;Car&gt; { private static final Random randomTestTimes = new Random(); public final String driverName; public final double lapTime; public final double firstQuarterTime; public Car(String driverName) { this.driverName = driverName; this.lapTime = Double.MAX_VALUE; this.firstQuarterTime = Double.MAX_VALUE; } public Car(String driverName, double lapTime, double firstQuarterTime) { this.driverName = driverName; this.lapTime = lapTime; this.firstQuarterTime = firstQuarterTime; } public Car setLapTime(){ return new Car(driverName,randomTestTimes.nextDouble(), randomTestTimes.nextDouble()); } @Override public int compareTo(Car o) { int i = Double.compare(lapTime, o.lapTime); if(i !=0) return i; return Double.comp…
favorite count: 0
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21510411
has title: What's the most efficient way (best performance and least gc) to store unique sorted values in Java?
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21510457
type: Question
has comment: http://stackoverflow.com/comment/32474834
has answer: http://stackoverflow.com/a/21510419
tagged with: sorting
answer count: 3
possible better answer: http://stackoverflow.com/a/21510419
has answer: http://stackoverflow.com/a/21510411
downvote count: 0

http://stackoverflow.com/q/21425108
score: 0
has answer: http://stackoverflow.com/a/21425117
has answer: http://stackoverflow.com/a/21425150
accepted answer: http://stackoverflow.com/a/21425117
has comment: http://stackoverflow.com/comment/32323044
has body: I have an array which has null elements also. I want to keep track of number of elements that have the contents in it. int counter = 0; for (int a = 0; i &lt;=array1.length; a ++){ if (array1[a] != null) counter ++; } I used the above code for it. But I am getting ArrayIndexoutofBound exception at line if (array1[a] != null) why is that? Can someone point it pls.
has answer: http://stackoverflow.com/a/21425144
has title: counting the elements of array
has answer: http://stackoverflow.com/a/21425148
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32323001
has answer: http://stackoverflow.com/a/21425168
type: Question
has answer: http://stackoverflow.com/a/21425149
tagged with: arrays
answer count: 6
possible better answer: http://stackoverflow.com/a/21425148

http://stackoverflow.com/comment/32364168
comment on: http://stackoverflow.com/a/21447617
type: Comment
has text: What do *you* mean by "repaint" ? (I asked first :P )
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32261391
type: QuestionComment
type: Comment
has text: Well, then he needs anchors or the nagative behind assertion.
comment on: http://stackoverflow.com/q/21389270
score: 0

http://stackoverflow.com/comment/32337650
comment on: http://stackoverflow.com/q/21430744
score: 1
has text: It will be in Java 8.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32354924
comment on: http://stackoverflow.com/q/21442768
has text: Why not just save on exit instead of in real time?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21501384
tagged with: java
tagged with: uml
has title: oop interface implementation along with abstract class
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: design-patterns
has body: I have this scenario where I have 4 types of animals: A]. Cat i. Name - property ii.Speak - operation B]. Wild Cat i. Name - property ii.Speak - operation iii. Hunt - operation C]. Dog i. Name - property ii.Speak - operation D]. Wild Dog i. Name - property ii.Speak - operation iii. Hunt - operation Now, I had to implement class hierarchy for the above four animals. I did it as below: /////////////////////////Interface iAnimal/////////////////////////////// Interface iAnimalHunter{ Hunts(); } Interface iAnimalSpeach{ Speaks(); } /////////////////////////Abstract class Animal/////////////////////////////// Abstract class Animal{ Protected String name; protected function Speaks(){ } } /////////////////////////Class Cat/////////////////////////////// Class Cat extends Animal implements iAnimalSpeach{ Public function Speaks(){ } } /////////////////////////Class WildCat/////////////////////////////// Class WildCat extends Cat implements iAnimalSpeach, iAnimalHunter{ Public function Speaks(){ } Public function Hunts(){ } } /////////////////////////Class Dog/////////////////////////////// Class Dog extends Animal implements iAnimalSpeach{ Public function Speaks(){ } } /////////////////////////Class WildDog/////////////////////////////// Class WildDog extends Dog implements iAnimalSpeach, iAnimalHunter{ Public function Speaks(){ } Public function Hunts(){ } } Am I right in using interfaces for this purpose or a simple abstract class (without the interfaces, allowing child classes to override the hunt() and speak() methods when required) would have been a better approach in terms of object oriented design pattern? Which would be a better way?
type: Question
tagged with: oop
has answer: http://stackoverflow.com/a/21504098
accepted answer: http://stackoverflow.com/a/21504098
score: 1

http://stackoverflow.com/a/21514369
type: Answer
has body: The best way to diagnose a problem like this is to break it down. 1) Check that you're getting inside your click listener: if (view.getId() == R.id.button) { //make sure you get here } 2) If you're getting inside the click listener OK, simplify your calculateRESULT() function and return a simple result: private float calculateRESULT (float text1, float text2) { return 3.14; } This will help you find where the problem is. P.S.: I would also suggest you do validation around your inputs: float text1 = 0; float text2 = 0; try { text1 = Float.parseFloat(text1Text.getText().toString()); text2 = Float.parseFloat(text2Text.getText().toString()); } catch(Exception e) { // handle if user inputs non-number }
has comment: http://stackoverflow.com/comment/32482191
has comment: http://stackoverflow.com/comment/32718907
score: 0
has comment: http://stackoverflow.com/comment/32482109
has comment: http://stackoverflow.com/comment/32482121
has comment: http://stackoverflow.com/comment/32485638
has comment: http://stackoverflow.com/comment/32484473
has comment: http://stackoverflow.com/comment/32718093
has comment: http://stackoverflow.com/comment/32718053
answers question: http://stackoverflow.com/q/21514195

jlayeredpane
tags question: http://stackoverflow.com/q/21500162
tags question: http://stackoverflow.com/q/21369670
tag name: jlayeredpane
type: Tag
tags question: http://stackoverflow.com/q/21397067

http://stackoverflow.com/q/21490522
score: 0
tagged with: java
tagged with: bigdata
tagged with: oracle11g
answer count: 1
has title: Huge Storage for Weblogic JMS Server
has answer: http://stackoverflow.com/a/21512126
type: UnansweredQuestion
tagged with: weblogic11g
tagged with: jms
type: Question
has body: In my weblogic server (4 nodes) I defined a migratable JMS Server with (Oracle) Database Storage. Here I receive 1000 messages per second. Every message is an XML message of about 1kB. I might have the need to stop the java MDB for 1 day and store several GB of data (due to maintenance). how can I (with little overhead) save these messages compressed in order to reduce the space?

http://stackoverflow.com/q/21496645
accepted answer: http://stackoverflow.com/a/21496703
score: 0
tagged with: java
tagged with: mysql
tagged with: eclipse
tagged with: servlets
tagged with: jsp
has title: call or get username values from servlet to jsp on successful of login in eclipse
has comment: http://stackoverflow.com/comment/32450327
has answer: http://stackoverflow.com/a/21496703
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32450247
linked to: http://stackoverflow.com/q/3177733
has body: I have created a simple login form with username and password with database connectivity and to validate it properly. For this I did the following: 1.> Login.java package roseindia.net; import java.io.*; //import java.util.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.sql.*; /*** Servlet implementation class Login ***/ @WebServlet(description = "Login Servlet", urlPatterns = { "/login" }) public class Login extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Login() { super(); // TODO Auto-generated constructor stub } /** * @see Servlet#init(ServletConfig) */ public void init(ServletConfig config) throws ServletException { // TODO Auto-generated method stub } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("We are service method of servlet"); /* String username="user"; String password="root"; */ String un=request.getParameter("username"); String pw=request.getParameter("password"); String msg=" "; Connection conn=null; String url="jdbc:mysql://localhost:3306/"; String dbName="userlogindb"; String driver="com.mysql.jdbc.Driver"; String dbUserName="root"; String dbPassword="root"; try{ Class.forName(driver).newInstance(); conn = DriverManager.getConnection(url+dbName,dbUserName,dbPassword); String strQuery="select * from usertable where username='" + un + "' and password='" + pw + "'"; Statement st= conn.createStatement(); ResultSet rs= st.executeQuery(strQuery); if(rs.next()) { msg="Hello " + un + "! Your login is successful"; request.setAttribute("msg", msg); RequestDispatcher req=re…
answer count: 1

http://stackoverflow.com/comment/32269949
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21393145
has text: I don't know what you mean. You have problems in all of your classes except Time.

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/21448781
tags question: http://stackoverflow.com/q/21353872
tags question: http://stackoverflow.com/q/21512651
tags question: http://stackoverflow.com/q/21420887
tags question: http://stackoverflow.com/q/21464011
tags question: http://stackoverflow.com/q/21500898
tags question: http://stackoverflow.com/q/21507331
tags question: http://stackoverflow.com/q/21497227
tags question: http://stackoverflow.com/q/21491551
tags question: http://stackoverflow.com/q/21470849
tags question: http://stackoverflow.com/q/21377942
type: Tag
tags question: http://stackoverflow.com/q/21357451
tags question: http://stackoverflow.com/q/21467735
tags question: http://stackoverflow.com/q/21460579
tags question: http://stackoverflow.com/q/21416796
tags question: http://stackoverflow.com/q/21376738
tags question: http://stackoverflow.com/q/21437595
tags question: http://stackoverflow.com/q/21384647
tags question: http://stackoverflow.com/q/21511321
tags question: http://stackoverflow.com/q/21499318
tags question: http://stackoverflow.com/q/21352769
tags question: http://stackoverflow.com/q/21502978
tags question: http://stackoverflow.com/q/21418101
tags question: http://stackoverflow.com/q/21394436
tags question: http://stackoverflow.com/q/21372215
tags question: http://stackoverflow.com/q/21403290
tags question: http://stackoverflow.com/q/21447152
tags question: http://stackoverflow.com/q/21502292
tags question: http://stackoverflow.com/q/21447862
tags question: http://stackoverflow.com/q/21419184
tags question: http://stackoverflow.com/q/21402395
tags question: http://stackoverflow.com/q/21494189
tags question: http://stackoverflow.com/q/21431113
tags question: http://stackoverflow.com/q/21381683
tags question: http://stackoverflow.com/q/21487644
tag name: html
tags question: http://stackoverflow.com/q/21421790
tags question: http://stackoverflow.com/q/21424091
tags question: http://stackoverflow.com/q/21429762
tags question: http://stackoverflow.com/q/21393448
tags question: http://stackoverflow.com/q/21361243
tags question: http://stackoverflow.com/q/21502149
tags question: http://stackoverflow.com/q/21511004
tags question: http://stackoverflow.com/q/21470985
tags question: http://stackoverflow.com/q/21483506

http://stackoverflow.com/comment/32451876
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21497261
has text: public class MainActivity extends Activity { Double a, b, c, D, x1, x2, x, dRootNr; public double getDouble(String str) { if (str.equalsIgnoreCase(null)) { return 0; } else { return Double.parseDouble(str); } } //what am i doing wrong ?
score: 0

http://stackoverflow.com/a/21478324
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/32417993
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21478182
has comment: http://stackoverflow.com/comment/32417708
has comment: http://stackoverflow.com/comment/119759514
answers question: http://stackoverflow.com/q/21478182
type: AcceptedAnswer
downvote count: 0
has body: From the docs you link yourself: Trims the capacity of this ArrayList instance to be the list's current size. An application can use this operation to minimize the storage of an ArrayList instance. Internally an ArrayList stores an array that holds all the items. At certain moments the ArrayList will "expand" this array by copying all values into a larger array. This happens whenever an item is being added and the required capacity is bigger than the current one. What happens at this point is the following line of code: int newCapacity = oldCapacity + (oldCapacity &gt;&gt; 1); elementData = Arrays.copyOf(elementData, newCapacity); In essence this will create a new array that is 1.5 times the size of the current one. What this method does is resize the internal array so that it has no empty space left. Nothing will happen that's visible to you. You won't lose any data, it's just smaller backing array. Adding data to the arraylist will again expand the array normally. I assume you mean a "normal" ArrayList. If you use this, you will reduce the memory used but it will also be futile if you will still add data after that AND it is pretty useless for small lists. If you have an ArrayList of many, many items and you're sure you don't want to add anymore then you can call this method to reduce some memory footprint. See above. I don't think it's very likely you'll ever use this. trimToSize() from the source: public void trimToSize() { modCount++; int oldCapacity = elementData.length; if (size &lt; oldCapacity) { elementData = Arrays.copyOf(elementData, size); } }
has comment: http://stackoverflow.com/comment/32417511

http://stackoverflow.com/q/21493931
possible better answer: http://stackoverflow.com/a/33332943
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/33332943
tagged with: java
tagged with: r-tree
has answer: http://stackoverflow.com/a/21497174
type: Question
has title: K-D Tree vs R-Tree for small, dynamic data
answer count: 2
accepted answer: http://stackoverflow.com/a/21497174
has body: I have been reading several SO posts regarding K-D Trees vs. R-Trees but I still have some questions regarding my specific application. For my Java application, I want to maintain a relatively small number of spatial data points (a few hundred thousand). The key is that data insertion will not be bulk loaded, but rather, frequently and incrementally inserted. I should also mention that I will be performing a good number of periodic range queries on sub-regions of the spatial domain. I have read that K-D Trees do not typically support incremental building and that R-trees are more suitable for this since they maintain a balanced state. However, after looking into the solutions suggested here: Java commercial-friendly R-tree implementation? I did not find that the implementations were easy to work with for returning a list of points in range searches. However, I have found: http://java-ml.sourceforge.net/ to have a very nice implementation of a K-D Tree that works quickly and outperforms standard array storage for a test set of points (~25K). Additionally, I have read that R-trees store redundant information when dealing with points (since a point is a rectangle with min=max). Since I am working with a smaller number of points, are the differences between the two structures less important than, say, if I was working with a database application storing millions of points?
downvote count: 0
tagged with: kdtree
favorite count: 0
linked to: http://stackoverflow.com/q/7435645
upvote count: 2

http://stackoverflow.com/a/21509257
answers question: http://stackoverflow.com/q/21504816
has comment: http://stackoverflow.com/comment/32530514
score: 2
has body: Your attempt with @XmlAnyElement for the unknown elements is the right way, but you were missing the @XmlElementWrapper for the collection. The following mapping produces a collection for those elements: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Root { @XmlElementWrapper(name="linksCollection") @XmlElement(name="links") protected List&lt;Link&gt; linksCollection; } public class Link { @XmlAnyElement(lax = true) protected Object content; } According to this explanation you will have an instance of org.w3c.dom.Element in your collection if you do not specify a mapping. If you have only a limited subset of unknown elements, you could change the annotation in the link class as follows: @XmlElements({ @XmlElement(name = "foo", type = FooBar.class), @XmlElement(name = "bar", type = FooBar.class) , ...}) protected Object content; The FooBar class could then look like this: public class FooBar { @XmlAttribute(name = "href") protected String href; @XmlAttribute(name = "rel") protected String rel; } However when you can't predict the possible tags, I would stay with the @XmlAnyElement and add a @XmlTypeAdapter. There is another thread: Jaxb complex xml unmarshall about this topic.
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/q/21490755
has comment: http://stackoverflow.com/comment/32441760
has comment: http://stackoverflow.com/comment/32440459
has comment: http://stackoverflow.com/comment/32513534
tagged with: java
has title: How to stop my XML file from being truncated when I try and parse the file
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/32448546
tagged with: xml-parsing
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21490823
has body: I am getting the below error when my program tries to read from an XML config file: org.xml.sax.SAXParseException; systemId: file:/home/sara/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PoseidonWebserviceWAR_v12/config.xml; lineNumber: 74; columnNumber: 20; XML document structures must start and end within the same entity. After a bit a reading, I am fairly certain that this is because the parser is truncating my XML file, causing the program to believe I don't have well-formed XML. But, I am at a major loss on to go about debugging this problem as I am new to web-projects like the one I am making. Another oddity: My web-project has been working well for several weeks now just fine, but now all of a sudden I get this error? Can anyone explain this? The below code is is from a class where I define my XML read/write operations: DocumentBuilder builder; Document doc; ... public XMLReader(String filePath){ try { String f = filePath; xmlFile = new File(filePath); builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse(xmlFile); ...In another class I want to set the element "LastCurrentState" to 1234, but since the XML file was truncated, my reader is unable to read the file and here and error is where the error is thrown: XMLReader xmlread = new XMLReader(filepath); xmlread.setNameofNode(0, "LastCurrentState", 1234); Again, these methods have been working fine for awhile, but now all of a sudden the file is being truncated. What could be causing this? ----UPDATE---- here is my XML file code.. <?xml version="1.0" encoding="UTF-8"?> <Config> <Source> 1 Dish1 <Source> 2 Dish2 <Source> 3 Sky1 <Source> 4 Sky2 <Source> 5 Sky3 <Source> 6 Sky4 <Source> 7 Source7 <Source> 8 Source8 1 Corner - TV1 2 Left - TV2 3 Main - TV3 4 Right - TV4 5 Office - TV5 6 Bar - TV6 7 Outside - TV7 8 Downstairs - TV8 EE11111111 KeyDigitalMSW /dev/ttyS0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion

http://stackoverflow.com/comment/32463003
has text: @Wlad: If you also count diagonal as neighbors, then second row should be `0 3 4 0` last row should be `0 0 0 2` and if you don't, then @Christian is correct about the first two rows.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21503628

http://stackoverflow.com/q/21478455
type: Question
has title: Selenium / JUnit 4 / Java 1.6 / Eclipse - Script terminates after 4 seconds with no error
has comment: http://stackoverflow.com/comment/32423351
favorite count: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/44562163
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: selenium
upvote count: 1
has comment: http://stackoverflow.com/comment/32423112
downvote count: 1
tagged with: java
has body: I am running my script and it terminates after 4 seconds. Have been stuck on this for hours, any help very much appreciated. Could it be that I may be using JUnit 3 code somewhere in a Junit 4 script? Just a thought. I am also calling a seperate PageObjects script, could this be the reason? Code is below: package com.testcases; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.Select; import jxl.*; import com.PageObjects.RegisterUserPageObject; import java.io.File; import jxl.write.*; public class RegisterUser { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://newtours.demoaut.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testRegisterUser() throws Exception { RegisterUserPageObject registerUserPage = PageFactory.initElements (driver, RegisterUserPageObject.class); Workbook wb = Workbook.getWorkbook(new File("C:\\Users\\mce\\Documents\\Selenium\\Projects\\Mecury Tours\\Data1.xls")); WritableWorkbook copy = Workbook.createWorkbook(new File("C:\\Users\\mce\\Documents\\Selenium\\Projects\\Mecury Tours\\Data2.xls"),wb); WritableSheet s = copy.getSheet(0); for(int i=1;i&lt;s.getRows();i++) { driver.get(baseUrl + "/"); driver.findElement(By.xpath("//a[contains(text(),'Register \n here')]")).click(); driver.findElement(By.name("firstName")).sendKeys("Tester"); driver.findElement(By.name("lastName")).clear(); driver.findElement(By.name("lastName")).sendKeys("01"); driver.findElement(By.name("phone")).clear(); driver.findElement(By.name("phone")).sendKeys("010101010"); driver.findElement(By.id("userName")).clear(); driver.findElemen…
has comment: http://stackoverflow.com/comment/32420992
tagged with: eclipse

http://stackoverflow.com/comment/32343233
type: Comment
type: QuestionComment
has text: kleopatra, are you suggesting that i simply get rid of the keylisteners implementation and make the textArea editable and have a try-catch block to stop non-numeric values type in?
score: 0
comment on: http://stackoverflow.com/q/21434873

http://stackoverflow.com/comment/32468114
type: QuestionComment
comment on: http://stackoverflow.com/q/21506060
score: 0
type: Comment
has text: Thank you OldProgrammer. I did so after reading Doberman's response.

http://stackoverflow.com/q/21432871
favorite count: 0
has body: I need to create a PDF file using JasperReports. The problem is that it has to take only one Java bean as a parameter (not list nor array) and the report has custom layout that can not be expressed in tables or lists or whatever. If I execute the following code, when jrxml has only layout and no printing of the parameters - PDF displays OK. This is how I try to pass a parameter: Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); url = getClass().getClassLoader().getResource("/WEB-INF/reports/reg.jrxml"); jasperReport = JasperCompileManager.compileReport(url.getPath()); map.put("PARAM_NAME", myBean); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map, new JREmptyDataSource()); JasperExportManager.exportReportToPdfStream(jasperPrint, responseOutputStream); The question is, how should I configure my jrxml file so that I have access to fields of myBean, so that I can fill in text fields? I have tried adding &lt;parameter name="PARAM_NAME" class="net.sf.jasperreports.engine.JRDataSource"/&gt; to jrxml file but I still can't access it's fields. Say, myBean has a field uid and getUid() correspondingly and I need to print it somewhere.
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21458478
accepted answer: http://stackoverflow.com/a/21458478
score: 1
tagged with: java
type: Question
tagged with: jasper-reports
has title: Accessing the only Java bean passed to jasper records
upvote count: 1
answer count: 1

http://stackoverflow.com/a/21585381
has body: It appears that your bucket "apireleasecandidate1" is not in the us-west-1 region. I think it is in the us-classic region. You should modify your code to remove the setRegion() call.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21506270
downvote count: 0

http://stackoverflow.com/comment/32265781
type: QuestionComment
comment on: http://stackoverflow.com/q/21391990
score: 0
has text: @user3238603 you can edit your post and add the relevant info.
type: Comment

http://stackoverflow.com/q/21444221
answer count: 1
accepted answer: http://stackoverflow.com/a/21471718
score: 0
tagged with: android
has body: i'm trying to add markers to my map, the coordinates and names are contained in a stop object that i'm getting through a query to a stackmob database, the program runs fine displays the map, but for some reason it looks like its not executing the addmarker instruction, won't even loop through the for in the addMarkers method. Also i'm not getting errors or messages of any kind in the console or LogCat, i'm running out of ideas to solve this. public class MainActivity extends Activity { GoogleMap map; List&lt;Stop&gt; stops=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); StackMobAndroid.init(getApplicationContext(), 0, "f4e013f5-3e0f-41e2-af2f-3fc2bfa2446b"); getMarkers(); } public void getMarkers( ) { Stop.query(Stop.class, new StackMobQuery().field(new StackMobQueryField("stop")), new StackMobQueryCallback&lt;Stop&gt;() { @Override public void success(List&lt;Stop&gt; result) { addMarkers(result); } @Override public void failure(StackMobException e) { System.out.println("Fail"); } }); } public void addMarkers(List&lt;Stop&gt; stops) { for(int i=0;i&lt;=stops.size();i++) { LatLng markerPos = new LatLng(stops.get(i).getLatitude(), stops.get(i).getLongitude()); System.out.println(markerPos); System.out.println(stops.get(i).getName()); System.out.println(i); map.addMarker(new MarkerOptions().title(stops.get(i).getName()).snippet("test").position(markerPos)); } } Thanks Edit: If i add a a marker manually in, lets say the onCreate method, it will display correctly on the map. Edit2: When i put a try catch statement around the map.addmarker the error message reads "Not on the main thread" not sure about this.
tagged with: stackmob
has answer: http://stackoverflow.com/a/21471718
type: AnsweredQuestion
has title: Markers not showing on map after stackmob query
tagged with: java
type: Question
tagged with: google-maps

http://stackoverflow.com/comment/32418479
score: 0
has text: @Dunkey- you have set `return ""; ` for special character. thus you are not able to type any special character. and also you have not tried/implemented what you are looking for.
comment on: http://stackoverflow.com/q/21478662
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21506889
has comment: http://stackoverflow.com/comment/60802566
has body: There is a way to compose a method reference that is the opposite of a current method reference. See @vlasec's answer below that shows how by explicitly casting the method reference to a Predicate and then converting it using the negate function. That is one way among a few other not too troublesome ways to do it. The opposite of this: Stream&lt;String&gt; s = ...; int emptyStrings = s.filter(String::isEmpty).count(); is this: Stream&lt;String&gt; s = ...; int notEmptyStrings = s.filter(((Predicate&lt;String&gt;) String::isEmpty).negate()).count() or this: Stream&lt;String&gt; s = ...; int notEmptyStrings = s.filter( it -&gt; !it.isEmpty() ).count(); Personally, I prefer the later technique because I find it clearer to read it -&gt; !it.isEmpty() than a long verbose explicit cast and then negate. One could also make a predicate and reuse it: Predicate&lt;String&gt; notEmpty = (String it) -&gt; !it.isEmpty(); Stream&lt;String&gt; s = ...; int notEmptyStrings = s.filter(notEmpty).count(); Or, if having a collection or array, just use a for-loop which is simple, has less overhead, and *might be **faster: int notEmpty = 0; for(String s : list) if(!s.isEmpty()) notEmpty++; *If you want to know what is faster, then use JMH http://openjdk.java.net/projects/code-tools/jmh, and avoid hand benchmark code unless it avoids all JVM optimizations — see Java 8: performance of Streams vs Collections **I am getting flak for suggesting that the for-loop technique is faster. It eliminates a stream creation, it eliminates using another method call (negative function for predicate), and it eliminates a temporary accumulator list/counter. So a few things that are saved by the last construct that might make it faster. I do think it is simpler and nicer though, even if not faster. If the job calls for a hammer and a nail, don't bring in a chainsaw and glue! I know some of you take issue with that. wish-list: I would like to see Java Stream functions evolve a bit now that Java users are mor…
has comment: http://stackoverflow.com/comment/89178929
has comment: http://stackoverflow.com/comment/57116179
has comment: http://stackoverflow.com/comment/85590280
downvote count: 2
has comment: http://stackoverflow.com/comment/138829628
upvote count: 167
has comment: http://stackoverflow.com/comment/77217808
has comment: http://stackoverflow.com/comment/57267764
answers question: http://stackoverflow.com/q/21488056
has comment: http://stackoverflow.com/comment/57180711
type: Answer
score: 165
has comment: http://stackoverflow.com/comment/57090623

http://stackoverflow.com/comment/32342913
has text: "A king owns n gold coins, stored in an array". There’s something hilarious about that
score: 3
comment on: http://stackoverflow.com/q/21436392
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32716627
comment on: http://stackoverflow.com/a/21396680
score: 0
type: AnswerComment
has text: when you mention configuring the local machine to respond and then line up the resources, how is that achieved? Hate to bother, just frustrating that i can't get this simple jnlp to run other than their work computer.... :-/
type: Comment

http://stackoverflow.com/comment/32458120
comment on: http://stackoverflow.com/a/21501152
score: 0
type: AnswerComment
type: Comment
has text: Thanks! But I also want a user to be able to use "for each" loop, for example, to fill JFileChooser with filters.

http://stackoverflow.com/a/21404495
score: 0
type: Answer
has body: You can use preimplemented method onProgressUpdate() of AsyncTask which allows you to post Toasts. To do this, you have to change your AsyncTask declaration into private class WeatherAsyncTask extends AsyncTask&lt;String, String, WeatherInfo&gt; and add method @Override protected void onProgressUpdate(String... values) { super.onProgressUpdate(values); Toast.makeText(WeatherActivity.this, values[0], Toast.LENGTH_SHORT).show(); } and inside your AsyncTask you can catch your exception and do this catch (IOException e) { e.printStackTrace(); publishProgress(e.getMessage()); } All this is available by default in AsyncTask without the need of creating new runnables.
answers question: http://stackoverflow.com/q/21402225

http://stackoverflow.com/comment/32447285
has text: Once you've answered my question above, read [this](http://stackoverflow.com/questions/409784/simplest-way-to-print-an-array-in-java).
comment on: http://stackoverflow.com/q/21494733
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21353603
tagged with: java
tagged with: dom
type: Question
has body: I try parse xml file, it is true length of element, but when I try get value of this tag element - it's null. Why? My xml code: <?xml version="1.0" encoding="utf-8"?> first second third DOM parser code(create three radioButton, but value of this is null): NodeList name = doc.getElementsByTagName("name"); for (int x = 0; x < name.getLength(); x++) { Node nNode = name.item(x); radioButton = new RadioButton(this); group.addView(radioButton); radioButton.setId(x); radioButton.setText(nNode.getNodeValue()); radioButton.setTextColor(Color.BLACK); } Thank you for the help.
has answer: http://stackoverflow.com/a/21353815
score: 0
answer count: 1
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has title: XML DOM Parser: null value of all element
tagged with: android
accepted answer: http://stackoverflow.com/a/21353815
type: AnsweredQuestion

http://stackoverflow.com/comment/32202238
has text: Move `promptInventory` out of your `main` method
type: QuestionComment
comment on: http://stackoverflow.com/q/21357111
type: Comment
score: 2

http://stackoverflow.com/q/21436392
linked to: http://stackoverflow.com/q/21420029
has comment: http://stackoverflow.com/comment/32343962
has comment: http://stackoverflow.com/comment/32343640
has comment: http://stackoverflow.com/comment/32343814
has comment: http://stackoverflow.com/comment/32344081
has comment: http://stackoverflow.com/comment/32344620
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32343554
score: -4
duplicate of: http://stackoverflow.com/q/21420029
has comment: http://stackoverflow.com/comment/32342913
has comment: http://stackoverflow.com/comment/32343512
has comment: http://stackoverflow.com/comment/32343535
has comment: http://stackoverflow.com/comment/32343294
has comment: http://stackoverflow.com/comment/32344154
has comment: http://stackoverflow.com/comment/32343372
favorite count: 0
has comment: http://stackoverflow.com/comment/32343928
has title: Does my pseudocode make sense?
has comment: http://stackoverflow.com/comment/32343498
type: Question
has comment: http://stackoverflow.com/comment/32344204
has comment: http://stackoverflow.com/comment/32343586
answer count: 2
has answer: http://stackoverflow.com/a/21436654
has comment: http://stackoverflow.com/comment/32343445
has comment: http://stackoverflow.com/comment/32343845
has comment: http://stackoverflow.com/comment/32343689
has comment: http://stackoverflow.com/comment/32344296
has comment: http://stackoverflow.com/comment/32343071
has comment: http://stackoverflow.com/comment/32344063
tagged with: java
has comment: http://stackoverflow.com/comment/32344242
has comment: http://stackoverflow.com/comment/32344246
has answer: http://stackoverflow.com/a/21436630
has body: I believe my code is now foolproof. I will write up the pseudocode now. But I do have one question. Why does DRJava ask that I return something outside of my if statements? As you can see I wrote for ex: "return 1;" just because it asked. It will never return that value however. Can someone explain this to me? public class assignment1question2test { public static void main(String[] args) { int[] a = new int[1]; int l = 0; int r = a.length-1; for(int i=0; i&lt;=r; i++) { a[i] = 1; } a[0] = 10; for (int i=0; i&lt;=r; i++) { System.out.println(a[i]); } System.out.print(recursiveSearch(a,l,r)); } public static int recursiveSearch (int[] a, int l, int r) { int third1 = (r-l)/3 + l; int third2 = third1*2 - l + 1; if (r-l == 0) { return l; } System.out.println("i will be checking compare from " + l + " to " + third1 + " and " + (third1 + 1) + " to " + third2); int compareResult = compare(a,l,third1,third1 + 1, third2); if(r-l == 1) { if (compareResult == 1) { return l; } else { return r; } } if (compareResult == 0) { return recursiveSearch(a,third2 + 1, r); } if (compareResult == 1) { return recursiveSearch(a,l,third1); } if (compareResult == -1) { return recursiveSearch(a,third1 + 1, third2); } return 1; } public static int compare(int[] a, int i, int j, int k, int l) { int count1 = 0; int count2 = 0; for(int g=i; g&lt;=j; g++) { count1 = count1 + a[g]; } for(int g=k; g&lt;=l; g++) { count2 = count2 + a[g]; } if (count1 == count2) { return 0; } if (count1 &gt; count2) { return 1; } if (count1 &lt; count2) { return -1; } return 0; } } FINAL PSEUDOCODE I THINK Algorithm: recursiveSearch (a,l,r) Inputs: An array a, indices l and r which delimit the part of interest. Output: The index that has the lead coin. int third1 ← (r - l)/3 int third2 ← third1*2 - l + 1 if (r-l = 0) then return l int compareResult ← compare(a,l,third1,third1 + 1,third2) if (r-l = 1) then if (compareResult = 1) then return l else return r if (compareResult = 0) then return recursiveSearch(a, third2 + 1,…
has comment: http://stackoverflow.com/comment/32343939
has comment: http://stackoverflow.com/comment/32343994
tagged with: pseudocode
upvote count: 1
has comment: http://stackoverflow.com/comment/32342864

http://stackoverflow.com/q/21360891
has answer: http://stackoverflow.com/a/21361894
has body: I'm just starting out with Java web development using Eclipse. I'm playing with Jetty for JSP &amp; Servlet. Installed Eclipse Kepler Java EE IDE - it came with tomcat and other servers adapters but not Jetty. I know there are jetty plugins but I'm not interested in them. When I create a new dynamic web project and create a new servlet, my file comes with the import statements and class structure. Those imports fail saying cannot resolve class name. It's because of eclipse not having the servlet &amp; jsp API jars. I have the jetty 9.1.1 distribution and I added the jar lib/servlet-api-3.1.jar &amp; lib/jsp/jsp-api-something.jar The thing works now. But is this the correct way or there's some other way which can be helpful when developing more web projects because this library addition essentially for this project alone?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21368055
tagged with: eclipse
tagged with: servlets
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21368055
has title: What's the proper way to add JSP & Servlet libs to Eclipse?
tagged with: jsp
score: 0
possible better answer: http://stackoverflow.com/a/21361894
tagged with: jetty

http://stackoverflow.com/comment/32191036
type: Comment
has text: Well, it needs to be `.equals`, not `==`.
comment on: http://stackoverflow.com/a/21350815
score: 3
type: AnswerComment

http://stackoverflow.com/q/21466542
tagged with: eclipse
type: Question
tagged with: testing
downvote count: 0
tagged with: aop
has answer: http://stackoverflow.com/a/21467191
accepted answer: http://stackoverflow.com/a/21467191
has title: Java automation testing tool with recording program execution for regression testing
answer count: 1
favorite count: 0
tagged with: netbeans
has body: Searching for any free tool capable doing this. It's not import if it's for eclipse, netbeans or standalone tool, but I prefer eclipse or netbeans plugin. What I need is record program execution for the following regression testing of java programs, but it can't work via writing test, but via recording program execution flow. Explanation of question: I'm building java profiling tool mostly through AOP aproach and I must first run program for identifing pointcuts in code execution flow for testing so I need record it and after that its helpfull for regression testing of recorded execution flow.
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32399051
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21467543
has text: Ohhhh, sorry, my bad. Please see my edited question, changed one line of code in Entity.

http://stackoverflow.com/comment/32243244
comment on: http://stackoverflow.com/a/21379220
type: AnswerComment
has text: I regret that I do not know the reason for that. I recommend asking a new question for this new issue you are facing.
score: 0
type: Comment

http://stackoverflow.com/comment/32212667
score: 0
type: Comment
has text: The link can die, and to make this answer independent of it. I have copied the text, with sources mentioned in it. This is clearly not plagiarism.
comment on: http://stackoverflow.com/a/21362999
type: AnswerComment

timer
tag name: timer
tags question: http://stackoverflow.com/q/21492693
tags question: http://stackoverflow.com/q/21413349
tags question: http://stackoverflow.com/q/21479670
tags question: http://stackoverflow.com/q/21392822
tags question: http://stackoverflow.com/q/21361395
type: Tag
tags question: http://stackoverflow.com/q/21507506
tags question: http://stackoverflow.com/q/21442322
tags question: http://stackoverflow.com/q/21459950
tags question: http://stackoverflow.com/q/21501530
tags question: http://stackoverflow.com/q/21366534
tags question: http://stackoverflow.com/q/21418001
tags question: http://stackoverflow.com/q/21421539
tags question: http://stackoverflow.com/q/21456643
tags question: http://stackoverflow.com/q/21400851
tags question: http://stackoverflow.com/q/21368645

http://stackoverflow.com/a/21447376
accepted answer of: http://stackoverflow.com/q/21447049
answers question: http://stackoverflow.com/q/21447049
upvote count: 2
has body: Here's another approach if you want to avoid recursion. public static int bitsSet(char arg) { int counter = 0; for (int oneBit = 1; oneBit &lt;= 0x8000; oneBit &lt;&lt;= 1) { if ((arg &amp; oneBit) &gt; 0) { counter++; } } return counter; } Update Here's a bit of an explanation. In the loop, oneBit bit-shifts to the left each time, which doubles its value. The &lt;&lt;= operation is a kind of shorthand for oneBit = oneBit &lt;&lt; 1. So, the first time through, we have oneBit = 0000000000000001. Then the next time, we have oneBit = 0000000000000010, then oneBit = 0000000000000100, and so on, until we reach the last iteration, when we have oneBit = 1000000000000000 (these are all binary of course). Now, the value of arg &amp; oneBit will equal oneBit if arg has the matching bit set, or 0 otherwise. So the condition is executing counter++ if it encounters a set bit. By the time the loop has run all 16 times, we've counted all the set bits.
has comment: http://stackoverflow.com/comment/32365825
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32401417
score: 2
downvote count: 0

http://stackoverflow.com/comment/32331880
type: AnswerComment
type: Comment
has text: @RiponAlWasim : It's hard to stay on the current. Oracle changes the security settings again and again.
comment on: http://stackoverflow.com/a/21427782
score: 0

http://stackoverflow.com/a/21492700
has body: You may give apache FileUpload a try http://commons.apache.org/proper/commons-fileupload/using.html then you could process your multipart request like this // Process the uploaded items Iterator&lt;FileItem&gt; iter = items.iterator(); while (iter.hasNext()) { FileItem item = iter.next(); if (item.isFormField()) { processFormField(item); } else { processUploadedFile(item); } }
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21491551
type: Answer

http://stackoverflow.com/comment/32460345
comment on: http://stackoverflow.com/q/21501354
type: Comment
type: QuestionComment
score: 0
has text: Received files contains that info.

http://stackoverflow.com/q/21402754
answer count: 1
has comment: http://stackoverflow.com/comment/32283963
has comment: http://stackoverflow.com/comment/32284945
has comment: http://stackoverflow.com/comment/32284900
tagged with: android
has answer: http://stackoverflow.com/a/21403487
has comment: http://stackoverflow.com/comment/32284589
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32284224
has comment: http://stackoverflow.com/comment/32285038
tagged with: java
has comment: http://stackoverflow.com/comment/32284797
has body: hi i want to scroll down automatically to a text view from a text view in the same layout but it gives me error please find out the error where i am doing wrong..here is my code. i want that when i click on the textview of id "Signandsymptoms" it scroll down directly to the id of "Signandsymptomsparagragh". Error log: 01-28 15:22:39.929: E/AndroidRuntime(18673): FATAL EXCEPTION: main 01-28 15:22:39.929: E/AndroidRuntime(18673): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kmcpesh.shortreviewofcardiology/com.kmcpesh.shortreviewofcardiology.Atherosclerosis}: java.lang.NullPointerException 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.app.ActivityThread.access$700(ActivityThread.java:159) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.os.Handler.dispatchMessage(Handler.java:99) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.os.Looper.loop(Looper.java:137) 01-28 15:22:39.929: E/AndroidRuntime(18673): at android.app.ActivityThread.main(ActivityThread.java:5419) 01-28 15:22:39.929: E/AndroidRuntime(18673): at java.lang.reflect.Method.invokeNative(Native Method) 01-28 15:22:39.929: E/AndroidRuntime(18673): at java.lang.reflect.Method.invoke(Method.java:525) 01-28 15:22:39.929: E/AndroidRuntime(18673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187) 01-28 15:22:39.929: E/AndroidRuntime(18673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 01-28 15:22:39.929: E/AndroidRuntime(18673): at dalvik.system.NativeStart.main(Native Method) 01-28 15:22:39.929: E/AndroidRuntime(18673): Caused by: java.lang.NullPointe…
type: Question
has comment: http://stackoverflow.com/comment/32284662
has title: scroll down from a TextView click to a TextView
has comment: http://stackoverflow.com/comment/32284714
accepted answer: http://stackoverflow.com/a/21403487
tagged with: eclipse
score: 0

http://stackoverflow.com/comment/32474657
has text: This is a another way of doing it, but I wanted to know if its possible to allow the user to change certain parts of the textpane text. without having huge amount of code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21510267
type: Comment

http://stackoverflow.com/q/21423679
has title: call a number using skype in android and need to get skype contact list
has answer: http://stackoverflow.com/a/21423782
duplicate of: http://stackoverflow.com/q/6414494
tagged with: java
type: Question
has body: I am making an app where I need to make a video call using Skype. Can anyone help me? The code I wrote so far is: Intent sky = new Intent("android.intent.action.VIEW"); sky.setData(Uri.parse("skype:" + playerChanged + "?call&amp;video=true")); sky.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); sky.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(sky); but this code did nothing except open the Skype app. I need to fetch my skype contact list...
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/32320690
linked to: http://stackoverflow.com/q/6414494
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/21388756
answers question: http://stackoverflow.com/q/21388639
has body: if (l&lt;r) quicksort(array,l,r); Isnt l always less than r? this will cause an infinite recursion which is why you dont get an overflow if both values are the same.
type: Answer
has comment: http://stackoverflow.com/comment/32259313
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32461021
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21502382
has text: I think its not a straight forward to achieve this directly using `JPA`. First you need to find the right query in native sql and then try to convert that to `JQL`. Here is more or less a simliar problem http://stackoverflow.com/questions/20783136/improving-mysql-related-articles-query
score: 0

http://stackoverflow.com/a/33683459
has body: I created an example using Tomcat DBCP 1.4 for GAE frontend instances, which do not allow threads to live outside of request scope. This works with Java 7. https://github.com/kennberg/appengine-java-connection-pool
type: Answer
answers question: http://stackoverflow.com/q/21457736
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/32343489
type: AnswerComment
score: 0
type: Comment
has text: But just to answer your 'original' question: you have a problem in your -cp parameter: the compiler can't find your class A
comment on: http://stackoverflow.com/a/21435019

http://stackoverflow.com/comment/32350489
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21440413
score: 3
has text: Also note for the future that Java and Javascript are entirely different languages.

http://stackoverflow.com/q/21444301
has comment: http://stackoverflow.com/comment/32357739
has answer: http://stackoverflow.com/a/21446270
has comment: http://stackoverflow.com/comment/32357803
has answer: http://stackoverflow.com/a/21444610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21446368
has answer: http://stackoverflow.com/a/21444591
downvote count: 1
has answer: http://stackoverflow.com/a/21444368
has comment: http://stackoverflow.com/comment/32357645
tagged with: java
has comment: http://stackoverflow.com/comment/32357835
score: -1
has title: Comparing if 2 dates are the same day Java
type: Question
has comment: http://stackoverflow.com/comment/32357783
upvote count: 0
has body: Good day, quick question, Am trying to compare if 2 dates are the same day for the same time zone (city)Anyone have any idea why the following code holds and the other doesn't, can't seem to understand why. SimpleDateFormat fmt = new SimpleDateFormat("EEE dd,MMM"); Date newparsetemp = fmt.parse(parsedate); Date currentdateparse = fmt.parse(currentdate); if(currentdateparse.equals(newparsetemp)){ //code executes } but if i do use this, the if condition doesn't hold SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd"); Date newparsetemp = fmt.parse(parsedate); Date currentdateparse = fmt.parse(currentdate); if(currentdateparse.equals(newparsetemp)){ //does not }
favorite count: 0
has comment: http://stackoverflow.com/comment/32357954
has comment: http://stackoverflow.com/comment/32357822
has comment: http://stackoverflow.com/comment/32357826
has comment: http://stackoverflow.com/comment/32357708
answer count: 5
has comment: http://stackoverflow.com/comment/32357765

http://stackoverflow.com/comment/32417266
has text: I am now using eclipse Scala IDE. I can inspect the member variables etc now. But I cannot inspect the local variables. The IDE pops up a Java.lang.NullPointerException. I am debugging it as a Java application. May be the IDE is confused with the type of the variables.
comment on: http://stackoverflow.com/a/21425113
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21400342
favorite count: 0
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/21400430
has body: I don't know, why you need to throw exception in java. I can just evaluate the return value. Here is an example: int logic(int i){ switch(i){ case 0: return 0; case 1: return 1; default: throw new Exception(); // return -1; } } In the case of default, I can throw exception object, but I can also can return -1. The two methods can capture it. Why do I need to throw an exception? My English is not that great, because English is not my main language. If there are something you do not understand, please tell me. Thanks.
has answer: http://stackoverflow.com/a/21400561
score: -2
has comment: http://stackoverflow.com/comment/32279845
has comment: http://stackoverflow.com/comment/32279873
possible better answer: http://stackoverflow.com/a/21400438
has answer: http://stackoverflow.com/a/21400438
has comment: http://stackoverflow.com/comment/32280065
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21400465
accepted answer: http://stackoverflow.com/a/21400430
answer count: 5
has answer: http://stackoverflow.com/a/21400451
has title: why you need to throw exception in java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32279911

http://stackoverflow.com/q/21384646
tagged with: java
type: Question
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/21384935
has comment: http://stackoverflow.com/comment/32251828
has title: Change Making algorithm
tagged with: coin-change
has body: A typical Change Making problem but a bit twisted. Given a large amount and the denominations given, I need to come up with total number of ways in which the amount can be made using RECURSION. The signature of the function is as follows int makeChange(int Amount, int[] Denominations) Amount-Total Amount Denominations- The available denominatins. It returns total number of ways.. make sure this has to be done Using Recursion..
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32252892
upvote count: 1
has comment: http://stackoverflow.com/comment/32252754
has answer: http://stackoverflow.com/a/21384935
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/21420834
answers question: http://stackoverflow.com/q/21420624
upvote count: 2
score: 2
has body: Folk i realize i did not have the right jar for the base64. for folk who have the same problem as me please download commons-codec-1.9-bin.zip at http://commons.apache.org/proper/commons-codec/download_codec.cgi to able run the given code.
downvote count: 0
type: Answer

http://stackoverflow.com/q/21424313
has comment: http://stackoverflow.com/comment/32321576
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am working on some data structures - after searching for an element, I am attempting to delete that element - but throws Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at SearchArray.deleteElements(SearchArray.java:68) at SearchArrayDemo.main(SearchArrayDemo.java:25) this is my method void deleteElements(int value) { int j,k; for (j=0;j&lt;setArray.length;j++) if ( value == setArray[j]) break; if (setArray[j] == setArray.length) System.out.print("no item found"); else { for( k=j;k&lt;setArray.length;k++) `setArray[k]=setArray[k+1];` k=setArray.length-1; setArray[j]=0; System.out.println("item deleted"); }` and main method used to call that functions deleteElements sa.deleteElements(5); I did not include all the code for conciseness, this is the line where code breaks setArray[k]=setArray[k+1]; please let me know if remaining code is required. thanks all for your help.
type: Question
has answer: http://stackoverflow.com/a/21424416
has answer: http://stackoverflow.com/a/21424373
has title: delete array [] elements
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/32321714
has answer: http://stackoverflow.com/a/21424617
possible better answer: http://stackoverflow.com/a/21424363
has answer: http://stackoverflow.com/a/21424363
accepted answer: http://stackoverflow.com/a/21424373
has answer: http://stackoverflow.com/a/21424516
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/32321631
upvote count: 1

http://stackoverflow.com/a/21362546
answers question: http://stackoverflow.com/q/21362417
has comment: http://stackoverflow.com/comment/32211920
has comment: http://stackoverflow.com/comment/32211959
downvote count: 0
has comment: http://stackoverflow.com/comment/32211808
type: Answer
has comment: http://stackoverflow.com/comment/32211762
has comment: http://stackoverflow.com/comment/32211747
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32212167
has body: A lesson to learn: use sensible names for your variables. They may not matter to the compiler, but they matter a lot to you. You have used unintuitive variable names in your GroceryList: for (GroceryItem items : item) { if(items != null){ retuurn += item.toString() + "\n"; } } You call the array item, and the item in the array items. This made you use the wrong variable in retuurn += item.toString() + "\n"; You should have used retuurn += items.toString() + "\n"; Once past this error, you'll find you are still getting cryptic strings for each item because you haven't overridden GroceryItem.toString() so it has inherited Object.toString(), which behaves as you witnessed. Override GroceryItem.toString() with a method which produces a string to your liking.
has comment: http://stackoverflow.com/comment/32211874

http://stackoverflow.com/q/21470999
score: 1
tagged with: java
tagged with: swing
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/32405308
has body: I'm having trouble figuring out how make my program calculate the day of the week based on user input for month, day, year. Such as in this picture below. I have no clue on how to make it connect with the JTextField and the JComboBoxes. I truly appreciate anyones help with this. I know is I'm supposed to use: Calendar xmas = new GregorianCalendar(1998, Calendar.DECEMBER, 25); int dayOfWeek = xmas.get(Calendar.DAY_OF_WEEK); // 6=Friday import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JComboBox; import javax.swing.DefaultComboBoxModel; import javax.swing.JTextField; import javax.swing.JTextArea; public class DayOfWeek extends JFrame { private JPanel contentPane; private JTextField yearField; private JLabel dayOfW; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { DayOfWeek frame = new DayOfWeek(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public DayOfWeek() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 230); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel monthL = new JLabel("Month:"); monthL.setBounds(10, 11, 46, 14); contentPane.add(monthL); JComboBox monthBox = new JComboBox(); monthBox.setModel(new DefaultComboBoxModel(new String[] {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"})); monthBox.setBounds(53, 8, 109, 20); contentPane.add(monthBox); JLabel dayL = new JLabel("Day: "); dayL.setBounds(172, 11, 31, 14); contentPane.add(dayL); JCom…
has comment: http://stackoverflow.com/comment/32405749
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/32405337
has answer: http://stackoverflow.com/a/21471074
has comment: http://stackoverflow.com/comment/32407455
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21471343
has answer: http://stackoverflow.com/a/21471177
has comment: http://stackoverflow.com/comment/32405344
has title: Calculate day of the week based on user input
downvote count: 0

http://stackoverflow.com/comment/32391917
score: 2
has text: @victorantunes: The partial LIKE 'prefix%' query is under the hood implemented as a query with inequality filter
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21463490

http://stackoverflow.com/a/28771063
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21478341
has body: I've accomplished something similar with SQS using Java's ExecutorService, Future, and the ConcurrentLinkedQueue. The ExecutorService creates a thread pool that can execute classes that implement the Callable interface and returns a Future. As the ExecutorService creates the futures I push them onto a ConcurrentLinkedQueue that runs in a thread and processes the results as the futures complete. Implement checking SQS and starting the work asynchronously: import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class SqsProcessor { private static final int THREAD_COUNT = 100; private ExecutorService _executor = null; private FutureResultProcessor futureResultProcessor = null; public SqsProcessor() { _executor = Executors.newFixedThreadPool(THREAD_COUNT); _futureResultProcessor = new FutureResultProcessor(); } public void waitReceive() { // Receive a SQS message // Start the work related to the SQS message Callable&lt;MyWorkerResult&gt; sqsWorker = new MyWorker(sqsMessage); Future&lt;MyWorkerResult&gt; sqsFuture = _executor.submit(sqsWorker); // Send to the queue so the result can be processed when it completes _futureResultProcessor.add(sqsFuture); } } Class that does the work: import java.util.concurrent.Callable; public class MyWorker implements Callable&lt;MyWorkerResult&gt; { private String _sqsMessage = null; public MyWorker(String sqsMessage) { _sqsMessage = sqsMessage; } @Override public MyWorkerResult call() throws Exception { // Do work relating to the SQS message } } Holds the results of the work: public class MyWorkerResult { // Results set in MyWorker call() } ConcurrentLinkedQueue to receive and process the future results: import java.util.concurrent.Future; import java.util.concurrent.ConcurrentLinkedQueue; public class FutureResultProcessor extends Thread { private final ConcurrentLinkedQueue&lt;Fut…
accepted answer of: http://stackoverflow.com/q/21478341
score: 3

http://stackoverflow.com/q/21491288
score: 0
has answer: http://stackoverflow.com/a/21492829
tagged with: pong
possible better answer: http://stackoverflow.com/a/21491381
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21491381
tagged with: methods
has body: Create a method in Scores.java that takes 2 arguments: player1Scores and player2Scores. The method should print out the number of games player1 won and the number of games player2 won. This is the last part to an assignment given by our teacher and I can't figure out where to start. I was thinking a simple compare each win but thats not provided by the Player1Score. It only stores the current score of the game thats going on. I need to be able to calculate all the games that have happened. Any idea how i could add this to my code? Here is a snippet of the program I'm working on so far. import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Scores { public static void main (String args[]) { } static String allScoresFilename = "allscores.txt"; static String lastScoreFilename = "lastscores.txt"; public boolean writeScores(int player1Score, int player2Score) throws IOException { PrintWriter scores = new PrintWriter (new File ("Score.txt")); scores.println("Player 1 \t Player 2 \n " +player1Score+"\t\t\t " +player2Score); PrintWriter scores1 = new PrintWriter(new BufferedWriter(new FileWriter("Scores Append", true))); scores1.println("Player One:"+player1Score+"\tPlayer Two:"+player2Score); scores1.close(); scores.close(); return true; }//End writeScores public boolean appendScores(int player1Score, int player2Score) throws IOException{ return true; }//End appendScores public void readScores() throws FileNotFoundException { File scores = new File ("Scores Append"); Scanner fileScanner = new Scanner (scores); fileScanner.useDelimiter("[\t|,|\n|\r|:]+"); String players, player1; int numbers, i=0; int []p1= new int[10]; int []p2= new int[10]; while (fileScanner.hasNext()) { players = fileScanner.next(); p1[i] = fileScanner.nextInt(); player1 = fileScanner.next(); p2[i] = fileScanner.nextInt(); System.out.println ("p1 is currently "+ p1[i]); System.out.println ("p2 is currently "+ p2[i]); i++; } }//End readScores public bo…
type: Question
answer count: 2
has title: Counting Wins in a Ping Pong game
accepted answer: http://stackoverflow.com/a/21492829

pdf-parsing
type: Tag
tag name: pdf-parsing
tags question: http://stackoverflow.com/q/21355363

http://stackoverflow.com/a/21432382
score: 0
type: Answer
has body: jar containing javax/servlet/http/HttpSessionBindingListener is missing.so download this jar and then set your classpath
answers question: http://stackoverflow.com/q/21432288

gwt
tags question: http://stackoverflow.com/q/21461751
tags question: http://stackoverflow.com/q/21412375
tags question: http://stackoverflow.com/q/21432795
tag name: gwt
tags question: http://stackoverflow.com/q/21457164
tags question: http://stackoverflow.com/q/21454931
tags question: http://stackoverflow.com/q/21437850
tags question: http://stackoverflow.com/q/21461773
type: Tag
tags question: http://stackoverflow.com/q/21407041
tags question: http://stackoverflow.com/q/21508969
tags question: http://stackoverflow.com/q/21463021
tags question: http://stackoverflow.com/q/21465183
tags question: http://stackoverflow.com/q/21387335
tags question: http://stackoverflow.com/q/21467914
tags question: http://stackoverflow.com/q/21430977
tags question: http://stackoverflow.com/q/21450374
tags question: http://stackoverflow.com/q/21470849
tags question: http://stackoverflow.com/q/21489980
tags question: http://stackoverflow.com/q/21458991
tags question: http://stackoverflow.com/q/21442159
tags question: http://stackoverflow.com/q/21461240
tags question: http://stackoverflow.com/q/21437595
tags question: http://stackoverflow.com/q/21473970
tags question: http://stackoverflow.com/q/21402189
tags question: http://stackoverflow.com/q/21430544
tags question: http://stackoverflow.com/q/21359986
tags question: http://stackoverflow.com/q/21489063
tags question: http://stackoverflow.com/q/21413379
tags question: http://stackoverflow.com/q/21504686
tags question: http://stackoverflow.com/q/21454286
tags question: http://stackoverflow.com/q/21508789
tags question: http://stackoverflow.com/q/21409465
tags question: http://stackoverflow.com/q/21499318

http://stackoverflow.com/q/21499876
has body: In the following code: PreparedStatement statement = conn .prepareStatement(SQLQueries.isMuted); statement.setString(1, player); statement.setString(2, player); //in SQLQueries.java public static final String isMuted = "SELECT EXISTS(SELECT * FROM " + "(SELECT playerid FROM mute, players AS player " + "WHERE player.username = '?' AND playerid = player.id" + "UNION ALL " + "SELECT playerid FROM tempmute, players AS player " + "WHERE player.username = '?' AND playerid = player.id) AS tbl) " + "AS isMuted;"; I get the following error: [08:10:38 WARN]: java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0). I am very confused by that, because the documentation told me the parameter index starts at 1, and this is confirmed, because when I changed the setString statements to 0 and 1, respectivly, it gave me another error. Also, the statement has two placeholders, so I do not understand why this code fails. Have I overlooked something in the documentation?
has comment: http://stackoverflow.com/comment/32455824
type: Question
has title: Issue with prepared statement
has comment: http://stackoverflow.com/comment/32456083
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21499937
has answer: http://stackoverflow.com/a/21499937
has answer: http://stackoverflow.com/a/21500269
accepted answer: http://stackoverflow.com/a/21500269
has comment: http://stackoverflow.com/comment/32456528
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
tagged with: mysql

encryption
tags question: http://stackoverflow.com/q/21406884
tags question: http://stackoverflow.com/q/21418111
tags question: http://stackoverflow.com/q/21389844
tags question: http://stackoverflow.com/q/21469202
tags question: http://stackoverflow.com/q/21396495
tag name: encryption
tags question: http://stackoverflow.com/q/21489029
tags question: http://stackoverflow.com/q/21375381
tags question: http://stackoverflow.com/q/21455346
tags question: http://stackoverflow.com/q/21495944
tags question: http://stackoverflow.com/q/21398613
tags question: http://stackoverflow.com/q/21465637
tags question: http://stackoverflow.com/q/21473245
tags question: http://stackoverflow.com/q/21485046
tags question: http://stackoverflow.com/q/21387935
tags question: http://stackoverflow.com/q/21418857
tags question: http://stackoverflow.com/q/21483272
tags question: http://stackoverflow.com/q/21404162
tags question: http://stackoverflow.com/q/21455115
tags question: http://stackoverflow.com/q/21421016
tags question: http://stackoverflow.com/q/21468099
tags question: http://stackoverflow.com/q/21480202
tags question: http://stackoverflow.com/q/21455539
tags question: http://stackoverflow.com/q/21354559
type: Tag
tags question: http://stackoverflow.com/q/21384601

http://stackoverflow.com/comment/32329677
score: 0
has text: Hi, thanks for answer. Check edit in my question - I've added my servlet code and the HTTP 403 message.
type: AnswerComment
comment on: http://stackoverflow.com/a/21410896
type: Comment

http://stackoverflow.com/comment/32210193
has text: Make sure you dont have set android:onClick="onSignClicked()" on mLoginButton by xml
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21361650
score: 0

http://stackoverflow.com/q/21406091
tagged with: java
has answer: http://stackoverflow.com/a/21407937
accepted answer: http://stackoverflow.com/a/21407937
tagged with: load-time-weaving
type: Question
has comment: http://stackoverflow.com/comment/32289744
has comment: http://stackoverflow.com/comment/32290444
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/32291495
has body: I have a class that gets created within server startup. It serves as entry method for the client application. I cannot change this behaviour. Though I'd like to use Spring @Autowired inside this unmanaged class. I read that aspectj weaving might be the way to go. It seems to already execute accoding to logs: 2014-01-28 13:11:10,156 INFO org.springframework.context.weaving.DefaultContextLoadTimeWeaver: Using a reflective load-time weaver for class loader: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader But still my injected Dao service is null. What might be missing? @WebListener public class MyContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { new TestService().run(); //throws NPE } } @Configurable class TestService extends AbstractLegacyService { @Autowired private Dao dao; @Override public void run() { //dao is always null dao.find(); } } @Component class Doa dao; enable weaving (tomcat): @Configuration @EnableLoadTimeWeaving @EnableSpringConfigured public class AppConfig { }
has comment: http://stackoverflow.com/comment/32291967
has comment: http://stackoverflow.com/comment/32292094
has comment: http://stackoverflow.com/comment/32290474
has comment: http://stackoverflow.com/comment/32291801
has comment: http://stackoverflow.com/comment/32289935
tagged with: aspectj
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32292442
favorite count: 0
has comment: http://stackoverflow.com/comment/32290330
has comment: http://stackoverflow.com/comment/32291493
has comment: http://stackoverflow.com/comment/32291892
has comment: http://stackoverflow.com/comment/32292028
tagged with: spring
has comment: http://stackoverflow.com/comment/32289865
type: AnsweredQuestion
has title: How to autowire classes in unmanaged instances?
downvote count: 0
score: 1

http://stackoverflow.com/q/21508682
has comment: http://stackoverflow.com/comment/32471773
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/32471975
has comment: http://stackoverflow.com/comment/32471842
has comment: http://stackoverflow.com/comment/32471708
type: UnansweredQuestion
has body: suppose I want to design Java GUI frame with 30 radio box on it . Are there any way to add them without write many lines of code may about 60 line ?
has title: I want a way to reduce java GUI code
upvote count: 0
has comment: http://stackoverflow.com/comment/32471979
favorite count: 0
has answer: http://stackoverflow.com/a/21508875
type: Question
has answer: http://stackoverflow.com/a/21508721
score: -2
has comment: http://stackoverflow.com/comment/32471736
has comment: http://stackoverflow.com/comment/32471836

http://stackoverflow.com/q/21447520
answer count: 1
has title: Java classpath search issue: direct setting vs using environment variables
linked to: http://stackoverflow.com/q/3282653
tagged with: javac
type: UnansweredQuestion
has body: I have a Scala library that is called from Java. This is scala code. package org.fun object ScalaPower{ def showMyPower(time:Int) = { (0 to time-1).mkString(", ") } } This is Java code. import org.fun.*; public class Test { public static void main(String args[]) { System.out.println("show my power: " + ScalaPower.showMyPower(3)); } } With this build script: SCALA_LIB=~/bin/jar/scala/scala-library.jar scalac -d ~/temp/java s.scala javac -cp .:~/temp/java:$SCALA_LIB Test.java -d ~/temp/java java -cp .:~/temp/java:$SCALA_LIB Test I have errors. Test.java:1: error: package org.fun does not exist import org.fun.*; ^ Test.java:5: error: cannot find symbol System.out.println("show my power: " + ScalaPower.showMyPower(3)); ^ symbol: variable ScalaPower location: class Test 2 errors Interestingly, I have no problem when I get the class path from environment variable. SCALA_LIB=~/jar/scala/scala-library.jar JP=.:~/temp/java:~/temp/java2:$SCALA_LIB scalac -d ~/temp/java s.scala scalac -d ~/temp/java2 s2.scala javac -cp $JP Test.java -d ~/temp/java java -cp $JP Test Why is this? Do I have to always use environment variable for setup class path with -cp? Or did I make some mistakes? I checked with Mac OS X and Linux; both of them working with $JP, but not with direct path enlisting. The code is copied from this post: How do you call a Scala singleton method from Java?
tagged with: java
has answer: http://stackoverflow.com/a/21457861
tagged with: classpath
type: Question
tagged with: scalar
score: 0

http://stackoverflow.com/a/21390416
score: 4
answers question: http://stackoverflow.com/q/21390342
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has body: You can use the synchronized statement: synchronized(anObject){ performSomeOperation(); } Every synchronized statement using the same object is guaranted to wait until another thread in such a statement is finished. Example for Hot Licks comment: synchronized returntype someMethod(parameters ...){ performSomeOperation(); } In this example the object which is locked is 'this'.
has comment: http://stackoverflow.com/comment/32262607
accepted answer of: http://stackoverflow.com/q/21390342

http://stackoverflow.com/a/21432119
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21431725
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32337023
has comment: http://stackoverflow.com/comment/32337579
has body: Try this mVideoView.setMediaController(new MediaController(OpenStream.this)); mVideoView.setVideoURI(Uri.parse(url)); mVideoView.requestFocus(); mVideoView.setOnPreparedListener(new OnPreparedListener() { public void onPrepared(MediaPlayer mp) { int w = mp.getVideoWidth(); int h = mp.getVideoHeight(); SurfaceHolder holder = mVideoView.getHolder(); holder.setFixedSize(w, h); // Or setup a proportional sizes mp.start(); } });

http://stackoverflow.com/q/21357323
tagged with: java
has answer: http://stackoverflow.com/a/56369048
type: Question
linked to: http://stackoverflow.com/q/4739407
has body: I'm porting some Java code to C#, but it appears as though the public key padding between Java and C# is inconsistent. Here is my Java code: package Encryption; import java.security.cert.X509Certificate; import java.security.interfaces.RSAPublicKey; import java.io.ByteArrayInputStream; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import javax.xml.bind.DatatypeConverter; /** * * @author Cameron */ public class Encryptiontest { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String publicKey = "[binary]"; ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(DatatypeConverter.parseBase64Binary(publicKey)); X509Certificate x509certificate; try { x509certificate = (X509Certificate)CertificateFactory.getInstance("X.509").generateCertificate(bytearrayinputstream); RSAPublicKey key = (RSAPublicKey)x509certificate.getPublicKey(); System.out.println(DatatypeConverter.printBase64Binary(key.getEncoded())); } catch (CertificateException certificateexception) { } } } When I print the base64 representation of the RSAPublicKey, this is what I get: [binary] However, the result is different with C# with the same base64 public key. Here is my C# code: using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace EncryptionTest { class Program { static void Main(string[] args) { String publicKey = "[binary]"; byte[] data = Convert.FromBase64String(publicKey); X509Certificate x509certificate = new X509Certificate(data); byte[] rsaPublicKey = x509certificate.GetPublicKey(); string base64 = Convert.ToBase64String(rsaPublicKey); Console.WriteLine(base64); Console.ReadKey(); } } } C# output: [binary] Why are the two similar, but padded differently? How do I make the C# output look like the Java output?
type: AnsweredQuestion
tagged with: c#
has title: X509 Certificate Public Key Padding
tagged with: rsa
score: 4
answer count: 2
tagged with: padding
has answer: http://stackoverflow.com/a/21364233
accepted answer: http://stackoverflow.com/a/21364233
possible better answer: http://stackoverflow.com/a/56369048
favorite count: 0
tagged with: x509certificate
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/32372996
score: 0
type: Comment
has text: Hmm... I am running out of ideas. I've tested my code successfully in a unit test using the H2 DB. Are you using MySQL's MyISAM engine. If so try using InnoDB, since MyISAM cannot handle foreign key constraints. Try making progress step by step. First focus on Order and OrderLine and ignore everything else. If persisting this parent/child entity combination works, add your draw entities.
type: AnswerComment
comment on: http://stackoverflow.com/a/21403602

http://stackoverflow.com/comment/32446360
score: 0
comment on: http://stackoverflow.com/q/21494053
type: Comment
type: QuestionComment
has text: No I do not have my own String class.

http://stackoverflow.com/q/21479156
favorite count: 0
has title: How to configure ActiveMQ memory settings under Apache Tomee?
has answer: http://stackoverflow.com/a/21480087
upvote count: 1
has body: I have an embedded ActiveMQ under Apache TomEE. TomEE configures JMS in a file called tomee.xml, in my case, it's configured like this BrokerXmlConfig = broker:(tcp://localhost:61616)?persistent=true ServerUrl = tcp://localhost:61616 DataSource = MyDataSource Now, I'd like to specify custom memory settings, which is done in the activemq.xml file. TomEE can load activemq.xml configuration using Spring XBeans if I add , like this (I think) BrokerXmlConfig = xbean:file:conf/activemq.xml ServerUrl = tcp://localhost:61616 DataSource = MyDataSource See http://tomee.apache.org/jms-resources-and-mdb-container.html Is that right? I've added the 5 jars into tomee's lib path, just as indicated in the link above. And then, I have an activemq.xml like this <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> file:${activemq.conf}/credentials.properties " producerFlowControl="false" prioritizedMessages="true" useCache="false" expireMessagesPeriod="0" queuePrefetch="1" /> <vmQueueCursor /> <transportConnector name="anythingHere" uri="broker:(tcp://localhost:61616)?persistent=true"/> but obviously, I am doing something wrong here, because JMS does not start and returns an error message like SEVERE: Failed to connect to broker [tcp://localhost:61616]: Could not connect to broker URL: tcp://loc…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21480087
tagged with: activemq-classic
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: apache-tomee

http://stackoverflow.com/q/21360688
has answer: http://stackoverflow.com/a/21443837
answer count: 2
has title: key validation class type in cassandra UTF8 or LongType?
downvote count: 0
score: 4
accepted answer: http://stackoverflow.com/a/21407723
possible better answer: http://stackoverflow.com/a/21443837
tagged with: cassandra
favorite count: 0
tagged with: nosql
type: AnsweredQuestion
tagged with: bigdata
type: Question
has answer: http://stackoverflow.com/a/21407723
has body: Using cassandra, I want to store 20 million+ of row key in column family. my question is: Is there a REAL performance difference between long and utf8 rowKey keys? any,row key storage size problem? my userkey look like this rowKey=&gt;112512462152451 rowKey=&gt;135431354354343 rowKey=&gt;145646546546463 rowKey=&gt;154354354354354 rowKey=&gt;156454343435435 rowKey=&gt;154435435435745
tagged with: java
upvote count: 4

http://stackoverflow.com/q/21427946
tagged with: android
score: 3
has answer: http://stackoverflow.com/a/23074707
tagged with: java
tagged with: google-gdk
type: Question
has body: I read here there are 2 types of voice commands in glass: 1) choosing from a menu (e.g. "ok glass, directions to") 2) free speech recognition (e.g. "fifth avenue NYC") I want develop a glass app and want to use voice recognition. which of them can i use non-English language? I talk developer-wise to change the language not user-wise. Meaning saying "Ok Glass" and then menu items are in hebrew or "take me to" and then place description in hebrew. Is there any workaround for that?
has title: can I use hebrew in Google glass speech recognition?
upvote count: 3
tagged with: google-glass
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21369787
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21369969
has comment: http://stackoverflow.com/comment/32225231
has answer: http://stackoverflow.com/a/21369854
has body: I try to write application, which shows GPS coordinates on button click. @Override public void onClick(View arg0) { EditText editText; editText = (EditText) findViewById(R.id.editText1); LocationManager locationManager; locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Location location = locationManager.getLastKnownLocation("gps"); editText.setText(location.toString()); } Is problem: while in first time I got coordinates of location with time of GPS reading, second click get the same location. Even when I stop program and run again, it get the same location! How enforce to refresh reading GPS?
type: UnansweredQuestion
type: Question
tagged with: gps
tagged with: java
has title: How enforce Android to re-read GPS position?
answer count: 2

http://stackoverflow.com/a/21467514
answers question: http://stackoverflow.com/q/21467462
has body: Your bankParser method is empty. It needs to return a Bank object, and Java will complain until you do this. You could always have it return null for now til, make it at least a compilable stub you figure this out: public static Bank bankParser(String lineToParse) { Bank returnValue = null; // TODO: create a Bank object, assign to returnValue return returnValue; } As for your override bit, are you getting an error message? Or a warning? The code you've posted seems kosher, so it should compile. Please show the actual full message. As for your actual parsing, I'd use String#split("/") to split the lineToParse into an array of tokens and then work with each token, create arguments for a Bank constructor call and create a Bank object. i.e., code to show the concept: String text = "Bank Arizona/10001/Phoenix,AZ"; String[] tokens = text.split("/"); System.out.println(java.util.Arrays.toString(tokens));
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/32399511
type: Answer
has comment: http://stackoverflow.com/comment/32401364
has comment: http://stackoverflow.com/comment/32402113
has comment: http://stackoverflow.com/comment/32402148
accepted answer of: http://stackoverflow.com/q/21467462
has comment: http://stackoverflow.com/comment/32399413

http://stackoverflow.com/q/21451001
has comment: http://stackoverflow.com/comment/32369624
has comment: http://stackoverflow.com/comment/32369682
type: Question
possible better answer: http://stackoverflow.com/a/21451192
has answer: http://stackoverflow.com/a/21451192
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32370189
has comment: http://stackoverflow.com/comment/32369843
answer count: 2
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32369967
has title: abstract with 2 base classes..what is the use of abstract class here in the issue mentioned below
has comment: http://stackoverflow.com/comment/32370107
tagged with: abstract-class
has body: I am a java learner..doing exercises from web.. I have an abstract class X and 2 subclasses Y and Z. Y needs to have an int and should be able to set and get int. Z needs to have an arraylist of integers and should be able to get and set it. My need is to have one object of the baseclass and then make use of either Y or Z alone from the user input. I want to do it the correct way. PS: I am not sure how abstract class will help here. but that is part of the requirement.. thanks
has answer: http://stackoverflow.com/a/21451381
accepted answer: http://stackoverflow.com/a/21451381
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/32370155

http://stackoverflow.com/comment/32286843
comment on: http://stackoverflow.com/q/21404269
score: 0
type: QuestionComment
has text: At least use an array, and a lookup table or enum, so that news[0] might be ita, news[1] eng, and so on.
type: Comment

http://stackoverflow.com/q/21364962
has comment: http://stackoverflow.com/comment/32216310
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32216115
has body: I have a strange "problem" according these two functions. I have an EJB container, stateless in which i have my functions that make inserts,updates, deletes selects to my Database. I have my tables in entities and so the above operations use these entities, except some selects. The problem i am facing is that, until now(AppServer glassfish) i was using only .persist() function and if there was any violation problem (px bigger "string" than the column's length of a table) then my try catch(Exception e) block was catching these problems and i could send a more firenly message/exception to EJB that called the specific function and therefore the webservice which initially called that function. Now with JBoss i could not catch the same excpetion and the code returned an rollback exception. When i add the .flush() function at the end of each function then i could catch the exception and all be ok. (Of course in both situation the rollback was working as i want to do) I have read that with persist the data were remaining in cache and the java was deciding when to do the actual actions at database, and when you call flush then you force the cashed actions to complete at the DB right a way. My question is, why is this happening? I mean what changed from the one appServer to another with the same code and mostly how if i could not catch the exception the final webservice was getting the exception
type: Question
has title: JPA persist flush functions
tagged with: jpa
has answer: http://stackoverflow.com/a/21365150
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32216074
has comment: http://stackoverflow.com/comment/32216705
type: UnansweredQuestion

http://stackoverflow.com/comment/32431100
has text: I don't know how to do that... But placed on the "onquerysubmit", `Log.d("thread", Thread.currentThread().toString());` gives "Thread[main,5,main]"
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21478106
type: Comment

http://stackoverflow.com/q/21449387
has body: I have One Main Activity file In which I have a button . So When I click on it I want go to the next screen/page. So I came to know that I have to create a another MainActivity.java file so how can I do . ANd Please correct me if I am wrong and provide me with a solution. A big Thanks in Advance.
type: Question
has comment: http://stackoverflow.com/comment/32367029
has title: What are steps I have to follow to create a new MainActivity.java file
downvote count: 5
has comment: http://stackoverflow.com/comment/32367019
linked to: http://stackoverflow.com/q/16641643
has answer: http://stackoverflow.com/a/21449470
favorite count: 0
upvote count: 2
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/21449482
possible better answer: http://stackoverflow.com/a/21449468
answer count: 4
has answer: http://stackoverflow.com/a/21449485
has answer: http://stackoverflow.com/a/21449468
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21449482
tagged with: java

http://stackoverflow.com/q/21402584
answer count: 1
has title: GoogleMap v2 crash if first use Android
tagged with: android
has comment: http://stackoverflow.com/comment/32283660
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21402674
accepted answer: http://stackoverflow.com/a/21402674
has comment: http://stackoverflow.com/comment/32283600
has body: I added a GoogleMap v2 in my Android application. In normal use, I don't have problem. However, if I reset my phone and install my app, the map crash. report : Caused by: java.lang.NullPointerException: CameraUpdateFactory is not initialized When I update google services, this bug disappears. anyone would have a track, or a way to force the user to update the Google services before use app ? Thanks Exception : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.app/com.test.app.activity.AcHome}: java.lang.NullPointerException: CameraUpdateFactory is not initialized at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2067) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092) at android.app.ActivityThread.access$600(ActivityThread.java:133) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4794) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException: CameraUpdateFactory is not initialized at com.google.android.gms.internal.s.b(Unknown Source) at com.google.android.gms.maps.CameraUpdateFactory.aX(Unknown Source) at com.google.android.gms.maps.CameraUpdateFactory.newLatLngZoom(Unknown Source) at com.test.app.activity.AcHome.onCreate(AcHome.java:126) at android.app.Activity.performCreate(Activity.java:5008) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031) ... 11 more
score: 0
tagged with: google-maps

http://stackoverflow.com/comment/32391274
comment on: http://stackoverflow.com/q/21463369
has text: @Fabinout I appreciate the feedback, and while I agree with the general idea that strict MVC is too much for a novice, the tutorials introduce OOP through Processing before jumping into Java. And I posted it here because even if the OP doesn't understand everything, he'll hopefully see the basic flow of the program, which is what he's confused about here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32254040
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21384599
has text: Look up "Regular Expressions". `[0-9]` matches any digit from 0 to 9. `[0-9]+` matches one or more digits from 0 to 9. `\.` matches the `.` character. `+` makes regex match the previous pattern one or more times. `*` makes regex match the previous pattern zero or more times. `\.[0-9]+` matches `.3`, `.0321`, `.2239487192783948729`. put that between brackets and add `*` to make regex match it zero or more times. Put it all together to match any number from 0 to infinity, possibly followed by a dot and then any number from 0 to infinity.
score: 0

http://stackoverflow.com/a/21350894
upvote count: 2
has comment: http://stackoverflow.com/comment/46132934
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/21350827
has body: Count the number of leading zeros as follows: int lz = 8; while (i) { lz--; i &gt;&gt;&gt;= 1; } Of course, this supposes the number doesn't exceed 255, otherwise, you would get negative results.
has comment: http://stackoverflow.com/comment/54611616
answers question: http://stackoverflow.com/q/21350827
score: 1

http://stackoverflow.com/a/21397919
has comment: http://stackoverflow.com/comment/32276317
downvote count: 0
has comment: http://stackoverflow.com/comment/32276070
has body: You can return Number: private static Number parseStringFormatNumber(String val){ try { return Integer.valueOf(val.substring(0, val.indexOf("."))); } catch (NumberFormatException e) { try { return Float.valueOf(val.substring(0, val.indexOf("."))); } catch (NumberFormatException e2) { // handle invalid value (throw exception, return 0?) } } }
answers question: http://stackoverflow.com/q/21397850
has comment: http://stackoverflow.com/comment/32287877
has comment: http://stackoverflow.com/comment/32276428
type: Answer
has comment: http://stackoverflow.com/comment/32276295
upvote count: 1
has comment: http://stackoverflow.com/comment/32276088
score: 1
has comment: http://stackoverflow.com/comment/32276173
has comment: http://stackoverflow.com/comment/32276001

http://stackoverflow.com/comment/32437951
comment on: http://stackoverflow.com/q/21489779
score: 0
has text: Use `list` instead of `a` inside your method, although note that this is generally not a good idea as it could cause issues later, much better to return a new one.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21501328
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21501294
has comment: http://stackoverflow.com/comment/32658355
accepted answer of: http://stackoverflow.com/q/21501294
type: Answer
has body: In java all the built in exception are the child class of Exception. So if you create your own class that has a parent of Exception then you can use it as a new exception. public class MyException extends Exception { public MyException(String message) { super(message); } } So now all you gotta do is throw new MyException("blah blah blah"); where necessary.

http://stackoverflow.com/comment/32342961
type: QuestionComment
comment on: http://stackoverflow.com/q/21435403
score: 0
type: Comment
has text: As the exception said, you cannot edit views of another thread. You can put mp3 search in another thread and run view update in the main thread.

http://stackoverflow.com/a/21385052
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21384290
upvote count: 2
has body: The idea would be to use a comparator to compare each String (I removed the part which was using the Set) : public static void main(String [] args){ String [] names = { "0.0.1.1", "1.0.1.1", "0.0.1.2", "0.0.1.5", "0.0.1.11", "0.0.0.100", "0.0.0.256", "0.0.2.1", "0.0.1.68"}; String maxVersion = names[0]; for(int i = 1; i &lt; names.length; i++){ if(compare(maxVersion, names[i]) == 1) maxVersion = names[i]; } System.out.print(maxVersion); } static int compare(String a, String b){ String[] sA = a.split("\\."); String[] sB = b.split("\\."); for(int i = 0; i &lt; sA.length; i++){ int cmp = Integer.compare(Integer.parseInt(sB[i]), Integer.parseInt(sA[i])); if(cmp != 0) return cmp; } return 0; } Which outputs: "1.0.1.1" Note that this assume that each version number has the same length, but you can change this by checking both the length of the resulting arrays when splitting. i got another problem: i got some files next to the Version Folders, so i can't get the names List from File.list() You can provide a FileNameFilter with the listFiles method: File file = new File("/pathToVersionFolders"); File[] files = file.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return new File(dir, name).isDirectory(); } }); Now you have only the directories. If you want to get only the names, you can use list.
has comment: http://stackoverflow.com/comment/32252942
has comment: http://stackoverflow.com/comment/32252830
answers question: http://stackoverflow.com/q/21384290
has comment: http://stackoverflow.com/comment/32253035
has comment: http://stackoverflow.com/comment/32254810
has comment: http://stackoverflow.com/comment/32254722
has comment: http://stackoverflow.com/comment/32252749
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32253382
has comment: http://stackoverflow.com/comment/32254697
has comment: http://stackoverflow.com/comment/32253957

http://stackoverflow.com/a/21373975
answers question: http://stackoverflow.com/q/21373738
has body: import java.util.Scanner; public class Print { public static void main(String[] args) { int row,temp,c,n; Scanner s=new Scanner(System.in); n=s.nextInt(); temp = n; for ( row = 1 ; row &lt;= n ; row++ ) { for ( c = 1 ; c &lt; temp ; c++ ) System.out.print(" "); temp--; for ( c = 1 ; c &lt;= 2*row - 1 ; c++ ) System.out.print("*"); System.out.println(""); } } }
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32232916
downvote count: 0

http://stackoverflow.com/q/21353212
has answer: http://stackoverflow.com/a/21353492
tagged with: collision
has comment: http://stackoverflow.com/comment/32195270
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32195259
type: Question
tagged with: arraylist
score: 0
answer count: 1
has body: I have a problem with my code here. I want to make a game with thow ball on each side of screen, on ball being controlled by the user and the other one by the computer. Both ball shoot to each other, and if the bullets intersects one with another, i need to make something happen. I managed to do some thing here, and I have two class, one for the player bullets, and the other one for the enemies bullets, and the bullets are created trough arraylists. All works fin until now, but if I try ti make them collision with each other,it doesnt work at all. I've tried a lot of things but none of it worked, and I would really appreciate if someone could help me. That is the Player Projectile class: import java.awt.Rectangle; public class Projectiles { private int x, y, speedX; private boolean visible; private int width = 10; private int height = 10; private Rectangle r; public Projectiles(){ } public Projectiles(int startX, int startY) { x = startX; y = startY; speedX = 1; visible = true; r = new Rectangle(0, 0, 0, 0); } public void update(){ x += speedX; r.setBounds(x, y, width, height); if (x &gt; 800){ visible = false; r = null; } if (x &lt; 800){ checkCollision(); } } private void checkCollision() { } public int getX() { return x; } public int getY() { return y; } public int getSpeedX() { return speedX; } public boolean isVisible() { return visible; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void setSpeedX(int speedX) { this.speedX = speedX; } public void setVisible(boolean visible) { this.visible = visible; } public int getWidth() { return width; } public int getHeight() { return height; } public void setWidth(int width) { this.width = width; } public void setHeight(int height) { this.height = height; } public Rectangle getR() { return r; } public void setR(Rectangle r) { this.r = r; } } And this one is the Enemy_Projectile class: import java.awt.Rectangle; public class Enemy_Projectiles { private int x, y, speedX; private boo…
has title: How to handle the collision between two arraylist objects?
has comment: http://stackoverflow.com/comment/32195453

http://stackoverflow.com/comment/32446775
has text: @twirlobite: we're talking *interface*, and so you **implement**, and myself, I'd implement MutableTreeNode or extend DefaultMutableTreeNode.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21494361
type: Comment

http://stackoverflow.com/comment/32351845
comment on: http://stackoverflow.com/a/21441224
has text: I'll take iterative approach, if not regex.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32279959
has text: Isn't that Java code? I'm asking how to access the Object in JavaScript after it was stringified and sent. Sorry if that wasn't clear in my question.
comment on: http://stackoverflow.com/a/21400375
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21487381
has body: Type which findjobj in your command window. It will likely return "'findjobj' not found." The function findjobj is not a built-in function. It is user-contributed function available on the Mathworks File Exchange: FindJObj - find java handles of Matlab graphic objects.
has comment: http://stackoverflow.com/comment/32695719
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/21487259
has comment: http://stackoverflow.com/comment/32433486
answers question: http://stackoverflow.com/q/21487259

http://stackoverflow.com/comment/32413468
type: AnswerComment
comment on: http://stackoverflow.com/a/21475929
type: Comment
has text: findViewById is a method of Activity, not of Context. if you are calling ShowToast from an Activity and passing "this" as argument, you can cast context to activity: ((Activity)context).findViewById
score: 1

http://stackoverflow.com/comment/32302118
type: AnswerComment
type: Comment
has text: I use myfile.toString(); and it works see my new methos i get nullPointerException : http://s22.postimg.org/5hhv07c01/classes.jpg this my 2 classes @Mohammad S.
comment on: http://stackoverflow.com/a/21385613
score: 0

http://stackoverflow.com/comment/32342738
score: 0
type: AnswerComment
has text: i understand my mistakes now thanks for the help. i just started learning programming so i think i still have a lot to learn. thanks for the help. I can finally move on to do the other programming for my project
type: Comment
comment on: http://stackoverflow.com/a/21436233

http://stackoverflow.com/comment/32481110
type: Comment
comment on: http://stackoverflow.com/a/21513900
has text: Well but Yes it does. Thanks again. I temporarily fixed it first with adding a small timer to the loop but this is more subtle and efficient solution by far.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32466087
type: Comment
type: QuestionComment
has text: `if(f1.getSpecies()=="Sunfish")` This is going to cause other problems. Please read [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
score: 0
comment on: http://stackoverflow.com/q/21505312

http://stackoverflow.com/comment/32312043
has text: Thanks, I saw that shortly after posting. The only problem is that my final linked list is "c:a:d:m:x:null". The first 'c' doesn't seemed to be affected by the sort.
comment on: http://stackoverflow.com/a/21418550
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21421523
has title: How to get one thread to wait for another thread?
type: Question
has comment: http://stackoverflow.com/comment/32317475
has answer: http://stackoverflow.com/a/21421663
has comment: http://stackoverflow.com/comment/32317411
score: 0
has comment: http://stackoverflow.com/comment/32317156
answer count: 3
has comment: http://stackoverflow.com/comment/32318139
has comment: http://stackoverflow.com/comment/32317370
has comment: http://stackoverflow.com/comment/32317425
tagged with: synchronization
has answer: http://stackoverflow.com/a/21421591
has comment: http://stackoverflow.com/comment/32318282
accepted answer: http://stackoverflow.com/a/21421591
has body: I have two threads: C and D. If I want thread C to execute first, then thread D, that is what I must do: This is code for class ThreadC: public class ThreadC implements Runnable { int isi[] = new int[100]; public void run () { for (int i = 0;i &lt; isi.length; i++) { isi[i] = i; System.out.print(isi[i] + " "); } } } This is code for class ThreadD: public class ThreadD implements Runnable { int temp=0; public void run () { for(int i = 0; i &lt; 1000; i++) temp += i; System.out.println("nilai temp : " + temp); } } This is the main method: public class main { public static void main (String[] args) { ThreadC tc = new ThreadC(); Thread t1 = new Thread(tc); t1.start(); ThreadD td = new ThreadD(); Thread t2 = new Thread(td); t2.start(); } } EDIT: I actually have the problem, that I have class. First I call ThreadC. I want thread C is completed execute then thread under for will be executed. Then I call ThreadD. It is like the code below: for (int j = 0; j &lt; idW.length; j++) { webtext = d.getWebText(idW[j]); ThreadPrepo tpo = new ThreadPrepo(webtext, host[j%jumhost], "server", 1099, idW[j]); Thread t1 = new Thread(tpo); t1.start(); } ThreadD td = new ThreadD; Thread t2 = new Thread(t2); t2.start(); So ThreadD t2 will executed after thread t1 complete executed, so Thread t2 must wait until t1 hash finished. How can I solve that?
has comment: http://stackoverflow.com/comment/32317355
possible better answer: http://stackoverflow.com/a/21421663
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21421735
tagged with: multithreading

http://stackoverflow.com/q/21439355
has title: Are wait() and notify() unreliable despite of synchronized?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21439555
tagged with: java
linked to: http://stackoverflow.com/q/21633246
has comment: http://stackoverflow.com/comment/32353682
has body: I recently discovered that using synchronized won't prevent any dead locks. E.g. within this code: ArrayList &lt;Job&gt; task; ... public void do(Job job){ synchronized(tasks){ tasks.add(job); } synchronized(this){ notify(); } } public void run(){ while(true){ for (int = 0;i&lt;tasks.size();i++){ synchronized(tasks){ Job job = tasks.get(i); } //do some job here... } synchronized(this){ wait(); //lock will be lost... notifier = false; //lock will be acquired again after notify() } } } Now, what is the problem? Well, if the running thread isn't waiting, he won't see any notifications (i.e. notify() calls), therefore he may run into a dead lock and not handle the tasks he received! (Or he may handle them too late...) Therefore I implemented this code: private volatile boolean notifier = false; ArrayList &lt;Job&gt; task; ... public void do(Job job){ synchronized(tasks){ tasks.add(job); } synchronized(this){ notifier = true; notify(); } } public void run(){ while(true){ for (int = 0;i&lt;tasks.size();i++){ synchronized(tasks){ Job job = tasks.get(i); } //do some job here... } synchronized(this){ if(!notifier){ wait(); //lock will be lost... notifier = false; //lock will be acquired again after notify() } } } } Is this correct or am I missing something? And can it be done easier?
type: Question
has answer: http://stackoverflow.com/a/21443615
tagged with: wait
tagged with: notify
tagged with: synchronized
has comment: http://stackoverflow.com/comment/32348573
has comment: http://stackoverflow.com/comment/32695410
score: 0
accepted answer: http://stackoverflow.com/a/21439555
answer count: 3
has answer: http://stackoverflow.com/a/21439744
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32348317
possible better answer: http://stackoverflow.com/a/21439744
has comment: http://stackoverflow.com/comment/32693532
has comment: http://stackoverflow.com/comment/32695496

http://stackoverflow.com/comment/32439389
comment on: http://stackoverflow.com/q/21490521
has text: that's a strange error. have you tried running with debug output turned on (`-X`)? what was the outcome?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32219517
comment on: http://stackoverflow.com/a/21357600
has text: The `getUser()` method annotated with `@SMDMethod` is not invoked. When I add `"root", "user"` to the list of parameters - `param`, the `getUser()` method is invoked but the response is empty then.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21358637
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21358551
type: Answer
upvote count: 1
has body: Never try to optimise your code in such ways if you're not having a specific problem with efficiency. Like Pshemo said: premature optimisation is the root of all evil. The only real difference I see between the two, is that the second one is one line longer and therefore less readable. Also, if anything, I'd say in the second case the variable is declared in a higher scope, which I think is actually a bad thing. Typically, you want to have variables declared in the scope that they are used in, nested as deep as possible and as such have the shortest possible lifespan.

http://stackoverflow.com/a/21413831
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32324908
has comment: http://stackoverflow.com/comment/32303639
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32303847
has body: You must define your function to return jobject. Use this example to create in C a new instance of Java object, populate it, and return to Java.
answers question: http://stackoverflow.com/q/21413158

http://stackoverflow.com/comment/32285038
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21402754
has text: please look at the java code. Is that correct? i think i have made some mistake in the scrollview method
score: 0

http://stackoverflow.com/q/21505370
has comment: http://stackoverflow.com/comment/32466018
type: UnansweredQuestion
tagged with: multithreading
downvote count: 1
has answer: http://stackoverflow.com/a/21505416
has body: I'm inexperienced in using threads and I wanted to check if I understand their implementation in Java and other programming languages well enough. Is the fact that a class is called thread misleading? I understand threads as an abstract concept which is a set of steps done by the processor that have an order and a meaning. A java thread object however(as well as classes and structs form other programming languages) does not represent a thread entirely, as it passes control to monitors and does not execute the whole abstract thread. Am I correct? Or am I understanding threads incorrectly? (Obviously, I've read several definitions along the way including wikipedia but I'm still uncertain) Also, are OS system processes(although implemented in C structs) similar to Java threads?
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
answer count: 2
upvote count: 0
favorite count: 0
tagged with: operating-system
has title: Java thread concept
score: -1
has answer: http://stackoverflow.com/a/21505459

http://stackoverflow.com/a/21436645
upvote count: 1
has comment: http://stackoverflow.com/comment/32346430
has comment: http://stackoverflow.com/comment/32346233
type: Answer
has comment: http://stackoverflow.com/comment/32346626
downvote count: 0
has comment: http://stackoverflow.com/comment/32345605
answers question: http://stackoverflow.com/q/21436231
has body: Try calling MainModelDAOobject.flush() after saving the value, but before reading the ID. See this answer for an explanation. Edit: try manually saving newAm by adding a new line: mm.addAssociated(newAm); // Existing line newAm = MainModelDAOobject.save(newAm); // New line MainModelDAOobject.save(mm); // Existing line
score: 1
has comment: http://stackoverflow.com/comment/32344100
has comment: http://stackoverflow.com/comment/32345752

http://stackoverflow.com/comment/32197705
type: Comment
has text: so you telling me to put `imageview.recycle();` before the end of return statement ?
type: QuestionComment
comment on: http://stackoverflow.com/q/21354501
score: 0

http://stackoverflow.com/a/21419327
upvote count: 1
answers question: http://stackoverflow.com/q/21419279
has comment: http://stackoverflow.com/comment/32313713
has comment: http://stackoverflow.com/comment/32314391
has body: You can use addAll list2.addAll(list1);
downvote count: 0
has comment: http://stackoverflow.com/comment/32313855
type: Answer
has comment: http://stackoverflow.com/comment/32314039
score: 1

http://stackoverflow.com/a/21400499
score: 0
type: Answer
has body: You have to use java.awt.Container, because JFrame is not a direct subclass of JComponent! So it should work with the following code: package CustomComponents; import java.awt.Container; import java.awt.Dimension; public class CSize { public static void setDefiniteSize(Container c, int h, int w) { Dimension k = new Dimension (h, w); c.setMaximumSize(k); c.setMinimumSize(k); c.setPreferredSize(k); } } Look at the hierarchy of the components: java.awt.Component |--java.awt.Container |--java.awt.Window | |--java.awt.Frame | |--javax.swing.JFrame |--javax.swing.JComponent |--javax.swing.JLabel Even better would be using java.awt.Component, since this class is defining all methods you want to use (setMinimumSize, setMaximumSize and setPreferredSize).
has comment: http://stackoverflow.com/comment/32281952
accepted answer of: http://stackoverflow.com/q/21400129
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21400129

http://stackoverflow.com/a/21437336
upvote count: 2
has comment: http://stackoverflow.com/comment/32359478
has comment: http://stackoverflow.com/comment/32477534
answers question: http://stackoverflow.com/q/21437181
score: 2
has body: It looks like it uses ThumbnailAction instead which extends AbstractAction (at the very bottom of the code). Swing components can use Actions instead of ActionListeners. The advantage of Actions is that buttons can share an Action and they will automatically use the same key-bindings etc. http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html EDIT: I have added some code demonstrating that you do not need to explicitly repaint(). Give it a try. public static void main(String args[]) { JFrame frame = new JFrame(); frame.setSize(200, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new GridLayout(2, 1)); final JLabel iconLabel = new JLabel(); JButton button = new JButton("Put Image"); button.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { try { iconLabel.setIcon(new ImageIcon(ImageIO.read(fc.getSelectedFile()))); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); panel.add(iconLabel); panel.add(button); frame.add(panel); frame.setVisible(true); } EDIT 2 (There is no Edit 2) EDIT 3: Try this public class MyActionListener implements ActionListener { private JPanel imagePanel; private Image image; public MyActionListener(JPanel imagePanel, Image image) { this.imagePanel = imagePanel; this.image = image; } @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Clicked"); imagePanel.removeAll(); imagePanel.add(image); //Needs Fixing imagePanel.revalidate(); } }
accepted answer of: http://stackoverflow.com/q/21437181
has comment: http://stackoverflow.com/comment/32359252
has comment: http://stackoverflow.com/comment/32392844
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32486821
has comment: http://stackoverflow.com/comment/32484044
type: Answer
has comment: http://stackoverflow.com/comment/32392089
has comment: http://stackoverflow.com/comment/32394358
has comment: http://stackoverflow.com/comment/32486350
has comment: http://stackoverflow.com/comment/32391964
has comment: http://stackoverflow.com/comment/32384444

oop
tags question: http://stackoverflow.com/q/21392235
tags question: http://stackoverflow.com/q/21428595
tags question: http://stackoverflow.com/q/21501330
tags question: http://stackoverflow.com/q/21445624
tags question: http://stackoverflow.com/q/21501384
tags question: http://stackoverflow.com/q/21498951
tags question: http://stackoverflow.com/q/21457265
tag name: oop
tags question: http://stackoverflow.com/q/21414662
tags question: http://stackoverflow.com/q/21444717
tags question: http://stackoverflow.com/q/21498631
tags question: http://stackoverflow.com/q/21390823
tags question: http://stackoverflow.com/q/21481345
tags question: http://stackoverflow.com/q/21392717
tags question: http://stackoverflow.com/q/21462099
tags question: http://stackoverflow.com/q/21388479
tags question: http://stackoverflow.com/q/21446846
tags question: http://stackoverflow.com/q/21401103
tags question: http://stackoverflow.com/q/21506587
type: Tag
tags question: http://stackoverflow.com/q/21507899

http://stackoverflow.com/comment/32417102
comment on: http://stackoverflow.com/q/21478200
score: 0
has text: Try to move button/image to onCreate. My guess would be that there is no view at the moment when you define button/image
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32411589
type: QuestionComment
score: 1
has text: I don't think that the varchars are the cause of the performance problems. But using uuid types give 10% to 30% more performance. And now my task is to find out how to use uuid type at all supported databases
comment on: http://stackoverflow.com/q/21460074
type: Comment

http://stackoverflow.com/comment/32419219
has text: you must know that when we're talking about floating point numbers, 0.13 is not 0.130000000000000000000000000 and 0.21 is not 0.2100000000000000000000000000
comment on: http://stackoverflow.com/q/21479507
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32428801
has text: Why is this an improvement, isn't a() a completely seperate function from whatever you're passing to it? In that it prints a new line, which seems to be what you want
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21484584
score: 0

http://stackoverflow.com/a/21498278
answers question: http://stackoverflow.com/q/21483272
score: 3
has comment: http://stackoverflow.com/comment/32456432
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21483272
has body: You are encoding and decoding to Base64 in your Java code, but your PHP code does not seem to perform any encoding/decoding whatsoever. This seems to be confirmed by what you posted on Pastebin. If you want to use strings instead of bytes - bytes are the only input accepted by modern ciphers - then you should make sure that the (character) encoding is correct on both sides. If you just want to use bytes, don't decode the binary in Java - the input is already in bytes, not text.

http://stackoverflow.com/a/21512105
type: Answer
has comment: http://stackoverflow.com/comment/32478722
accepted answer of: http://stackoverflow.com/q/21511954
has body: Your network needs to have a state, using one or several instance field(s). As is, it doesn't have any state. Each method creates a local variable of type List or Map, adds something to this List or Map, and returns. So the List or Map directly goes out of scope and is garbage collected. private Map&lt;String, List&lt;String&gt;&gt; stations = new HashMap&lt;&gt;(); // now all your methods should use the above map. See http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html
answers question: http://stackoverflow.com/q/21511954
has comment: http://stackoverflow.com/comment/32478603
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/21472821
has comment: http://stackoverflow.com/comment/32408399
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21472762
has comment: http://stackoverflow.com/comment/32408375
has body: @SuppressLint("UseValueOf") final Handler handler = new Handler(); handler.post(new Runnable() { @Override public void run() { // change your text here if (condition) { i++; txt_TimeRecord.setText("" + i); } else { i = 0; } handler.postDelayed(this, 1 * 1000L); } }); [Formatted the code properly]

http://stackoverflow.com/comment/32206275
type: AnswerComment
type: Comment
has text: Both bugs threw off my answer. Thanks a bunch!
comment on: http://stackoverflow.com/a/21359252
score: 0

http://stackoverflow.com/q/21359649
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/21359681
has comment: http://stackoverflow.com/comment/32206999
has body: I have a problem with eclipse. I am trying to make a program that generate random pizza toppings Five in total. All of them are put in 4 different arrays. I try to put in a array list and then to send through a button in a JtexArea. In a console program variant i randomised the arrays and send first element with sysout. It works. Now i try to make work with a desktop GUI package nzk.nazakthul.pizza; import java.util.*; public class TopinguriClass { // Arrays String[] salami = { "muschi", "bacon", "salam de vara", "salam de sibiu","sunca presata", "salam corizo" }; // arraylist List&lt;String&gt; list = new ArrayList&lt;String&gt;(); } if i put the next code after list object i get 2 errors. one says i need to have a } that closes the class and the other says that expect something after ; on the ArrayList line for (String x:salami) list.add(x); am i missing something? I have written already the code for GUI If there is a possibility to send an array directly to a text area would be ok.
tagged with: swing
has title: Eclipse error message ArrayList()
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21359681
has answer: http://stackoverflow.com/a/21359711
tagged with: eclipse
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21359711
tagged with: arrays

http://stackoverflow.com/comment/32476021
has text: Try adding permitAll() to formLogin(),that usually happens when the login page itself is protected, I have updated my post
type: AnswerComment
comment on: http://stackoverflow.com/a/21504449
score: 0
type: Comment

http://stackoverflow.com/q/21371626
type: Question
has comment: http://stackoverflow.com/comment/32228681
accepted answer: http://stackoverflow.com/a/21371697
has comment: http://stackoverflow.com/comment/32228769
tagged with: hashset
has body: I have a class which is a Set and I override .equals() to check if the sets are equal element-wise. How do I override HashCode since from what I've seen there is some interdependence between the two public class ASet{ Set g=new Set(); public boolean equals(Object s1) { Set S= (Set)s1; for(Object o : S.getcontents()) { for(Object r : g.getcontents()) { if(!o.equals(r)) { return false; } } } return true; } public int hashCode() { ????????? }
has comment: http://stackoverflow.com/comment/32228734
has comment: http://stackoverflow.com/comment/32228597
has comment: http://stackoverflow.com/comment/32228957
has comment: http://stackoverflow.com/comment/32228665
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32228596
has comment: http://stackoverflow.com/comment/32228615
favorite count: 0
tagged with: equals
has comment: http://stackoverflow.com/comment/32228620
type: AnsweredQuestion
has title: Overriding HashCode
has comment: http://stackoverflow.com/comment/32228582
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21371697
upvote count: 1

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/21489460
tags question: http://stackoverflow.com/q/21356378
tags question: http://stackoverflow.com/q/21357638
tags question: http://stackoverflow.com/q/21365400
tags question: http://stackoverflow.com/q/21467787
tags question: http://stackoverflow.com/q/21431856
tag name: android-actionbar

http://stackoverflow.com/comment/32288703
type: AnswerComment
has text: @mungaialex Odd... Can you post the stack trace?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21405431

http://stackoverflow.com/q/21499401
has comment: http://stackoverflow.com/comment/32455328
has comment: http://stackoverflow.com/comment/32455683
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21499470
has comment: http://stackoverflow.com/comment/32455731
linked to: http://stackoverflow.com/q/21200421
linked to: http://stackoverflow.com/q/2148679
duplicate of: http://stackoverflow.com/q/2148679
type: AnsweredQuestion
has body: I have to resolve this task for my college... I need to create one new class (with one new method, just to show I know how to do it) which extends swt class which is final (so it can't be extended in a classic way with extend keyword..). I have been told I can write wrapper class and instantiate final class object inside it. But what then? I would be really thankful if someone can show me some example of this kind of extending (with some final class, new class and using method of new class which extends final class), because I have no idea how to do it.
tagged with: swt
type: Question
has answer: http://stackoverflow.com/a/21499470
tagged with: java
has comment: http://stackoverflow.com/comment/32454975
has title: Java - How to extend final swt class? How to create wrapper class?

http://stackoverflow.com/q/21455699
has body: I executing below code but some times i got java.util.ConcurrentModificationException exception..But some times working fine.please let me know where i did wrong code.Below is my code please check my logic also if there is any better way then let me know. public String saveSkills(HttpServletRequest request,@RequestParam String skills,@RequestParam String Email) throws IOException { Domain domain1 = (Domain)request.getSession().getAttribute("Domain"); Long domanId =domain1.getDomainId(); System.out.println(skills); String[] skillsParts = skills.split(","); UserProfile user = userProfileManager.getUserByEmail(domain1.getPrimary_Domain_Id(), Email); if(user.getSkillsList().size()&gt;0){ Iterator it = user.getSkillsList().iterator(); while (it.hasNext()) { Skills skillsitereator = (Skills) it.next(); int count=0; for(int i =0;i&lt;skillsParts.length;i++){ if((skillsParts)[i].equals(skillsitereator.getSkillName())){ break; }else{ count++; } } if(count == skillsParts.length){ it.remove(); userProfileManager.update(user); } } }else{ for(int i =0;i&lt;skillsParts.length;i++){ Skills skillObj = new Skills(); skillObj.setSkillName(skillsParts[i]); user.getSkillsList().add(skillObj); } userProfileManager.update(user); } skillsParts = skills.split(","); System.out.println(skillsParts); ArrayList&lt;Integer&gt; values =new ArrayList&lt;Integer&gt;(); for(int i =0;i&lt;skillsParts.length;i++){ Iterator it = user.getSkillsList().iterator(); while (it.hasNext()) { Skills skillsitereator = (Skills) it.next(); if((skillsParts)[i].trim().equals(skillsitereator.getSkillName().trim())){ break; } else{ Skills skillObj = new Skills(); skillObj.setSkillName(skillsParts[i]); user.getSkillsList().add(skillObj); userProfileManager.update(user); } } } Gson gson = new Gson(); return gson.toJson(user); }
has answer: http://stackoverflow.com/a/21455762
tagged with: concurrency
has comment: http://stackoverflow.com/comment/32377252
answer count: 2
has title: Some times java.util.ConcurrentModificationException thrown
downvote count: 1
favorite count: 0
tagged with: exception
tagged with: spring
upvote count: 4
has answer: http://stackoverflow.com/a/21455866
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1196586
tagged with: java
accepted answer: http://stackoverflow.com/a/21455762
possible better answer: http://stackoverflow.com/a/21455866
type: Question
score: 3

http://stackoverflow.com/a/21376116
upvote count: 1
has body: Looking at your code and your marker, the NullPointerException occurs because you're passing in a null in the place of a required parameter. getLoaderManager().initLoader(1,null,null); //here is the error According to the LoaderManager Docs the callback is required: Parameters id A unique identifier for this loader. Can be whatever you want. Identifiers re scoped to a particular LoaderManager instance. args Optional arguments to supply to the loader at construction. If a loader already exists (a new one does not need to be created), this parameter will be ignored and the last arguments continue to be used. callback Interface the LoaderManager will call to report about changes in the state of the loader. Required. It looks like you're already implementing LoaderCallbacks, you just have to pass your implementation to the initLoader method: getLoaderManager().initLoader(1,null,this);
has comment: http://stackoverflow.com/comment/32236905
has comment: http://stackoverflow.com/comment/32236601
answers question: http://stackoverflow.com/q/21375379
accepted answer of: http://stackoverflow.com/q/21375379
has comment: http://stackoverflow.com/comment/32236713
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/32259247
has text: Then the problem is stupid. I'm sorry but it really is, they are the tools provided to solve exactly this problem and you would NEVER in a real world be asked to do anything like this without using them.
type: AnswerComment
comment on: http://stackoverflow.com/a/21388654
type: Comment
score: 1

http://stackoverflow.com/comment/32335740
comment on: http://stackoverflow.com/q/21432493
has text: I'd choose a JSON parser over a RegExp solution. Either Gson or Jackson are great!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/56887640
has body: I have spent quite some time trying to simulate a click with the control key pressed with the webdriver for Chrome. After some investigation it appeared, that when you generate a click on an OPTION element of a multiselect, no click actually happens. Instead, a change event is genetared in the browser. This leads to the situation, where subsequent "clicks" on other options of the multiselect do not clear the previously selected options, which is sometimes unwanted behavior. To solve this I have come up with the following solution: Actions actions = new Actions(driver); if(controlNeeded) actions.keyDown(Keys.CONTROL); actions.moveToElement((WebElement) option_you_want_to_click); actions.clickAndHold(); actions.pause(100); actions.release(); if(controlNeeded) actions.keyUp(Keys.CONTROL); actions.build().perform(); This way you can select both single and multiple elements depending on the Ctrl key.
downvote count: 0
answers question: http://stackoverflow.com/q/21421790
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32204127
comment on: http://stackoverflow.com/a/21358123
type: AnswerComment
score: 0
type: Comment
has text: Please if you write a full code for him, do not keep a O(n²) algorithm.

http://stackoverflow.com/a/21464706
has body: Instead of passing the data containing cursor into GasCursorAdapter constructor try to use swapCursor method of your adapter after attaching it to the ListView. Anyway, the better way is to use the CursorLoader class because it provides you loading from data source outside UI thread. Yeah, you should implement your own ContentProvider for this, but you can just extend the AsyncTaskLoader class and implement there direct retrieving data using MySQLiteHelper
score: 0
answers question: http://stackoverflow.com/q/21463777
type: Answer

http://stackoverflow.com/comment/32475298
has text: """There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."""
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21505522
type: Comment

http://stackoverflow.com/a/21462783
has body: Please create an index on the equipment node's property for name. CREATE INDEX ON :Equipment(name) Then please try the following optimized query. MATCH (n:Equipment { name: "name" }), (n)&lt;-[IS_INSIDE*]-(x), (x)&lt;-[CONNECTED_TO*]-(m:Cable) RETURN m Note that this is an equivalent match to the one you've specified but it chunks it up into triples which causes the query execution plan on Neo4j to first match the n:Equipment node on the property name, instead of doing a graph global match operation. From the reduced set of n:Equipment nodes the following match statements will more performantly scan the variable length patterns of IS_INSIDE and CONNECTED_TO.
answers question: http://stackoverflow.com/q/21452088
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33033011
upvote count: 1
type: Answer

http://stackoverflow.com/a/21382273
has body: Just String-playing... String in = "magnum-opus.txt: File(\"/magnum-opus.txt\", iconName=\"page_white_text\", mightHaveThumbnail=false, numBytes=17734, humanSize=\"17.3 KB\", lastModified=\"2014/01/27 05:19:30 UTC\", clientMtime=\"2014/01/27 05:19:30 UTC\", rev=\"11e6c9e5e\")"; String insideParenth = in.substring(in.indexOf("(")+1, in.length()-1); StringTokenizer tokenizer = new StringTokenizer(insideParenth, ", "); while (tokenizer.hasMoreTokens()) { Map&lt;String,String&gt; properties = new HashMap&lt;String,String&gt;(); String token = tokenizer.nextToken(); if(token.contains("=")){ token = token.replaceAll("\"", ""); String left= token.substring(0, token.indexOf("=")); String right=token.substring(token.indexOf("=")+1); properties.put(left,right ); System.out.println("left:["+left+"] and right=[" + right + "]"); } } Output is: left:[iconName] and right=[page_white_text] left:[mightHaveThumbnail] and right=[false] left:[numBytes] and right=[17734] left:[humanSize] and right=[17.3] left:[lastModified] and right=[2014/01/27] left:[clientMtime] and right=[2014/01/27] left:[rev] and right=[11e6c9e5e] EDIT: String titleWithPath, titleWithoutPath; insideParenth = in.substring(in.indexOf("(")+1, in.length()-1); titleWithPath = insideParenth.substring(insideParenth.indexOf("\"")+1, insideParenth.indexOf(",")‌​-1); System.out.println(titleWithPath); //Prints out: "/magnum-opus.txt" String titleWithoutPath = insideParenth.substring(insideParenth.indexOf("/")+1, insideParenth.indexOf(",")-1 ); System.out.println(titleWithoutPath); //Prints out: "magnum-opus.txt"
has comment: http://stackoverflow.com/comment/32247881
has comment: http://stackoverflow.com/comment/32270783
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21381751
has comment: http://stackoverflow.com/comment/32251525
upvote count: 1

http://stackoverflow.com/a/21464196
accepted answer of: http://stackoverflow.com/q/21428295
has comment: http://stackoverflow.com/comment/32414461
answers question: http://stackoverflow.com/q/21428295
score: 0
type: AcceptedAnswer
type: Answer
has body: Alright, I found a workaround. It's not really a solution that fixes the problem, but rather something that avoids it. Your problem seems to be caused by a delay that occurs when expanding the ExpandItem. Consequently, your code updating the minSize uses the unexpanded size. Adding a delay before setting the minSize solves your issue. Try playing around with the delay value, but 300ms seems to be working just fine and doesn't really interfere with usability: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); new ExpandBarExample(shell); shell.setMaximized(true); shell.setLayout(new FillLayout()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } private ExpandBar bar; private ScrolledComposite scroll; private Composite composite; private SashForm sash; private CTabFolder folder; private Button button; public ExpandBarExample(Composite composite) { this.composite = composite; init(); } public void init() { composite.setLayout(new FillLayout()); sash = new SashForm(composite, SWT.VERTICAL); folder = new CTabFolder(sash, SWT.None); scroll = new ScrolledComposite(folder, SWT.V_SCROLL); GridData data = new GridData(); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; bar = new ExpandBar(scroll, SWT.NONE); scroll.setContent(bar); scroll.setExpandVertical(true); scroll.setExpandHorizontal(true); scroll.setAlwaysShowScrollBars(true); CTabItem tab = new CTabItem(folder, SWT.None); tab.setControl(scroll); tab.setText("TEST"); Composite sashFill = new Composite(sash, SWT.BORDER); sashFill.setLayout(new FillLayout()); button = new Button(sashFill, SWT.PUSH); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event arg0) { Composite comp = new Composite(bar, SWT.BORDER); comp.setLayout(new GridLayout(2, false)); for (int a = 0; a &lt; 10; a++) { Label label = new Label(comp, SWT.BORDER); label.s…

http://stackoverflow.com/q/21373869
upvote count: 1
tagged with: parsing
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32232870
tagged with: compiler-construction
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: Parse Table Generator for Simple Precedence Parsing
type: Question
has body: I have been assigned a compiler project for a mini-Pascal language. The project enforce the use of 'Simple Precedence' as parsing algorithm but allows us to use parse table generator tools for creating the parse table. Does anyone now such a parse table generator? I have tried searching for one myself but haven't found anything useful yet. I am writing the program in Java so it would be best if the generator results were in Java, but C/C++ will also be useful. (I am in a bit of a hurry...) Thanks in advance.
has comment: http://stackoverflow.com/comment/32233289

http://stackoverflow.com/a/22248858
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35822198
type: Answer
has comment: http://stackoverflow.com/comment/52971591
accepted answer of: http://stackoverflow.com/q/21418892
upvote count: 26
has body: Since I wrote that one I guess I can explain best :-) int dv[]=new int[256*div]; for (i=0;i&lt;256*div;i++){ dv[i]=(i/div); } This line precalculates a lookup table for all the possible mean values that can occur. This is to avoid costly division in the inner loop. On some systems doing the division directly instead of a doing an array lookup might actually be faster nowadays, but when I wrote it the lookup was the faster way. for(i=-radius;i&lt;=radius;i++){ int ind = yi+Math.min(wm,Math.max(i,0)); p=pix[ind]; rsum+=(p &amp; 0xff0000)&gt;&gt;16; gsum+=(p &amp; 0x00ff00)&gt;&gt;8; bsum+= p &amp; 0x0000ff; } The reason why this algorithm is fast is that it uses a sliding window and thus reduces the number of required pixel lookups. The window slides from the left edge to the right (and in the second pass from top to bottom) and only adds one pixel at the right and removes one from the left. The code above initializes the window by prefilling the window with the leftmost edge pixel depending on the kernel size. if(y==0){ vmin[x]=Math.min(x+radius+1,wm); vmax[x]=Math.max(x-radius,0); } p1=pix[yw+vmin[x]]; p2=pix[yw+vmax[x]]; This is the part that adds a new pixel but at the same time handles the border conditions (when the window tries to read or remove pixels outside the bitmap). rsum+=((p1 &amp; 0xff0000)-(p2 &amp; 0xff0000))&gt;&gt;16; gsum+=((p1 &amp; 0x00ff00)-(p2 &amp; 0x00ff00))&gt;&gt;8; bsum+= (p1 &amp; 0x0000ff)-(p2 &amp; 0x0000ff); rsum, gsum and bsum is the accumulated sum of pixels inside the sliding window. What you see is the new pixel on the right side being added to the sum and the leftmost pixel i nthe window being removed from the sum.
answers question: http://stackoverflow.com/q/21418892
score: 26
has comment: http://stackoverflow.com/comment/53451558

http://stackoverflow.com/comment/32362618
score: 1
comment on: http://stackoverflow.com/q/21446846
type: Comment
type: QuestionComment
has text: It seems better to not refer to a hardcoded, static field for this. Use an instance variable, perhaps defaulting to `/my/path/to/file` if another value isn't supplied, and offer constructors that let subclasses set a different value.

http://stackoverflow.com/q/21364204
has body: Blank database. If I enter a username example1 it will add to the database. Then if I try and re-add it again it will be stopped by my code as it already in the database. Then if I enter example2 and add it it will go into the database and then if I try and re-add it my code lets it go through the only thing that stops it is the database primary key: I believe this line to be the issue: PreparedStatement st = connection.prepareStatement("select * from Members order by username asc"); Here is the whole method: public static boolean CheckUsernameExists(String username){ boolean usernameExists = false; try{ Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection(urlDB, usernameDB, passwordDB); PreparedStatement st = connection.prepareStatement("select * from Members order by username asc"); ResultSet r1=st.executeQuery(); String usernameCounter; if(r1.next()){ usernameCounter = r1.getString("username"); if(usernameCounter.equals(username)){ System.out.println(username); usernameExists = true; } } } catch (SQLException e) { System.out.println("SQL Exception: "+ e.toString()); }catch (ClassNotFoundException cE){ System.out.println("Class Not Found Exception: "+ cE.toString()); } return usernameExists; }
possible better answer: http://stackoverflow.com/a/21364486
answer count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/32214772
has title: Java SQL Unique username
type: Question
has comment: http://stackoverflow.com/comment/32214904
has comment: http://stackoverflow.com/comment/32215239
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: database
tagged with: mysql
has answer: http://stackoverflow.com/a/21364486
has comment: http://stackoverflow.com/comment/32214921
upvote count: 1
has answer: http://stackoverflow.com/a/21364456
accepted answer: http://stackoverflow.com/a/21364456
favorite count: 0
has answer: http://stackoverflow.com/a/21364725
has comment: http://stackoverflow.com/comment/32215152
has answer: http://stackoverflow.com/a/21364321
has comment: http://stackoverflow.com/comment/32215188

http://stackoverflow.com/comment/32351817
comment on: http://stackoverflow.com/q/21441026
type: QuestionComment
type: Comment
score: 2
has text: Suggest you start with some basic reading on FFT's then.

android-launcher
tags question: http://stackoverflow.com/q/21485290
tag name: android-launcher
type: Tag

http://stackoverflow.com/a/21354783
has comment: http://stackoverflow.com/comment/32198195
downvote count: 0
has comment: http://stackoverflow.com/comment/32197968
upvote count: 2
has comment: http://stackoverflow.com/comment/32198166
has comment: http://stackoverflow.com/comment/32198280
answers question: http://stackoverflow.com/q/21354748
type: Answer
has comment: http://stackoverflow.com/comment/32198129
has body: What @Raghunandan said. Creating methods named the same as the classname (thus constructor) are apparently not necessarily illegal (warning, no error?), but can be very confusing. Try to come up with a more descriptive name of your method.
score: 2

http://stackoverflow.com/comment/32228447
type: QuestionComment
comment on: http://stackoverflow.com/q/21365508
has text: I'm going to assume, based on your comments, that you're doing something like `message.acknowledge()`, this method is actually misleading. Per the docs, this acknowledges everything within the session and not an individual message.
score: 0
type: Comment

http://stackoverflow.com/q/21434845
has comment: http://stackoverflow.com/comment/32340114
type: Question
has answer: http://stackoverflow.com/a/21435036
has answer: http://stackoverflow.com/a/21435059
has comment: http://stackoverflow.com/comment/32340160
favorite count: 0
has comment: http://stackoverflow.com/comment/32340048
downvote count: 1
has title: Do you save the garbage collector work by declaring in-method variables as attributes?
has comment: http://stackoverflow.com/comment/32340103
upvote count: 4
has answer: http://stackoverflow.com/a/21435076
has comment: http://stackoverflow.com/comment/32340244
possible better answer: http://stackoverflow.com/a/21435059
accepted answer: http://stackoverflow.com/a/21435009
has body: Compare public class Core { public int addToA(int a) { int b = a + 2; return b; } } To public class Core { int b; public int addToA(int a) { b = a + 2; return b; } } Assuming that the addToA method is called a lot do you save the garbage collector work (and speed up your program) by using the second one?
answer count: 4
type: AnsweredQuestion
score: 3
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/21435009
has comment: http://stackoverflow.com/comment/32340172
tagged with: memory

http://stackoverflow.com/comment/32365420
has text: @LouisWasserman Yeah, I realized such (as I edited my later comment) - care to expand on it in an answer?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21448328

http://stackoverflow.com/comment/32344803
type: Comment
comment on: http://stackoverflow.com/a/21437444
score: 0
type: AnswerComment
has text: what should I be annotating it with? it is simple POJO class . I have put up the class in the question to demonstrate .

http://stackoverflow.com/q/21481899
tagged with: udp
answer count: 1
has body: i am trying to make a TCP server In java that accepts 10 clients, each client should be treated on thread so no clients are waiting. Each thread will receive the client and make him wait for 5 minutes. here's my so far code; public class ThreadServer { static class ServerThread implements Runnable { Socket client = null; public ServerThread(Socket c) { this.client = c; } public void run() { try { System.out.println("Connected to client : "+client.getInetAddress().getHostName()); client.close(); } catch (Exception e) { System.err.println(e.getMessage()); } } } public static void main(String args[]) { try { ServerSocket server = new ServerSocket(8787); while (true) { Socket p = server.accept(); new Thread(new ServerThread(p)).start(); } } catch (Exception ex) { System.err.println("Error : " + ex.getMessage()); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32424667
tagged with: connection
has comment: http://stackoverflow.com/comment/32423589
has comment: http://stackoverflow.com/comment/32423716
tagged with: tcp
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32423475
has comment: http://stackoverflow.com/comment/32424035
type: Question
has title: Accepting Multiple Clients in Java TCP and make each client wait for 5 minutes
has answer: http://stackoverflow.com/a/21482284
has comment: http://stackoverflow.com/comment/32423321
tagged with: java
score: 0

http://stackoverflow.com/comment/32382798
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21458801
has text: int tmpX = ((spawnX.equals("smallX")) ? smallX : ((spawnX.equals("mediumX")) ? mediumX : largeX)); - I ended up with this, but it's not setting the variables correctly as they all spawn at the same X position. What am I doing wrong?
score: 0

junit
tags question: http://stackoverflow.com/q/21391990
tags question: http://stackoverflow.com/q/21422155
type: Tag
tags question: http://stackoverflow.com/q/21457829
tags question: http://stackoverflow.com/q/21399454
tags question: http://stackoverflow.com/q/21441551
tags question: http://stackoverflow.com/q/21406751
tags question: http://stackoverflow.com/q/21369953
tags question: http://stackoverflow.com/q/21497536
tags question: http://stackoverflow.com/q/21413174
tags question: http://stackoverflow.com/q/21465873
tags question: http://stackoverflow.com/q/21380064
tags question: http://stackoverflow.com/q/21482067
tags question: http://stackoverflow.com/q/21409230
tags question: http://stackoverflow.com/q/21410930
tags question: http://stackoverflow.com/q/21456800
tags question: http://stackoverflow.com/q/21368999
tag name: junit
tags question: http://stackoverflow.com/q/21478455
tags question: http://stackoverflow.com/q/21377236
tags question: http://stackoverflow.com/q/21414750
tags question: http://stackoverflow.com/q/21478692
tags question: http://stackoverflow.com/q/21511588
tags question: http://stackoverflow.com/q/21354311
tags question: http://stackoverflow.com/q/21398456
tags question: http://stackoverflow.com/q/21399975
tags question: http://stackoverflow.com/q/21513597
tags question: http://stackoverflow.com/q/21391189
tags question: http://stackoverflow.com/q/21443225
tags question: http://stackoverflow.com/q/21506079
tags question: http://stackoverflow.com/q/21397775
tags question: http://stackoverflow.com/q/21413738
tags question: http://stackoverflow.com/q/21433497
tags question: http://stackoverflow.com/q/21444848
tags question: http://stackoverflow.com/q/21354115
tags question: http://stackoverflow.com/q/21464967
tags question: http://stackoverflow.com/q/21432137
tags question: http://stackoverflow.com/q/21465140
tags question: http://stackoverflow.com/q/21461885
tags question: http://stackoverflow.com/q/21418265
tags question: http://stackoverflow.com/q/21492247
tags question: http://stackoverflow.com/q/21465388
tags question: http://stackoverflow.com/q/21401504
tags question: http://stackoverflow.com/q/21463557
tags question: http://stackoverflow.com/q/21432476
tags question: http://stackoverflow.com/q/21449399
tags question: http://stackoverflow.com/q/21388482
tags question: http://stackoverflow.com/q/21463331
tags question: http://stackoverflow.com/q/21464169
tags question: http://stackoverflow.com/q/21393430
tags question: http://stackoverflow.com/q/21463185
tags question: http://stackoverflow.com/q/21485436
tags question: http://stackoverflow.com/q/21509812

http://stackoverflow.com/comment/32289382
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21405606
has text: Added controller code. I am running this from eclipse and I use Tomcat 7.0. I am not using maven. I compile code from eclipse. Can you please let me know which jar file are you referring to?

http://stackoverflow.com/comment/32322972
comment on: http://stackoverflow.com/a/21425041
has text: the issue is how can I understand vertical or horiontal ? because I capture image to holding my phone vertical or horizontal the bitmap says always same values,
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21435250
has comment: http://stackoverflow.com/comment/32341410
downvote count: 0
has comment: http://stackoverflow.com/comment/32341467
has comment: http://stackoverflow.com/comment/32350748
has title: High GC load using Hibernate
has comment: http://stackoverflow.com/comment/32341492
favorite count: 0
has comment: http://stackoverflow.com/comment/32351489
type: UnansweredQuestion
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/32343043
tagged with: spring
has answer: http://stackoverflow.com/a/21435608
tagged with: spring-mvc
score: 1
has body: I have developed a web application using Spring MVC + Hibernate and when running load tests it seems the Garbage Collector is being called too often. I am afraid it might have to do with the way I manage Hibernates session. I have an AbstractDao which all of my DAO objects extends: public class AbstractDaoHibernateImpl { protected GenericDataBaseExceptionHandler exceptionHandler; private SessionFactory sessionFactory; public AbstractDaoHibernateImpl() { } public void setExceptionHandler(GenericDataBaseExceptionHandler exceptionHandler) { this.exceptionHandler = exceptionHandler; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } protected Session getSession() { return sessionFactory.getCurrentSession(); } } In spring entity bean configuration I define each of my DAOs like this: &lt;bean name="userDao" class="com.kelmer.dao.UserDaoImpl"&gt; &lt;property name="sessionFactory" ref="SessionFactory" /&gt; &lt;property name="exceptionHandler" ref="defaultSpringExceptionHandler" /&gt; &lt;/bean&gt; And then this is a sample method from one of my DAOs: @Override public EstacionVO findById(Long id) throws InstanceNotFoundException { User e = (User ) getSession().createQuery(SELECT_USER_BY_ID).setParameter("userId", id).uniqueResult(); if (e == null) { throw new InstanceNotFoundException ("No user with provided Id", User.class); } return e; } I honestly can see anything that might be causing a memory leak but then again I'm no real expert here. Am I doing session management right? I know I took the code from AbstractDao from some legacy code and I fear that's where the memory problem could be, since there is no explicit session closing or finalizing. PS. For transaction management, I am using &lt;tx:annotation-driven /&gt; in spring context and annotating each method with @Transactional.
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21435627
answer count: 2

http://stackoverflow.com/comment/42471502
type: QuestionComment
comment on: http://stackoverflow.com/q/21485590
score: 0
type: Comment
has text: possible duplicate of [The final local variable cannot be assigned](http://stackoverflow.com/questions/10166521/the-final-local-variable-cannot-be-assigned)

http://stackoverflow.com/comment/32205400
type: QuestionComment
comment on: http://stackoverflow.com/q/21358740
score: 0
has text: Avoid using raw types.
type: Comment

http://stackoverflow.com/comment/32250541
score: 0
has text: OK, if all your tasks have no more than 1 next task you can use a doubly linked list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21383403

http://stackoverflow.com/q/21352024
has answer: http://stackoverflow.com/a/21352041
accepted answer: http://stackoverflow.com/a/21352069
tagged with: java
has comment: http://stackoverflow.com/comment/32193126
answer count: 3
possible better answer: http://stackoverflow.com/a/21352041
has comment: http://stackoverflow.com/comment/32193050
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/32193163
has answer: http://stackoverflow.com/a/21352069
type: Question
score: 1
has comment: http://stackoverflow.com/comment/32193254
favorite count: 0
has title: Remove duplicates and keep ordering of unmodifiable class
has body: My problem is that I am given a List&lt;T&gt; from which I need to remove duplicates and also keep the ordering. I know I can use a HashSet to get rid of duplicates but it is based on hashcode and the class T does not implement it and I cannot modify it. And as I understand I will lose the ordering of my original list. How can I achieve this?
has answer: http://stackoverflow.com/a/21352579
has comment: http://stackoverflow.com/comment/32193045
upvote count: 1

http://stackoverflow.com/a/21372293
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21372256
upvote count: 5
type: Answer
downvote count: 0
has body: You have two problems: 1) Your if statements don't run because they end in semi-colon. This means the code in {} forms a block and runs either way. 2) Your breaks are in the wrong place. The first only breaks if 'R' (or 'r') is chosen. The later breaks if the case is run. if (reply == 'P' || reply == 'p'); { System.out.println("Computer: Paper. You tied!"); } if (reply == 'S' || reply == 's'); { System.out.println("Computer: Paper. You won!"); } if (reply == 'R' || reply == 'r'); { System.out.println("Computer: Paper. You lost!"); break; } vs if (reply == 'P' || reply == 'p') { System.out.println("Computer: Paper. You tied!"); } if (reply == 'S' || reply == 's') { System.out.println("Computer: Paper. You won!"); } if (reply == 'R' || reply == 'r') { System.out.println("Computer: Paper. You lost!"); } break; Also, as suggested in the comments, you can use a loop to prompt for input. For example: while (! done) { System.out.print("Rock(R) Paper(P) or Scissors(S)? (or Quit(Q) "); reply = myScanner.findWithinHorizon(".", 0).charAt(0); // more code here } You'll need another case here so you can set done to true and end the loop.
answers question: http://stackoverflow.com/q/21372256
has comment: http://stackoverflow.com/comment/32230145
score: 5

http://stackoverflow.com/a/21406773
has body: As stated in MiG Layout Quick Start Guide: Components that are alone in a cell can be aligned within that cell, if there is space left over. You can specify this in the column/row constraints to get a default align for the components and/or you can specify it in the component's constraints. For instance, the following code: JPanel panel = new JPanel(new MigLayout("fillx")); panel.add(new JLabel("Very long label:"), ""); panel.add(new JTextField(20), "wrap"); panel.add(new JLabel("Short 1:"), "right"); panel.add(new JTextField(20)); panel.add(new JLabel("Short 2:"), "right"); panel.add(new JTextField(10), "wrap"); Will produce this outcome: You can also define the component's alignment as a column constraint, if you know how many columns you will have. The following will produce the same outcome as previous one: JPanel panel = new JPanel(new MigLayout("fillx","[right][][][]")); panel.add(new JLabel("Very long label:"), ""); panel.add(new JTextField(20), "wrap"); panel.add(new JLabel("Short 1:"), ""); panel.add(new JTextField(20)); panel.add(new JLabel("Short 2:"), ""); panel.add(new JTextField(10), "");
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21405916
score: 3
accepted answer of: http://stackoverflow.com/q/21405916
upvote count: 3

http://stackoverflow.com/q/21391557
answer count: 2
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/32265184
has answer: http://stackoverflow.com/a/21393738
has answer: http://stackoverflow.com/a/21393390
has comment: http://stackoverflow.com/comment/32267597
accepted answer: http://stackoverflow.com/a/21393738
has body: I want to create a custom JPanel to allow my user to select one of 4 corners. I have done this by using 4 JRadioButtons and placing a TitledBorder on the panel. I would like the panel to always be as small as possible for a neat and clean look to the panel. I thought this was possible since layouts are supposed to respect the Maximum and Minimum size properties. First I tried setting them to the minimum size using setMaximumSize() and setPreferredSize() but that did not work. Then I tried overloading getMaximumSize() and getPreferredSize() but that seemed to have no effect either. In all my layouts my panel grows to fill the space dictated by the layout on which it is placed. I've tested on a GridBagLayout where I want to place it and on a BorderLayout in a otherwise empty JFrame created for testing. Here is my code: public class OverlayAnchorPanel extends JPanel implements ItemListener{ /** * */ private static final long serialVersionUID = 1L; private AnchorChangeListener anchorListener; private JRadioButton rdbtnSouthEast; private JRadioButton rdbtnSouthWest; private JRadioButton rdbtnNorthWest; private JRadioButton rdbtnNorthEast; private ButtonGroup radioGroup; /** * Create the panel. */ public OverlayAnchorPanel() { this.radioGroup = new ButtonGroup(); setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Anchor", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0}; gridBagLayout.rowHeights = new int[]{0, 0}; gridBagLayout.columnWeights = new double[]{0.0, 0.0}; gridBagLayout.rowWeights = new double[]{0.0, 0.0}; setLayout(gridBagLayout); rdbtnNorthEast = new JRadioButton(""); GridBagConstraints gbc_rdbtnNorthEast = new GridBagConstraints(); gbc_rdbtnNorthEast.insets = new Insets(0, 0, 5, 0); gbc_rdbtnNorthEast.gridx = 1; gbc_rdbtnNorthEast.gridy = 0; add(rdbtnNorthEast, gbc_rdbtnNorthEast); this.radioGroup.add(rdbtnNorthEast); rdbtnNorthWe…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21393390
has title: Prevent custom JPanel from expanding
tagged with: swing
type: Question
tagged with: gridbaglayout
tagged with: java
has comment: http://stackoverflow.com/comment/32265507
score: 0

http://stackoverflow.com/comment/32337381
comment on: http://stackoverflow.com/q/21432400
type: Comment
type: QuestionComment
has text: @MarkoTopolnik I can reproduce what he describes: using `sum += data[c]` with or without sorting shows a perf difference (sorting 3x faster) but using `sum = data[c]` with or without sorting shows no perf difference.
score: 2

http://stackoverflow.com/q/21445691
answer count: 1
has comment: http://stackoverflow.com/comment/32360604
has body: I am working on a game right now and have been doing well so far, but I am having trouble right now. I have a JFrame. I added a JPanel to it. The JPanel consists of three JComponents that are supposed to draw pictures. Here is my code: (Note that not EVERYTHING from my methods are shown) public class Game extends JFrame implements KeyListener { public static Game g; public JPanel pan; Paddle p1; Paddle p2; Ball ball; public int p1Y = 0; public int p2Y = 0; public int ballY = 300; public Game() { setTitle("Game"); setSize(600, 600); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setResizable(false); pan = new JPanel(); pan.setBackground(Color.BLACK); p1 = new Paddle(0, p1Y); p2 = new Paddle(600, p2Y); ball = new Ball(300, ballY); pan.add(p1); pan.add(p2); add(pan); setVisible(true); pan.addKeyListener(this); pan.requestFocus(); } public static void main(String args[]) { g = new Game(); } This method sets everything up. I have two other methods that will draw the images. class Paddle extends JComponent { public Image img = new ImageIcon("resources/paddle.png").getImage(); public int x; public int y; public Paddle(int x, int y) { this.x = x; this.y = y; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, x, y, this); } } class Ball extends JComponent { public Image img = new ImageIcon("resources/ball.png").getImage(); public int x; public int y; public Ball(int x, int y) { this.x = x; this.y = y; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, x, y, this); } } I made it print whenever the paintComponent was called and it did print. The only thing is is that it won't paint it on the panel. My only guess is that the constructor is stopping it from painting.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21445735
tagged with: java
tagged with: jcomponent
tagged with: swing
has comment: http://stackoverflow.com/comment/32360315
type: Question
accepted answer: http://stackoverflow.com/a/21445735
tagged with: jpanel
has title: Why is my JComponent not drawing images?
tagged with: image
has comment: http://stackoverflow.com/comment/32360568
score: 0

http://stackoverflow.com/comment/32458596
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21501373
has text: for example I have variable called A, and a textfield called B. To get and pass the value of textfield to variable A, I would do something like A = B.getText();
type: AnswerComment

http-status-code-200
tags question: http://stackoverflow.com/q/21384647
tag name: http-status-code-200
type: Tag

http://stackoverflow.com/comment/32458492
comment on: http://stackoverflow.com/a/21501244
type: AnswerComment
score: 0
type: Comment
has text: @Joe here you have a better way to say thanks by accepting the answer ;)

http://stackoverflow.com/a/21374845
has comment: http://stackoverflow.com/comment/32234462
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/32234288
answers question: http://stackoverflow.com/q/21374629
downvote count: 0
has comment: http://stackoverflow.com/comment/32234547
has body: You should override the getTableCellRendererComponent of the DefaultTableCellRenderer: public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if(table.getColumnModel().getColumn(column).getIdentifier() .equals(your_4th_column_identifier)) // or use getColumnAt(4) { if(value.toString().equals("ACTIVE")) { c.setBackground(Color.GREEN); } } return c; }
type: Answer

http://stackoverflow.com/q/21510005
tagged with: java
has title: Spring Security 3.1.3 request querystring stripped
has body: I am securing my application using Spring Security 3.1.3 and I have a requirement to allow users to login via a link in a third-party application. However, the link in the third-party application will redirect to a specific resource and not to the login page, where the resource that the user wishes to access will be defined as a querystring parameter. So, for example, the link would be of the form : //server.com/app/build/panel.jsp?resourceid='blah' When a user clicks this link they should be taken to the login page defined in my Spring Security configuration and if authenticated then should be redirected to the original link including the querystring parameter. The querystring parameter has no influence on how the user should be authenticated it's merely an id of resource. Now, this all works fine apart from the querystring, which gets stripped by Spring Security before it enters the request processing flow. This is shown in the debug output from Spring Security; org.springframework.security.web.savedrequest.HttpSessionRequestCache: DefaultSavedRequest added to Session: DefaultSavedRequest[http://server.com:8080/app/build/panel.jsp] ie, the querystring is not saved and resourceid='blah' has been removed. Note, I'm currently using Ant matching. I have no need to actually match against the querystring. In earlier versions of Spring Security, it seemed like you could influence this behaviour by using a BeanPostProcessor as per this post, Spring Security - Url with request parameters rules ignored. But the method DefaultFilterInvocationSecurityMetadataSource.setStripQueryStringFromUrls() has been removed from Spring Security 3.1.3. How do I configure Spring Security to not strip the querystring from the original request? So that when the user is redirected after the login to the original URL the querystring parameter will be retained? Many Thanks Howard
type: Question
linked to: http://stackoverflow.com/q/8908052
upvote count: 36
has comment: http://stackoverflow.com/comment/65913234
has answer: http://stackoverflow.com/a/50548591
tagged with: spring-security
answer count: 3
has comment: http://stackoverflow.com/comment/65852322
has comment: http://stackoverflow.com/comment/34550278
favorite count: 0
has comment: http://stackoverflow.com/comment/76780420
has comment: http://stackoverflow.com/comment/65995699
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/65944162
has answer: http://stackoverflow.com/a/56359068
has answer: http://stackoverflow.com/a/46795430
score: 34

http://stackoverflow.com/q/21367873
answer count: 3
tagged with: variables
linked to: http://stackoverflow.com/q/2618059
tagged with: nan
has title: My value keeps showing up as NaN
has body: Essentially my delta value is giving me some trouble, when I print all the variables to the console window everything is right and proper except for delta, whose value keeps showing up as NaN. I can't for the life of me figure out why. I am a beginning CIS student at a University and this is really giving me a headache. import java.util.Scanner; public class ReimannSumCalculator { static double a,b,c,start,end; static double partitions; static double delta=end - start / partitions; private static double Quadratic(double a,double b,double c,double x) { double Quadratic = a*x*x + b*x + c; return Quadratic; } public static void leftReiman(double a,double b,double c,double delta,double start,double end) { double leftReiman = 0; for(double x = start; x&lt;end; x+=delta) { leftReiman = delta * Quadratic(a,b,c,x) + leftReiman; } System.out.println("Your left Reiman sum is " + leftReiman); } public static void rightReiman(double a,double b,double c,double delta,double start,double end) { double rightReiman = 0; for(double x = start+delta; x&lt;=end; x+=delta) { rightReiman = delta* Quadratic(a,b,c,x) + rightReiman; } System.out.println("Your right Reiman sum is " + rightReiman); } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter some values for a b and c."); a = keyboard.nextDouble(); b = keyboard.nextDouble(); c = keyboard.nextDouble(); System.out.println("Please enter a start and end point."); start = keyboard.nextDouble(); end = keyboard.nextDouble(); System.out.println("Now enter the amount of partitions."); partitions = keyboard.nextInt(); leftReiman(a,b,c,start,end,delta); rightReiman(a,b,c,start,end,delta); System.out.println("The delta is: " + delta); System.out.println("The amount of partitions are: " + partitions); System.out.println("a is: "+ a); System.out.println("b is: "+ b); System.out.println("c is: " + c); System.out.println("The start is: " + start); System.out.println("The end is: " + end…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21367932
has comment: http://stackoverflow.com/comment/32221582
has answer: http://stackoverflow.com/a/21367925
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21367951
score: 0

http://stackoverflow.com/a/21356210
has comment: http://stackoverflow.com/comment/32201306
has comment: http://stackoverflow.com/comment/32200529
accepted answer of: http://stackoverflow.com/q/21356199
score: 5
type: Answer
answers question: http://stackoverflow.com/q/21356199
has body: This is because your action is happening on the EDT thread. The GUI will not update at all until you return from that method. You need to use something like SwingWorker or SwingTimer to farm the updates out to another thread.
has comment: http://stackoverflow.com/comment/32201120
has comment: http://stackoverflow.com/comment/32202275
has comment: http://stackoverflow.com/comment/32201780
upvote count: 5
has comment: http://stackoverflow.com/comment/32200516
has comment: http://stackoverflow.com/comment/32201724
has comment: http://stackoverflow.com/comment/32201610
has comment: http://stackoverflow.com/comment/32201048
has comment: http://stackoverflow.com/comment/32201094
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21353286
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21352226
has body: You do need to work out a way to identify the different unique images you get from SHGetFileInfo and only create one Image for each. You must also keep track of the images you create because you must also dispose of them. You may be able to use org.eclipse.jface.resource.ImageRegistry to help manage the images. This requires a string key to identify each image. It looks like SHGetFileInfo gives you an index number that could be used as a unique key.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21352226

http://stackoverflow.com/q/21489682
downvote count: 1
has body: In a usage case, I have a HashMap which contains 1 entry and the key is A. I need to call get() with key B many many times. A equals() to B but A and B are not the same object. The Key contains a long array so its equals() is expensive. I am trying to improve the performance for this map checking operation. I know there are proper ways to address the performance issue. However, I am considering a hack which is the most expedient. The following is from HashMap.java: public V get(Object key) { if (key == null) return getForNullKey(); int hash = hash(key.hashCode()); for (Entry&lt;K,V&gt; e = table[indexFor(hash, table.length)]; e != null; e = e.next) { Object k; if (e.hash == hash &amp;&amp; ((k = e.key) == key || key.equals(k))) return e.value; } return null; } if i change the if block in the for loop to: if (e.hash == hash) { if (e.key == key) { return e.value; } else if (e.key.equals(key)) { e.key = (K) key; return e.value; } } I think it will help the performance a lot. The first time I call get() with key B, B's equals() will be called. For the rest of times, B will be == to the key in the map thus saves the equals() call. However, it is not possible to just extend HashMap and override get() since HashMap.field is package protected and Entry.key is final. Questions: Will this scheme work? Copying HashMap.java and its related code just to change one method is not very appealing. What is the best way to implement this hack? Thanks!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32438548
has title: java HashMap key swap during get()
tagged with: performance
tagged with: java
type: Question
upvote count: 4
tagged with: hashmap
has answer: http://stackoverflow.com/a/21490670
has comment: http://stackoverflow.com/comment/32437766
score: 3
has answer: http://stackoverflow.com/a/21491262
has answer: http://stackoverflow.com/a/21489935
answer count: 4
has answer: http://stackoverflow.com/a/21494202
favorite count: 0
accepted answer: http://stackoverflow.com/a/21491262
possible better answer: http://stackoverflow.com/a/21489935

http://stackoverflow.com/comment/32340543
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21435115
has text: It doesn't seem like you are using your `ExecutorService` at all.
score: 1

http://stackoverflow.com/q/21372215
accepted answer: http://stackoverflow.com/a/21376135
tagged with: jquery
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
upvote count: 1
has title: How to mouse hover using javascript executor in selenium 2?
downvote count: 1
has answer: http://stackoverflow.com/a/21376135
type: Question
has body: Currently working in Selenium WebDriver and using Java. I want to perform the action as mouse hover to the tab and it need to click the tab. Here in this code i can able to identify the element and it is opening the tab. But the problem is it is not mouse hovering and not clicking, it is directly opening the page. JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].click();", driver.findElement(By.id("ext-pr-backlog-evolution") )); If i use the WebElement menuHoverLink = driver.findElement(By.id("ext-pr-backlog-evolution")); actions.moveToElement(menuHoverLink).click().perform(); It is not exactly finding the element and it is clicking some other tab. so i want to mouse hover in javascript executor.
tagged with: javascript
has comment: http://stackoverflow.com/comment/32231982
score: 0
answer count: 1

http://stackoverflow.com/a/21378009
score: 109
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 110
accepted answer of: http://stackoverflow.com/q/21377859
answers question: http://stackoverflow.com/q/21377859
has body: why does the output comes 5,5? Because A.display() only knows about the fields A.a and A.b. Those are the only fields that any code in A knows about. It looks like you expect the declarations in B to "override" the existing field declarations. They don't. They declare new fields which hide the existing fields. Variables don't behave virtually in the way that methods do - the concept of overriding a variable simply doesn't exist. From the JLS section 8.3: If the class declares a field with a certain name, then the declaration of that field is said to hide any and all accessible declarations of fields with the same name in superclasses, and superinterfaces of the class. You can get the effect you want by changing B so that its constructor changes the values of the existing fields that it inherits from A instead: class B extends A { B() { a = 5; b = 6; } } Note that these are not variable declarations. They're just assignments. Of course in most code (well, most code I've seen anyway) the fields in A would be private, so couldn't be accessed from B, but this is just example for the purpose of explaining the language behaviour.

http://stackoverflow.com/q/21366036
has comment: http://stackoverflow.com/comment/32217939
answer count: 1
score: 0
has title: Correctly serializing objects in java
has comment: http://stackoverflow.com/comment/32217982
tagged with: serialization
type: UnansweredQuestion
has body: can anyone help me to spot the mistake? I am trying to pass certain information (min/max/avg ages) from file people.txt (which consists of 200 lines like 'Christel ; MacKay ; 4"2' ; 38'), to another file, by serializing. Here's the first class, where I process some info about these people: import java.io.Serializable; @SuppressWarnings("serial") public class Person implements Serializable { private String firstname; private String lastname; private int age; public Person (String PersonFN, String PersonLN, int PersonA) { firstname = PersonFN; lastname = PersonLN; age = PersonA; } public String toString() { return "Name: "+firstname+" "+lastname+" Age: "+age; } public int getAge() { return age; } } And another one, which does all the job: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.*; public class Collection { int min; int max; int total; private static ArrayList&lt;Person&gt; people; public Collection() { people = new ArrayList&lt;Person&gt;(); min = 100; max = 1; total = 0; } BufferedReader fr = null; BufferedWriter fw = null; public void readFromFile() throws IOException { fr = new BufferedReader (new FileReader("people.txt")); String line = null; StringTokenizer st; while (fr.ready()) { line = fr.readLine(); st = new StringTokenizer(line); String name = st.nextToken(";"); String surname = st.nextToken(";").toUpperCase(); String height = st.nextToken(";"); int age = Integer.parseInt(st.nextToken(";").trim()); Person p = new Person (name, surname, age); p.toString(); people.add(p); //for the 2nd part if(age &lt; min) min = age; if (age &gt; max) max = age; total = total + age; } } public int minAge() { int minA = 100; for (int i = 0; i &lt; people.size(); i++) { Person p = people.get(i); int age = p.getAge(); if (age &l…
tagged with: object
has answer: http://stackoverflow.com/a/21366107
tagged with: java
type: Question

http://stackoverflow.com/a/22080316
upvote count: 2
has comment: http://stackoverflow.com/comment/33506235
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33601802
answers question: http://stackoverflow.com/q/21402642
accepted answer of: http://stackoverflow.com/q/21402642
score: 2
downvote count: 0
has body: We have a configuration inheritance schema. Within development we have: BaseSetup &lt;- Setup &lt;- DevelopmentSetup &lt;-- StagingSystemSetup |- DeveloperMikeSetup |- DeveloperSusySetup So the demonstration server runs with the setup StagingSystemSetup which inherits from the general DevelopmentSetup, etc. Also each developer has its own configuration/setup, which is also checked in. This means everybody can change its configuration as needed, without interfering others. On production/customer just the setup is used without specialication, but that is the setup provided by the customer, which inherits from the basic setup. If we introduce and enable a new feature we only need to modify the base setup. Ideally, forced setup changes by the customer should not happen.

http://stackoverflow.com/comment/32394158
score: 0
has text: @bobbel I just revised the algorithm, but overlooked the implementation details. Thanks for pointing it out. Edited.
type: AnswerComment
comment on: http://stackoverflow.com/a/21463956
type: Comment

http://stackoverflow.com/a/21387668
has body: Your code looks perfectly reasonable and is easy to understand. I see no pressing need for changes.
score: 0
answers question: http://stackoverflow.com/q/21387457
type: Answer

http://stackoverflow.com/a/21363741
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21363644
has body: Why don't you simply use StringUtils#countMatches? StringUtils.countMatches(myStr, "cat") == StringUtils.countMatches(myStr, "dog"); Don't get lost with the indexes. However, if you don't want to use this method, debugging your code is the best thing you can do.

http://stackoverflow.com/a/21356600
type: Answer
score: 2
upvote count: 2
has body: Make a map and whenever a client sends SOPEN command add this client InetAdress and the InetAdress of the server into the map, now whenever you receive a new command you will get the server address from the map.
answers question: http://stackoverflow.com/q/21356526
downvote count: 0

http://stackoverflow.com/a/21493518
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21493497
answers question: http://stackoverflow.com/q/21493497
has body: Use the following code: Iterator itr = c.iterator(); T min = (T)itr.next(); T value; while (itr.hasNext()) { value=(T)itr.next(); if (comp.compare(min, value) &lt; 0) { min = value; } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/96400233

sql
tags question: http://stackoverflow.com/q/21355188
tags question: http://stackoverflow.com/q/21354496
tags question: http://stackoverflow.com/q/21495326
tags question: http://stackoverflow.com/q/21499861
tags question: http://stackoverflow.com/q/21491981
tags question: http://stackoverflow.com/q/21432781
tags question: http://stackoverflow.com/q/21452804
tags question: http://stackoverflow.com/q/21514390
tags question: http://stackoverflow.com/q/21419177
tags question: http://stackoverflow.com/q/21498716
tags question: http://stackoverflow.com/q/21367273
tags question: http://stackoverflow.com/q/21464328
tags question: http://stackoverflow.com/q/21487802
tags question: http://stackoverflow.com/q/21416176
tags question: http://stackoverflow.com/q/21380733
tags question: http://stackoverflow.com/q/21388488
tags question: http://stackoverflow.com/q/21390441
tags question: http://stackoverflow.com/q/21394667
tags question: http://stackoverflow.com/q/21398516
tag name: sql
tags question: http://stackoverflow.com/q/21508417
tags question: http://stackoverflow.com/q/21499197
tags question: http://stackoverflow.com/q/21512480
type: Tag
tags question: http://stackoverflow.com/q/21457378
tags question: http://stackoverflow.com/q/21476960
tags question: http://stackoverflow.com/q/21409916
tags question: http://stackoverflow.com/q/21465509
tags question: http://stackoverflow.com/q/21480694
tags question: http://stackoverflow.com/q/21409533
tags question: http://stackoverflow.com/q/21468885
tags question: http://stackoverflow.com/q/21435645
tags question: http://stackoverflow.com/q/21466125
tags question: http://stackoverflow.com/q/21505920
tags question: http://stackoverflow.com/q/21384113
tags question: http://stackoverflow.com/q/21456494
tags question: http://stackoverflow.com/q/21378414
tags question: http://stackoverflow.com/q/21425366
tags question: http://stackoverflow.com/q/21502124
tags question: http://stackoverflow.com/q/21412992
tags question: http://stackoverflow.com/q/21485325
tags question: http://stackoverflow.com/q/21430282
tags question: http://stackoverflow.com/q/21476755
tags question: http://stackoverflow.com/q/21412070
tags question: http://stackoverflow.com/q/21378599
tags question: http://stackoverflow.com/q/21513695
tags question: http://stackoverflow.com/q/21374732
tags question: http://stackoverflow.com/q/21460936
tags question: http://stackoverflow.com/q/21410585
tags question: http://stackoverflow.com/q/21479751
tags question: http://stackoverflow.com/q/21481193
tags question: http://stackoverflow.com/q/21462099
tags question: http://stackoverflow.com/q/21456211
tags question: http://stackoverflow.com/q/21490733
tags question: http://stackoverflow.com/q/21412195
tags question: http://stackoverflow.com/q/21369709
tags question: http://stackoverflow.com/q/21464638
tags question: http://stackoverflow.com/q/21436146
tags question: http://stackoverflow.com/q/21352055
tags question: http://stackoverflow.com/q/21477954
tags question: http://stackoverflow.com/q/21476000
tags question: http://stackoverflow.com/q/21482339
tags question: http://stackoverflow.com/q/21415621
tags question: http://stackoverflow.com/q/21490154
tags question: http://stackoverflow.com/q/21395687

http://stackoverflow.com/comment/32414502
comment on: http://stackoverflow.com/q/21436994
score: 0
has text: Ok, I have mentioned this issue on the sling dev mailing list, let's see if someone has more info about it ( http://mail-archives.apache.org/mod_mbox/sling-dev/ )
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32292435
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21407301
has text: Likely, but it is difficult to pinpoint that thanks to caching.

http://stackoverflow.com/comment/32273764
type: AnswerComment
comment on: http://stackoverflow.com/a/21396356
type: Comment
has text: Yeah, I've been starting to think about learning about debuggers. I don't use an IDE (I program in TextPad, and use PhraseExpress for auto-completes), so we'll see what's the best approach. I'm pretty ignorant about it all, but I've made it this far :)
score: 0

http://stackoverflow.com/comment/32458785
type: Comment
has text: My bad,sorry for that
type: QuestionComment
comment on: http://stackoverflow.com/q/21501343
score: 0

http://stackoverflow.com/q/21434258
score: 1
has comment: http://stackoverflow.com/comment/32339396
favorite count: 0
has comment: http://stackoverflow.com/comment/32339104
has title: Comparing two rows in a single 2D array
type: Question
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/21434433
possible better answer: http://stackoverflow.com/a/21434435
has comment: http://stackoverflow.com/comment/32339051
has comment: http://stackoverflow.com/comment/32339293
has answer: http://stackoverflow.com/a/21434435
has comment: http://stackoverflow.com/comment/32339263
has comment: http://stackoverflow.com/comment/32339507
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21434427
accepted answer: http://stackoverflow.com/a/21434433
tagged with: arrays
answer count: 4
has body: I am trying to compare two rows that are in different order from a 2D array, and store elements that are the same from both rows. Here's an example of what I have produced: String[] row1 = new String[10]; String[] row2 = new String[10]; String[][] fruit = {{"apple", "banana", "kiwi"},{"kiwi", "oranges", "grapes"}}; for (int i = 0; i &lt; fruit.length; i++ ) { for (int j = 0; j &lt; fruit[i].length; j++){ if(fruit[0][j].equals(fruit[1][j])) { row1[j] = fruit[0][j]; row2[j] = fruit[1][j]; System.out.println("Match found"); }else{ System.out.println("Not found"); } } } System.out.println("row1"); System.out.println(Arrays.deepToString(row1)); System.out.println("row2"); System.out.println(Arrays.deepToString(row2)); I want the row1[] and row2[] to store the elements that are the same (which is kiwi in this example). However, the problem is .equals function only detects matching patterns. The example above only prints out nulls from row1 and row2. It should really print out: row1 [kiwi] row2 [kiwi] Note: I don't want to declare... String check = "kiwi"; because the user can enter anything in the 2D array. Any suggestions? I feel I am getting close. I saw a similar example of someone using .equals and that worked, but it was only for single arrays.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21434609
downvote count: 0

http://stackoverflow.com/q/21368518
has body: I have searched for this solution but could find anything useful, Can Anyone plz tell me can i remove a particular tab/TabSpec from a TabHost. I am making objects for each tabSpec and saving it in arrayList. Here's the code: public class Main extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); final TabHost tabs=(TabHost)findViewById(R.id.tabhost); tabs.setup(); final ArrayList&lt;TabHost.TabSpec&gt; list = new ArrayList&lt;TabHost.TabSpec&gt;(); TabHost.TabSpec spec= tabs.newTabSpec("buttontab"); spec.setContent(R.id.buttontab); spec.setIndicator("Button"); tabs.addTab(spec); list.add(spec); tabs.setCurrentTab(0); Button btn=(Button)tabs.getCurrentView().findViewById(R.id.buttontab); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { TabHost.TabSpec spec=tabs.newTabSpec("tag1"); spec.setContent(new TabHost.TabContentFactory() { public View createTabContent(String tag) { return(new AnalogClock(Main.this)); } }); spec.setIndicator("Clock"); tabs.addTab(spec); list.add(spec); } }); } }
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21368562
tagged with: android
type: AnsweredQuestion
has title: Dynamically Remove Tabs in Android
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21368562
score: 1
tagged with: java

http://stackoverflow.com/comment/32461055
type: QuestionComment
comment on: http://stackoverflow.com/q/21502667
score: 1
has text: Please read [Returning a Value from a Method](http://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html)
type: Comment

http://stackoverflow.com/a/21471690
score: 0
type: Answer
has body: Make your computer suffer and make it drop all those mines. Remember. The definition of "computation" is "to force a machine do a boring job that nobody else would like to do" :-) public static void main(String[] args) { int rows = 25; int cols = 25; boolean[][] mines = new boolean[rows][cols]; while(mineCount(mines) &lt; 97){ dropMine(mines); } for(int i=0;i&lt;rows;i++){ for(int j=0;j&lt;cols;j++){ System.out.print("["); if (mines[i][j]){ System.out.print("*"); }else{ System.out.print(" "); } System.out.print("] "); } System.out.println(); } } private static void dropMine(boolean[][] mines) { int x = (int)(Math.random()*25); int y = (int)(Math.random()*25); mines[x][y] = true; } private static int mineCount(boolean[][] mines) { int count = 0; for(int i=0;i&lt;25;i++){ for(int j=0;j&lt;25;j++){ if (mines[i][j]){ count++; } } } return count; }
answers question: http://stackoverflow.com/q/21470227

http://stackoverflow.com/a/21476495
score: 0
has body: The class will not be serialisable, unless the field is declared transient (which will prevent the field from being serialised, i.e. it will not be saved). If you can, I suggest to make that member serialisable, otherwise you have to use writeObject and readObject to write and/or read the field manually. See the docs for information on these methods: http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html
type: Answer
answers question: http://stackoverflow.com/q/21476401

http://stackoverflow.com/q/21375559
has body: I am writting a program in hadoop. my code has two stages . in stage 1 , i have 6 reduce output file and this files are the input in the next stage. in stage 2 , i want to have 2 maps so i must merge 6 outputs of stage 1. I have used copymerg , but i got EOFException. the way i used this function is: copyMerge(FileSystem srcFS, Path srcDir, FileSystem dstFS, Path dstFile, boolean deleteSource, Configuration conf, String addString) I don't know what is addString. i have used "" instead of that.Is it correct? in this case my map task fails. the task log is: java.io.EOFException at java.io.DataInputStream.readFully(DataInputStream.java:180) at org.apache.hadoop.io.DataOutputBuffer$Buffer.write(DataOutputBuffer.java:63) at org.apache.hadoop.io.DataOutputBuffer.write(DataOutputBuffer.java:101) at org.apache.hadoop.io.SequenceFile$Reader.next(SequenceFile.java:1930) at org.apache.hadoop.io.SequenceFile$Reader.next(SequenceFile.java:2062) at org.apache.hadoop.mapreduce.lib.input.SequenceFileRecordReader.nextKeyValue(SequenceFileRecordReader.java:68) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:531) at org.apache.hadoop.mapreduce.MapContext.nextKeyValue(MapContext.java:67) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:143) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:369) at org.apache.hadoop.mapred.Child$4.run(Child.java:259) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059) at org.apache.hadoop.mapred.Child.main(Child.java:253) Is this way correct? Does the copyMerge function use ram to copy the file? means that if the the file be 1 gigabyte, i need 1 G ram to copy it? Thanks.
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: file
upvote count: 1
has title: How to merge reduce outputs and use in map input?
type: Question
score: 1
tagged with: java
tagged with: hadoop

http://stackoverflow.com/comment/32331528
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21428545
score: 0
has text: I've re-read your question several times, and am really confused about what you're actually asking! Can you perhaps show some more context of what problem you're trying to solve? Are you just trying to replace matched characters in a string, within <context>?

http://stackoverflow.com/comment/69688204
comment on: http://stackoverflow.com/a/21455258
type: Comment
score: 0
type: AnswerComment
has text: Hello Ori, How can you do the reverse of this? getting MongoDb values as an arraylist

http://stackoverflow.com/comment/32285324
type: AnswerComment
comment on: http://stackoverflow.com/a/21402007
score: 0
has text: how can I change the size of the thumb programatically ?
type: Comment

http://stackoverflow.com/q/21432078
has comment: http://stackoverflow.com/comment/53311644
has comment: http://stackoverflow.com/comment/32335135
has answer: http://stackoverflow.com/a/21432246
type: Question
linked to: http://stackoverflow.com/q/2459119
has answer: http://stackoverflow.com/a/52409343
tagged with: named-query
has body: This is my JPA ENTITY @Entity @NamedQueries({ @NamedQuery(name = "Question.randQuestion", query = "SELECT q FROM Question AS q ORDER BY RANDOM") }) @Table(name = "questions") public class Question implements Serializable { ..... } The problem is: eclipse gives me an error for this namedQuery. It says: "The identification variable 'RANDOM' is not defined in the FROM clause" I've tried also with RAND() instead of RANDOM and also NEWID(). Thanks.
tagged with: java
answer count: 3
tagged with: jpa
downvote count: 0
has title: JPA: select random row
tagged with: jpql
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21432374

http://stackoverflow.com/a/21465746
answers question: http://stackoverflow.com/q/21465629
type: Answer
has body: If you get an exception from the SOAP service, I would say that returning an HTTP 500 Internal Server Error is the only legal response to give to the caller of the REST service. Anything else would be misleading.
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21465629

http://stackoverflow.com/comment/32418285
has text: @HansHohenfeld hi there thanks for your immediate response, as I said, I would like to restrict consecutive digts and special characters of the user. This is not allowed: 1231414 $@#(@)(@#. The only allowed input data are: 1st, 2nd, John 14:18
comment on: http://stackoverflow.com/q/21478662
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32209873
score: 0
type: AnswerComment
type: Comment
has text: @user2729661 add a constructor in `MouseControl` class which takes `FileGUI` as a parameter and use that `FileGUI` instance in `MouseControl` (for that you can assign the parameter you receive to the `FileGUI` variable you have in `MouseControl`). In `FileGUI` class, in the place where you create instance of `MouseControl` instead of `new MouseControl()` use `new MouseControl(this)`.
comment on: http://stackoverflow.com/a/21361155

http://stackoverflow.com/comment/32483463
type: QuestionComment
has text: Jamey, loosing the session and application state is exactly the issue that JRebel addresses. If you're interested, drop me a message, what if we could improve to make it feasible for your environment - I'm involved with development of the product.
score: 0
comment on: http://stackoverflow.com/q/21463809
type: Comment

http://stackoverflow.com/comment/32435230
has text: You need to declare this bean in a context which has access to a `ServletContext`. You don't seem to be doing that.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21488252

http://stackoverflow.com/a/25457199
has body: Answer moved from original question to match site "Q and A" format. The Google Data Java Client Library supports OAuth 2.0. Unfortunately, there are no complete samples in the library showing how to use it with the Google Spreadsheet API. Here is an example that has worked for me. I hope someone find it helpful. import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson.JacksonFactory; import com.google.gdata.util.ServiceException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; public class NewClass { // Retrieve the CLIENT_ID and CLIENT_SECRET from an APIs Console project: // https://code.google.com/apis/console static String CLIENT_ID = "your-client-id"; static String CLIENT_SECRET = "your-client-secret"; // Change the REDIRECT_URI value to your registered redirect URI for web // applications. static String REDIRECT_URI = "the-redirect-uri"; // Add other requested scopes. static List&lt;String&gt; SCOPES = Arrays.asList("https://spreadsheets.google.com/feeds"); public static void main (String args[]) throws IOException, ServiceException, com.google.protobuf.ServiceException{ Credential credencial = getCredentials(); JavaApplication20.printDocuments(credencial); } /** * Retrieve OAuth 2.0 credentials. * * @return OAuth 2.0 Credential instance. */ static Credential getCredentials() throws IOException { HttpTransport transport = new NetHttpTransport(); JacksonFactory jsonFactory = new JacksonFactory(); // Step 1: Author…
has comment: http://stackoverflow.com/comment/50106224
has comment: http://stackoverflow.com/comment/40897344
has comment: http://stackoverflow.com/comment/44216556
answers question: http://stackoverflow.com/q/21440101
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/76543846
has comment: http://stackoverflow.com/comment/41556740
has comment: http://stackoverflow.com/comment/49099776
score: 7
upvote count: 8

http://stackoverflow.com/q/21431199
answer count: 1
upvote count: 3
tagged with: solr
has answer: http://stackoverflow.com/a/21456907
has body: I need to implement the following in a Spring Data Solr custom repository: (X OR Y) AND Z My current code is as follows: Criteria criteria = new Criteria("x").is(X_VALUE); criteria = criteria.or(new Criteria("y").is(Y_VALUE); criteria = criteria.and(new Criteria("z").is(Z_VALUE); But running this code I get the following precedence: X OR (Y AND Z) Any ideas?
tagged with: spring
tagged with: spring-data-solr
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/21456907
tagged with: java
tagged with: spring-data
has title: Spring Data Solr Precedence for Custom Repository
type: Question
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/32220189
type: AnswerComment
score: 0
type: Comment
has text: I change the form form <form:form> to but noting happen. Will it be valid if I remove the form from the login jsp and put it around the <jsp:include page="login.jsp"/> ?
comment on: http://stackoverflow.com/a/21366871

http://stackoverflow.com/comment/32277402
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21397374
has text: Check whether u were able to create author object and which object is coming as numm

http://stackoverflow.com/a/21457124
answers question: http://stackoverflow.com/q/21457058
score: 1
upvote count: 1
has body: The sleep method halts execution of the current thread, in your case 5000 milliseconds (5 seconds). This method however throws InterruptedException which has to be caught.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32270219
has text: @HectorLector : got true for that .. contents are 8.233 , 4.567 , 52.11 ,45.532 . Each line has only one value. (I just typed all the values in a single line here)
type: Comment
comment on: http://stackoverflow.com/q/21394382
score: 0
type: QuestionComment

http://stackoverflow.com/q/21388807
type: Question
has body: i use OpenJPA with an Oracle DB. For example, i have a entity that have a Map like this: @ElementCollection private Map&lt;Integer, String&gt; mapWithKeys; Now, i want load a entity with a subset of the map entries. For example i want load the entity with all map entrys that have the keys "1","3," or "5". Is that possible with JPA Criteria? I didnt find anything about it. I've tried it with a MapJoin, but if one value match the whole map would be load. Thank you for your time :)
tagged with: criteria
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21388860
upvote count: 2
tagged with: openjpa
score: 2
type: AnsweredQuestion
has title: Return a entity with a subset of a map
accepted answer: http://stackoverflow.com/a/21388860
tagged with: java

http://stackoverflow.com/comment/32416602
comment on: http://stackoverflow.com/a/21477151
has text: If a line does not have a numeral then yes it would
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21420628
type: AnsweredQuestion
tagged with: java
has title: Enabling spring aop sidesteps dependency injection
has comment: http://stackoverflow.com/comment/32317740
has body: I have a simple spring bean (that of an S2 action class) which uses autowiring to get injected with dependencies working as per usual. However when I subject one of this bean's methods to spring aop, say a @Before advice using JDK/cglib proxy, the dependency injection is skipped leaving my variables unset. I understand this has something to do with the way spring aop accomplishes join points through proxying, but I can't find anything from the docs about this particular issue. What am I missing? I can post the context xml too if someone needs to take a look, but it's really very simple in that, all it contains is a couple of beans for the action class, a bean for the aspect and a <aop:aspectj-autoproxy> setting. Answer: Here's the mistake: The class attribute must have been referring to the spring bean in the spring's app context instead. Update 1: I've tried both the JDK proxying and CGLib, and the same issue occurs in both the cases. Using bean properties to inject dependecies (instead of autowiring) didn't help either. I use spring 4.0.0.RELEASE and struts2.1.3. Update 2 (included the code): <context:annotation-config /> <aop:aspectj-autoproxy proxy-target-class="true" /> TestAspect class: @Aspect public class TestAspect { private static final Logger SLOGGER = Logger.getLogger(TestAspect.class); @Before ("actionAnnotatedPointCut() && (publicActionMethodPointCut() || protectedActionMethodPointCut())") public void checkUserAccess(JoinPoint pJoinPoint) throws Throwable { SLOGGER.smartError("Intercepted:", pJoinPoint.getSignature().getName()); } @AfterThrowing (value = "actionAnnotatedPointCut() && (publicActionMethodPointCut() || protectedActionMethodPointCut())", throwing = "pException") public void handlePortletException(JoinPoint pJoinPoint, Exception pException) { SLOGGER.smartError("Method threw error:", pJoinPoint.getSignature().getName(), "| Exception:", pException); } @Pointcut ("@annotation(org.apache.struts2.convention.annotation.Action") public void actio…
has comment: http://stackoverflow.com/comment/32337566
has comment: http://stackoverflow.com/comment/32318224
type: Question
has comment: http://stackoverflow.com/comment/32336451
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/21434532
has comment: http://stackoverflow.com/comment/32339000
score: 0
tagged with: spring-aop
tagged with: aspectj
answer count: 1
has comment: http://stackoverflow.com/comment/32328898
accepted answer: http://stackoverflow.com/a/21434532
has comment: http://stackoverflow.com/comment/32336958
has comment: http://stackoverflow.com/comment/32318627
tagged with: spring

http://stackoverflow.com/a/21503391
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32462468
score: 0
accepted answer of: http://stackoverflow.com/q/21503347
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21503347
has body: The problem is that instead of initializing your array, you set it to null. Try changing: char[] strippedInput = null; to char[] strippedInput = new char[inputString.length()]; I understand that the strippedInput will likely contain fewer characters than are in the inputString. However, as far as I know, it is possible that you will need the same amount of characters in the stripped array. If you do not need all of them, just write a null character at the end the data and it will work/print correctly. Regardless, this will solve your NullPointerException.
has comment: http://stackoverflow.com/comment/32462273

http://stackoverflow.com/comment/32248703
type: AnswerComment
has text: The toggle button should lie inside the "MyDialog" class
type: Comment
comment on: http://stackoverflow.com/a/21381414
score: 0

http://stackoverflow.com/comment/32309928
type: Comment
type: QuestionComment
has text: Why do you care what order the fields come back in? If all the same data is present, then your data is semantically equivalent, and the order of variables doesn't matter.
comment on: http://stackoverflow.com/q/21392955
score: 1

http://stackoverflow.com/comment/32341235
score: 1
comment on: http://stackoverflow.com/q/21435396
type: Comment
type: QuestionComment
has text: Use setOnItemClickListener() for listview, it will give you the position of the row clicked.

http://stackoverflow.com/comment/32441766
type: AnswerComment
comment on: http://stackoverflow.com/a/21491381
score: 0
type: Comment
has text: Thank you. Would what i said about p1[i] & p2[i] be going the the right direction also?

http://stackoverflow.com/comment/32328123
type: AnswerComment
comment on: http://stackoverflow.com/a/21427763
type: Comment
has text: Yes, ID's in example are different but each from them is included in layout.
score: 0

http://stackoverflow.com/comment/116450440
score: 0
type: AnswerComment
type: Comment
has text: @BradMace, or even `WHERE UPPER(u.username) LIKE CONCAT('%',UPPER(TRIM((:username)),'%')` to clear off blank space that could come from a Ctrl+V sometimes
comment on: http://stackoverflow.com/a/21461715

http://stackoverflow.com/a/21440031
upvote count: 3
has body: You have the temp variable to track the current number you're adding, but you don't ever change it. Change: sum += ++temp; instead of sum += temp;
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32350411
has comment: http://stackoverflow.com/comment/32350043
accepted answer of: http://stackoverflow.com/q/21439889
downvote count: 0
answers question: http://stackoverflow.com/q/21439889
has comment: http://stackoverflow.com/comment/32349769
has comment: http://stackoverflow.com/comment/32350530
score: 3
has comment: http://stackoverflow.com/comment/32351557
has comment: http://stackoverflow.com/comment/32353679
has comment: http://stackoverflow.com/comment/32349940

http://stackoverflow.com/comment/32416288
type: QuestionComment
comment on: http://stackoverflow.com/q/21455863
score: 1
has text: show message after signing jar show message in console " jar signed. Warning: No -tsa or -tsacert is provided and this jar is not timestamped. Without a times tamp, users may not be able to validate this jar after the signer certificate's expiration date (4751-12-22) or after any future revocation date."
type: Comment

http://stackoverflow.com/comment/32355221
has text: Is there a builtin solution with Spring to handle `REQUIRES_NEW`? It could require a lot of work to handle every method the test hits that has 'REQUIRES_NEW`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21439339
type: Comment

http://stackoverflow.com/comment/32217645
comment on: http://stackoverflow.com/q/21356691
score: 0
has text: @SteliosAdamantidis That's actually what I've done some time ago, but I fear there might still be some errant thread, etc. that's causing the issue. And trying to find that is beyond brutal. Is there any way to set an ID for each component so that I can at least identify it and limit the amount of code I have to look through?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21480051
type: Question
has comment: http://stackoverflow.com/comment/32420136
has answer: http://stackoverflow.com/a/21488589
answer count: 1
score: 0
has title: Android - Dialog inside another dialog - How to know when they both finished excuting?
tagged with: android
has body: I am calling method ShowDialog in my activity. I have a list of names, so I will loop in this list of names, and for each name, I will get its numbers. Some names might have just a number and some others might have more. If a name has more than a number, I will show another dialog that prompts you to select the numbers you want. When all names have only a number, it is easy, I call dialog.dismiss, then SendSMS(listOfNumbers) and finally finish(): ShowDialog(); SendSMS(listOfNumbers); finish(); However, the problem occurs when users have multiple numbers. I can't find a way to let me know when the process finishes. ShowDialog() method: protected void ShowDialog() { final Dialog dialog = new Dialog(ContactsPicker.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.alert_dialog); final CheckBox cbE = (CheckBox) dialog.findViewById(R.id.checkBoxEmail); final CheckBox cbN = (CheckBox) dialog.findViewById(R.id.checkBoxNumber); Button button = (Button) dialog.findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String names = ""; String names1 = ""; String names2 = ""; if (cbN.isChecked()) { //Send invitations through SMS //List&lt;String&gt; numbers = new ArrayList&lt;String&gt;(); String number = ""; List&lt;String&gt; usernumbers = new ArrayList&lt;String&gt;(); //Fill names string to send it back for (int i = 0; i &lt; selected.size(); i++) { //number = get_Number(contactName, getApplicationContext()); usernumbers = getNumber(selected.get(i), getApplicationContext()); //Toast.makeText(getApplicationContext(),"Usernumbers list size: "+usernumbers.size(),Toast.LENGTH_SHORT).show(); if (usernumbers.size() == 1) { selectedNumbers.add(usernumbers.get(0)); } else if (usernumbers.size() &gt; 1) { //Show select number dialog dialog.hide(); showSelectNumberPopup(usernumbers); } else { } //dialog.show(); } } if (cbE.isChecked()) { //Send invitations through e-mail List&l…
has comment: http://stackoverflow.com/comment/32423507
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android-alertdialog
tagged with: java

http://stackoverflow.com/q/21404533
score: 0
answer count: 1
has title: Is there any third party api in java to get cities based on country
favorite count: 0
type: UnansweredQuestion
has body: Earlier I've used maxmind geoip to get country based on ip. Now I need to list out all states &amp; cities based on the given country value. Any one aware of any Api to achieve this?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/32287568
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21404861

http://stackoverflow.com/q/21433959
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has title: Java zipfile/byte array issue
tagged with: byte
possible better answer: http://stackoverflow.com/a/21447177
has comment: http://stackoverflow.com/comment/32340674
has body: I have a zip file with 3 relatively large (several mb) binary files I need to read into a buffer to perform some regex operations on. //For entry in zip.getentries loop above long size = entry.getSize(); byte[] bytes = new byte[(int) size]; int numBytesRead = zipFile.getInputStream(entry).read(bytes); if (numBytesRead != size) { Logger.getLogger(this.getClass()).debug( "Read " + numBytesRead + " bytes from zip entry but size of the zip entry is " + size + " bytes"); //continue; - If I do not comment this out the size check fails and nothing happens } FileUtils.writeByteArrayToFile(extractFile, bytes); For some reason I am only getting about 1/15 of the data or so into the byte array (43 out of 642 records in one example). I originally thought it was an issue perhaps casting size to int, but size is typically between 1,000,000 - 10,000,000 or so so that isn't a problem. Any thoughts?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1590831
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21447177
tagged with: primitive
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/21434079
accepted answer: http://stackoverflow.com/a/21434079
answer count: 2
upvote count: 1

http://stackoverflow.com/q/21414750
answer count: 2
has comment: http://stackoverflow.com/comment/32344793
has comment: http://stackoverflow.com/comment/32344838
tagged with: junit
downvote count: 0
has title: Spring MVC Junit Test ApplicationContext Config
favorite count: 0
has comment: http://stackoverflow.com/comment/32316649
has answer: http://stackoverflow.com/a/21414920
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32345007
type: UnansweredQuestion
has body: I think I should be using the same application context config files with Junit test! is that correct? The issue that I have, I can run my spring mvc app without an issue, and I am trying to add a new junit test to test one of the controller and I can't even run the test. obviously the application context files are not the issue, as the app is running perfectly fine. So the question is how can I run a junit test using the existing application context config files? any link or example would be appreciated. Currently my application context files are located in /src/main/webapp/WEB-INF/*-appContext.xml In my web.xml contextConfigLocation /WEB-INF/*-appContext.xml I have no problem to run the app but I can't run the test. java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105) In the testing class; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration("file:src/main/webapp/WEB-INF/mvc-appContext.xml") public class AppTests { private MockMvc mockMvc; also I have tried using "*" file:src/main/webapp/WEB-INF/*-appContext.xml and tried using multiple files @ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/mvc-appContext.xml", "file:src/main/webapp/WEB-INF/mongo-appContext.xml"}) and tried using single xml to import others <import resource="file:src/main/webapp/WEB-INF/mvc-appContext.xml"/> <import resource="file:src/main/webapp/WEB-INF/mongo-appContext.xml"/> but none of them work for junit testing! so where should I put the config files? It doesn't seem to initialize other beans! java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.…
upvote count: 1
has answer: http://stackoverflow.com/a/26902186
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/49266076
type: Question

http://stackoverflow.com/comment/32523903
type: AnswerComment
has text: The point about the blocking is that the thread doing playback runs "off the hook" most of the time. If you haven't, make sure to actually run the code and see what happens. At least on the two systems I tested it on, I get 200+ repaints per second when not writing to the line. The line is pretty clearly the issue and opening it with a suggested buffer size does appear to correct it.
type: Comment
comment on: http://stackoverflow.com/a/21537809
score: 0

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/21509864

javascript
tags question: http://stackoverflow.com/q/21480404
tags question: http://stackoverflow.com/q/21495470
tags question: http://stackoverflow.com/q/21474085
tags question: http://stackoverflow.com/q/21460124
tags question: http://stackoverflow.com/q/21437985
tags question: http://stackoverflow.com/q/21452212
tags question: http://stackoverflow.com/q/21483506
tags question: http://stackoverflow.com/q/21392041
tag name: javascript
tags question: http://stackoverflow.com/q/21442159
tags question: http://stackoverflow.com/q/21376738
tags question: http://stackoverflow.com/q/21374638
tags question: http://stackoverflow.com/q/21377753
tags question: http://stackoverflow.com/q/21462385
tags question: http://stackoverflow.com/q/21437595
tags question: http://stackoverflow.com/q/21402414
tags question: http://stackoverflow.com/q/21449147
tags question: http://stackoverflow.com/q/21467914
tags question: http://stackoverflow.com/q/21430977
tags question: http://stackoverflow.com/q/21470849
tags question: http://stackoverflow.com/q/21455763
tags question: http://stackoverflow.com/q/21386955
type: Tag
tags question: http://stackoverflow.com/q/21354559
tags question: http://stackoverflow.com/q/21357451
tags question: http://stackoverflow.com/q/21442592
tags question: http://stackoverflow.com/q/21405635
tags question: http://stackoverflow.com/q/21371643
tags question: http://stackoverflow.com/q/21493459
tags question: http://stackoverflow.com/q/21448378
tags question: http://stackoverflow.com/q/21400290
tags question: http://stackoverflow.com/q/21457408
tags question: http://stackoverflow.com/q/21386324
tags question: http://stackoverflow.com/q/21499318
tags question: http://stackoverflow.com/q/21392322
tags question: http://stackoverflow.com/q/21381364
tags question: http://stackoverflow.com/q/21402189
tags question: http://stackoverflow.com/q/21451426
tags question: http://stackoverflow.com/q/21356273
tags question: http://stackoverflow.com/q/21351406
tags question: http://stackoverflow.com/q/21449550
tags question: http://stackoverflow.com/q/21432795
tags question: http://stackoverflow.com/q/21404747
tags question: http://stackoverflow.com/q/21382419
tags question: http://stackoverflow.com/q/21466215
tags question: http://stackoverflow.com/q/21404780
tags question: http://stackoverflow.com/q/21418101
tags question: http://stackoverflow.com/q/21423359
tags question: http://stackoverflow.com/q/21363205
tags question: http://stackoverflow.com/q/21461347
tags question: http://stackoverflow.com/q/21453634
tags question: http://stackoverflow.com/q/21509788
tags question: http://stackoverflow.com/q/21372215
tags question: http://stackoverflow.com/q/21449995
tags question: http://stackoverflow.com/q/21409533
tags question: http://stackoverflow.com/q/21437188
tags question: http://stackoverflow.com/q/21402395
tags question: http://stackoverflow.com/q/21392869
tags question: http://stackoverflow.com/q/21465767
tags question: http://stackoverflow.com/q/21406946
tags question: http://stackoverflow.com/q/21510431
tags question: http://stackoverflow.com/q/21402605
tags question: http://stackoverflow.com/q/21486046
tags question: http://stackoverflow.com/q/21408097
tags question: http://stackoverflow.com/q/21465337

http://stackoverflow.com/comment/32310924
type: AnswerComment
has text: nope, what is the point of testing an empty method? I need other dependencies, to test the actual controllers! also its better to have the same config files for both testing and the actual app. otherwise u will keep editing both!
type: Comment
comment on: http://stackoverflow.com/a/21414920
score: 0

http://stackoverflow.com/q/21398753
answer count: 2
accepted answer: http://stackoverflow.com/a/21399003
has body: I am making a program of mouse handling, but due to compile time error it is not working. Any idea what the problem is? import java.awt.*; import java.awt.event.*; public class Mouse extends Frame implements MouseListener, MouseMotionListener, MouseWheelListener { int x = 0, y = 0; String msg = ""; public static void main(String agrs[]) { Mouse m = new Mouse("ashish"); } Mouse(String mj) { super(mj); addWindowListener(new mywa(this)); addWindowListener(this); setSize(500, 500); setVisible(true); } class mywa extends WindowAdapter { Mouse m = null; mywa(Mouse m) { this.m = m; } public void windowClosing(WindowEvent we) { m.setVisible = false; } } public void mouseClicked(MouseEvent e) { msg = "mouseclicked"; x = e.getX(); y = e.getY(); repaint(); } public void mouseEntered(MouseEvent e1) { msg = "mouseentered"; x = e1.getX(); y = e1.getY(); repaint(); } public void mouseExited(MouseEvent e2) { msg = "mouseexit"; x = e2.getX(); y = e2.getY(); repaint(); } public void mousePressed(MouseEvent e3) { msg = "mouse pressed"; x = e3.getX(); y = e3.getY(); repaint(); } public void mouseReleased(MouseEvent ee) { msg = "mouse released"; x = ee.getX(); y = ee.getY(); repaint(); } public void mouseDragged(MouseEvent e11) { msg = "dragged"; x = e11.getX(); y = e11.getY(); repaint(); } public void mouseMoved(MouseEvent e12) { msg = "moved"; x = e12.getX(); y = e12.getY(); repaint(); } public void mouseWheelMoved(MouseWheelEvent e13) { msg = "wheel"; x = e13.getX(); y = e13.getY(); repaint(); } public void paint(Graphics g) { g.drawString(msg + " at " + x + "," + y, 50, 100); } } ---------- compile ---------- .\MouseEvent.java:8: error: class Mouse is public, should be declared in a file named Mouse.java public class Mouse extends Applet ^ Mouse.java:29: error: cannot access MouseEvent public void mouseClicked(MouseEvent e){ ^ bad source file: .\MouseEvent.java file does not contain class MouseEvent Please remove or make sure it appears in the correct subdirectory of the sourcepath.…
has answer: http://stackoverflow.com/a/21399003
possible better answer: http://stackoverflow.com/a/30439828
type: AnsweredQuestion
tagged with: java
type: Question
has title: Mouse handling program
tagged with: mousewheel
has answer: http://stackoverflow.com/a/30439828
tagged with: mouseevent
score: 0

http://stackoverflow.com/a/21442427
answers question: http://stackoverflow.com/q/21442302
upvote count: 3
type: Answer
has body: Here, totala, totalb, totalc, totald are declared locally. When you declare a variable it will be accessible inside the block, and not outside. There are two ways: You can declare and initialize totala, totalb, totalc, totald before the beginning of the quiz (at the same level as a, b, c). OR You can keep your variable finala (and find a better name like score), and use it in the 4 blocks to add the result.
score: 3
downvote count: 0

eclipse-rcp
tags question: http://stackoverflow.com/q/21381355
tags question: http://stackoverflow.com/q/21445067
type: Tag
tags question: http://stackoverflow.com/q/21437819
tags question: http://stackoverflow.com/q/21460422
tags question: http://stackoverflow.com/q/21382848
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/21360995

http://stackoverflow.com/q/21497976
upvote count: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21499382
tagged with: java
has comment: http://stackoverflow.com/comment/32454432
downvote count: 1
linked to: http://stackoverflow.com/q/14023988
type: Question
has comment: http://stackoverflow.com/comment/36728076
has comment: http://stackoverflow.com/comment/32454204
linked to: http://stackoverflow.com/q/11227809
has comment: http://stackoverflow.com/comment/32452601
has comment: http://stackoverflow.com/comment/32454014
accepted answer: http://stackoverflow.com/a/21499382
score: 12
has body: I've been playing with Java 8 Streams - API and I decided to microbenchmark stream() and parallelStream() streams. As expected the parallelStream() was as twice as fast, but something else popped up - If I sort the data before passing them to the filter it takes 5-8 times more time to filter-&gt;map-&gt;collect the result, than passing an unsorted list. Unsorted (Stream) Elapsed time [ns] : 53733996 (53 ms) (ParallelStream) Elapsed time [ns] : 25901907 (25 ms) Sorted (Stream) Elapsed time [ns] : 336976149 (336 ms) (ParallelStream) Elapsed time [ns] : 204781387 (204 ms) Here is the code package com.github.svetlinzarev.playground.javalang.lambda; import static java.lang.Long.valueOf; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.stream.Collectors; import com.github.svetlinzarev.playground.util.time.Stopwatch; public class MyFirstLambda { private static final int ELEMENTS = 1024 * 1024 * 16; private static List&lt;Integer&gt; getRandom(int nElements) { final Random random = new Random(); final List&lt;Integer&gt; data = new ArrayList&lt;Integer&gt;(nElements); for (int i = 0; i &lt; MyFirstLambda.ELEMENTS; i++) { data.add(random.nextInt(MyFirstLambda.ELEMENTS)); } return data; } private static void benchStream(List&lt;Integer&gt; data) { final Stopwatch stopwatch = new Stopwatch(); final List&lt;Long&gt; smallLongs = data.stream() .filter(i -&gt; i.intValue() &lt; 16) .map(Long::valueOf) .collect(Collectors.toList()); stopwatch.log("Stream"); System.out.println(smallLongs); } private static void benchParallelStream(List&lt;Integer&gt; data) { final Stopwatch stopwatch = new Stopwatch(); final List&lt;Long&gt; smallLongs = data.parallelStream() .filter(i -&gt; i.intValue() &lt; 16) .map(Long::valueOf) .collect(Collectors.toList()); stopwatch.log("ParallelStream"); System.out.println(smallLongs); } public static void main(String[] args) { final List&lt;Integer&gt; data = MyFirstLambda.getRandom(MyFirstLambda.ELEMENTS); // Co…
has comment: http://stackoverflow.com/comment/32452528
answer count: 1
has comment: http://stackoverflow.com/comment/32452524
favorite count: 0
has title: Why filtering an unsorted list is faster than filtering a sorted list
has comment: http://stackoverflow.com/comment/32452580
has comment: http://stackoverflow.com/comment/32452563
has comment: http://stackoverflow.com/comment/33266554
has comment: http://stackoverflow.com/comment/32454394
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/32453840

http://stackoverflow.com/q/21360954
favorite count: 0
has comment: http://stackoverflow.com/comment/32209545
type: UnansweredQuestion
tagged with: swing
has body: i am trying to add a single row in my table... but the following code adds a row twice at the end of each row...ie., i i am getting two similar rows instead of a single row DefaultTableModel tb=(DefaultTableModel)tb1.getModel(); Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost/db","root",""); Statement stmt=con.createStatement(); int a=(Integer) l1.getSelectedValue(); System.out.println(a); String query="select * from student where rno ="+a+";"; System.out.println(query); ResultSet rs=stmt.executeQuery(query); while(rs.next()){ int rno=rs.getInt("rno"); String name=rs.getString("name"); String sec= rs.getString("sec"); tb.insertRow(0,new Object[]{name,rno,name,sec}); tb1.setModel(tb);
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21361336
type: Question
has comment: http://stackoverflow.com/comment/32209364
has answer: http://stackoverflow.com/a/21361498
tagged with: jtable
answer count: 2
has title: row adds two times jtable
downvote count: 0

http://stackoverflow.com/comment/32269699
comment on: http://stackoverflow.com/a/21394134
type: AnswerComment
score: 0
type: Comment
has text: No attack, but I don't think your argument about `copy.` is valid. `findWithinHorizon` ignores delimiters. It is just like `her` and `where` as you correctly have mentioned.

http://stackoverflow.com/q/21417958
score: 0
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/21418228
has body: I am getting the following error on my application: SEVERE: Exception sending context initialized event to listener instance of class com.puntobile.videre.util.VidereContextListener javax.persistence.PersistenceException: [PersistenceUnit: Videre] Unable to build EntityManagerFactory This happened when I changed my DAO and closed each EntityManager session when it was used, which I was not doing before, and is a bad practise. For that reason, I had to add fetch=EAGER to my Collections. Here are my three entities: package com.puntobile.videre.data; import java.util.ArrayList; import java.util.List; import javax.persistence.*; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; @Entity @SequenceGenerator(name="user_seq", sequenceName="user_seq", allocationSize=1, initialValue=1) @Table(name="users") public class User { @Id @GeneratedValue(generator="user_seq", strategy=GenerationType.SEQUENCE) private Long id; @Column(name="userName") private String userName; @Column(name="password") private String password; @Column(name="accessLevel") private int accessLevel; @OneToMany(mappedBy="user", fetch=FetchType.EAGER) @LazyCollection(LazyCollectionOption.FALSE) private List&lt;Sign&gt; signs; public User() {} public User(String userName, String password, int accessLevel) { this.userName = userName; this.password = password; this.accessLevel = accessLevel; this.signs = new ArrayList&lt;Sign&gt;(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getAccessLevel() { return accessLevel; } public void setAccessLevel(int accessLevel) { this.accessLevel = accessLevel; } public void setSigns(List&lt;Sign&gt; signs) { this.signs = signs; } public List&lt;…
has title: MultipleBagFetch when starting application
linked to: http://stackoverflow.com/q/4334970
has answer: http://stackoverflow.com/a/57591678
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: vaadin
type: Question
tagged with: entity

http://stackoverflow.com/comment/32197864
has text: Do no hesitate to ask here about any specific problems you may encounter.
score: 0
comment on: http://stackoverflow.com/a/21354758
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21477297
score: 0
has body: Yes, you can simply call load(): private void onTimer() { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { load(); // Call the containing class method } }, TTL * 60000); } because every anonymous class is actually also an inner class, so it has a reference to the containing class that declares it. But, you would only use a Timer if you really wanted active expiration. You already have lazy expiration due to the call to verifyCache() in every call to get(). Maybe that's enough for your needs now.
has comment: http://stackoverflow.com/comment/32445736
accepted answer of: http://stackoverflow.com/q/21476861
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21476861
type: Answer
has comment: http://stackoverflow.com/comment/32449249

http://stackoverflow.com/a/21428471
has body: You can sort the String as is explained in this answer: Sort a single String in Java char[] chars = original.toCharArray(); Arrays.sort(chars); Once is sorted you only have to check that the last one in the array of chars is higher than your given hex value. For EBCDIC you can add a comparator to the sort and order based on the EBCDIC instead. char[] chars = original.toCharArray(); // I will convert my array of chars to array of Characters to use Arrays.sort int length = Array.getLength(chars); Character[] ret = new Character[length]; for(int i = 0; i &lt; length; i++) ret[i] = (Character)Array.get(chars, i); // and now the important bit Arrays.sort(ret, new Comparator&lt;Character&gt;() { @Override public int compare(Character arg0, Character arg1) { // convert arg0 and arg1 to EBCDIC with whatever tools you have return arg0InEBCDIC - arg1InEDBCIC; } }); Once you have an ordered array you just need to check the last element as I said.
score: 0
answers question: http://stackoverflow.com/q/21428213
type: Answer

tostring
tags question: http://stackoverflow.com/q/21467462
tags question: http://stackoverflow.com/q/21411801
tag name: tostring
type: Tag
tags question: http://stackoverflow.com/q/21371870
tags question: http://stackoverflow.com/q/21470696
tags question: http://stackoverflow.com/q/21362417
tags question: http://stackoverflow.com/q/21505534
tags question: http://stackoverflow.com/q/21394413

http://stackoverflow.com/q/21390915
has comment: http://stackoverflow.com/comment/32268296
has body: I have a string like : "\"[\"a\",\"b\", \"c\"]\"" How to convert this to a list of strings Could you suggest me a nice way of doing it in Java?
has answer: http://stackoverflow.com/a/21390977
has answer: http://stackoverflow.com/a/21390981
linked to: http://stackoverflow.com/q/506105
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32264391
downvote count: 1
has comment: http://stackoverflow.com/comment/32263432
type: Question
has comment: http://stackoverflow.com/comment/32268105
score: -1
duplicate of: http://stackoverflow.com/q/506105
answer count: 2
has title: List from encoded string
upvote count: 0
has comment: http://stackoverflow.com/comment/32274731
linked to: http://stackoverflow.com/q/11012044
favorite count: 0
linked to: http://stackoverflow.com/q/18297816
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32274753

http://stackoverflow.com/q/21416152
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32309415
tagged with: genymotion
has comment: http://stackoverflow.com/comment/32308675
has comment: http://stackoverflow.com/comment/32312025
has comment: http://stackoverflow.com/comment/32308692
has comment: http://stackoverflow.com/comment/32311761
has comment: http://stackoverflow.com/comment/32308573
has comment: http://stackoverflow.com/comment/32308417
has comment: http://stackoverflow.com/comment/32309893
has comment: http://stackoverflow.com/comment/32310662
answer count: 1
accepted answer: http://stackoverflow.com/a/21418878
has comment: http://stackoverflow.com/comment/32309612
downvote count: 0
has comment: http://stackoverflow.com/comment/32308850
has body: I have installed Genymotion in my osx (I am using Android Studio). The Genymotion icon appears in the ide toolbar but I can't run my app with this emulator, since it is not shown in my AVD manager. How can I make this work ? Edit :@pyus13, I can't find any bottom tab button, here's a screen
has title: Can't run my app with Genymotion
favorite count: 0
has comment: http://stackoverflow.com/comment/32308448
has comment: http://stackoverflow.com/comment/32311955
has comment: http://stackoverflow.com/comment/32308197
has comment: http://stackoverflow.com/comment/32310993
tagged with: android
has comment: http://stackoverflow.com/comment/32312268
has comment: http://stackoverflow.com/comment/32311588
tagged with: android-studio
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32308862
has comment: http://stackoverflow.com/comment/32309196
upvote count: 1
has answer: http://stackoverflow.com/a/21418878
type: Question
has comment: http://stackoverflow.com/comment/32307999

http://stackoverflow.com/comment/32351384
has text: I am not trying to use them. That is not my question. I get that I should never use KeyListeners. What I want to know is: are they notified programmatically BEFORE DocumentListeners or AFTER DocumentListeners? Or are they intermingled WITH DocumentListeners? Is there a general order for all the different kinds of Listeners on a JTextField?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21439652

http://stackoverflow.com/comment/32355469
type: AnswerComment
has text: So implementing it with `mul` is not reasonable, 4^(5^6) will have more than 9000 digits, and iterating that much.... to just calculate 3^(4^(5^6))) would last forever.
type: Comment
comment on: http://stackoverflow.com/a/21442645
score: 1

http://stackoverflow.com/q/21477934
type: Question
has comment: http://stackoverflow.com/comment/32416802
has title: Marshal java classes annotated with JAXB by StAX
score: 0
has body: Is it possible to marshal java classes (annotated with JAXB annotations) by StAX without using JAXB itself?
has answer: http://stackoverflow.com/a/21478343
linked to: http://stackoverflow.com/q/9923326
answer count: 1
accepted answer: http://stackoverflow.com/a/21478343
duplicate of: http://stackoverflow.com/q/9923326
tagged with: stax
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32416690
tagged with: java
tagged with: jaxb
tagged with: marshalling

http://stackoverflow.com/comment/32470220
comment on: http://stackoverflow.com/a/21507718
has text: I was done with new correction, but now new error is comming, java.io.IOException: Hostname <www.w3schools.com> was not verified
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21448248
upvote count: 1
has body: I downloaded eclipse and it wouldn't open at all, then I went and downloaded Java SE Development Kit 7 and now Eclipse opens but I still cant get a new project to open where I can mess around with some code. Is it because I have them downloaded into two different locations? I have Eclipse downloaded in: OS(C):/Program Files(x86)/Eclipse on my laptop and I downloaded the Java SE Development Kit 7 to OS(C):/Program Files/Java. Any help would be much appreciated.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32365070
type: Question
has comment: http://stackoverflow.com/comment/32365106
has title: Downloaded Eclipse and also downloaded Java SE Development Kit 7 but cannot get a new project in Eclipse to work?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21448308
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32367587
tagged with: windows
score: 1
tagged with: java

http://stackoverflow.com/q/21407573
has answer: http://stackoverflow.com/a/21409477
score: 2
has comment: http://stackoverflow.com/comment/32292714
has title: JAXb (version 2.2.8) marshalls gmonth in wrong format
tagged with: java
tagged with: jaxb
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/32339365
answer count: 1
has body: The xsd file contains the following: <xsd:attribute name="month" type="xsd:gMonth" use="optional"/> and I try to marshall a valid XML: Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setSchema(schema); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE); marshaller.marshal(cv, outWriter); StringBuffer sb = ((StringWriter) outWriter).getBuffer(); xml = sb.toString(); the resulting String (xml) contains: month="--03--" instead of month="--03". My pom.xml dependency for jaxb is: com.sun.xml.bind jaxb-impl 2.2.8-b01 provided Is this related to this issue? https://java.net/jira/browse/JAXB-643 It should have been resolved in 2.2.8. How can I get a proper value for the gmonth?
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/32340091
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32338786
tagged with: xsd
has comment: http://stackoverflow.com/comment/32340361

http://stackoverflow.com/comment/32232031
score: 1
comment on: http://stackoverflow.com/q/21373582
has text: are you starting as a root user ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32253058
type: Comment
comment on: http://stackoverflow.com/a/21358803
has text: What's on the test task's class path is solely determined by the party(s) configuring the task (e.g. the `java` plugin). Include/exclude patterns are used if they are present (none are added by the `java` plugin).
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32470395
type: Comment
comment on: http://stackoverflow.com/a/21507871
has text: You had "USER_AGENT" entered in your code, but instead should be "User-Agent"; That fixed the problem.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32304022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21414124
score: 0
has text: Do you think we can see something at "localhost:8080"? I don't run tomcat. And the namespace is the root namespace. And is STRUTS, not struCts

http://stackoverflow.com/comment/32381140
type: QuestionComment
comment on: http://stackoverflow.com/q/21457851
has text: use listeners, cleanest way i think
score: 0
type: Comment

http://stackoverflow.com/a/22345407
has comment: http://stackoverflow.com/comment/34726201
has comment: http://stackoverflow.com/comment/34726009
has body: I suspect this : 14/01/27 13:16:02 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). I got the same error when using CDH4.6 and it got solved after resolving the above warning.
downvote count: 0
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21373550

http://stackoverflow.com/comment/32442076
has text: @RandallSchulz eh, I separate increment/decrement from read and write.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21469716
type: QuestionComment

http://stackoverflow.com/q/21392811
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21392980
linked to: http://stackoverflow.com/q/2336692
has comment: http://stackoverflow.com/comment/32267316
type: Question
has title: Java: automatically creating a .class file for each class
has comment: http://stackoverflow.com/comment/32267166
has body: Let's say I have a A.java with two classes (a public one and a private) both in the same file. public class A{ public static void main(string[] args){ ... } } class B{ ... } Why is Java automatically automatically creating a A.class and a B.class when compiling the A.java? Is it to avoid this sort of problems? https://stackoverflow.com/a/2336762/2034015 What happens if Foo.java refers to Baz but not Bar and we try to compile Foo.java? The compilation fails with an error like this: Foo.java:2: cannot find symbol symbol : class Baz location: class Foo private Baz baz; ^ 1 error Also, I know that the right way to work with Java is a file per class, but I wonder why Java does this.
has comment: http://stackoverflow.com/comment/32267231
accepted answer: http://stackoverflow.com/a/21392980
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/21453569
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21453913
tagged with: java
accepted answer: http://stackoverflow.com/a/21453913
score: 0
answer count: 2
has body: Situation: I wish to send an array of objects (of different types) from a client to a server using ObjectOutputStream. Problem : The Object array is not serializable (I get a NotSerializable Exception). What I tried: I created a dummy class that extends Object, and implements Serializable. But I cannot cast the original objects array to this class. Is there any way to serialize an array of Objects ?
tagged with: arrays
tagged with: notserializableexception
has title: Android: Serializing an array of Objects
tagged with: serialization
has answer: http://stackoverflow.com/a/60792612
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32373870
possible better answer: http://stackoverflow.com/a/60792612
linked to: http://stackoverflow.com/q/4118751

abort
tags question: http://stackoverflow.com/q/21445303
tag name: abort
type: Tag

http://stackoverflow.com/comment/32261298
score: 0
type: Comment
has text: Yes, I agree with you. I have moved it as you told. Can you help me to fix it because it's executing catch()
type: AnswerComment
comment on: http://stackoverflow.com/a/21389156

http://stackoverflow.com/comment/32427401
comment on: http://stackoverflow.com/a/21484002
type: AnswerComment
has text: please adjust your interface usage to best practice of `List<Data> arrl = new ArrayList<Data>();`
score: 0
type: Comment

http://stackoverflow.com/comment/32471158
comment on: http://stackoverflow.com/a/21508073
has text: @Hannes I'm not duplicating the list
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/70594962
type: QuestionComment
type: Comment
has text: I have the same issue. Can you please clarify how synthetica causes it and what you did to solve it? Thanks.
comment on: http://stackoverflow.com/q/21372907
score: 0

http://stackoverflow.com/comment/32281911
score: 0
comment on: http://stackoverflow.com/a/21401387
type: Comment
has text: @RossDrew oops, meant to type 7 there...no idea why I put 8. Fixed it thanks.
type: AnswerComment

http://stackoverflow.com/a/21497307
type: Answer
upvote count: 1
score: 1
has body: The Body element is in the http://schemas.xmlsoap.org/soap/envelope/ namespace, but you're using the single argument getChildren method which looks for elements in no namespace. You need to pass an appropriate Namespace to the two-argument version of getChildren.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21496749
answers question: http://stackoverflow.com/q/21496749

http://stackoverflow.com/q/21409533
tagged with: php
has title: How to Delete one Unique Record from All tables in Mysql
has comment: http://stackoverflow.com/comment/32296260
tagged with: mysql
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21409638
tagged with: javascript
has answer: http://stackoverflow.com/a/21410016
score: 0
answer count: 3
tagged with: sql
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21409745
has body: Here are my tables table1: id mark 01 80 02 100 table2: id subject 01 80 02 100 I want to delete id 01 record in both tables at the same time in one query this code is not working s2.executeUpdate("Delete from * where Student_ID = '"+mng_stu_stuid.getText()+"' ");

http://stackoverflow.com/q/21361322
has answer: http://stackoverflow.com/a/21363462
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21361341
has title: Extracting necessary url from a set of url
tagged with: java
type: Question
tagged with: jsoup
linked to: http://stackoverflow.com/q/12869817
has body: I copied the same code and tried executing but it shows the following exceptions.Please check this. Are you getting the same exceptions.If not please provide the HtmlUnit API's link to make sure that I tried the same thing. public class Program{ public static void main(String[] args) throws FailingHttpStatusCodeException, IOException { final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17); WebRequest request = new WebRequest(new URL("http://www.firstpost.com/tag/crime-in-india")); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.setJavaScriptTimeout(10000); webClient.getOptions().setJavaScriptEnabled(true); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.getOptions().setTimeout(10000); HtmlPage page = webClient.getPage(request); webClient.waitForBackgroundJavaScript(10000); List&lt;HtmlAnchor&gt; anchors1 = page.getAnchors(); HtmlAnchor link2 = null; for (HtmlAnchor anchor : anchors1) { if (anchor.asText().indexOf("Why do we care more when NRIs go missing?") &gt; -1) { link2 = anchor; break; } } page = link2.click(); webClient.waitForBackgroundJavaScript(10000); DomNodeList&lt;DomElement&gt; paras = page.getElementsByTagName("p"); for (DomElement el : paras.toArray(new DomElement[paras.size()])) { System.out.println(el.asText()); } } }
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/a/21378817
upvote count: 6
has comment: http://stackoverflow.com/comment/32247195
answers question: http://stackoverflow.com/q/21378646
downvote count: 0
score: 6
type: Answer
has body: You already have several answers with a "Yes". I would like to add a "but" (if I would be bold, I would say "No" ;-) Yes, an object of this class appears to be mutable, since it provides a setter to change the field. However, since it does not have a getter for that field, neither any other getter depending on that field, and since the field is private, it is currently not possible to read that state. Put differently: The object has state, but it does not expose any state to the outside. I would call that object "effectively immutable". There are some design patterns, where objects are "effectively immutable", for example "Lazy Initialization" of an "Immutable Object". Note: The concept of being "effectively immutable" is discussed in Section 3.5.4 of Java Concurrency in Practice by Brian Goetz.

http://stackoverflow.com/q/21432484
answer count: 1
has comment: http://stackoverflow.com/comment/32336572
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32337963
accepted answer: http://stackoverflow.com/a/21432513
tagged with: java
has comment: http://stackoverflow.com/comment/32339860
type: Question
tagged with: httpsession
has answer: http://stackoverflow.com/a/21432513
tagged with: session
has body: Is it advisable to set -1 what are the dis advantages of doing so ??? Is there any better way to make sure the session never expires ???
has title: Session Timeout/Expiry in java
score: 0

http://stackoverflow.com/q/21397850
type: AnsweredQuestion
tagged with: numbers
tagged with: java
has comment: http://stackoverflow.com/comment/32275864
type: Question
has comment: http://stackoverflow.com/comment/32276964
score: 5
possible better answer: http://stackoverflow.com/a/21397887
tagged with: function
upvote count: 5
accepted answer: http://stackoverflow.com/a/21397896
downvote count: 0
has answer: http://stackoverflow.com/a/21397887
has comment: http://stackoverflow.com/comment/32276032
has answer: http://stackoverflow.com/a/21398698
has comment: http://stackoverflow.com/comment/32275931
has body: Is it possible to have a function that returns either Integer or Float? I want to have the 2 functions become one if it's possible: private static Integer parseStringFormatInt(String val){ System.out.println(Integer.parseInt(val.substring(0, val.indexOf(".")))); return Integer.parseInt(val.substring(0, val.indexOf("."))); } private static Float parseStringFormatFloat(String val){ System.out.println(Float.parseFloat(val.substring(0, val.indexOf(".")))); return Float.parseFloat(val.substring(0, val.indexOf("."))); }
tagged with: integer
favorite count: 0
has title: Java Possible to Return Either Float or Integer?
answer count: 5
linked to: http://stackoverflow.com/q/2254435
has answer: http://stackoverflow.com/a/21397896
has answer: http://stackoverflow.com/a/21397919
has answer: http://stackoverflow.com/a/36010631

http://stackoverflow.com/q/21394399
has comment: http://stackoverflow.com/comment/32270005
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21394750
tagged with: java
has comment: http://stackoverflow.com/comment/32270035
has title: Java try-catch not catching exception
type: Question
has comment: http://stackoverflow.com/comment/32270125
tagged with: try-catch
downvote count: 0
has comment: http://stackoverflow.com/comment/32271356
has body: I have the following method: private void checkIfLoggedIn() { try{ try { new WebDriverWait(driver, 10) .until(ExpectedConditions.visibilityOfElementLocated( By.cssSelector("a[href*='score']"))); } catch (WebDriverException e) { } loggedInState = 2; } catch (TimeoutException e) { loggedInState = -1; } } Simply put, this method's job is to wait until the webpage finishes loading the logged-in pa ge, and let the rest of the code know by changing a variable. This code works perfectly the vast majority of the time, however if the driver is closed (by another thread) before it finishes, it crashes. I'm perfectly fine with the code stopping - If the webpage has closed it has most likely finished it's task (or crashed for a different reason). The problem is that the error log (posted below) won't go away. I'v even tried something as broad as catch (Exception e)in order to catch any possible exception, but the crashlog won't go away. Any Advice would be appreciated! EDIT: Thanks to @jdigital, I discovered that the code was in fact catching the exceptions, however that was masked by Selenium outputting it's own exceptions. Any advice on how to have selenium stop outputting errors would be appreciated! Jan 27, 2014 6:48:29 PM org.openqa.selenium.support.ui.ExpectedConditions findElement WARNING: WebDriverException thrown by findElement(By.selector: a[href*='score']) org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: '[Edited out for Privacy]', ip: '[Edited out for Privacy]', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_45' Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307) at org.openqa.selenium.remote.RemoteWebDriver.findE…
accepted answer: http://stackoverflow.com/a/21394750
tagged with: exception
has comment: http://stackoverflow.com/comment/32270178
has comment: http://stackoverflow.com/comment/32270225
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32269954
tagged with: selenium
has comment: http://stackoverflow.com/comment/32270001
has comment: http://stackoverflow.com/comment/32270315
upvote count: 1

http://stackoverflow.com/comment/32405590
has text: *"They are not parent-children relationship."* Why? A child of a particular parent does not have to be modal, but there are other advantages of linking them..
comment on: http://stackoverflow.com/q/21468622
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21493497
has comment: http://stackoverflow.com/comment/32444960
score: 0
tagged with: iterator
accepted answer: http://stackoverflow.com/a/21493518
answer count: 1
has comment: http://stackoverflow.com/comment/32445398
has comment: http://stackoverflow.com/comment/32445002
tagged with: minimum
tagged with: java
has title: Finding minimum value in a collection
tagged with: collections
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21493518
has body: To find the minimum value in a collection of given types, what would I need to set "value" to in order to compare it to "min"? Value should be the next element in the collection and it should iterate until the collection is fully read through. public &lt;T&gt; T min(Collection&lt;T&gt; c, Comparator&lt;T&gt; comp) { if ((c == null) || (comp == null)) { throw new IllegalArgumentException(); } if (c.isEmpty() == true) { throw new NoSuchElementException(); } Iterator itr = c.iterator(); T min = (T)itr.next(); T value = ; while (itr.hasNext()) { if (comp.compare(min, value) &lt; 0) { min = value; } } return min; }

http://stackoverflow.com/a/21497261
accepted answer of: http://stackoverflow.com/q/21497201
answers question: http://stackoverflow.com/q/21497201
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32452060
has body: this is NPE at line Double.parseDouble(..). Create this function public double getDouble(String str) { if (str != null) { if (str.equalsIgnoreCase("")) { return 0; } else { return Double.parseDouble(str); } } else { return 0; } } Then use this code a = getDouble(inputA.getText().toString()); b = getDouble(inputB.getText().toString()); c = getDouble(inputC.getText().toString());
has comment: http://stackoverflow.com/comment/32451876
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32451931

http://stackoverflow.com/a/21365125
answers question: http://stackoverflow.com/q/21365046
type: Answer
has body: You need to step thread what you are doing exactly. Obviously the simplest way to sent a boolean is as a single byte like this. out.write(success ? 1 : 0); and to read this you would do boolean success = in.read() != 0; However, if you need to send a string, I would check what string you are reading and what the correct length is, because there is any number of reasons a binary protocol can fail, e.g. because the previous thing you read/wrote was incorrect.
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21365046

http://stackoverflow.com/a/21421857
type: Answer
has body: Please check if below url helps you http://selenium.polteq.com/en/controlling-a-selectbox-or-dropdownbox-with-selenium-webdriver/ You can check below option public void selectByValue() { Select selectBox = new Select(driver.findElement(By .cssSelector("select#id_contact"))); selectBox.selectByValue("2"); } public void selectByIndex() { Select selectBox = new Select(driver.findElement(By.cssSelector("select#id_contact"))); selectBox.selectByIndex(2); } you can change it according to your requirement
answers question: http://stackoverflow.com/q/21421790
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/21426661
score: 0
answers question: http://stackoverflow.com/q/21426529
has body: deleting the R.Java file in /Gen folder did the trick for me In my case this problem started after eclipse updated the plugin with the v4.0 API release. I fixed it by going to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
type: Answer

http://stackoverflow.com/comment/32404965
has text: dont know what's happening but i'm still getting java.util.MissingResourceException: Can't find bundle for base name MyResource, locale en_US :?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21470742

http://stackoverflow.com/a/21429122
has body: In your Add class, the line public double a, b; does nothing, since the addfn method only adds and returns the method arguments. Since Subtract extends Add, you can work directly with addfn. public double subfn(double d) { c = addfn(5+10); return (c-d); }
answers question: http://stackoverflow.com/q/21428917
score: 0
type: Answer

http://stackoverflow.com/comment/32252632
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21384806
has text: if you don't want to use regex, try with the Scanner class, it's simpler for a beginner http://stackoverflow.com/questions/11871520/how-to-use-the-scanner-class-in-java
score: 0

http://stackoverflow.com/comment/32209605
type: AnswerComment
type: Comment
has text: +1 For not being a cynical old, dried up husk, burnt out by a passionless industry so and so... ;)
comment on: http://stackoverflow.com/a/21361250
score: 1

http://stackoverflow.com/q/21437949
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21438203
linked to: http://stackoverflow.com/q/9554636
answer count: 2
downvote count: 0
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/21438079
accepted answer: http://stackoverflow.com/a/21438079
has comment: http://stackoverflow.com/comment/32345698
possible better answer: http://stackoverflow.com/a/21438203
has comment: http://stackoverflow.com/comment/32345820
score: 1
tagged with: java
has title: Replacement for multiple JFrames
has body: In my program I have a window to pop up when clicked on a button. It does some complex stuff, so it needs to be in it's own class. So instead of multiple JFrames Could I have something else, like a Layout that supports multiple windows. Remember I already have a solution, I'm just asking if there is a better way to do it, a way in which there won't be 1000 task bar icons for 1000 windows.
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/a/21435951
accepted answer of: http://stackoverflow.com/q/21435502
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: There are different options. Extending JButton should IMHO be the last resort, and hardly ever necessary. Looping through the grid[][] array and checking whether they are the source of the respective event may be OK. But another (IMHO simple and elegant) solution is to use anonymous listeners: // Where the grid buttons are created: .... grid[x][y].addActionListener(createActionListener(x, y)); private ActionListener createActionListener(final int x, final int y) { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clickedButton(x, y); } }; } private void clickedButton(int x, int y) { System.out.println("Clicked "+x+" "+y); } EDIT: Again, in form of a http://sscce.org/ (you could have created one, then I could have integrated my answer in your example...) /** * * @author Craig and me :D */ import javax.swing.JFrame; import javax.swing.*; import java.awt.Container; import java.awt.GridLayout; import java.awt.*; import java.awt.event.*; import javax.swing.border.Border; public class menu extends JPanel { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new menu(4,4)); f.setLocationRelativeTo(null); f.pack(); f.setVisible(true); } JButton[][] grid; TextField text = new TextField(20); public menu(int width, int length) { Border playerBorder = BorderFactory.createTitledBorder("Player"); Border comBorder = BorderFactory.createTitledBorder("Com"); JPanel player = new JPanel(); player.setBorder(playerBorder);// set border round player grid player.setLayout(new GridLayout(4,4)); grid=new JButton[width][length]; //allocate the size of grid for(int y=0; y&lt;length; y++){ for(int x=0; x&lt;width; x++){ grid[x][y]=new JButton(); //creates new button player.add(grid[x][y]); //adds button to grid grid[x][y].setBackgrou…
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21435502
has comment: http://stackoverflow.com/comment/32351269

http://stackoverflow.com/a/21491609
score: 5
accepted answer of: http://stackoverflow.com/q/21491550
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21491550
upvote count: 5
has body: Navigate to your file in cmd, and then type java -jar jarfile.jar If you can could you upload the file please?

http://stackoverflow.com/comment/32456489
has text: what is the IDE you used?
score: 0
comment on: http://stackoverflow.com/q/21500213
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32282522
type: Comment
has text: Of course random noise results in big size. In theory, it has maximal possible entropy so it's hard to compress:) Anyway if you're concerned about the results, you should always start with solid filled picture(and you can apply alpha channel to other operations), because transparency can be displayed different on different browsers.
score: 1
comment on: http://stackoverflow.com/a/21389500
type: AnswerComment

http://stackoverflow.com/a/21431971
answers question: http://stackoverflow.com/q/21431658
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: If your problem was to create the chart from given List&lt;Revenue&gt; then try something like the following. DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Revenue revenue : revenueList) { // the middle parameter is for naming the value, can be empty if you have just one dataset.addValue(revenue.getRevenue(), "", revenue.getId()); } JFreeChart chart = ChartFactory.createBarChart( "", "", "Revenues", dataset, PlotOrientation.VERTICAL, true, false, false ); // or whatever parameters you need Info about the static factory method is here.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21431658

http://stackoverflow.com/comment/32262757
comment on: http://stackoverflow.com/q/21389079
score: 0
type: Comment
type: QuestionComment
has text: I've initiated Connection in Support.java that contain definition of add(). But add(); is called from Frame2.java .... Should I have to write Connection in Frame2.java or Make Connection object static in any one of the mentioned class. What to do next?

http://stackoverflow.com/a/21409479
score: 0
answers question: http://stackoverflow.com/q/21409183
type: Answer
has body: Go to root of your class files. For example c:/proj/classes. If your class name is MyClass and it belongs to package com.mycompany you should find file com/mycompany/MyClass.class there. If so type in command prompt java com.mycompany.MyClass and press ENTER. Pay attention that when you are using javac you have to type the extension *.java, however when you are running the class you have not type extension .class. The string com.mycompany.MyClass is called fully qualified class name. This name is used by JVM to load class.

http://stackoverflow.com/a/21419622
downvote count: 0
has comment: http://stackoverflow.com/comment/43263160
has comment: http://stackoverflow.com/comment/32314613
has comment: http://stackoverflow.com/comment/32327728
accepted answer of: http://stackoverflow.com/q/21419508
score: 7
answers question: http://stackoverflow.com/q/21419508
has comment: http://stackoverflow.com/comment/44938553
has comment: http://stackoverflow.com/comment/32314142
upvote count: 7
type: AcceptedAnswer
type: Answer
has body: You can sort the array and fetch second last element which executes in O(nlogn), but this works only if you are sure that there are no duplicates in the array else this method is unreliable. You can iterate through the array maintain counters for highest and second highest and return 2nd highest. This executes in O(n) Example: int highest = Integer.MIN_VALUE+1; int sec_highest = Integer.MIN_VALUE; for(int i : b) //b is array of integers { if(i&gt;highest) { sec_highest = highest; //make current highest to second highest highest = i; //make current value to highest } else if(i&gt;sec_highest &amp;&amp; i != highest) { sec_highest = i; } } Another solution is: int b[] = {1, 2, 31,22,12,12}; Arrays.sort(b); System.out.println(b[b.length-2]);

http://stackoverflow.com/comment/32268441
type: Comment
has text: I'll try that right now, thanks. FYI, `ProcessBuilder pb = new ProcessBuilder("cmd", "/c", file.toString());`
comment on: http://stackoverflow.com/a/21393379
score: 0
type: AnswerComment

http://stackoverflow.com/q/21410359
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/21410397
has body: I need a value as close to 0 as possible. I need to be able to divide through this value, but it should be effectively 0. Does Java provide an easy way of generating a double with only the least significant bit set? Or do I have to calculate it myself? //EDIT: A little background information, because someone requested it. I know that my soultion is not a particularly clean one, but here you are: I am writing a program for homework. It calculates the resistance of a circuit consisting of multiple resistors in parallel and serial circuits. It is a 2nd year programming class. Our teacher still designs classes for us, we need to implement them according to his design. Parallel circuits involve calculation of 1/*resistance*, therefore my program prohibits creation of resistors with 0 Ohm. Physics tells you that this is impossible anyway (you have just a tiny little resistance in every metal). However, the example circuit we should use to test the program contains a 0 Ohm resistor. It is placed in a serial circuit, but resistors do not know where they are (the teacher designed it that way), so I cannot change my program to allow resistors with 0 Ohm resistance in serial circuits only. Two solutions: Allow 0 Ohm resistors in any case - if division by 0 occurs, well, bad luck Set the resistor not to 0, but to a resistance one can neglect. Both are not very good. The first one seemed not too good to me, and neither did the second, but I had to decide. It was just a random choice that threw up the problem. I could not let go without solving it, so switching to the first one was not an option anymore ;-)
has comment: http://stackoverflow.com/comment/32299659
has comment: http://stackoverflow.com/comment/32298311
has comment: http://stackoverflow.com/comment/32297350
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/32298113
has title: Double as close to 0 as possible?
tagged with: double
has comment: http://stackoverflow.com/comment/32301413
has comment: http://stackoverflow.com/comment/32297780
has comment: http://stackoverflow.com/comment/32297864
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: floating-point
type: Question
has answer: http://stackoverflow.com/a/21410429
accepted answer: http://stackoverflow.com/a/21410397
possible better answer: http://stackoverflow.com/a/21410429

http://stackoverflow.com/comment/32442751
score: 1
comment on: http://stackoverflow.com/a/21492250
has text: While I don't doubt your comments, the OP makes no mention of Swing in particular. I think you'll find almost all GUI frameworks have the same problem though ;)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32329504
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21428605
has text: Well, since count is volatile and its been assigned a new value both the threads should see the latest value of 3. Both threads cannot read value to be same while incrementing anyways.

http://stackoverflow.com/a/21455845
accepted answer of: http://stackoverflow.com/q/21455346
has comment: http://stackoverflow.com/comment/32379492
answers question: http://stackoverflow.com/q/21455346
type: Answer
has comment: http://stackoverflow.com/comment/32399463
downvote count: 0
has comment: http://stackoverflow.com/comment/32379604
has comment: http://stackoverflow.com/comment/32378141
score: 7
has comment: http://stackoverflow.com/comment/32377503
has body: I don't have the money to buy an SSL certificate You can't afford not to. You've already wasted more in time than the certificate will cost you. so I thought of making one myself (theoretically with java Not with the Java JRE alone. The users won't trust it like they trust SSL but it would provide the security I'm looking for. Not if the users don't trust it, it won't. If SSL encrypts the password/info/whatever on the client's computer and than sends it to the server for decryption, what problem would there be for a sniffer to sniff the encoded password and send it to the server? It's considerably more complex than that. The client authenticates the server's identity via PKI and the server's certificate. Client and server then negotiate a symmetric session key using the math you referred to. The key itself is never transmitted. Data is encrypted with this key, and sent along with a message authentication code that shows whether the message is intact. Because of the encryption, the data is private; and because of the way the key is negotiated, SSL also provides invulnerability to replay attacks.
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/comment/32400183
score: 0
type: Comment
has text: why +97? I dont understand that part
comment on: http://stackoverflow.com/a/21468236
type: AnswerComment

http://stackoverflow.com/comment/32451360
has text: You can replace System.out to throw an Error and this would give a stack trace of where this is called.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21497351
type: Comment

http://stackoverflow.com/comment/32455673
type: Comment
has text: New problem is when I pressed backspace, the MessageDialog comes out. That is not supposed to happen.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21499809

http://stackoverflow.com/q/21420029
has answer: http://stackoverflow.com/a/21438263
has comment: http://stackoverflow.com/comment/32346250
tagged with: recursion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32343024
tagged with: pseudocode
has comment: http://stackoverflow.com/comment/32315180
type: Question
downvote count: 2
has title: Can you quickly tell me if this pseudocode makes sense or not?
has comment: http://stackoverflow.com/comment/32316605
score: -2
has comment: http://stackoverflow.com/comment/32315178
answer count: 1
favorite count: 0
has body: I believe my code is now foolproof. I will write up the pseudocode now. But I do have one question. Why does DRJava ask that I return something outside of my if statements? As you can see I wrote for ex: "return 1;" just because it asked. It will never return that value however. Can someone explain this to me? public class assignment1question2test { public static void main(String[] args) { int[] a = new int[50]; int l = 0; int r = a.length; for(int i=0; i&lt;r; i++) { a[i] = 1; } a[0] = 10; for (int i=0; i&lt;r; i++) { System.out.println(a[i]); } System.out.print(recursiveSearch(a,l,r)); } public static int recursiveSearch (int[] a, int l, int r) { int third1 = (r-l)/3 + l; int third2 = third1*2 - l + 1; System.out.println("i will be checking compare from " + l + " to " + third1 + " and " + (third1 + 1) + " to " + third2); int compareResult = compare(a,l,third1,third1 + 1, third2); if(r-l == 1) { if (compareResult == 1) { return l; } else { return r; } } if (compareResult == 0) { return recursiveSearch(a,third2 + 1, r); } if (compareResult == 1) { return recursiveSearch(a,l,third1); } if (compareResult == -1) { return recursiveSearch(a,third1 + 1, third2); } return 1; } public static int compare(int[] a, int i, int j, int k, int l) { int count1 = 0; int count2 = 0; for(int g=i; g&lt;=j; g++) { count1 = count1 + a[g]; } for(int g=k; g&lt;=l; g++) { count2 = count2 + a[g]; } if (count1 == count2) { return 0; } if (count1 &gt; count2) { return 1; } if (count1 &lt; count2) { return -1; } return 0; } } UPDATED FINAL PSEUDOCODE: Algorithm: recursiveSearch (a,l,r) Inputs: An array a, indices l and r which delimit the part of interest. Output: The index that has the lead coin. int third1 ← (r - l + 1)/3 int third2 ← third1*2 - l + 1 if (r-l = 0) then return l int compareResult ← compare(a,l,third1,third1 + 1,third2) if (r-l = 1) then if (compareResult = 1) then return l else return r if (compareResult = 0) then return recursiveSearch(a, third2 + 1, r) if (compareResult = "1…
type: UnansweredQuestion

http://stackoverflow.com/a/21488484
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21488419
upvote count: 1
downvote count: 1
has body: When it comes to java excel you should try out Apache POI.

http://stackoverflow.com/a/21438263
has comment: http://stackoverflow.com/comment/32352066
has comment: http://stackoverflow.com/comment/32349809
has comment: http://stackoverflow.com/comment/32355698
has comment: http://stackoverflow.com/comment/32349849
has comment: http://stackoverflow.com/comment/32358494
has comment: http://stackoverflow.com/comment/32359217
type: Answer
has comment: http://stackoverflow.com/comment/32350564
has comment: http://stackoverflow.com/comment/32350619
has comment: http://stackoverflow.com/comment/32359356
has comment: http://stackoverflow.com/comment/32351708
has comment: http://stackoverflow.com/comment/32357687
has body: You seem to be including mid in the following search regardless of which side is larger. The recursive calls should both exclude mid from their search space. Also, for the comparison to be meaningful, the two groups being compared need to be of equal size. That will require some extra odd/even logic.
has comment: http://stackoverflow.com/comment/32350455
has comment: http://stackoverflow.com/comment/32350781
score: 0
answers question: http://stackoverflow.com/q/21420029
has comment: http://stackoverflow.com/comment/32350065
has comment: http://stackoverflow.com/comment/32359531

http://stackoverflow.com/q/21378128
tagged with: eclipse
tagged with: jdwp
score: 0
has comment: http://stackoverflow.com/comment/32244185
has title: Remote debugging error using JDWP from a JUnit test
has comment: http://stackoverflow.com/comment/32243483
has body: I am using Eclipse Juno w/ Maven and have a JUnit test which uses Jemmy to start up another Java application and run automated testing on it via event queue. Because of limitations of the application being tested, and we want to run multiple instances of the application, it has to be run in its own process. So the main class I run my JUnit test from sets up the environment, then creates a process via ProcessBuilder, and executes that process to spawn a Jemmy worker &amp; target application in the same process/jvm. My problem is that I want to debug the spawned process and I seem to be unable to do so following all the other Eclipse remote debugging guides. My processbuilder looks like this ProcessBuilder builder = new ProcessBuilder( javaBin, "-Xmx512M", "-Xdebug", "-Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=y", "-cp", classpath, "-Djava.library.path=./native", "-D" + PID_PROP + "=" + newPid, MyJemmyTestHarness.class .getCanonicalName()); No matter what port I specify I get the same error ERROR: transport error 202: bind failed: Address already in use I've tried dozens of ports, ones I know that are not in use, and the processbuilder simply refuses to start with a JDWP port open. So I think I have a systematic problem with how I'm trying to do this but I am not very experienced in this area. I have followed the remote debugging guides almost to the letter e.g.: Remote debugging a Java application http://javarevisited.blogspot.nl/2011/02/how-to-setup-remote-debugging-in.html Yet the Address Already in Use error persists. Any ideas?
type: UnansweredQuestion
tagged with: remote-debugging
linked to: http://stackoverflow.com/q/975271
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32240039
type: Question

http://stackoverflow.com/comment/32193101
comment on: http://stackoverflow.com/q/21351826
has text: The fact that you get "Activity" not found points to a problem with locating the Android libraries. Are you sure you've set up everything correctly? What is the content of your ant.properties file?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21456470
has comment: http://stackoverflow.com/comment/32389745
answers question: http://stackoverflow.com/q/21357538
accepted answer of: http://stackoverflow.com/q/21357538
has comment: http://stackoverflow.com/comment/32421251
score: 0
has body: It is impossible to truly compose two non-interface classes in Java. If those two objects have a common structure (by A), then this would result in a conflict since any field or method in A would be doubled what is illegal in Java. However, if there is no such conflicting information present, then the classes B and C should not share a super class A. If you want to apply this sort of mixin delegation, you will need to create some interface abstraction for your classes. These interfaces can then be combined inside a proxy and delegate to the instances of B and C depending on which of those implement an interface. This, and nothing more, is offered by cglib's Mixin. Here is an example of how the composition with cglib works: public interface Interface1 { String first(); } public interface Interface2 { String second(); } public class Class1 implements Interface1 { @Override public String first() { return "first"; } } public class Class2 implements Interface2 { @Override public String second() { return "second"; } } public interface MixinInterface extends Interface1, Interface2 { /* empty */ } @Test public void testMixin() throws Exception { Mixin mixin = Mixin.create(new Class[]{Interface1.class, Interface2.class, MixinInterface.class}, new Object[]{new Class1(), new Class2()}); MixinInterface mixinDelegate = (MixinInterface) mixin; assertEquals("first", mixinDelegate.first()); assertEquals("second", mixinDelegate.second()); }
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21457016
has body: When i run my app on Android 2.3 devices.I am getting an java.lang.ClassCastException: android.widget.ImageView .But it works perfect in other Devices. If i Comment the below Lines it is working.But i can't find any Error's in these Lines. Any Suggestions ??? up = (Button) findViewById(R.id.up); down = (Button) findViewById(R.id.down); start = (Button) findViewById(R.id.start); stop = (Button) findViewById(R.id.stop); up.setOnClickListener(this); down.setOnClickListener(this); start.setOnClickListener(this); stop.setOnClickListener(this); Activity public class Presentation extends MainActivity implements ControllerDroidActionReceiver, OnClickListener { Button up, down, start, stop; private ControllerDroid application; private ControlView controlView; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.application = (ControllerDroid) this.getApplication(); ActionBar ab = getSupportActionBar(); ab.setTitle("Presentation"); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View contentView = inflater.inflate(R.layout.presentation, null, false); mDrawer.addView(contentView, 0); up = (Button) findViewById(R.id.up); down = (Button) findViewById(R.id.down); start = (Button) findViewById(R.id.start); stop = (Button) findViewById(R.id.stop); up.setOnClickListener(this); down.setOnClickListener(this); start.setOnClickListener(this); stop.setOnClickListener(this); } @Override public void onClick(View v) { if (v == up) { application.sendAction(new KeyboardAction(19)); // Log.i("Button", "UP"); } else if (v == down) { application.sendAction(new KeyboardAction(20)); } else if (v == start) { application.sendAction(new KeyboardAction(26)); // Log.i("Button", "STARTED PPT"); } else if (v == stop) { application.sendAction(new KeyboardAction(23)); } } @Override protected void onResume() { super.onResume(); this.application.registerActionReceiver(this); } protected void onPause() { super.onPause(…
downvote count: 0
tagged with: button
has comment: http://stackoverflow.com/comment/32379360
tagged with: android
possible better answer: http://stackoverflow.com/a/21457388
favorite count: 0
accepted answer: http://stackoverflow.com/a/21457285
has comment: http://stackoverflow.com/comment/32379511
upvote count: 1
type: AnsweredQuestion
has title: java.lang.ClassCastException only on Android 2.3?
has answer: http://stackoverflow.com/a/21457285
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21457388
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32379389

http://stackoverflow.com/comment/32474206
type: AnswerComment
has text: i cant understand your question ?
comment on: http://stackoverflow.com/a/21509970
type: Comment
score: 0

http://stackoverflow.com/q/21491770
has answer: http://stackoverflow.com/a/21491817
tagged with: regex
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21491817
score: 0
has body: First and foremost, this is not a homework/school question. This is something I needed for a personal project and was able to generalize the problem using simple characters as follows: Create a regular expression which can be used in the java string replaceAll function for an input string aaabaabaa (or similar) and converts each a to A, UNLESS it is preceded by a b. So the expected output is AAAbaAbaA. I've been trying this for at least 2 hours now... The best I could come up with was: replaceAll("^a|([^b])a", "$1A"); This fails on aaa, where the return value is AaA I'm trying to say "Any 'a' without a 'b' before it should be an A. Any ideas for a RegEx novice? Thanks very much!
answer count: 1
has title: Using Regular Expressions to replace a select instance of a character

http://stackoverflow.com/comment/32210252
has text: to detect the disconnection!, and retrieve the connection, not matter about the reason of disconnection..
type: Comment
comment on: http://stackoverflow.com/a/21361475
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32359971
has text: @MartijnCourteaux `finalize()` bears the danger of reclaiming the object which is going to be GCed and therefore prevent the actual GC of the object. PhantomReferences do not allow this, however if someone keeps the reference to the PR alive, this will also prevent the GC.
comment on: http://stackoverflow.com/q/21445354
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/93728589
type: Comment
has text: What/Where is `Utils`? Does it belong to Selenium or Java?
score: 0
comment on: http://stackoverflow.com/a/21422329
type: AnswerComment

http://stackoverflow.com/comment/105092049
type: Comment
has text: Hi Deep, welcome. Please consider adding more information.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/59455216

http://stackoverflow.com/a/21361754
type: Answer
upvote count: 4
has body: I would like to allow all charichters but new line and "." You can use this negation based regex: %([^.%\\n\\r]*)% [^.%\\n\\r] means match anything but DOT OR % OR new line characters
downvote count: 0
answers question: http://stackoverflow.com/q/21361694
score: 4

http://stackoverflow.com/a/21604115
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21456080
answers question: http://stackoverflow.com/q/21456080
type: AcceptedAnswer
downvote count: 0
has body: I have figured this out. In Paper class, I have used some other classes, such as Sentence.class, PaperIndex.class, but I did not add them in addClasses() method. This referred classse can not be found so the injection failed. How stupid am I...
type: Answer

http://stackoverflow.com/comment/32322646
comment on: http://stackoverflow.com/q/21424846
has text: then you have to create another bitmap from the bitmap that you get from the camera
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21367554
answer count: 2
has comment: http://stackoverflow.com/comment/32220987
has comment: http://stackoverflow.com/comment/32220916
has answer: http://stackoverflow.com/a/21367740
has comment: http://stackoverflow.com/comment/32221103
has comment: http://stackoverflow.com/comment/32221000
has title: Java return type is an Object. Complains about initialization. Best approach with use of try and catch
has comment: http://stackoverflow.com/comment/32220958
has body: I have this public method within a class public Flight getFlight(int flightNumber){ Flight flightFound; try{ for (int i=0; i&lt;fl.length; i++){ if(fl[i].getFlightNumber()==flightNumber){ flightFound= fl[i]; } } }catch(Exception e){ System.out.println("The object does not exist"); } finally{ return flightFound; } } The purpose of method within a learning exercise, is to return the corresponding object with the flight number passed in to the method. What would be good error checking like try catch blocks? Also the current method complains that return flightFound may not be initialized. So my question would be what are some good practices with returning the object, and error checking if the object is not present? public class Manager { Flight[] fl; Ticket[] ticket; public void createFlights(){ this.fl = new Flight[5]; for (int i=0; i&lt;5; i++){ fl[i]= new Flight(); } this.fl[0].Flight(1030, "Toronto", "Kolkata", "03/02/14 7:50 pm", 250, 1450.00); this.fl[1].Flight(1040, "Toronto", "Lahore", "03/02/14 7:10 pm", 250, 1450.00); this.fl[2].Flight(1050, "Toronto", "Kolkata", "03/02/14 1:50 pm", 250, 1450.00); this.fl[3].Flight(1060, "Toronto", "Lahore", "03/02/14 1:10 pm", 250, 1450.00); this.fl[4].Flight(1070, "New York", "Kolkata", "03/02/14 4:50 pm", 250, 1450.00); } public void displayAvailableFlights(String origin, String destination){ for(int i=0; i&lt;5; i++){ if ((this.fl[i].getOrigin().equals(origin)) &amp;&amp;(this.fl[i].getDestination().equals(destination))){ if (this.fl[i].getNumberOfSeatsLeft()&gt;0){ System.out.println(this.fl[i].toString()); } } } } public Flight getFlight(int flightNumber){ Flight flightFound = new Flight(); try{ for (int i=0; i&lt;fl.length; i++){ if(fl[i].getFlightNumber()==flightNumber){ flightFound= fl[i]; } } } catch(Exception e){ System.out.println("The object does not exist"); } finally{ return flightFound; } } public static void main(String[] args){ Manager man = new Manager(); Flight flightFound = new Flight(); man.createFlights(…
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32221057
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/21367613

http://stackoverflow.com/a/21432993
score: 0
has body: String[] variables = value.split(" "); http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split%28java.lang.String%29
answers question: http://stackoverflow.com/q/21432911
type: Answer

http://stackoverflow.com/q/21355363
score: 2
has answer: http://stackoverflow.com/a/21359459
type: AnsweredQuestion
tagged with: java
tagged with: itext
type: Question
answer count: 2
has title: How to parse untagged pdf file with iText
has body: I want to parse this file (http://www.bbm.ca/_documents/top_30_tv_programs_english/2011/nat01032011.pdf) with iText. The problem is it is not tagged so I can't get the XML file. I decided to extract the text from it and I thought that for example the first line will be like : 1\specialCharWJC:PLAYOFFS CANADA\specialCharTSN+\specialCharM.W....\specialChar19:30\specialChar21:57\specialChar5133 The text I extracted for the first line is 1 WJC:PLAYOFFS CANADA TSN+ M.W.... 19:30 21:57 5133 I extracted the text using : PdfReader reader = new PdfReader(filename); String str = PdfTextExtractor.getTextFromPage(reader, 1); How the PDf viewer know that CANADA is in the second column not in the third. My current solution is to convert the pdf file to html5 using http://www.idrsolutions.com/online-pdf-to-html5-converter/ who can determine the text for each column. Thanks for your response
has answer: http://stackoverflow.com/a/21355933
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21355933
tagged with: pdf-parsing
possible better answer: http://stackoverflow.com/a/21359459

http://stackoverflow.com/comment/103582074
has text: The one solution which solved my problem. Thank you, friend.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21453907
type: AnswerComment

http://stackoverflow.com/a/21440183
has body: The sqrt() method may help. Here is an idea of how to use it: int squareRoot = (int) Math.sqrt((double) input); Input being the number you want to round. Casting the result to an int will automatically round it. It is optional. I cast the input to a double, but you only need to do so if your input in an int. Here is an easier way to check if a number is prime: if (input % 2 == 0){ input += 1; } return input; I reccomend you look at @useSticks answer again. Using the approach he described I created a method that does exactly what I think you want. Here is a method that finds the square root of a positive number: public static int sqrt(double number){ double g1; if(number==0){ return 0; } double squareRoot = number/2; do{ g1=squareRoot; squareRoot = (g1 + (number/g1))/2; }while((g1-squareRoot)!=0); return (int) squareRoot; }
score: 0
has comment: http://stackoverflow.com/comment/32351237
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32350430
accepted answer of: http://stackoverflow.com/q/21438803
answers question: http://stackoverflow.com/q/21438803
type: Answer
has comment: http://stackoverflow.com/comment/32350268
has comment: http://stackoverflow.com/comment/32351398
has comment: http://stackoverflow.com/comment/32350826
has comment: http://stackoverflow.com/comment/32351132
has comment: http://stackoverflow.com/comment/32351017

http://stackoverflow.com/comment/32365413
score: 1
type: AnswerComment
has text: @AZ_ That seems wrong to me. Can you edit your question and add the actual code that you are running that works and the one that fails?
type: Comment
comment on: http://stackoverflow.com/a/21448062

http://stackoverflow.com/comment/32263343
score: 0
type: QuestionComment
type: Comment
has text: Yep, in general you should never use float/double numbers to represent money (except perhaps if you're doing stock market analysis and precise to-the-penny results are not needed). As to why, you've demonstrated that above.
comment on: http://stackoverflow.com/q/21390830

http://stackoverflow.com/a/21429515
type: Answer
has comment: http://stackoverflow.com/comment/32331450
has comment: http://stackoverflow.com/comment/32333581
accepted answer of: http://stackoverflow.com/q/21429160
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21429160
has body: something like this: List&lt;String&gt; newList = new ArrayList&lt;String&gt;(); for( String s : yourArray ){ while( s.startsWith( " " ) ){ newList.add( "" ); s = s.substring( 1 ); } int indexToAddValue = newList.size(); while( s.endsWith( " " ) ){ newList.add( "" ); s = s.substring( 0, s.length() - 1 ); } newList.add( indexToAddValue, s ); } String[] newArray = newList.toArray( String[] );
score: 0

http://stackoverflow.com/comment/32373806
has text: `But the problem is to fetch image to my jsp page.` Where is code that fetches records???
comment on: http://stackoverflow.com/q/21452418
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32388193
has text: Thanks. I indeed ended up building the string Query and then using SimpleStringCriteria to create the criteria from it. Let's hope the patch can solve at a later stage.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21456907

android-asynctask
tags question: http://stackoverflow.com/q/21472660
tags question: http://stackoverflow.com/q/21356059
tags question: http://stackoverflow.com/q/21513629
tags question: http://stackoverflow.com/q/21447229
type: Tag
tags question: http://stackoverflow.com/q/21367299
tag name: android-asynctask
tags question: http://stackoverflow.com/q/21462565
tags question: http://stackoverflow.com/q/21350282
tags question: http://stackoverflow.com/q/21438946
tags question: http://stackoverflow.com/q/21402225
tags question: http://stackoverflow.com/q/21507537
tags question: http://stackoverflow.com/q/21468814
tags question: http://stackoverflow.com/q/21351946
tags question: http://stackoverflow.com/q/21480051
tags question: http://stackoverflow.com/q/21423537
tags question: http://stackoverflow.com/q/21514390

http://stackoverflow.com/a/21368961
has comment: http://stackoverflow.com/comment/90690834
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21367907
score: 1
has body: That code probably does not do as much as you think. It simply generates 16 (128 / 8) secure random bytes, then wraps a key object around it. So with nodejs, you simply generate 16 bytes and feed the algorithm the raw key data. If you want to use the generated key, then make sure you create a binary encoded string or buffer from the bytes returned by the getEncoded() method. You could use hexadecimal encoding/decoding if you require the key to be a textual string somewhere in the process. See randomBytes() and createCipheriv() for information. AES keys are just cryptographically strong random bytes, DES (parity bits) and RSA (prime number calculation) keys are not.
has comment: http://stackoverflow.com/comment/32225336
has comment: http://stackoverflow.com/comment/32223896
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32224182
downvote count: 0
has comment: http://stackoverflow.com/comment/90691082
answers question: http://stackoverflow.com/q/21367907
type: Answer
has comment: http://stackoverflow.com/comment/90704627

http://stackoverflow.com/comment/32357708
type: Comment
type: QuestionComment
has text: Are you albe to use Joda Time instead? That's always a good start to "I've got this date/time problem in Java..." Note that the code you've given doesn't mention time zones at all... do you actually *have* a time zone?
score: 1
comment on: http://stackoverflow.com/q/21444301

http://stackoverflow.com/q/21434082
has comment: http://stackoverflow.com/comment/32338747
tagged with: java
has comment: http://stackoverflow.com/comment/32338556
downvote count: 1
has comment: http://stackoverflow.com/comment/32340296
type: Question
linked to: http://stackoverflow.com/q/20090994
has body: package car; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; @WebServlet(name = "detail", urlPatterns = {"/detail"}) public class detail extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ClassNotFoundException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String name=request.getParameter("name"); String emailid=request.getParameter("emailid"); int mobile=Integer.parseInt(request.getParameter("mobile")); String carname=request.getParameter("carname"); int regno=Integer.parseInt(request.getParameter("regno")); int manufacturingyear=Integer.parseInt(request.getParameter("manufacturingyear")); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:userdetail","",""); Statement st=con.createStatement(); st.executeUpdate("insert into userdetail (name,emailid,mobile,carname,regno,manufacturingyear) values('"+name+"','"+emailid+"','"+mobile+"','"+carname+"','"+regno+"','"+manufacturingyear+"',)"); getServletContext().getRequestDispatcher("index.jsp").forward(request, response); out.println(" "); out.println(" "); out.println(" Servlet detail "); out.println(" "); out.println(" "); out.println(" FILL DETAILS "); out.println(" "); out.println(" "); } catch (Exception e) { e.printStackTrace(); } finally { out.close(); } } The values are not inserting the given values into the database(userdetail).In database fields are showing null. Field Datatype name Text emailid Text mobile Int carname Text regno Int manufacturingyear Int
has comment: http://stackoverflow.com/comment/32338721
upvote count: 0
has answer: http://stackoverflow.com/a/21434840
tagged with: jsp
score: -1
has comment: http://stackoverflow.com/comment/32338945
tagged with: servlets
has comment: http://stackoverflow.com/comment/32339334
answer count: 1
has comment: http://stackoverflow.com/comment/32339596
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32339469
has title: This is servlet code to insert value into the database
has comment: http://stackoverflow.com/comment/32338639

http://stackoverflow.com/q/21414124
type: Question
has comment: http://stackoverflow.com/comment/32304022
has title: What does "/" means in namespace attribute of package element in struts.xml?
tagged with: struts
has answer: http://stackoverflow.com/a/21414681
answer count: 3
has answer: http://stackoverflow.com/a/21414421
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21414585
score: 1
tagged with: java
has body: I'm new in struts so I what know the meaning of "/" in namespace of package. i.e. when I put namespace as "/Home" /message.jsp and type this Url : "localhost:8080/Struts2Example/Home/HelloWorld.action" on browser , then page opens. but when I change the namespace to "Home" then it gives "Error : 404". So what's this "/" means ?

http://stackoverflow.com/comment/32450929
score: 0
type: Comment
has text: a [FragmentActivity](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCMQFjAA&url=http%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Fsupport%2Fv4%2Fapp%2FFragmentActivity.html&ei=8dHsUqemDMuS0QW9-YHIDg&usg=AFQjCNE9dlSgxqPBqw4MwuFoxv9GmqDXfQ&sig2=3aNw-2FjfbTKmrousDoEbQ) is not a fragment, but an Activity defined in android support in order to use fragments with `API < 11`.
type: QuestionComment
comment on: http://stackoverflow.com/q/21492598

http://stackoverflow.com/comment/32308522
comment on: http://stackoverflow.com/a/21416104
type: Comment
has text: yes. In that case, you don't need to catch where you call this `callUrl`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32367177
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21429456
has text: I tried this as well but still getting nullpointerexception File fi = new File("D:\\Selenium\\Excel\\Example.xlsx"); try { FileInputStream fis = new FileInputStream(fi); XSSFWorkbook w = new XSSFWorkbook(fis); XSSFCell cell=w.getSheetAt(0).getRow(0).getCell(0); //System.out.println(cell.getStringCellValue()); cell.setCellValue("PASSPASS"); FileOutputStream fos = new FileOutputStream(fi); w.write(fos); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

http://stackoverflow.com/q/21511414
tagged with: trim
tagged with: list
type: UnansweredQuestion
has title: Trim characters from list elements
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/21511891
has body: I have the below code: public class HtmlParser { private Document doc; private List&lt;String&gt;dataList; public HtmlParser(Properties configuration) throws IOException { String url = configuration.getProperty("url"); Document doc = Jsoup.connect(url).get(); this.dataList = new ArrayList&lt;String&gt;(); Elements tableRows = doc.getElementsByTag("tr"); for (Element tr : tableRows){ dataList.add(tr.text()+"\n"); } System.out.println(this.dataList); which prints out the following: [Flights on time 93% , Within 1 hour 99% , FLIGHT FROM TO DEPART ARRIVE STATUS , FR 2111 Manchester Paphos 06:25 13:20 Landed 13:40 , FR 8582 London Stansted Thessaloniki 06:30 11:45 Landed , FR 6093 Gran Canaria Milan Bergamo 06:35 12:05 Landed Early 11:47 , FR 4002 Lanzarote Milan Bergamo 07:15 12:25 Landed , FR 2482 Leeds Bradford Riga 07:20 11:55 Landed , FR 5212 Marrakesh Paris Beauvais 07:20 11:50 Landed Early 11:40 , FR 1041 Gran Canaria Stockholm Skavsta 07:45 14:30 On Time , FR 6342 Rome Fiumicino Barcelona El Prat 08:15 10:00 Estimated Arrival 14:35 , OPERATING FROM FIUMICINO DUE TO WEATHER DIVERSION - PASSENGERS TO BE COACHED TO FIUMICINO AIRPORT , FR 4172 Porto Frankfurt Hahn 08:15 11:45 Landed , FR 4883 Rome Fiumicino Cagliari 08:20 09:30 Landed 12:50 , FR 7062 Dublin Alicante 08:30 12:25 Landed Early 12:05 , FR 1015 Tenerife Sth Stockholm Skavsta 08:30 15:15 On Time , FR 7158 Dublin Madrid 08:45 12:35 Landed Early 12:15 , FR 8405 London Stansted Wroclaw 08:50 11:50 Landed , FR 2065 Porto Dortmund 08:55 12:30 Landed , FR 1031 Tenerife Sth Oslo Rygge 09:00 15:30 On Time , FR 9283 Faro London Stansted 09:05 11:55 Landed Early 11:46 , FR 3071 London Stansted Comiso 09:05 13:15 Landed Early 13:10 , FR 3006 London Stansted Rome Ciampino 09:10 12:35 Landed ] Firstly, I want to remove the , and the whitespace from the start of the rows and have the text starting with FR. I've tried dataList.remove(0) but it doesn't work. Oddly enough, in the console display, all the rows are separated…

http://stackoverflow.com/q/21405092
has comment: http://stackoverflow.com/comment/32288167
has comment: http://stackoverflow.com/comment/32289179
favorite count: 0
tagged with: class
has body: I have a Treemap of people and that treemap is keyed to a name and a person object. That person object has another treemap with more data. I am trying to read data that is not uniform and update said treemap with more data with this code: golfer update = golfers.get(tempName); course getCourse = courses.get(tempCourse); tempDiff = (((tempScore - getCourse.rating) * 113) / getCourse.slope); update.scores.put(tempCalendar, tempDiff); golfers.put(tempName, update); However, upon running through all the code I find that all the data is wiped and only the most recent entry is in the treemap. Any thoughts on what is wrong?
has comment: http://stackoverflow.com/comment/32287875
upvote count: 2
has title: Updating a object in a TreeMap (Java)
type: UnansweredQuestion
tagged with: object
score: 2
has comment: http://stackoverflow.com/comment/32287956
tagged with: java
tagged with: treemap
type: Question
has answer: http://stackoverflow.com/a/21405824
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/32387107
score: 0
type: Comment
type: QuestionComment
has text: Do these functions return some kind of response ? I need to programmatically be able to determine if the process is running.
comment on: http://stackoverflow.com/q/21460775

http://stackoverflow.com/comment/32225261
comment on: http://stackoverflow.com/a/21362925
has text: Order them how? Lowest values?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32267648
has text: This may help you out: [Method name collision in interface implementation - Java](http://stackoverflow.com/questions/2598009/method-name-collision-in-interface-implementation-java)
score: 0
comment on: http://stackoverflow.com/q/21392404
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32420990
has text: On .net side you use RijndaelManaged instead of AesManaged. Rijndael is the algorithm used by AES but in AES there are further restrictions.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21480202
type: QuestionComment

http://stackoverflow.com/comment/32358185
comment on: http://stackoverflow.com/a/21443880
has text: @abcXYZ: I'm not sure what you mean. You haven't really told us what you're trying to achieve - and as I say, this question was only about BigDecimal. Ask a new question about MySQL...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21362930
type: Answer
accepted answer of: http://stackoverflow.com/q/21362659
upvote count: 2
answers question: http://stackoverflow.com/q/21362659
has body: So, well, apart from the fact that the constructor you want to invoke uses a URL object as first parameter instead of a String, I guess the behavior you see may have something to do with the fact that file scheme URI are hierarchical, but if you don't provide any hierarchy symbol (i.e. the slash) the constructor gives priority to the spec part (i.e. the second parameter) over the context part (i.e. the first parameter). For example, when you forget the trailing slash on file:/foo/bar, what you really are indicating is file bar in directory foo. If you pass along a relative path such as images/a.png, the constructor combines the two as best as it can: of course it cannot append a relative path to what it believes to be a file, giving as a result file:/foo/bar/images/a.png, so it just replaces the bar file with the file you passed as second parameter, giving as a result file:/foo/images/a.png. The same applies to your second example: file:foo.bar indicates a foo.bar file, but when you pass the second parameter representing an images.a.png file, the substitution happens as explained in the preceding example, giving a result of file:images.a.png. This happens, I believe, because you are missing hierarchy symbols (i.e. slashes) where you need to have them in order to obtain the desired result. This is really a guess rather than an ol' good informed answer. However, when you type: URL url = new URL(new URL("file:foo.bar/"), "images.a.png"); System.out.println(url); appending a / suffix to one of the parts, as you say you had, the result indeed changes, contrary to what you affirm, giving the following result: file:foo.bar/images.a.png which appears to be consistent with my guesses. Still, since I never used OneJar, from your question is unclear what your input really is, and what you want to obtain as a result.
has comment: http://stackoverflow.com/comment/32212759
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32463999
has text: @bradleyduncan is it works for you my friend
type: Comment
comment on: http://stackoverflow.com/a/21504277
type: AnswerComment
score: 0

http://stackoverflow.com/q/21479331
has title: Can not open beans.xml (config file) because does not exist
has answer: http://stackoverflow.com/a/21479865
type: Question
has comment: http://stackoverflow.com/comment/56679839
has comment: http://stackoverflow.com/comment/117093096
tagged with: java
answer count: 1
downvote count: 0
tagged with: javabeans
has body: Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/main/beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [com/main/beans.xml] cannot be opened because it does not exist ApplicationContext context = new ClassPathXmlApplicationContext("com/main/beans.xml"); I have tried before with ApplicationContext context = new FileSystemXmlApplicationContext("src/main/java/com/main/beans.xml"); And it works well. How to do that relative to the classpath? Note: classpath is in the build path In the example I'm following, it has the following structure and it works Project structure Classpath ApplicationContext context = new ClassPathXmlApplicationContext("com/caveofprogramming/spring/test/beans/beans.xml");
linked to: http://stackoverflow.com/q/12893760
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32418990
has comment: http://stackoverflow.com/comment/52820244
tagged with: spring
has comment: http://stackoverflow.com/comment/32420348
has comment: http://stackoverflow.com/comment/52820082
upvote count: 6
tagged with: http://stackoverflow.com/tag/xml
score: 6

http://stackoverflow.com/q/21467439
has comment: http://stackoverflow.com/comment/32402991
has comment: http://stackoverflow.com/comment/32399201
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22511438
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33261918
tagged with: multithreading
has title: Multiple threads calling the @Cacheable method. Spring cache (3.2.6) is allowing all threads into the method
tagged with: spring
has answer: http://stackoverflow.com/a/38502240
has body: I have a DAO object with a method of the following type. I have injected the DAO into service layer and I'm able to get cached results from this DAO method call. But when multiple threads invoke this method (on a proxy that wraps the DAO singleton) some of those threads still going to fetch the data from my database i.e., the fetchDataFromDb() method call is still executed. Is there a way to get around this? Is this a Spring caching bug? @Override @Cacheable(value = "CacheName") public Map<String, DomainObject> fetchDataFromDb() { .... } Following XML configuration of my Spring application context file. This is a web application. I simulated the multiple threads using JMeter. <cache:annotation-driven />
tagged with: java
has answer: http://stackoverflow.com/a/51905905
has comment: http://stackoverflow.com/comment/33261896
tagged with: caching
type: Question

http://stackoverflow.com/a/21482652
type: Answer
has comment: http://stackoverflow.com/comment/51711951
has comment: http://stackoverflow.com/comment/32683402
downvote count: 0
answers question: http://stackoverflow.com/q/21482602
has body: Yes, you should fully test A. B might change at some point down the road, so just because it uses A now doesn't mean that it always will. B may not use all of the functionality of A which means that you're not testing all of your code.
has comment: http://stackoverflow.com/comment/32660567
score: 8
upvote count: 8

http://stackoverflow.com/comment/32791613
comment on: http://stackoverflow.com/a/21461987
has text: Can any one clear me how JMX works?I have gone through online tutorial but still not sure how JMX works, how to get all the process running on the LINUX machine, how much % these process are using system resources, time etc
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32195864
comment on: http://stackoverflow.com/q/21353113
has text: Sure you can predict it. But it is easier to use a calculator, as you probably cannot do binary IEEE conformant arithmetic in your head.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21489678
downvote count: 0
answers question: http://stackoverflow.com/q/21486900
type: Answer
score: 1
upvote count: 1
has body: Just for help, a modern general purpose sorting algorithm would be: private static &lt;T extends Comparable&lt;? super T&gt;&gt; void bubbleSortObjects(T[] array) { int i = 0; boolean swapped = true; while (swapped &amp;&amp; i &lt; array.length - 1) { i++; swapped = false; for (int j = 0; j &lt; array.length - i; j++) { if (array[j].compareTo(array[j + 1]) &gt; 0) { T temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; swapped = true; } } } }

http://stackoverflow.com/comment/32395099
type: Comment
comment on: http://stackoverflow.com/a/21446920
has text: @user278153 Yes, but that would be another question my friend. I'm sure you can figure it out. I will add that you would have to redo a lot of what you have done. :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/21402189
has body: I am trying to debug an issue in my GWT application that cache.html files are not downloaded to the browser for certain languages.I compiled the code with the DEBUG flag on, and saw that for that particular module, successive permutations have the same names. Eg. [INFO] Permutation 0 (strong name 69FCD2BE193AD6EDC4FD6FDEF49874E4) has an initial download size of 98999 and total script size of 98999 [INFO] Permutation 1 (strong name 69FCD2BE193AD6EDC4FD6FDEF49874E4) has an initial download size of 98999 and total script size of 98999 [INFO] Permutation 2 (strong name 69FCD2BE193AD6EDC4FD6FDEF49874E4) has an initial download size of 98999 and total script size of 98999 [INFO] Permutation 3 (strong name 658D84625663D1AD2C6C092B59783BA2) has an initial download size of 99004 and total script size of 99004 [INFO] Permutation 4 (strong name 69FCD2BE193AD6EDC4FD6FDEF49874E4) has an initial download size of 98999 and total script size of 98999 [INFO] Permutation 5 (strong name 69FCD2BE193AD6EDC4FD6FDEF49874E4) has an initial download size of 98999 and total script size of 98999 [INFO] Permutation 6 (strong name 979A66F54677F53C0E4A1E29A2C00FE5) has an initial download size of 94649 and total script size of 94649 [INFO] Permutation 7 (strong name 979A66F54677F53C0E4A1E29A2C00FE5) has an initial download size of 94649 and total script size of 94649 [INFO] Permutation 8 (strong name 979A66F54677F53C0E4A1E29A2C00FE5) has an initial download size of 94649 and total script size of 94649 I have verified that the particular module has all the entries related to the languages in its gwt.xml file. Eg. &lt;extend-property name="locale" values="en_US" /&gt; &lt;extend-property name="locale" values="nl" /&gt; &lt;extend-property name="locale" values="da" /&gt; &lt;extend-property name="locale" values="de" /&gt; What could be a possible reason for this behaviour?
tagged with: java
type: Question
tagged with: javascript
has title: Why does GWT generate permutations having the same strong name?
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: localization
has answer: http://stackoverflow.com/a/21408903
tagged with: gwt

http://stackoverflow.com/comment/32200042
has text: No problem lol, I was like what? Then I read what I wrote and was like ohhh that's why haha
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21355834

http://stackoverflow.com/q/21383345
has comment: http://stackoverflow.com/comment/32268239
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22684489
has comment: http://stackoverflow.com/comment/32269231
has body: I have a set of the keywords (over 600) and I want to use streaming api to track tweets with them. Twitter api limits the number of keywords, which you are allowed to track, to 200. So I decided to have several threads that will do it, using several OAuth tokens for this. This is how I do it: String[] dbKeywords = KeywordImpl.listKeywords(); List&lt;String[]&gt; keywords = ditributeKeywords(dbKeywords); for (String[] subList : keywords) { StreamCrawler streamCrawler = new StreamCrawler(); streamCrawler.setKeywords(subList); Thread crawlerThread = new Thread(streamCrawler); crawlerThread.start(); } This is how words are distributed among threads. Each thread receives no more than 200 words. This is the implementation of the StreamCrawler: public class StreamCrawler extends Crawler implements Runnable { ... private String[] keywords; public void setKeywords(String[] keywords) { this.keywords = keywords; } @Override public void run() { TwitterStream twitterStream = getTwitterInstance(); StatusListener listener = new StatusListener() { ArrayDeque&lt;Tweet&gt; tweetbuffer = new ArrayDeque&lt;Tweet&gt;(); ArrayDeque&lt;TwitterUser&gt; userbuffer = new ArrayDeque&lt;TwitterUser&gt;(); @Override public void onException(Exception arg0) { System.out.println(arg0); } @Override public void onDeletionNotice(StatusDeletionNotice arg0) { System.out.println(arg0); } @Override public void onScrubGeo(long arg0, long arg1) { System.out.println(arg1); } @Override public void onStatus(Status status) { ...Doing something with message } @Override public void onTrackLimitationNotice(int arg0) { System.out.println(arg0); try { Thread.sleep(5 * 60 * 1000); System.out.println("Will sleep for 5 minutes!"); } catch (InterruptedException e) { e.printStackTrace(); } } @Override public void onStallWarning(StallWarning arg0) { System.out.println(arg0); } }; FilterQuery fq = new FilterQuery(); String keywords[] = getKeywords(); System.out.println(keywords.length); System.out.println("Listening for "…
tagged with: java
tagged with: multithreading
tagged with: twitter
has title: Using multiple threads to get data from twitter using twitter4j
type: Question
tagged with: twitter4j
has answer: http://stackoverflow.com/a/22684489
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32267209
favorite count: 0
linked to: http://stackoverflow.com/q/17137037
upvote count: 2

http://stackoverflow.com/comment/32409388
has text: Check the logs, maybe it say something. Also try switch into an empty workspace, maybe something is slowing it down (eg: indexing maven repository).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21473391

http://stackoverflow.com/q/21413384
favorite count: 0
has title: How to show a progress bar for a layout until the SmartImageView is loaded
tagged with: android
has answer: http://stackoverflow.com/a/21413888
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
tagged with: internalsvisibleto
downvote count: 0
tagged with: load
has answer: http://stackoverflow.com/a/21413867
has body: How can I trigger spinner.setVisibility(View.GONE); after SmartImageView is loaded? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity); mUrl = getIntent().getStringExtra(URL); Image = (SmartImageView) findViewById(R.id.ivP); final ProgressBar spinner = (ProgressBar) findViewById(R.id.loading); spinner.setVisibility(View.VISIBLE); Image.setImageUrl(mUrl); spinner.setVisibility(View.GONE); }

http://stackoverflow.com/comment/32453558
score: 0
type: Comment
type: QuestionComment
has text: Returns 0 value!! why?!!!
comment on: http://stackoverflow.com/q/21498563

http://stackoverflow.com/comment/32394396
type: AnswerComment
type: Comment
score: 0
has text: ya it help you and you can also read this http://danzig.jct.ac.il/java_class/recursion.html
comment on: http://stackoverflow.com/a/21464556

http://stackoverflow.com/comment/32344256
type: Comment
has text: No but `apache.lang3` contains as I wrote constants for space, empty, linefeed. Maybe I missed something and any common/apache string util contains also separator chars?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21437180

http://stackoverflow.com/a/21510397
has comment: http://stackoverflow.com/comment/32475093
score: 0
answers question: http://stackoverflow.com/q/21510184
type: Answer
has body: can u specify what the error is?? or the line in whcih ur gettting error? Figure it the folder that contains the database file,further must be writeable by the user and since it is a web app it will be running as a user that did not have the correct permissions. besides sqlLite is not well suited for multiuser operation. it locks the database by creating a lock file in the same directory as the database. If you know it shouldn't be locked you can delete that file to unlock it.

http://stackoverflow.com/q/21371676
has title: How to have a JButton insert information into a JTextArea from another classes method? - java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21372145
has body: I'm having a hard time figuring out how to call information from another classes method, into a JTextArea when you press a JButton. jbutton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { jtextarea. ???? } }); I can make it print text if the text is already specified within the action performed and other methods that are specified for jtextarea methods. But I want the text area to return values from other methods in other classes. How can I do this? More info: I'm getting information from a URL connection, that information is parsed into a string which becomes a company, then there is another class that takes the companies and adds methods for printing. In addition I'm multi-threading the connection for uptodate info. But as these are kinda interacting aspects, I can't just type the information in the jtextarea, I need to call the method to insert the company information. How can I call methods that will deliver values and text into the jtextarea?
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32228992
has comment: http://stackoverflow.com/comment/32228678
score: 0
has answer: http://stackoverflow.com/a/21372224
has comment: http://stackoverflow.com/comment/32229358

http://stackoverflow.com/a/21472083
type: Answer
has comment: http://stackoverflow.com/comment/32416247
score: 0
has body: Where in the XML are you setting the attribute for the AuditQuestionNumber? The constructor is defaulting the value of the class attribute to 0 if the XML being used to inflate the class doesn't include the attribute: AuditQuestionNumber = attrs.getAttributeIntValue("http://schemas.android.com/apk/com.bc.workbench", "AuditQuestionNumber", 0);
has comment: http://stackoverflow.com/comment/32418988
has comment: http://stackoverflow.com/comment/32532387
has comment: http://stackoverflow.com/comment/32527354
answers question: http://stackoverflow.com/q/21469978

http://stackoverflow.com/a/21502178
accepted answer of: http://stackoverflow.com/q/21502153
has comment: http://stackoverflow.com/comment/32461234
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32460497
answers question: http://stackoverflow.com/q/21502153
type: Answer
has body: Rather than using Threads manually, submit your tasks to an ExecutorService, and use a CountDownLatch, CyclicBarrier, or Phaser to synchronize them, depending on whether you need multiple cycles of your job and whether you have the same number of task components in each cycle. Depending on what specifically your process consists of, a ForkJoinPool might be an option to consider; it basically wraps up the idea of "perform this same operation on a bunch of items and collect the results".

http://stackoverflow.com/comment/32260939
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21389029
has text: I totally agree with @yshavit

http://stackoverflow.com/comment/32313951
type: Comment
type: QuestionComment
has text: Thanks guys for the responses, Arrays.sort would have been more efficient solution, trying to study up for job interviews and test different data structures
score: 0
comment on: http://stackoverflow.com/q/21419508

http://stackoverflow.com/a/21454134
has body: You can do cast in this case: (Inteder extends Number) List&lt;IMyType&gt; list1 = new ArrayList&lt;&gt;(); List&lt;? extends IMyType&gt; list2 = new ArrayList&lt;&gt;(); list2 = list1;
type: Answer
answers question: http://stackoverflow.com/q/21453978
score: 0

http://stackoverflow.com/q/21441026
tagged with: math
tagged with: java
upvote count: 1
has title: Get frequency from microphone input and FFT- Java
downvote count: 1
type: Question
has body: My goal is to be able to process a single note from a guitar (or other instrument), and convert it into a frequency value. This does not have to be in real time- I figured it would be much easier to record a one-second sound and analyse the data afterwards. I understand that to do this I need to use a Fourier transform (and have a class that will perform a FFT). However, I don't really understand the input / output of a FFT algorithm- the class I am using seems to use a complex vector input and give a complex vector output. What do these represent? Also, could anyone recommend any Java classes that can detect and record an input (and if possible, give frequency or values that can be plugged into FFT?)? Thanks in advance.
has comment: http://stackoverflow.com/comment/32351795
accepted answer: http://stackoverflow.com/a/21441725
score: 0
tagged with: microphone
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32351529
tagged with: fft
has comment: http://stackoverflow.com/comment/32351817
has comment: http://stackoverflow.com/comment/32352120
has comment: http://stackoverflow.com/comment/32351752
has comment: http://stackoverflow.com/comment/32351598
has comment: http://stackoverflow.com/comment/32351936
tagged with: audio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21441725

http://stackoverflow.com/q/21505006
tagged with: grails
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21505202
has title: how to parse json data encoded with square brackets
has body: I'm using mailgun and the webhook sends a post to my server with json data in the following format. I am not familiar with how to parse this type of json request that doesn't use curly brackets. I'm not sure what the format is called to search for a solution. I need to parse the return string and be able to access the elements as json['Received'] [["Received", "by luna.mailgun.net with SMTP mgrt 8778766572977; Sat, 01 Feb 2014 22:55:12 +0000" ["X-Envelope-From", "&lt;person@domain.com&gt;" ["Return-Path", "&lt;person@domain.com&gt;" ["Received", "from some data here Sat, 01 Feb 2014 14:55:09 -0800 (PST)" ["Content-Type", "text/plain; charset=\"us-ascii\"" ["Mime-Version", "1.0 (Mac OS X Mail 6.6 \\(1510\\))" ["Subject", "Re: Hello world" ["From", "AT &lt;you@you.com&gt;" ["In-Reply-To", "&lt;20140201225343.7954.82391@mydomain.com&gt;" ["Date", "Sat, 1 Feb 2014 16:55:08 -0600" ["Content-Transfer-Encoding", "7bit" ["Message-Id", "&lt;86C3EA0C-5D9B-4BFA-A76B-54CFC3238714@you.com&gt;" ["References", "&lt;20140201225343.7954.82391@mydomain.com&gt;" ["To", "messages@mydomain.com" ["X-Mailgun-Incoming", "Yes"]]
upvote count: 0
type: UnansweredQuestion
type: Question
tagged with: java
score: -1

http://stackoverflow.com/comment/32261087
type: Comment
type: QuestionComment
has text: There is no such thing as a "binary value". If you have an integer value, you can write it down as a binary *number*, or a decimal *number*, and so on. And your example doesn't give "an array a (binary) value", it associates strings with values you chose to denote (for whatever reason) as binary numbers.
score: 0
comment on: http://stackoverflow.com/q/21389492

http://stackoverflow.com/comment/32343814
type: QuestionComment
has text: its not so easy to write in code because the compare method isnt real
comment on: http://stackoverflow.com/q/21436392
score: 0
type: Comment

http://stackoverflow.com/a/21446382
downvote count: 0
answers question: http://stackoverflow.com/q/21446343
type: Answer
has body: You try to access a variable method local variable from another method. Check the scope of that variable. Method local variable can be accessed within that method which they were declared only. finalAmount defined inside the calculateAmountNoCompounding() method, So, it has a scope withing that method only. You need to print whatever the value returned from calculateAmountNoCompounding() not the method local variable finalAmount
upvote count: 1
score: 1

http://stackoverflow.com/a/21478070
upvote count: 1
has body: To use @ParentPackage annotation with the action class or Java package you have to specify the valid Struts package name as a value attribute. If Struts is unable to find the specified package name it will inform you with the exception like in your case Unable to locate parent package [xxx] for [class yyy] This is normal, the specified Struts package must exist in the Struts runtime configuration before the convention plugin configuration provider would create its own configuration based on conventions. If you change the Struts package name to a package like tiles-default or convention-default it will work, because these Struts packages are created via the XML-based configuration provider from the plugin configuration files. But, your package is not created, because you didn't supply the configuration file struts.xml to your web application or it's not accessible by the dispatcher. By default struts.xml is placed on classpath where it could be loaded by the context classloader or you can specify the location of the configuration file using config init parameter of the Struts filter. struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter config ../../location/to/the/struts.xml,struts-default.xml,struts-plugin.xml Default result types are available to the parent packages which your packages should extend.
has comment: http://stackoverflow.com/comment/32418207
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32419589
type: Answer
answers question: http://stackoverflow.com/q/21473809

http://stackoverflow.com/a/21462917
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21462789
has body: You can use startActivityForResults to open 2nd Activity, when 2nd activity is supposed to be closed then you call: Intent returnIntent = new Intent(); returnIntent.putExtra("tv_text",tv.getText()); setResult(RESULT_OK,returnIntent); and in activity 1, you will receive results in onActivityResult and update textview in activity 1 with Intent data, sample code is from: How to manage `startActivityForResult` on Android?
downvote count: 0

http://stackoverflow.com/comment/32190563
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21350460
has text: Thanks this helped. I can only accept 1 answer, so I will upvote yours.

http://stackoverflow.com/comment/32456298
type: Comment
has text: @tom I like to see that, can you share its link? Or try it, see if that is working or not and share it as an answer.
comment on: http://stackoverflow.com/a/21481701
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32326714
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21427000
has text: so , with out a reference it is not possible to have an access to the object after the scope . the object just exist in memory with out any path of access to it . am i right ?

http://stackoverflow.com/q/21356503
tagged with: service
has answer: http://stackoverflow.com/a/27512821
has comment: http://stackoverflow.com/comment/32201436
upvote count: 1
tagged with: android-intent
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32201643
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32201122
type: Question
possible better answer: http://stackoverflow.com/a/27512821
has body: I have the following function: @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { if (s.equals("service_enabled")) { boolean shouldStart = sharedPreferences.getBoolean(s, false); Intent intent = new Intent(getActivity(), HUD.class); if (shouldStart) { // Turn on getActivity().startService(intent); } else { // Turn off getActivity().stopService(intent); } } } The function is called when a change is done to my PreferenceFragment. The service Hud is (probably) running if shouldStart == false, and then I want to stop it. This works as expected if you just click the option twice; the service starts, and stops. However, if you start it, go back to the previous activity, and enter this fragment again, and try to disable it, the following happends: 01-25 22:22:44.848 32548-32548/net.hath.drawcut E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at android.content.ComponentName.&lt;init&gt;(ComponentName.java:75) at android.content.Intent.&lt;init&gt;(Intent.java:3558) at net.hath.drawcut.ui.fragment.PrefsFragment.onSharedPreferenceChanged(PrefsFragment.java:35) at android.app.SharedPreferencesImpl$EditorImpl.notifyListeners(SharedPreferencesImpl.java:475) at android.app.SharedPreferencesImpl$EditorImpl.apply(SharedPreferencesImpl.java:385) at android.preference.Preference.tryCommit(Preference.java:1349) at android.preference.Preference.persistBoolean(Preference.java:1615) at android.preference.TwoStatePreference.setChecked(TwoStatePreference.java:83) at android.preference.TwoStatePreference.onClick(TwoStatePreference.java:69) at android.preference.Preference.performClick(Preference.java:949) at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:215) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1100) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749) at android.widget.AbsListView$1.run…
has answer: http://stackoverflow.com/a/27512720
downvote count: 0
linked to: http://stackoverflow.com/q/11631408
accepted answer: http://stackoverflow.com/a/21444421
has title: new Intent(Context, Class) throws NullPointerException
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21444421
favorite count: 0

http://stackoverflow.com/q/21383440
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21435819
tagged with: post
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21435819
tagged with: rest
has title: How to write a RestService Post that consumes an Excel File?
has body: I have to program a Restful Service that Consumes a Excel File Mapps it into a Class and writes it into the DataBase. @POST @Path("/insertDataInDB) @Consumes(MediaType.???) public Response insertDataInDB(???) { //do Stuff } My first idea would be to use a ByteStream and than to interpret the Stream with Apache POI. But here i got an Exception: "org.jboss.resteasy.spi.UnsupportedMediaTypeException" @POST @Path("/insertDataInDB") @Consumes(MediaType.MULTIPART_FORM_DATA) public void insertDataInDB(@FormDataParam("inputfile") File inputfile) { //do Stuff } Has anyone an idea what MediaType to use and what kind of java DataType? Or has someone a better idea?
tagged with: excel
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/21461659
tagged with: java-bytecode-asm
favorite count: 0
has title: Using an Annotation Processor to create a list of classes with a certain annotation
has body: I have a custom annotation that I've implemented and I'd like to use an annotation processor to generate a list of all the classes in my app that use that particular annotation. I've found this tutorial which describes how to generate a class file using an annotation processor, so it should be quite easy to generate a class for each class with my annotation. What I can't figure out is how I can collect all of that information into a single class. There doesn't seem to be a way to modify a class, so I can't append new items to the list once the class has been generated the first time. Is there a way to use an annotation processor to generate a method that will return the list of all classes in an app that are annotated with a particular annotation?
type: UnansweredQuestion
tagged with: annotations
upvote count: 7
score: 7
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21514363
tagged with: annotation-processing
downvote count: 0
answer count: 1

cdi
tags question: http://stackoverflow.com/q/21452132
type: Tag
tag name: cdi
tags question: http://stackoverflow.com/q/21353526
tags question: http://stackoverflow.com/q/21387746
tags question: http://stackoverflow.com/q/21479580

http://stackoverflow.com/q/21483604
tagged with: typeof
has answer: http://stackoverflow.com/a/21484542
has title: Passing System.out.println(); as an argument in a method
downvote count: 0
favorite count: 0
tagged with: arguments
tagged with: void
accepted answer: http://stackoverflow.com/a/21483710
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21484255
tagged with: java
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/21489604
type: Question
has answer: http://stackoverflow.com/a/21483827
has body: I want to pass System.out.println(); as an argument but the compiler won't allow me to return a void type as an argument. here is what I want it for. public class Array { public static void main(String args[]) { a(data()); } static void a(e) { System.out.println(e); } static void data() { ... } } So What is want a(data()); to look like after it is compiled is something like this. a(data()) = System.out.println(data(){...}); Eventually I want to shorthand System.out.println().
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/21483779
possible better answer: http://stackoverflow.com/a/21483827
upvote count: 4
has answer: http://stackoverflow.com/a/21483710

http://stackoverflow.com/a/21371759
type: Answer
has comment: http://stackoverflow.com/comment/32229868
has body: Are you using an Eclipse plugin for Hadoop? If not that is the problem. With out the plugin, Eclipse if just running the WordCount class and Hadoop can't find the necessary jars. Bundle all the jars including WordCount and run it in Cluster. If you want to run it from Eclipse you need Eclipse plugin. If you don't have one, you can build the plugin by following this instructions
score: 0
has comment: http://stackoverflow.com/comment/32230072
has comment: http://stackoverflow.com/comment/32270514
has comment: http://stackoverflow.com/comment/32244445
answers question: http://stackoverflow.com/q/21365929

http://stackoverflow.com/comment/32299685
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21406629
has text: I've added the Tomcat maven plugin to the sample. Version 2.2 of the plugin seems to be using Tomcat 7.0.47.

http://stackoverflow.com/q/21489300
possible better answer: http://stackoverflow.com/a/21507746
has comment: http://stackoverflow.com/comment/53297801
has comment: http://stackoverflow.com/comment/32437827
has answer: http://stackoverflow.com/a/21507746
answer count: 3
has answer: http://stackoverflow.com/a/21492653
upvote count: 10
favorite count: 0
has body: This seems like it would come up often, but I've Googled to no avail. Suppose you have a Hibernate entity User. You have one User in your DB with id 1. You have two threads running, A and B. They do the following: A gets user 1 and closes its Session B gets user 1 and deletes it A changes a field on user 1 A gets a new Session and merges user 1 All my testing indicates that the merge attempts to find user 1 in the DB (it can't, obviously), so it inserts a new user with id 2. My expectation, on the other hand, would be that Hibernate would see that the user being merged was not new (because it has an ID). It would try to find the user in the DB, which would fail, so it would not attempt an insert or an update. Ideally it would throw some kind of concurrency exception. Note that I am using optimistic locking through @Version, and that does not help matters. So, questions: Is my observed Hibernate behaviour the intended behaviour? If so, is it the same behaviour when calling merge on a JPA EntityManager instead of a Hibernate Session? If the answer to 2. is yes, why is nobody complaining about it?
has answer: http://stackoverflow.com/a/21536370
accepted answer: http://stackoverflow.com/a/21536370
has comment: http://stackoverflow.com/comment/32437133
has comment: http://stackoverflow.com/comment/32437931
has comment: http://stackoverflow.com/comment/32438725
type: AnsweredQuestion
downvote count: 0
has title: Should Hibernate Session#merge do an insert when receiving an entity with an ID?
has comment: http://stackoverflow.com/comment/32438490
tagged with: java
tagged with: hibernate
tagged with: concurrency
has comment: http://stackoverflow.com/comment/32438493
has comment: http://stackoverflow.com/comment/32437440
type: Question
has comment: http://stackoverflow.com/comment/32437876
tagged with: jpa
score: 10

http://stackoverflow.com/a/21374867
has comment: http://stackoverflow.com/comment/32246304
has comment: http://stackoverflow.com/comment/32243305
has body: Oke I reproduced your problem on Zk fiddle here As you can see it works under zk 7.0.0 but but doesn't work zk 6.5.2 and zk 6.5.3. I tested myself to under zk 6.5.3. If I set the google image, I don't get the image in the popup. But if I make a delete.png image local it works (but it is caption sensitive!). Very strange... But for your project, try (if you are allowed) to upgrade to 6.5.3 and test there. edit : I added to your bugreport this fiddle. Greetz chill.
upvote count: 1
answers question: http://stackoverflow.com/q/21352769
score: 1
has comment: http://stackoverflow.com/comment/32245086
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21352769
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32421916
has text: No if it is running, the new task should be scheduled
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21442322

http://stackoverflow.com/comment/32406883
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21470665
has text: What do you mean by "the scope of the second Matrix"? It looks like you already know how to retrieve the contents of a second Matrix (called `A` in your function), along with its row and column sizes. What do you need that isn't already there?

http://stackoverflow.com/comment/32464679
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21504309
has text: Well, the code in the link you provided would actually tell you the queue is full, but a better implementation would be to treat it as circular, and then yes, next entries would be at index 0 1 2. As far as implementation, you can't assume anything. There are tons of ways of implementing anything.
score: 0

http://stackoverflow.com/a/37345997
downvote count: 0
answers question: http://stackoverflow.com/q/21418107
type: Answer
has body: For community edition on windows, click on Options, Database Configuration, Edit look for allow_store_upgrade
upvote count: 1
score: 1

http://stackoverflow.com/a/21420057
has comment: http://stackoverflow.com/comment/32342424
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21419814
has body: I think that its not possible with aspectJ. There are other approaches, for example the libraries used for cobertura reporting in testing present you reports that counts the number of times the program goes through each line. These libraries uses some form or code instrumentation. The most relevant cobertura libraries are probably clover, emma or cobertura, you can try to find some information about the techniques that this libraries uses and try to do something similar. Not an easy task.

http://stackoverflow.com/comment/32248675
type: AnswerComment
comment on: http://stackoverflow.com/a/21381029
has text: `visibility: hidden;` works instead of `-fx-opacity: 0.0;`, and is probably a little more intuitive.
type: Comment
score: 1

http://stackoverflow.com/q/21475026
type: UnansweredQuestion
downvote count: 2
has title: Validate file contents based on extension
has comment: http://stackoverflow.com/comment/32411948
linked to: http://stackoverflow.com/q/13248466
has answer: http://stackoverflow.com/a/21475456
has comment: http://stackoverflow.com/comment/32411842
tagged with: java
has body: I want to validate file contents based on their extension. For example, a user can save a document file (.doc/.docx) as an Excel file (.xls/.xlsx). Before I get the file contents, using Java I need to validate the content type matches with that extension. Is any one have idea about, please share your points.
type: Question
has comment: http://stackoverflow.com/comment/32411868
has comment: http://stackoverflow.com/comment/32411839
upvote count: 0
score: -2
duplicate of: http://stackoverflow.com/q/13248466
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21490590
has answer: http://stackoverflow.com/a/21490635
has comment: http://stackoverflow.com/comment/32439658
has body: My understanding is that closing streams in Java is recommended, but not even close to a "requirement". Likewise, it's a good idea, but not near a requirement, to reset a CharsetDecoder after you are done using it. Throwing the exception makes the method look clean and very readable. Catching the exception might be "recommended", but it adds a little clutter to the method. So, on a professional programming team, would you really "catch and close/reset"? Is it that important? Here, I preferred to just throw it: &lt;!-- language: Java --&gt; public static String[] grabData(URL url, CharsetDecoder dcdr) throws Exception { List&lt;String&gt; dump = new ArrayList&lt;String&gt;(); dcdr.reset(); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); BufferedReader bufrdr = new BufferedReader(new InputStreamReader(conn.getInputStream(), dcdr)); while (dump.add(bufrdr.readLine())) { } bufrdr.close(); dcdr.reset(); return dump.toArray(new String[0]); }
has comment: http://stackoverflow.com/comment/32441299
possible better answer: http://stackoverflow.com/a/21490635
score: 0
accepted answer: http://stackoverflow.com/a/21490652
has title: is it worth catching an Exception just to close a stream and reset a CharsetDecoder?
has comment: http://stackoverflow.com/comment/32441258
has answer: http://stackoverflow.com/a/21490652
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32441271
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32439604

http://stackoverflow.com/q/21387920
type: Question
accepted answer: http://stackoverflow.com/a/21388242
score: 0
answer count: 1
tagged with: storage
has title: SharedPreferences doesnt want to store my code
tagged with: android
has answer: http://stackoverflow.com/a/21388242
type: AnsweredQuestion
tagged with: java
has body: I am making a login system on android. I am pretty noob at coding and i need help. I want the user to be able to register a code and then login with it. I have three activities and i will show you two java files. THere is no error in my code. Here is links to the codes: Register code: https://dl.dropboxusercontent.com/u/97063669/registerCode.png login code: https://dl.dropboxusercontent.com/u/97063669/loginCode.png I am having 1234 as a default code, and that is the only code that works. If i try to register a new code i cant us`e it, only 1234. Please help me! :)
has comment: http://stackoverflow.com/comment/32258222
tagged with: sharedpreferences
tagged with: authentication

http://stackoverflow.com/comment/32294506
type: Comment
type: QuestionComment
has text: show the Log and tell us which line is mentioned there!
score: 0
comment on: http://stackoverflow.com/q/21407943

http://stackoverflow.com/a/21502701
downvote count: 0
has body: String s = "This is institute of insurance and insu.".replaceFirst("ins", "JSS");
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21502642
score: 1

http://stackoverflow.com/a/21413929
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32304337
has comment: http://stackoverflow.com/comment/32304632
has comment: http://stackoverflow.com/comment/32303771
has body: If you want to make your code working you will need to fix k for-cycle, where you iterate b array. if(duplicate==1) { for(k=0; k&lt;m; k++) { // increase k if(a[i] == b[k]) { intersect = intersect + 1; break; // insert break to avoid duplicates in b array } } } And here little bit cleaner and shorter code. (I assume, you are not allowed to use Java collection classes.) public class assignment1question1 { public static void main(String[] args) { int[] a = {1,3,4,3,5}; int[] b = {1,3,4,1,7,3}; System.out.print(listIntersection(a,b)); } public static int listIntersection(int[] a, int[] b) { int intersect = 0; for(int i = 0; i &lt; a.length; i++) { boolean duplicate = false; for (int j = 0; j &lt; i; j++) { if(a[i] == a[j]) { duplicate = true; break; } } if (!duplicate) { for(int k = 0; k &lt; b.length; k++) { if (a[i] == b[k]) { intersect++; break; } } } } return intersect; } }
type: Answer
accepted answer of: http://stackoverflow.com/q/21413588
answers question: http://stackoverflow.com/q/21413588
has comment: http://stackoverflow.com/comment/32304447
score: 0

http://stackoverflow.com/comment/32212996
comment on: http://stackoverflow.com/q/21355799
score: 0
type: Comment
has text: possible duplicate of [Only allowing numbers and a symbol (-) to be typed into a JTextField](http://stackoverflow.com/questions/8017811/only-allowing-numbers-and-a-symbol-to-be-typed-into-a-jtextfield)
type: QuestionComment

http://stackoverflow.com/comment/32494630
has text: I have only one dao class and i have changed everything in my app as you suggested way. but still i got these errors **org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction;** **org.hibernate.TransactionException: JDBC begin failed:** **java.net.SocketTimeoutException: Read timed out** **com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@1c5950a9 -- timeout at awaitAvailable()**
type: Comment
comment on: http://stackoverflow.com/a/21476410
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32430238
has text: Try running a specific test. `mvn -Dtest=<test_class_name> test`
comment on: http://stackoverflow.com/q/21485744
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32392011
has text: I will try to solve this by writing a class that implements MethodInterceptor of cglib. In the intercept method, I will try to delegate to the appropriate object (B or C) by looking at the name of the method and finding which object has the method. If the method is available in B and C, I will delegate the call to B or C. In my case it does not matter since both B and C extend A.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21451088
type: Comment

http://stackoverflow.com/comment/32301148
has text: possible duplicate of [Passing command line arguments to javaws (Java WebStart) executable](http://stackoverflow.com/questions/1396426/passing-command-line-arguments-to-javaws-java-webstart-executable)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21412457

http://stackoverflow.com/a/21395477
answers question: http://stackoverflow.com/q/21395408
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21395408
type: AcceptedAnswer
has body: Typically, the JVM allocates new memory until the heap is full, in which case it garbage collects, freeing up non-referenced objects. If you allocated 14GB for the heap, chances are it will consume that much memory.

http://stackoverflow.com/comment/32340766
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21433510
has text: No, I mean the entire stack trace: http://stackoverflow.com/a/3988794/115145
score: 0

http://stackoverflow.com/comment/127187470
comment on: http://stackoverflow.com/a/21416354
type: AnswerComment
score: 0
type: Comment
has text: First method was by far the best I have seen thank u for this

http://stackoverflow.com/a/21470472
accepted answer of: http://stackoverflow.com/q/21469600
has body: Eclipse has a notion of status. IStatus interface has a severity code, and message. MultiStatus implements composite pattern. Custom descendant define additional fields to represent different kind of messages in their specific form. Usually a method returns IStatus composed from the return values of its callees. Resulting hirrarhical structure is pretty convenient to view in both interactive GUI and console.
answers question: http://stackoverflow.com/q/21469600
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32373961
score: 0
type: Comment
type: QuestionComment
has text: Which options do you use when using the export runnable JAR wizard?
comment on: http://stackoverflow.com/q/21451008

http://stackoverflow.com/comment/32213076
has text: Then I believe you are looking for Dependency injection - Object creation by the framework based on the configuration
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21362997

http://stackoverflow.com/q/21512372
has title: Which characters shouldn't be used in a filename?
favorite count: 0
has answer: http://stackoverflow.com/a/21512437
accepted answer: http://stackoverflow.com/a/21512437
duplicate of: http://stackoverflow.com/q/122400
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: naming
type: Question
linked to: http://stackoverflow.com/q/122400
has body: I wrote a program which creates a file with the name derived from a users txtarea. But it got me thinking ,what if the user uses whitespaces in his name or any other special symbols, which in turn than becomes a file with this name. Can stuff go wrong? Ifso,which signs/symbols should I allow to be used in a file's name? Thank you for your time
score: -2
downvote count: 2
answer count: 1

http://stackoverflow.com/a/21360846
score: 1
answers question: http://stackoverflow.com/q/21360791
upvote count: 1
has body: Because your loop is not correct, try the following code: while((str=br.readLine())!=null) { boolean foundCap = false; //Remove the words with first letter capital for(int i=0;i&lt;capLetters.length;i++) { if(str.charAt(0)==capLetters[i]) { foundCap = true; } } if(!foundCap) { wordList.add(str); } number++; } After all, you don't need to write a loop to check if a char is capital or not. Just use the utility method: Character.isUpperCase(char c)
type: Answer
downvote count: 0

http://stackoverflow.com/comment/133180313
type: AnswerComment
type: Comment
has text: This was an EXCELLENT addition to this post, Thank you! You saved me potentially hours of work to figure this out.
score: 1
comment on: http://stackoverflow.com/a/30724844

http://stackoverflow.com/q/21353102
has answer: http://stackoverflow.com/a/21354757
tagged with: google-maps-android-api-2
tagged with: android
has comment: http://stackoverflow.com/comment/32195075
has comment: http://stackoverflow.com/comment/32195099
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21354757
tagged with: java
has comment: http://stackoverflow.com/comment/32195054
has body: i am in the process of creating a app which track the user location using Google maps and calculate the distance. i have not calculate the distance but is trying to create a map but faced problems. i know using Google Maps API v2 cannot run on a emulator as it does not support Google Play Services. i have tried running on emulator and my real phone but both faced problems On emulator: i saw that the person who posted this tutorial http://www.youtube.com/watch?v=awX5T-EwLPc can do it so i think it is possible, but it does not say how to do it. i followed all the steps in this tutorial http://www.youtube.com/watch?v=vUsBOZ7-qBE and downloaded all apk uses the same emulator. but there is the error that my google play services need updating. i researched and it means google play services is not supported on emulator.. On real devices: when i run my application, it crashes by saying "Unfortunately, My ApplicationNameApp has stopped" then i press ok. the CatLog is EDIT: 01-26 01:33:08.004: D/dalvikvm(10815): GC_CONCURRENT freed 205K, 6% free 12413K/13191K, paused 2ms+2ms, total 19ms 01-26 01:33:08.004: D/dalvikvm(10815): WAIT_FOR_CONCURRENT_GC blocked 11ms 01-26 01:33:08.049: D/AndroidRuntime(10815): Shutting down VM 01-26 01:33:08.049: W/dalvikvm(10815): threadid=1: thread exiting with uncaught exception (group=0x4178f2a0) 01-26 01:33:08.054: E/AndroidRuntime(10815): FATAL EXCEPTION: main 01-26 01:33:08.054: E/AndroidRuntime(10815): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.studenthealthapp/com.example.studenthealthapp.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class fragment 01-26 01:33:08.054: E/AndroidRuntime(10815): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) 01-26 01:33:08.054: E/AndroidRuntime(10815): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) 01-26 01:33:08.054: E/AndroidRuntime(10815): at android.app.ActivityThread.…
type: Question
has comment: http://stackoverflow.com/comment/32196318
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32196108
score: 0
has title: displaying Google Maps API v2 on real device/emulator. can't figure out error
answer count: 1

http://stackoverflow.com/comment/32435390
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21481962
score: 0
has text: @Walls I apologize but I am unable to upvote due to my level being too low but I am most thankful for all of your help.

try-catch
tags question: http://stackoverflow.com/q/21511390
tags question: http://stackoverflow.com/q/21394399
tags question: http://stackoverflow.com/q/21401356
type: Tag
tags question: http://stackoverflow.com/q/21457058
tags question: http://stackoverflow.com/q/21387153
tags question: http://stackoverflow.com/q/21415948
tag name: try-catch
tags question: http://stackoverflow.com/q/21351764
tags question: http://stackoverflow.com/q/21464491
tags question: http://stackoverflow.com/q/21472063
tags question: http://stackoverflow.com/q/21429058

http://stackoverflow.com/comment/32316249
comment on: http://stackoverflow.com/q/21420997
has text: Before you continue, read [this](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java).
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/21496151
score: 0
possible better answer: http://stackoverflow.com/a/21496165
tagged with: validation
has title: For Good coding practice, do we still have to validate data again in method2 if we already validated in method1 & method1 passes that data to method2?
has answer: http://stackoverflow.com/a/21496174
has comment: http://stackoverflow.com/comment/32449390
favorite count: 0
tagged with: php
has answer: http://stackoverflow.com/a/21496168
answer count: 4
has answer: http://stackoverflow.com/a/21496234
tagged with: c++
tagged with: java
upvote count: 1
has body: Let say I have public void method1(){ String s1=""; String s1=getText(); if(MyValidation.isOk(s1)){ dosomethingWith s1 here then method2(s1); } } public void method1(String s1){ if(MyValidation.isOk(s1)){ // do we need this line of code?? //do something } } For Good coding practice, do we still have to validate data again in method2 if we already validated it in method1 &amp; method1 passes that data to method2?
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: c#
has answer: http://stackoverflow.com/a/21496165
accepted answer: http://stackoverflow.com/a/21496234

http://stackoverflow.com/a/21469358
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21469286
type: Answer
has body: you can use this: String text = "test {{test1}} test2"; Pattern p = Pattern.compile("\\[\\[(.*?)]]", Pattern.DOTALL); Matcher m = p.matcher(text); while (m.find()) { System.out.print(m.group(1)); }
score: 2

http://stackoverflow.com/comment/32407465
comment on: http://stackoverflow.com/q/21472302
score: 0
has text: Please post your logCat
type: QuestionComment
type: Comment

foreground
type: Tag
tags question: http://stackoverflow.com/q/21374629
tag name: foreground

http://stackoverflow.com/q/21438135
has comment: http://stackoverflow.com/comment/32373460
has comment: http://stackoverflow.com/comment/32366090
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: Andengine - creating a simple polygon body
tagged with: andengine
type: Question
tagged with: c#
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32365921
has body: I'm trying to learn AndEngine, i made a program in Visual STudio that I can make my polygon vertices. But i just can't figure out how to add it to the physics world.. Sprite cartman = new Sprite(50, 50, ballTextureRegion, this.getVertexBufferObjectManager()); cartman.setRotation(50); final FixtureDef PLAYER_FIX = PhysicsFactory.createFixtureDef(10.0f, .5f, 0.3f); float[] vertices = new float[] { 16, 20, 16, 20, 39, 4, 69, 8, 83, 22, 85, 44, 97, 56, 98, 68, 95, 69, 91, 78, 88, 82, 88, 91, 12, 91, 8, 76, 4, 69, 0, 60, 14, 44, 13, 30 }; for (int i = 0; i &lt; vertices.length; i++) vertices[i] /= PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT; PolygonShape ps = new PolygonShape(); ps.set(vertices); ..... this.scene.attachChild(cartman); physicsWorld.registerPhysicsConnector(new PhysicsConnector(cartman, body, true, false)); I can't understand what is a iShape.. Can anybody help me?
type: UnansweredQuestion

http://stackoverflow.com/comment/32445238
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21492728
has text: @Tinman Thank you Tinman! I'm watching it increase in the Ubuntu System Monitor. I'm about to update my answer with what's necessary. I very much appreciate your help!

http://stackoverflow.com/q/21444846
has comment: http://stackoverflow.com/comment/32359182
has comment: http://stackoverflow.com/comment/32358738
favorite count: 0
has answer: http://stackoverflow.com/a/50536818
upvote count: 2
type: UnansweredQuestion
has body: I have a problem in using swing. I don't know what is the cause of this but i'm just trying to create a simple frame app using swing at it give me a lot of error. import javax.swing.JFrame; public class StacksGui { public static void main(String args[]) JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(100,200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } Exception in thread "main" java.lang.ExceptionInInitializerError at javax.swing.JPanel.updateUI(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JRootPane.createGlassPane(Unknown Source) at javax.swing.JRootPane.&lt;init&gt;(Unknown Source) at javax.swing.JFrame.createRootPane(Unknown Source) at javax.swing.JFrame.frameInit(Unknown Source) at javax.swing.JFrame.&lt;init&gt;(Unknown Source) at StacksGui.main(StacksGui.java:9) Caused by: java.lang.IllegalArgumentException: 0 incompatible with Text-specific LCD contrast key at java.awt.RenderingHints.put(Unknown Source) at sun.awt.windows.WDesktopProperties.getDesktopAAHints(Unknown Source) at sun.awt.windows.WToolkit.getDesktopAAHints(Unknown Source) at sun.awt.SunToolkit.getDesktopFontHints(Unknown Source) at sun.awt.windows.WDesktopProperties.getProperties(Unknown Source) at sun.awt.windows.WToolkit.updateProperties(Unknown Source) at sun.awt.windows.WToolkit.lazilyInitWProps(Unknown Source) at sun.awt.windows.WToolkit.lazilyLoadDesktopProperty(Unknown Source) at java.awt.Toolkit.getDesktopProperty(Unknown Source) at javax.swing.UIManager.&lt;clinit&gt;(Unknown Source) ... 10 more
has answer: http://stackoverflow.com/a/21444942
has comment: http://stackoverflow.com/comment/32358841
tagged with: swing
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32408324
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32358811
has title: Swing apps doesn't run
has comment: http://stackoverflow.com/comment/32359306
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/32359002
tagged with: illegalargumentexception
has comment: http://stackoverflow.com/comment/32358748

http://stackoverflow.com/comment/32334792
comment on: http://stackoverflow.com/a/21430650
has text: See the my edit and follow it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32223825
type: Comment
type: QuestionComment
has text: Does someone have an idea?
score: 0
comment on: http://stackoverflow.com/q/21368092

http://stackoverflow.com/comment/32459530
score: 0
type: AnswerComment
type: Comment
has text: Hustl3r28 it contains the last intance of a button that has been pressed, it's assigned in the last line of the acitonPerformed method; @Radiodef typically yes but the actual restriction is that all the listener must have access to the shared memory in this case _lastButtonPressed. I'll update my answer with an executable example in a moment.
comment on: http://stackoverflow.com/a/21497353

http://stackoverflow.com/a/21429570
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32330975
has comment: http://stackoverflow.com/comment/32331188
downvote count: 0
has body: public static void main(String[] h) { String input = getInput(); while (!input.matches("[A-Z0-9]+")) { System.out.println("Please input again"); input = getInput(); } System.out.println("your input : " + input); } public static String getInput() { Scanner Input = new Scanner(System.in); System.out.println("Input two words: "); return Input.nextLine(); } Only these characters are allowed = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 is written easily in terms of [A-Z0-9]
answers question: http://stackoverflow.com/q/21429196

http://stackoverflow.com/comment/32477816
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21511978
has text: thanks Gray for quick response ..... i dont manage the Futrure object now ( modified the code in question , still same issue ) ... ALSO i highlighted the output (hope u can see the number of END > number of start) .... Let me know if i need to clarify further

http://stackoverflow.com/comment/32360922
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21445898
has text: By the way, you should always override `hashCode` when overriding `equals`, because otherwise containers like `HashMap` will malfunction. It's usually best to leave `equals` alone (using the default `==` implementation) until you write an actual implementation of it.
type: Comment

http://stackoverflow.com/comment/32287310
comment on: http://stackoverflow.com/q/21404797
type: Comment
type: QuestionComment
has text: And the related codes for this description is ...
score: 3

http://stackoverflow.com/q/21383019
has comment: http://stackoverflow.com/comment/32248933
has answer: http://stackoverflow.com/a/21383210
tagged with: deserialization
has title: Java JSON Deserialization Error
possible better answer: http://stackoverflow.com/a/21383210
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have the following code that uses Java JSON: Widget w = new Widget(true, "LIVE"); WidgetService service = new WidgetServiceImpl(); // 3rd party JSON web service JSONObject response = service.postWidget(w); System.out.println("Response is: " + response.toString()); System.out.println("Now fetching orderid..."); System.out.println(response.getString("order_id")); Don't worry about Widget or WidgetService: this question has to do with how I'm using the Java JSON API (and specifically JSONObject). When I run the above code, I get: Response is: {"response":{"credits_used":"0.30","job_count":1,"order_id":"243050","currency":"USD"},"opstat":"ok"} Now fetching orderid... Exception in thread "main" org.json.JSONException: JSONObject["order_id"] not found. at org.json.JSONObject.get(JSONObject.java:473) at org.json.JSONObject.getString(JSONObject.java:654) at com.me.myapp.MyDriver.main(MyDriver.java:49) As you can see, there is an order_id String field coming back in the response, and it has a value of "243050". So why am I getting the exception?
has answer: http://stackoverflow.com/a/21383133
accepted answer: http://stackoverflow.com/a/21383133
type: Question
answer count: 2
score: 0

http://stackoverflow.com/q/21437561
answer count: 0
type: UnansweredQuestion
tagged with: dependency-management
has title: Grails NoSuchField exception because of wrong denpendecy version of apache http core
downvote count: 0
score: 1
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/32369901
has body: I have Grails 2.0.4 application that depends on a jar that depends on org.apache.httpcomponents:httpcore:4.3.1 I'm getting a NoSuchField exception which I managed to track down to org.apache.http.impl.conn.BasicLineParser.INSTANCE. This field is only present from httpcore 4.3, before this version the field was BasicLineParser.DEFAULT instead My BuildConfig.groovy is like: dependencies { runtime 'mysql:mysql-connector-java:5.1.16' runtime 'org.apache.httpcomponents:httpclient:4.3.1' runtime 'org.apache.httpcomponents:httpcore:4.3.1' } Running the dependecy report I found out the there is a signpost-commonshttp4 by oauth.signpost that depends on httpcore:4.0.1 which is probably the root cause of my issue, because it doesn't have the INSTANCE property. I've tried to exclude this dependency adding runtime('oauth.signpost:signpost-commonshttp4:1.2.1.1'){ excludes 'httpcore' } with no success. Is there any other way to prevent the code to use the older library version? Regards RESOLVED I managed to resolve this issue adding an extra dependecies configuration build 'org.apache.httpcomponents:httpclient:4.3.1' build 'org.apache.httpcomponents:httpcore:4.3.1' along with the runtime Thank you all
has comment: http://stackoverflow.com/comment/32352179
tagged with: grails
type: Question
upvote count: 1
tagged with: apache-httpclient-4.x

http://stackoverflow.com/q/21380382
answer count: 1
has answer: http://stackoverflow.com/a/21381684
score: 0
has comment: http://stackoverflow.com/comment/32294208
linked to: http://stackoverflow.com/q/21334068
type: UnansweredQuestion
tagged with: excel
has comment: http://stackoverflow.com/comment/32258553
tagged with: java
has title: How to save Bargraph,piechart dynamically in excel
has body: I am creating bar graphs,pie charts using jfreechart and i have to save them in a excel sheet corresponding to the data from which bar graph,pie chart are created.Can anyone help me as to how i can acheive it.I know that we can save bar graphs,piecharts in jpeg,png format but can we save it directly to excel sheet.Since the no of bar graphs and piecharts are many.Please guide me with this.
linked to: http://stackoverflow.com/q/18311467
tagged with: jfreechart
type: Question

http://stackoverflow.com/comment/32323620
score: 0
has text: `\\w+` to match any word after `)` and `$1` is the back reference of that word (captured group #1) in the replacement string.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21425360

http://stackoverflow.com/q/21490289
has comment: http://stackoverflow.com/comment/32438845
has body: This is just curiosity, I read on some posts that is not a recommended practice create constructors on Servlets, but to be honest I have no idea why they say that, there must be a reason because I know there's an init() method to initialize things, but why can't I use the constructor to do this? Also the Eclipse Servlet wizard generated a constructor calling super() in it, and I'm not why is this super doing there Thanks!
has comment: http://stackoverflow.com/comment/32438819
score: 0
tagged with: java
answer count: 1
tagged with: http
has title: Why do people say that is not recommended using constructors on Servlets/SIP Servlets?
tagged with: sip
accepted answer: http://stackoverflow.com/a/21490815
tagged with: servlets
linked to: http://stackoverflow.com/q/1276082
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2103479
duplicate of: http://stackoverflow.com/q/1276082
tagged with: constructor
type: Question
has answer: http://stackoverflow.com/a/21490815

http://stackoverflow.com/comment/32228085
comment on: http://stackoverflow.com/a/21371362
has text: no i didnt , will try that ... but what is the max key amount ? what should it be !
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21461669
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21461506
has body: try firstName.getText() first_names.add(firstName.getText())

http://stackoverflow.com/q/21364279
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21364287
upvote count: 1
has title: Java String.replace not working
type: Question
has body: This is my code. String x = "1+&amp;radic;10"; x = x.replace(".*", "x"); System.out.println(x); This should return "x" but istead it is returning "1+&amp;radic;10". Why isn't this working?
downvote count: 0
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/21364287
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32214791

http://stackoverflow.com/comment/32278708
type: QuestionComment
type: Comment
has text: added UserListitemHolder
comment on: http://stackoverflow.com/q/21398760
score: 0

http://stackoverflow.com/a/21484422
answers question: http://stackoverflow.com/q/21484308
type: Answer
has body: Scroll the page using your script to bring element into the view. Example below: JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,450)", "");
score: 0

http://stackoverflow.com/comment/32414736
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21476735
has text: Just as I expected, quote from that link: "Just for clarity, this does make your pages stateless so don't use this if you want statefull pages"
type: Comment

http://stackoverflow.com/q/21387335
score: 1
favorite count: 0
tagged with: gwt-super-dev-mode
type: UnansweredQuestion
upvote count: 1
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/21387532
type: Question
has title: GWT Super Dev Mode
downvote count: 0
has body: I am very concerned for this new alternative for development life-cycle. Actually by this feature we are compiling Java file to Js in a super draft mode but what happens for very large projects that normal compilation takes over 45min (my last project) ?! every time I change something in UI I should recompile all codes?! Optimistic speaking, it should take over 5mins to recompile in super mode! Please let me know if I am wrong. Regads,
answer count: 1

http://stackoverflow.com/q/21353113
possible better answer: http://stackoverflow.com/a/21353163
tagged with: java
has answer: http://stackoverflow.com/a/21353257
has answer: http://stackoverflow.com/a/21353163
tagged with: primitive
downvote count: 1
has comment: http://stackoverflow.com/comment/32195528
type: Question
has answer: http://stackoverflow.com/a/21353329
has comment: http://stackoverflow.com/comment/32195211
has comment: http://stackoverflow.com/comment/32195388
linked to: http://stackoverflow.com/q/1661273
upvote count: 5
linked to: http://stackoverflow.com/q/588004
score: 4
duplicate of: http://stackoverflow.com/q/1661273
accepted answer: http://stackoverflow.com/a/21353257
duplicate of: http://stackoverflow.com/q/588004
has comment: http://stackoverflow.com/comment/32195443
has answer: http://stackoverflow.com/a/21353414
has comment: http://stackoverflow.com/comment/32195433
favorite count: 0
has comment: http://stackoverflow.com/comment/32196360
has comment: http://stackoverflow.com/comment/32195864
has body: I have messed with code execution result. code: System.out.println(0.2==0.1+0.1); System.out.println(0.3==0.1+0.1+0.1); output: true false I know that 0.2 and 0.3 cannot transform to binary correct. Why do I see different results? UPDATE: Can I predict result in similar issues without compiler?
answer count: 4
has comment: http://stackoverflow.com/comment/32195423
type: AnsweredQuestion
has title: surprising double comparison

http://stackoverflow.com/q/21451388
tagged with: java
has answer: http://stackoverflow.com/a/21571700
type: Question
possible better answer: http://stackoverflow.com/a/21455254
has comment: http://stackoverflow.com/comment/32408526
linked to: http://stackoverflow.com/q/9156379
has answer: http://stackoverflow.com/a/21455254
has comment: http://stackoverflow.com/comment/32377397
has title: Can not connect oracle 10g personal edition r2 database using JDBC
score: 0
answer count: 2
has body: i tried to perform connection test on netbeans as by creating new connection from databases node. i am trying to connect with ojdbc6.jar driver and my sid of databse is orcl (oracle personal edition). while creating new connection i did locate the oracle thin driver, used port 1521, i am using hr user which i have unlocked previously, the connection string of my connection is jdbc:oracle:thin:@localhost:1521:orcl but when i perform testing it throws message Cannot establish a connection to jdbc:oracle:thin:@localhost:1521:orcl using oracle.jdbc.OracleDriver (IO Error: The Network Adapter could not establish the connection), need help ,thanks in advance !
accepted answer: http://stackoverflow.com/a/21571700
tagged with: oracle-database
tagged with: jdbc
type: AnsweredQuestion

http://stackoverflow.com/q/21399351
accepted answer: http://stackoverflow.com/a/21399409
has answer: http://stackoverflow.com/a/21399449
linked to: http://stackoverflow.com/q/4969171
score: 0
tagged with: static
has body: Error: Cannot make a static reference to the non-static method setSelectedInfoRole(SelectOption) from the type PeopleInfoViewModel.PeopleInfoData Here's code: @Command @NotifyChange({ "peopleInfoList", "selectedFolderInfo" }) public void encryptInfo() { Set selectedPeopleInfo=peopleInfoList.getSelection(); if (selectedPeopleInfo == null) { showError(pageResourceBundle.getText("PLS_SELECT_AN_INFO_TO_CRYPT")); return; } List&lt;PeopleInfoRecord&gt; folderRecord = new ArrayList&lt;PeopleInfoRecord&gt;(); for (Object selectedObj : selectedPeopleInfo) { if (selectedObj instanceof PeopleInfoData) { PeopleInfoData peopleInfoData = (PeopleInfoData) selectedObj; ValidInfoRow validInfoRow = Services.folderService().findValidInfoByInfoCode(peopleInfoData.getPeopleInfoRecord().getInfoCode()); if (InfoType.CHOOSE.equals(validInfoRow.getInfoType())) { if (!CsdcStringUtils.isBlank(peopleInfoData.getPeopleInfoRecord().getInfoValue(), true)) { PeopleInfoData.setSelectedInfoRole(new SelectOption&lt;String&gt;(peopleInfoData.getPeopleInfoRecord().getInfoValue())); } } } } } In above method line PeopleInfoData.setSelectedInfoRole(new SelectOption&lt;String&gt;(peopleInfoData.getPeopleInfoRecord().getInfoValue())); give error. Here's Pojo class: public class PeopleInfoData { private ListModelList&lt;SelectOption&lt;String&gt;&gt; infoobj; private PeopleInfoRecord peopleInfoRecord; private SelectOption&lt;String&gt; selectedInfoRole; public SelectOption&lt;String&gt; getSelectedInfoRole() { return selectedInfoRole; } public void setSelectedInfoRole(SelectOption&lt;String&gt; selectedInfoRole) { this.selectedInfoRole = selectedInfoRole; } public ListModelList&lt;SelectOption&lt;String&gt;&gt; getInfoobj() { return infoobj; } public void setInfoobj(ListModelList&lt;SelectOption&lt;String&gt;&gt; infoobj) { this.infoobj = infoobj; } }
tagged with: non-static
has answer: http://stackoverflow.com/a/21399409
duplicate of: http://stackoverflow.com/q/4969171
has answer: http://stackoverflow.com/a/21399460
answer count: 4
has title: Static and non static in java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21399463
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21399449

http://stackoverflow.com/comment/32273021
score: 0
comment on: http://stackoverflow.com/q/21374157
type: Comment
has text: I am no expert on framewise enhancement, sorry.
type: QuestionComment

http://stackoverflow.com/a/21488231
has comment: http://stackoverflow.com/comment/51544513
upvote count: 16
has comment: http://stackoverflow.com/comment/32435018
has comment: http://stackoverflow.com/comment/32435493
has comment: http://stackoverflow.com/comment/32434919
answers question: http://stackoverflow.com/q/21488056
has comment: http://stackoverflow.com/comment/32434932
downvote count: 4
has comment: http://stackoverflow.com/comment/32435034
type: Answer
has comment: http://stackoverflow.com/comment/32435082
has comment: http://stackoverflow.com/comment/32435545
has body: Shouldn't Predicate#negate be what you are looking for?
score: 12

http://stackoverflow.com/a/21363277
answers question: http://stackoverflow.com/q/21362956
score: 0
has body: You can avoid using the new operator in most of your code by creating a static factory method on your class: class Foo { public static Foo create() { return new Foo(); } } Then instantiation looks like this: Foo f = Foo.create(); This is not much more concise, however it does have several advantages as detailed in section 1 of Effective Java: it allows type inference of generic types (Map&lt;String,String&gt; m = Maps.newHashMap(); instead of Map&lt;String,String&gt; m = new HashMap&lt;String,String&gt;();), and allows you to change the method in the future to e.g. memoize the objects instead of creating a new object on each call.
type: Answer

http://stackoverflow.com/q/21511338
has comment: http://stackoverflow.com/comment/32476612
accepted answer: http://stackoverflow.com/a/21511479
has body: I've a problem with some objects in my Android application. I'm pretty newbie so the error might be stupid but I can't see it. Here the code: activity_main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:id="@+id/main_page" android:orientation="vertical" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/main_TV" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@str_listen" android:id="@+id/button_send" android:onClick="sendMessage" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@str_info" android:id="@+id/id_info" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@str_credits" android:id="@+id/id_credits" /&gt; &lt;/LinearLayout&gt; MainActivity.java package com.example.cartoonia; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn_listen = (Button) findViewById(R.id.id_listen); Button btn_credit = (Button) findViewById(R.id.id_credits); Button btn_info = (Button) findViewById(R.id.id_info); } /** Called when the user touches the button */ public void sendMessage(View view) { // Do something in response to button click TextView tv = (Te…
has title: Android item id not resolved
tagged with: android
linked to: http://stackoverflow.com/q/3296047
type: AnsweredQuestion
score: 0
duplicate of: http://stackoverflow.com/q/3296047
has comment: http://stackoverflow.com/comment/32476469
type: Question
has answer: http://stackoverflow.com/a/21511479
tagged with: java
has comment: http://stackoverflow.com/comment/32476326
has comment: http://stackoverflow.com/comment/32476442
answer count: 1

http://stackoverflow.com/q/21479874
score: 3
has answer: http://stackoverflow.com/a/21479994
has answer: http://stackoverflow.com/a/21481651
tagged with: java
has body: I need to use a gridview and I want to change row numbers dynamically. Example: I need something like this: I receive an ArrayList with the result, I need to show first ten results on single row and results from eleven to end on two rows layout. is it possible to do?
has comment: http://stackoverflow.com/comment/32420105
downvote count: 0
has comment: http://stackoverflow.com/comment/32419827
has answer: http://stackoverflow.com/a/21480251
favorite count: 0
has answer: http://stackoverflow.com/a/21481998
answer count: 5
has title: Android GridView with different row number
tagged with: android
has answer: http://stackoverflow.com/a/21479963
tagged with: gridview
upvote count: 3
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/32794009
comment on: http://stackoverflow.com/a/21670595
type: Comment
has text: It worked, and I've updated my [sample code](https://github.com/donkirkby/vograbulary/blob/enter-key-traversal/vograbulary/src/com/github/donkirkby/vograbulary/VograbularyGame.java#L31) to include it. The bounty is yours.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21484338
tagged with: visualvm
has body: I need to know if it is possible to declare a output path for a heap space dump in the java visualVM. Is there any parameter that I can use for the java visual VM? I have to trace a specific service on my server and need to get a dump of the heap space. thanks. UPDATE Thanks a lot. I found a solution for my problem. I connected to my service with jmx remote. There it is possible to save the heapdump on any other drive of the server.
has comment: http://stackoverflow.com/comment/32449909
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/49842886
tagged with: dump
has title: Java VisualVM heap space dump into output path
upvote count: 3
has answer: http://stackoverflow.com/a/21749855
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/60186391
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32455142

http://stackoverflow.com/comment/32196366
comment on: http://stackoverflow.com/a/21352928
score: 0
type: Comment
has text: Shows this Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ControllerDroid.client/com.ControllerDroid.client.activity.MainActivity}: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.support.v4.widget.DrawerLayout
type: AnswerComment

http://stackoverflow.com/comment/32264669
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21391520
has text: I just added the main method that launches the GUI

http://stackoverflow.com/comment/32552386
score: 0
type: QuestionComment
has text: @Gagravarr I've experienced that you can manage the memory usage with `.xlsx` file a lot more easily than with `.xls`. Also, for large files, `xlsx` use less memory when done properly.
type: Comment
comment on: http://stackoverflow.com/q/21488738

http://stackoverflow.com/q/21378390
type: Question
answer count: 2
tagged with: swing
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32244514
has answer: http://stackoverflow.com/a/21379895
has body: I am designing one client interaction application in which the requirement is as follows:- User had already done editing in the cells. On pressing Enter key new row is inserted. From the above, if client edit something in a cell and press ENTER key it will make a new row with edit. In other words, when user is out of focus from the cells ENTER key must be used to add a row. And when user has focused one cell and press ENTER it must not add a row. On cell focus + ENTER key pressed = do nothing but edit of cell. Outside cell focus + ENTER key pressed = New row is added. SimpleTableDemo package com.ajay.test; /* * SimpleTableDemo.java requires no other files. */ import java.awt.Dimension; import java.awt.GridLayout; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class SimpleTableDemo extends JPanel { private boolean DEBUG = false; private JTable table = null; public SimpleTableDemo() { super(new GridLayout(1,0)); String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"}; Object[][] data = { {"Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(false)}, {"John", "Doe", "Rowing", new Integer(3), new Boolean(true)}}; table = new JTable(new javax.swing.table.DefaultTableModel(data, columnNames)); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); if (DEBUG) { table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { printDebugData(table); } }); } //Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher(new KeyEventDispatcher() { …
has comment: http://stackoverflow.com/comment/32242735
type: UnansweredQuestion
tagged with: jtable
has title: How to add a row in a JTable when click focus is out of the Table and <ENTER> key is pressed
has comment: http://stackoverflow.com/comment/32244890
has answer: http://stackoverflow.com/a/21380072

http://stackoverflow.com/comment/32245669
comment on: http://stackoverflow.com/q/21381231
score: 0
type: Comment
type: QuestionComment
has text: Since you say this is causing a crash, posting the stack trace would be helpful.

http://stackoverflow.com/comment/32444364
score: 0
type: Comment
has text: Finally, even though it may be well defined, it demonstrates a misunderstanding of how recursion is done. Perhaps 0 points is too harsh, but it should get a poor grade.
comment on: http://stackoverflow.com/a/21493128
type: AnswerComment

http://stackoverflow.com/a/21444900
has body: How can value == value + number ever be true, given that value nor number is zero (as we can see by looking at your test numbers)? You clearly missed something simple in the logic. I guess you need a third parameter that expresses the expected result, so you can do: expected == o.add(value, number);
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21444848
downvote count: 0
has comment: http://stackoverflow.com/comment/32358702
type: Answer

http://stackoverflow.com/q/21377900
score: 4
has answer: http://stackoverflow.com/a/21377968
has answer: http://stackoverflow.com/a/21377948
answer count: 2
tagged with: version
has comment: http://stackoverflow.com/comment/32239676
favorite count: 0
linked to: http://stackoverflow.com/q/5583975
has body: Basically, I'm trying to determine whether a user is using an IBM JDK or Oracle JDK from within the code itself, but can't think of an elegant solution outside of running command line arguments and using a string tokenizer. Does anybody know of an API or native method of discovering these details?
type: UnansweredQuestion
upvote count: 4
has title: Check Java version/type from within code
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/32371582
score: 0
type: Comment
type: QuestionComment
has text: Unrelated: Please learn java naming conventions and stick to them.
comment on: http://stackoverflow.com/q/21446947

http://stackoverflow.com/q/21500807
tagged with: java
possible better answer: http://stackoverflow.com/a/21502227
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21502449
score: 0
has answer: http://stackoverflow.com/a/21502227
has answer: http://stackoverflow.com/a/21502449
tagged with: multithreading
tagged with: android
has body: I want: if user already put name and choose game types, user can click button 'OK' but if user doesn't already put name and choose game types, user can't click button 'OK'. public class UserConfig extends Activity { Button userConfigBack; Button userConfigOK; EditText userNameTextbox; Spinner gameTypes; private String gameType; private String playerName; private Handler handler; Thread validation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.user_config); userConfigBack = (Button) findViewById(R.id.user_config_back); userConfigOK = (Button) findViewById(R.id.user_config_ok); userNameTextbox = (EditText) findViewById(R.id.user_name_textbox); gameTypes = (Spinner) findViewById(R.id.game_types); gameTimes = (Spinner) findViewById(R.id.game_times); userConfigOK.setEnabled(false); userConfigOK.setClickable(false); setName(); setGameType(); handler = new Handler(); autoValidation(); OK(); } public void setName() { playerName = userNameTextbox.getText().toString(); userNameTextbox.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { playerName = userNameTextbox.getText().toString(); nameLabel.setText(playerName); } @Override public void afterTextChanged(Editable arg0) { } }); } public void setGameType() { gameTypes.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; adapterView, View arg1, int arg2, long arg3) { gameType = (String) gameTypes.getSelectedItem(); gameTypeLabel.setText(gameType); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } }); } public void OK() { userConfigOK.setOnClickListener( new OnClickListener() { @SuppressWarnings("deprecation") @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent…
linked to: http://stackoverflow.com/q/11140285
has title: Android - False when make thread
type: AnsweredQuestion

http://stackoverflow.com/comment/32193626
score: 1
comment on: http://stackoverflow.com/q/21351918
has text: You can do this with a `javax.xml.transform.Transformer`, but not with a DTD file. You'll need an XSLT file for that.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21371536
has answer: http://stackoverflow.com/a/21371620
has title: How to dynamically add rows from a table (sqlite) to layout? (Android)
tagged with: java
has body: I am trying to take all the rows from my db and add it to the current layout, also, making each row clickable in the layout to take the user to a new screen with the id... Here is my current code, but stuck on that part... I understand that I can put an onClickListener, but then does it have to be a button? For a visual representation refer to a notepad app on any device where each note title appears and clicking on it takes you to that note. public class MainActivity extends Activity implements OnClickListener { private Button add_new_dictionary; // Database helper private DatabaseHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // db setup db = new DatabaseHelper(getApplicationContext()); // get all dictionaries List&lt;db_dictionary&gt; allDictionaries = db.getAllDictioniaries(); for (db_dictionary dictionary_found : allDictionaries) { // create new view for each dictionary name include id and make it // dynamic and include onclick to take to dictionary_view screen Button dictionary_button = new Button(this); } add_new_dictionary = (Button) findViewById(R.id.add_new_dictionary); } @Override public void onClick(View v) { if (v == add_new_dictionary) { Intent add_new_dictionary_intent = new Intent(MainActivity.this, add_new_dictionary.class); startActivity(add_new_dictionary_intent); } } } To re-iterate the question: How do I go about dynamically taking rows from my db and adding it to my layout dynamically based on how many results are returned from the query? (However, the rows should be able to point to a new screen with the dictionary id)
type: Question
accepted answer: http://stackoverflow.com/a/21371675
score: 0
answer count: 2
tagged with: sqlite
has comment: http://stackoverflow.com/comment/32228618
has answer: http://stackoverflow.com/a/21371675
tagged with: android
possible better answer: http://stackoverflow.com/a/21371620
type: AnsweredQuestion

http://stackoverflow.com/a/21466029
has comment: http://stackoverflow.com/comment/33802518
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21465388
has comment: http://stackoverflow.com/comment/32427589
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21465388
has body: Where is the line Session session = sessionFactory.getCurrentSession();? If it's a simple member variable, then it will be executed at construction time. But the resources aren't injected until later. So move that line into a method annotated with @Before. private Session session; @Before public void setUpSession() throws Exception { session = sessionFactory.getCurrentSession(); }
type: Answer

http://stackoverflow.com/comment/32365156
type: Comment
has text: I just copy pasted your code. but it throws me the exception dear
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21448062

http://stackoverflow.com/comment/32212797
comment on: http://stackoverflow.com/a/21361799
type: Comment
has text: @kleopatra _errors_ or _bad practices_? I didn't get an errors testing the code. As far as bad practices go, the code in the question was eclipses auto-generated, so I didn't want to mess with it much, just trying to solve the OP's problem.
score: 0
type: AnswerComment

http://stackoverflow.com/a/44383488
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21395646
has body: Here are different cases to split string in java. You can use one which may fit in your application. case 1 : Here is code to split string by a character "." : String imageName = "picture1.jpg"; String [] imageNameArray = imageName.split("\\."); for(int i =0; i&lt; imageNameArray.length ; i++) { system.out.println(imageNameArray[i]); } And what if mistakenly there are spaces left before or after "." in such cases? It's always best practice to consider those spaces also. String imageName = "picture1 . jpg"; String [] imageNameArray = imageName.split("\\s*.\\s*"); for(int i =0; i&lt; imageNameArray.length ; i++) { system.out.println(imageNameArray[i]); } Here, \\s* is there to consider the spaces and give you only required splitted strings. Now, suppose you have placed parameters in between two special charaters like : #parameter# or parameter or even two differnt signs at a time like *paramter#. We can have list of all these parameters between those signs by this code : import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; public class Splitter { public static void main(String[] args) { String pattern1 = "#"; String pattern2 = "#"; String text = "(#n1_1#/#n2_2#)*2/#n1_1#*34/#n4_4#"; Pattern p = Pattern.compile(Pattern.quote(pattern1) + "(.*?)" + Pattern.quote(pattern2)); Matcher m = p.matcher(text); while (m.find()) { ArrayList parameters = new ArrayList&lt;&gt;(); parameters.add(m.group(1)); System.out.println(parameters); ArrayList result = new ArrayList&lt;&gt;(); result.add(parameters); // System.out.println(result.size()); } } } Here list result will have parameters n1_1,n2_2,n4_4.
upvote count: 1

http://stackoverflow.com/comment/32280522
comment on: http://stackoverflow.com/q/21400646
score: 0
has text: background of every TextView is shown as arrow.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32254335
score: 0
has text: OK that would work, but then it is not guaranteed anymore that a person object has been set into the service, probably causing null pointer exceptions. That's why I forced to set the service with required person object in constructor...
type: Comment
comment on: http://stackoverflow.com/a/21385880
type: AnswerComment

http://stackoverflow.com/comment/32242695
score: 0
has text: Are you using opencsv writer?
type: Comment
comment on: http://stackoverflow.com/q/21379575
type: QuestionComment

http://stackoverflow.com/comment/130167822
comment on: http://stackoverflow.com/a/21437170
type: Comment
score: 1
type: AnswerComment
has text: @YunusCanEmre Hmm, good point. It's not wrong if you add a new task every 10 seconds by repeatedly calling one of the `schedule` methods. I either didn't know or was thinking of that. Work queues will overflow if you produce work faster than the queue is emptied, just not by a single task that repeats itself every time it finishes

http://stackoverflow.com/comment/32476958
type: AnswerComment
comment on: http://stackoverflow.com/a/21510093
type: Comment
has text: Just for the record I have no problem using any framework, library or anything that can make my life easier here, after all I am not trying to re-invent the wheel....I just need something reliable that won't cause me a lot of trouble. I've given a simple example before on trouble caused by upgrade in hibernate version
score: 0

http://stackoverflow.com/comment/32438817
comment on: http://stackoverflow.com/q/21490123
has text: Null pointer exception raised from netty after 30 minutes of working. The Heap Memory Usage was raising continuously. When it reached about 2,5GBytes the exception raised.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21465387
downvote count: 0
has comment: http://stackoverflow.com/comment/32395169
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21465353
has body: Delete the ; after the if condition: for (int i=0; i&lt; a.length; i++); ^------------- delete this Why? Because it declares an empty statement, so the for body will be empty. Therefore when you try to use variable i, it is actually out of the block it was declared in (a block is delimited by { }).
upvote count: 4
has comment: http://stackoverflow.com/comment/32395419

http://stackoverflow.com/q/21452716
downvote count: 0
favorite count: 0
tagged with: driver
type: Question
tagged with: jdbc
tagged with: openshift
accepted answer: http://stackoverflow.com/a/21454609
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/21348850
answer count: 1
has answer: http://stackoverflow.com/a/21454609
has title: No Suitable Driver Found Error after deploying a war file on Openshift
tagged with: servlets
has body: Hi all I know that the No Suitable Driver Found Error for openshift thread has been solved before but , after the multiple errors i get when i deploy a project from eclipse( a maven one) i have tried to deploy the war file ( a dynamic web project) on webapp folder and then just git add , commit and push and finally i got my servlet running But i cant communicate with mysql database I have added the mysql_connector to the web-inf/lib/ folder but still nothing ! Like i said i am on a dynamic web project so i cant add the dependencies to the pom.xml file Does anyone have a idea? My java file: import java.io.*; //import java.util.*; //import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; //krijojme nje klase qe zgjaton superclassen HttpServlet public class DBConnection extends HttpServlet { public static final String MYSQL_USERNAME = System.getenv("OPENSHIFT_MYSQL_DB_USERNAME"); public static final String MYSQL_PASSWORD = System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD"); public static final String MYSQL_DATABASE_HOST = System.getenv("OPENSHIFT_MYSQL_DB_HOST"); public static final String MYSQL_DATABASE_PORT = System.getenv("OPENSHIFT_MYSQL_DB_PORT"); public static final String MYSQL_DATABASE_NAME = "jbossews"; /** * kjo ketu nuk e di per cfare perdoret po duhet vene */ private static final long serialVersionUID = 1L; //krijojme nje metode te klases HttpServlet me emrin service //dhe qe merr 2 parametra nje reqyest dhe nje response //si dhe hedh disa lloje gabimesh si psh input out exeption //si dhe servlet Exception public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ //ketu tregon si do te jete pergjigja jone ne kete rast e duam html response.setContentType("text/html"); //dhe fillojme te paraqisim PrintWriter out = response.getWriter(); out.println(" "…
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/21499920
accepted answer of: http://stackoverflow.com/q/21499894
has body: There are several errors actually: a semicolon right after if clause \ is not a division symbol, / is the one itemcount is double, and dividing it by an int we get double, but containerAmount is declared int itemcount % cartons = 0 is not a valid boolean expression, you probably wanted itemcount % cartons == 0 a typo: containerAmount is declared, but containeramount is referenced An advice: try using some syntax highlighting and dynamically compiling IDE. I can recommend eclipse or IntelliJ IDEA
answers question: http://stackoverflow.com/q/21499894
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32455867
type: Answer
has comment: http://stackoverflow.com/comment/32456002
has comment: http://stackoverflow.com/comment/32455890
upvote count: 5

http://stackoverflow.com/comment/32365974
comment on: http://stackoverflow.com/a/21448583
has text: You've now got the same code that the OP has in the question, which doesn't do what he wants it to. The problem is really about formatting - and if the OP uses a format which doesn't include the milliseconds part, there's no need to change the value in the first place.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32293348
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21407999
has text: You should let the animation control the turing logic. Meaning that the animating class calls something like perform step on your `TuringSlimLs` instead of trying to synchronize two threads.

http://stackoverflow.com/q/21502149
has comment: http://stackoverflow.com/comment/32461877
has body: I have a small application (HTML form, servlet as controller and jsp files) and i try to figure out why i cannot to forward the request from servlet to jsp files. the problem is after submit from html, showed up "HTTP Status 404" Application flow: submit from html. controller get the name from html. controller supposed to move the request to jsp files. thanks! project hierarchy: http://s23.postimg.org/kgt7r7lwb/Capture.jpg main.html: Coupons categories Coupons categories Select category Type: Restaurants Electrics Hotels controller.java: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //PrintWriter out = response.getWriter(); //out.write(request.getPathInfo()); String path = request.getParameter("type"); if(path.equals("electrics")) { request.setAttribute("timestamp", new Date()); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/view/electrics.jsp"); dispatcher.forward(request, response); } else if(path.equals("hotels")) { request.setAttribute("timestamp", new Date()); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/view/hotels.jsp"); dispatcher.forward(request, response); } else if(path.equals("restaurants")) { request.setAttribute("timestamp", new Date()); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/view/restaurants.jsp"); dispatcher.forward(request, response); } } electrics.jsp: <%@ page language="java" contentType="text/html; charset=windows-1255" pageEncoding="windows-1255"%> Insert title here products list... <% Object ob = request.getAttribute("timestamp"); out.println(ob); %> web.xml: CouponsServer Controller for CouponsServer Controller uses.server.Controller Controller /Controller </web-app> update: Probably the problem is in the controller.java. When i try the following code, i got HTTP Status 500. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExcepti…
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/32461632
has comment: http://stackoverflow.com/comment/32460210
tagged with: java
upvote count: 10
has answer: http://stackoverflow.com/a/21502214
type: Question
has answer: http://stackoverflow.com/a/38687587
score: 10
tagged with: servlets
answer count: 3
has title: Forward request from servlet to jsp
has comment: http://stackoverflow.com/comment/32461408
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21502828
favorite count: 0
has comment: http://stackoverflow.com/comment/32461607
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32460684
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/32478027
comment on: http://stackoverflow.com/q/21511978
score: 0
type: Comment
type: QuestionComment
has text: I think the issue is with Syncronization of Rules , my rules dont implement Runnable/Callable ... when i monitor the output log closely then i see that "Start running ... Rule 1 for File1.20140203" I was expecting this message for rule1 for 6 DIFFERENT files .... but i notice the file names are repeated ( adding same to question )

http://stackoverflow.com/q/21408788
answer count: 1
has body: I have a class named SNMPv3 as given below. When I try to call the function mergeParameters() from an instance of this class, some strange things occurs. class SNMPv3{ String[] names={"value1", "value2", "value3", "value4", "value5", "value6"}; Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); void mergeParameters(ArrayList&lt;SNMPv3&gt; snmpv3List) { for(String parametername : this.map.keySet()) { String parametervalue=""; for(SNMPv3 row : snmpv3List) { if(!row.equals(this)) { if(parametervalue.equals("")) { parametervalue = row.map.get(parametername); } else if(parametervalue.equals(row.map.get(parametername))) { this.map.put(parametername, ""); for(SNMPv3 rowinside : snmpv3List) { if(!rowinside.equals(this)) { this.map.put(parametername,this.map.get(parametername) + rowinside.map.get(parametername)); } } } } } } } } At compile time when compiler comes into this line when 'row' and 'this' shows same object if(!row.equals(this)) it should go to next loop but it does not. Strangely it goes to this line: this.map.put(parametername,this.map.get(parametername) + rowinside.map.get(parametername)); I didnt understand why? Btw I have already checked curly braces. Then I tried to add an else to that strange if: class SNMPv3{ String[] names={"value1", "value2", "value3", "value4", "value5", "value6"}; Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); void mergeParameters(ArrayList&lt;SNMPv3&gt; snmpv3List) { for(String parametername : this.map.keySet()) { String parametervalue=""; for(SNMPv3 row : snmpv3List) { if(!row.equals(this)) { if(parametervalue.equals("")) { parametervalue = row.map.get(parametername); } else if(parametervalue.equals(row.map.get(parametername))) { this.map.put(parametername, ""); for(SNMPv3 rowinside : snmpv3List) { if(!rowinside.equals(this)) { this.map.put(parametername,this.map.get(parametername) + rowinside.map.get(parametername)); } } } } else{ System.out.println("Isnt it strange?"); } } } } } Then it works pre…
has answer: http://stackoverflow.com/a/21409060
favorite count: 0
type: UnansweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32294678
has comment: http://stackoverflow.com/comment/32294665
has comment: http://stackoverflow.com/comment/32295082
type: Question
has comment: http://stackoverflow.com/comment/32295010
has title: I found an Error at IDEA's debugger
downvote count: 11
has comment: http://stackoverflow.com/comment/32294825
score: -11
tagged with: intellij-idea

http://stackoverflow.com/comment/32442657
comment on: http://stackoverflow.com/q/21492107
score: 0
type: Comment
type: QuestionComment
has text: the error I receive is: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

http://stackoverflow.com/comment/32308197
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21416152
has text: And Genymotion is running right?

http://stackoverflow.com/a/21427050
downvote count: 0
answers question: http://stackoverflow.com/q/21426901
upvote count: 2
type: Answer
has body: There are two options: You return the new reference as you suggested You wrap the reference in another reference so you can update the inner reference without a problem. A simple solution would be an array: Node[] ref = new Node[1] {prev}; ref[0] = //update here I think option one would be better here because the Ref-Ref or the array would just clutter the method
score: 2
has comment: http://stackoverflow.com/comment/32327319

http://stackoverflow.com/q/21359841
has comment: http://stackoverflow.com/comment/32207331
accepted answer: http://stackoverflow.com/a/21359866
downvote count: 0
possible better answer: http://stackoverflow.com/a/21359869
favorite count: 0
has comment: http://stackoverflow.com/comment/32207281
has answer: http://stackoverflow.com/a/21359869
answer count: 3
has comment: http://stackoverflow.com/comment/32207286
has answer: http://stackoverflow.com/a/21359880
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21359866
has body: I am attempting to write a method that tests to see if a string is a palindrome. This is what I have so far: public static boolean isPalindrome(String word) { boolean flag = false; if (word.length() &lt; 2) { flag = true; } else if (word.charAt(0) == word.charAt(word.length() - 1)) { flag = isPalindrome(word.substring(1, word.length() - 2)); } return flag; } The problem I'm running into is, this method consistently returns true for strings of the form "aaaba", where the pair that should cause false to be propagated back through the stack is in the middle of the string. I'm banging my head against the wall trying to see where my error is, but to no avail. Perhaps a fresh set of eyes will see something I'm missing?
upvote count: 1
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/32207635
score: 1
tagged with: java
has title: Recursive Palindrome method debugging

http://stackoverflow.com/comment/32212973
has text: how about using the search field at the upper trailing edge of this page? It's a question asked about a trizillion times already with millions of correct answers ..
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21355799

http://stackoverflow.com/q/21356563
has title: How Come Height Isn't Defined
upvote count: 0
answer count: 1
tagged with: height
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32201165
has body: I'm working on a game in java. My Background class needs a width and height but it still doesn't recognise them. package TileMap; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import main.GamePanel; public class Background { private BufferedImage image; private int width; private double x; private double y; private double dx; private double dy; private double moveScale; public Background(String s, double ms) { try { image = ImageIO.read( getClass().getResourceAsStream(s) ); width = image.getWidth(); height = image.getHeight(); moveScale = ms; } catch(Exception e) { e.printStackTrace(); } } public void setPosition(double x, double y) { this.x = (x * moveScale); this.y = (y * moveScale); fixPosition(); } public void setVector(double dx, double dy) { this.dx = dx; this.dy = dy; } public void update() { x += dx; y += dy; fixPosition(); } private void fixPosition() { while(x &lt;= -width) x += width; while(x &gt;= width) x -= width; while(y &lt;= -height) y += height; while(y &gt;= height) y -= height; } public void draw(Graphics2D g) { g.drawImage(image, (int)x, (int)y, null); if(x &lt; 0) { g.drawImage( image, (int)x + GamePanel.WIDTH, (int)y, null ); } if(x &gt; 0) { g.drawImage( image, (int)x - GamePanel.WIDTH, (int)y, null ); } } } image.getHeight gives me an error saying "Height Can not be resolved into a variable" although image.getWidth is not. Could somebody tell me what is the issue with my code?
tagged with: java
tagged with: image-processing
type: Question
tagged with: width
score: -2
tagged with: image
has answer: http://stackoverflow.com/a/21356582

http://stackoverflow.com/a/21351505
score: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21351395
answers question: http://stackoverflow.com/q/21351395
type: Answer
upvote count: 6
has body: You should call methods, not constructors, using the dot (.) operator. Here you are calling super class' constructor using dot (.). That's why you are getting errors like these: The method myCoord() is undefined for the type myCoord and The method myCoord(double, double) is undefined for the type myCoord Use these to call your super constructor: super(); and super(x,y); as shown below. public class Coord3D extends myCoord { private double coorZ; Coord3D() { super(); // not super.myCoord(); its a constructor call not method call coorZ = 1; } Coord3D(double x, double y, double z) { super(x,y); // not super.myCoord(x,y); its a constructor call not method call coorZ = z; } }

http://stackoverflow.com/comment/32463980
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21504256
has text: http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#setTime(java.util.Date)

http://stackoverflow.com/a/21413970
has comment: http://stackoverflow.com/comment/32303742
accepted answer of: http://stackoverflow.com/q/21413938
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32303821
downvote count: 0
has comment: http://stackoverflow.com/comment/32303797
has body: This has nothing to do with Spring. If you are deploying a web application, everything in WEB-INF/classes will appear starting at the root of the classpath. You can get it the InputStream to that resource with InputStream in = Configures.class.getResourceAsStream("/backupData.properties"); prop.load(in); Since a web application is not always extracted from its .war file, the actual properties file might only exist as a zip entry. As such, you can't (and shouldn't) retrieve it with FileInputStream. Here's the javadoc.
upvote count: 2
has comment: http://stackoverflow.com/comment/32303914
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32303750
has comment: http://stackoverflow.com/comment/32304006
answers question: http://stackoverflow.com/q/21413938
has comment: http://stackoverflow.com/comment/32303973

http://stackoverflow.com/comment/32357878
comment on: http://stackoverflow.com/a/21444288
score: 0
type: AnswerComment
type: Comment
has text: thank you for the response. I added some settings.gradle file and changed the tree as well. But now it is throwing another error (see my update). Btw, what am I supposed to do with the `pom` file in the `library` folder ?

http://stackoverflow.com/q/21408199
type: Question
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/21408395
answer count: 1
has body: I need to click once to implement the methods in Onclick but the problem here that in counter it won't count until i click button constantly and i have several check conditions that print text to the user if true these texts don't show up until i click the button one more time , how to handle that issue ? i want the button to be clicked once then all the code inside Onclick implemented properly Life.setOnClickListener(new OnClickListener() { public void onClick(View v) { counterLife(); Help.setVisibility(View.INVISIBLE); Reset.setVisibility(View.VISIBLE); // other code ............. void counterLife() //To count { if (a &amp;&amp; T2 ==0 &amp;&amp; T3 == 0) { if(countLife == 6) { //code text.setText("You Completed 6 Lives "); } else countLife ++ ; }
favorite count: 0
has title: Onclick not working properly
type: UnansweredQuestion
tagged with: android
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/32290330
type: Comment
comment on: http://stackoverflow.com/q/21406091
score: 0
type: QuestionComment
has text: @SotiriosDelimanolis OP uses the load-time weaver. The load-time weaver injects objects created with the `new` operator if the are `@Configurable`. It's for bean whose lifecycle is managed outside the spring container.

http://stackoverflow.com/comment/32232498
comment on: http://stackoverflow.com/a/21373747
has text: have applied your changes but getting alert of bluetooth on other device after accepting request its showing me error "File not sent" on sending device
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21374507
has comment: http://stackoverflow.com/comment/32233793
type: Answer
has comment: http://stackoverflow.com/comment/32233801
answers question: http://stackoverflow.com/q/21374342
has comment: http://stackoverflow.com/comment/32234071
has comment: http://stackoverflow.com/comment/32234125
has body: You are trying to access to not static method from static method. At first make an instance of CollegeTester class, than call it. For example: import java.util.ArrayList; import java.util.Scanner; public class CollegeTester { private Scanner input = new Scanner(System.in); private ArrayList&lt;Student&gt; array = new ArrayList&lt;Student&gt;(); public static void main(String[] args) { new CollegeTester().getCommand(); } public void getCommand() { System.out.println("Enter a command: "); String command = input.nextLine(); if (command.equals("add")) this.addCommand(); } public void addCommand() { System.out.println("Enter a Name: "); String name = input.nextLine(); } } public class Student { // Some properties and fty. }
has comment: http://stackoverflow.com/comment/32235055
score: 0
has comment: http://stackoverflow.com/comment/32233859
has comment: http://stackoverflow.com/comment/32234314
has comment: http://stackoverflow.com/comment/32233959
has comment: http://stackoverflow.com/comment/32234596

http://stackoverflow.com/a/21454851
type: Answer
upvote count: 1
has body: The two options available to you are: Don't reload the page. Instead submit the data via AJAX or validate it by javascript. That way you don't ever have to touch the data in the form. Make sure your javascript highlights the fields that have errors in some way. The endpoint that you're POSTing your data to needs to be able to recognise that the data is invalid and include that data when returning the user to the same page. I'm not familiar with jsp, but generally you'd do that by including variables in your template for your form that could contain the data, and passing empty strings on the first load of the page. If the page is then shown to the user again after a failed form validation, pass back the POST data that you received in your form request.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21454709

http://stackoverflow.com/comment/32261588
comment on: http://stackoverflow.com/q/21384220
score: 0
type: Comment
type: QuestionComment
has text: thank you. Appreciate your comments

http://stackoverflow.com/q/21368726
type: UnansweredQuestion
answer count: 0
has body: I am having a pretty strange error, I am rendering first some terrain and then a quad to have some reference plane in case things go wrong. This is my most relevant code: @Override protected void compilePrograms() { super.compilePrograms(); programTerrain = new Program( new VertexShader("data/shaders/terrain.vs.glsl").compile(), new TessellationControlShader("data/shaders/terrain.tcs.glsl").compile(), new TessellationEvaluationShader("data/shaders/terrain.tes.glsl").compile(), new FragmentShader("data/shaders/terrain.fs.glsl").compile() ).compile(); programQuad = new Program( new VertexShader("data/shaders/quad.vs.glsl").compile(), new FragmentShader("data/shaders/quad.fs.glsl").compile() ).compile(); programsCompiled(); } @Override protected void init() { super.init(); float[] plane = new float[] { -400f, -5f, -400f, -400f, -5f, 400f, 400f, -5f, 400f, 400f, -5f, -400f }; //temp FloatBuffer dataBuffer = BufferUtils.createFloatBuffer(16 * 16 * 16 * 3 + 4 * 3); dataBuffer.put(generateRandomTerrain(16, 16)); dataBuffer.put(plane); dataBuffer.clear(); buffer = new DynamicDrawArrayBuffer().create().bind().fillData(dataBuffer); vertexArray = new VertexArrayObject().create().bind(); vertexArray.setAttribute(buffer, VS_POSITION, 3, GL_FLOAT, false, 0, 0); vertexArray.enableAttributes(VS_POSITION); modelMatrix.identity().translate(0f, 0f, 0f); Uniforms.setUniformMatrix4(UNIFORM_MODEL_MATRIX, false, modelMatrix.writeToFloatBuffer(modelMatrixBuffer)); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glPatchParameteri(GL_PATCH_VERTICES, 16); } @Override protected void render(final double msDelta) { super.render(msDelta); glClearColor(25f / 255f, 25f / 255f, 112f / 225f, 1.0f); glClearDepthf(1f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); programTerrain.use(); programTerrain.drawArrays(GL_PATCHES, 0, 16 * 16 * 16); programQuad.use(); programQuad.drawArrays(GL_QUADS, 16 * 16 * 16, 4); } Everything I used here should be straight forward as the objects are just very simple…
tagged with: opengl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/32223723
type: Question
has comment: http://stackoverflow.com/comment/32223356
score: 0
has comment: http://stackoverflow.com/comment/32223877
has title: OpenGL drawArrays GL_QUADS gived Invalid Enum (1280)

http://stackoverflow.com/comment/32427796
type: QuestionComment
has text: @SnakeDoc While that is valid, but I can't think of a single instance where it would be beneficial to throw Strings and Integers into list together.
score: 0
comment on: http://stackoverflow.com/q/21483942
type: Comment

http://stackoverflow.com/a/24483696
has body: try this its work : private void dchooser_departurePropertyChange(java.beans.PropertyChangeEvent evt) { ((JTextField)dchooser_departure.getDateEditor().getUiComponent()).setEditable(false); }
type: Answer
answers question: http://stackoverflow.com/q/21354037
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/21398698
has comment: http://stackoverflow.com/comment/32279855
has comment: http://stackoverflow.com/comment/32280009
upvote count: 1
has body: I wouldn't. I would have the method return 'float', with a small 'f', or more probably 'double'; I would have it parse the entire value without any substring operations; and I would cast the value to 'int' at the call sites that require it, and/or from there to Integer, Float, Double, ... whatever you need at the call site. You will find this is orders of magnitude more efficient than the answer you've accepted, which is just a poor man's self-implemented runtime polymorphism where you previously had compile-time polymorphism. But the problem itself is highly dubious. There are no ints and floats in an Excel file. There are only decimal numbers with zero or more decimal places.
type: Answer
has comment: http://stackoverflow.com/comment/32279986
has comment: http://stackoverflow.com/comment/32279916
downvote count: 0
has comment: http://stackoverflow.com/comment/32279883
has comment: http://stackoverflow.com/comment/32277177
score: 1
has comment: http://stackoverflow.com/comment/32277562
answers question: http://stackoverflow.com/q/21397850
has comment: http://stackoverflow.com/comment/32279475

http://stackoverflow.com/q/21439780
tagged with: android
linked to: http://stackoverflow.com/q/18254848
has answer: http://stackoverflow.com/a/21439928
has comment: http://stackoverflow.com/comment/32350084
has comment: http://stackoverflow.com/comment/32350052
has comment: http://stackoverflow.com/comment/32350009
upvote count: 2
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/32349859
has comment: http://stackoverflow.com/comment/32349695
linked to: http://stackoverflow.com/q/7975473
downvote count: 1
has comment: http://stackoverflow.com/comment/32349252
tagged with: java
has comment: http://stackoverflow.com/comment/32349952
has comment: http://stackoverflow.com/comment/32350091
has comment: http://stackoverflow.com/comment/32350779
type: Question
has comment: http://stackoverflow.com/comment/32395498
has comment: http://stackoverflow.com/comment/32349193
has comment: http://stackoverflow.com/comment/32350976
has body: Is it possible to get the public IP address of the device using some Java code in Android? Can I use curl with php to remote server to know the public IP? But I don't know how to use curl in Java. I need the code for user's country based on the public IP address. I Only need the code for public ip of the user later see the country
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32349547
has title: How to get Public IP address of the device?

http://stackoverflow.com/comment/32341410
has text: I would use `Session.load(class, PrimaryKey)` to load an object by its Primary Key, instead of using a query.
comment on: http://stackoverflow.com/q/21435250
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32472367
comment on: http://stackoverflow.com/a/21509000
type: AnswerComment
has text: That splits on point and dash. What use it that to the OP? Did you just copy and paste this from some other question?
score: 0
type: Comment

http://stackoverflow.com/comment/32471147
type: AnswerComment
comment on: http://stackoverflow.com/a/21508073
type: Comment
has text: The interface documentation of iterator can be found at http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html Knowing it is part of any basic java certificate. Dublicating the list is not only bad practise, it also leads to major security flaws.
score: 0

http://stackoverflow.com/a/21489879
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/32438197
has body: You are using the wrong character class. Use s.replaceFirst("^[^a-zA-Z]+", "") That is ^ start at the beginning of the string [^ ]+ one or more (greedy - keep going until you hit a letter a-zA-Z ascii characters between a-z or A-Z Following comments from @anubhava, I changed the * to a +. If you have no match, there is nothing that needs replacing. It's actually cleaner.
has comment: http://stackoverflow.com/comment/32438242
type: Answer
answers question: http://stackoverflow.com/q/21489853
accepted answer of: http://stackoverflow.com/q/21489853
score: 5
upvote count: 6

http://stackoverflow.com/q/21353147
tagged with: actionlistener
score: 0
answer count: 1
has body: I'm trying write a program where I have 3 different buttons and when you click a button it changes the background of a panel in the frame. I got my panel set up and everything is in the right place, but I need to have all my actionlisteners for my buttons all in one class. I tried doing that but all the buttons change colors and not the background. Here's the code I have so far. import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Kelle Schmitt */ public class BackgroundColorChooserFrame extends JFrame { private static final int WIDTH = 300; private static final int HEIGHT = 300; private JLabel titleLbl; private JButton redBtn; private JButton greenBtn; private JButton blueBtn; private JButton quitBtn; public BackgroundColorChooserFrame() { createButton(); createLabel(); createPanel(); setSize(WIDTH, HEIGHT); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } class ColorListener implements ActionListener { public void actionPerformed(ActionEvent evt) { redBtn.setBackground(Color.red); greenBtn.setBackground(Color.green); blueBtn.setBackground(Color.blue); } } public void createButton() { redBtn = new JButton("Red"); greenBtn = new JButton("Green"); blueBtn = new JButton("Blue"); ActionListener colorlistener = new ColorListener(); redBtn.addActionListener(colorlistener); greenBtn.addActionListener(colorlistener); blueBtn.addActionListener(colorlistener); } public void createLabel() { titleLbl = new JLabel("Background Color Chooser"); } //create and add panels public void createPanel() { JPanel mainPnl, titlePnl, colorPnl, controlPnl; mainPnl = new JPanel(); mainPnl.setL…
has title: ActionListeners and JButtons
tagged with: colors
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/21353198
accepted answer: http://stackoverflow.com/a/21353198
type: Question

http://stackoverflow.com/q/21462775
tagged with: webmethods
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21533012
upvote count: 2
has comment: http://stackoverflow.com/comment/32390185
tagged with: java
answer count: 2
has title: Can Eclipse for Java and Eclipse for WEBMethods be on the same hard drive?
has body: I am new to WEBMethods. I have been working on a Java service for a project. I really need to be able to write some code in regular Java for some quick testing of reading in a simple text expression with some regular expressions. Nothing at all that fancy with the Java part. But eclipse currently is set up for WEBMethods and I need to be in a regular Java mode for Eclipse (If there is such a thing). At home I have the standard eclipse version and have no trouble writting code. But at work I have WEBMethods installed in the Eclipse (Software AG Designer). I think that if I can write the code in regular Java then I can just copy and paste it into the WEBMethods Java services and set up the INPUT and OUTPUT variables and it should work. But currently I cannot find a way to just write Java code like I do from my home computer. Question: How can I write just a regular Java program (classes, packages, ...etc...) with a machine with WEBMethods installed? Do I have to install another session of Eclipse on my hard drive? (I tried this a while back and there was an issue with having more than one session of Eclipse on the machine). Java Web Services Code: package DssAccessBackup.services.flow; import com.wm.data.*; import com.wm.util.Values; import com.wm.app.b2b.server.Service; import com.wm.app.b2b.server.ServiceException; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public final class new_javaService_SVC { /** * The primary method for the Java service * * @param pipeline * The IData pipeline * @throws ServiceException */ public static final void new_javaService(IData pipeline) throws ServiceException { // pipeline IDataCursor pipelineCursor = pipeline.getCursor(); String inputFileName = IDataUtil.getString( pipelineCursor, "inputFileName" ); pipelineCursor.destroy(); // pipeline IDataCursor pipelineCursor_1 = pipeline.getCursor(); IDataUtil.put( pipelineCursor_1, "fileName", "fileName" ); // outDoc IData outDoc = IDataFactory.create…
linked to: http://stackoverflow.com/q/8616163
accepted answer: http://stackoverflow.com/a/21533012
possible better answer: http://stackoverflow.com/a/21523986
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21523986

http://stackoverflow.com/q/21498239
has body: How / why is is that autoboxing works for the first example below, but not the second? What's the reasoning / logic behind this? Short i = 5; // works Short i = new Short(5) // doesn't work Short i = new Short( (short) 5) // works again, but uses explicit cast
has answer: http://stackoverflow.com/a/21498257
favorite count: 0
accepted answer: http://stackoverflow.com/a/21498257
has title: How come autoboxing doesn't work for Short(5)?
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: casting
upvote count: 1
answer count: 1
downvote count: 0
tagged with: autoboxing
tagged with: wrapper

http://stackoverflow.com/a/21401489
has body: Spring does provide a mechanism to validate your models, as shown here. Personally I would recommend that you follow those guidelines so that your application makes full use of the features offered by Spring. That being said, the most basic forms of validation for user names is to make sure that the user name is not already in your database and in some cases, certain special characters might not be allowed. For passwords, on the other hand, there are usually some length restrictions, such as at least 5 characters. In certain situations, you can also enforce the use of letters of different casing, numbers and other special symbols. In these cases, regular expressions can be helpful. (Note: For this case, it is not recommended to build a single regex that will attempt to match everything). On a completely different note, do not forget to store your passwords as hash values, and then, when the user logs on, you compare the value of the hash of the password which the user has entered with the hash that you have already in your DB.
has comment: http://stackoverflow.com/comment/32281910
type: Answer
accepted answer of: http://stackoverflow.com/q/21401228
score: 1
has comment: http://stackoverflow.com/comment/32282140
upvote count: 1
answers question: http://stackoverflow.com/q/21401228
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32283264

http://stackoverflow.com/q/21357638
has answer: http://stackoverflow.com/a/21357755
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21357755
score: 6
has comment: http://stackoverflow.com/comment/32203975
favorite count: 0
has body: I am following the tutorial about Overlaying the Action Bar When I tried to add <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:paddingTop="@dimen/activity_action_bar_overlay_margin"> ?attr/actionBarSize and then I got the following errors: 01-25 23:10:33.132: E/AndroidRuntime(554): FATAL EXCEPTION: main 01-25 23:10:33.132: E/AndroidRuntime(554): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfirstapp/com.example.myfirstapp.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown> 01-25 23:10:33.132: E/AndroidRuntime(554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.app.ActivityThread.access$600(ActivityThread.java:123) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.os.Handler.dispatchMessage(Handler.java:99) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.os.Looper.loop(Looper.java:137) 01-25 23:10:33.132: E/AndroidRuntime(554): at android.app.ActivityThread.main(ActivityThread.java:4424) 01-25 23:10:33.132: E/AndroidRuntime(554): at java.lang.reflect.Method.invokeNative(Native Method) 01-25 23:10:33.132: E/AndroidRuntime(554): at java.lang.reflect.Method.invoke(Method.java:511) 01-25 23:10:33.132: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-25 23:10:33.132: E/AndroidRuntime(554): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-25 23:10:33.132: E/AndroidRuntime(554): at dalvik.system.NativeStart.main(Native Method) 01-25 23:10:33.132: E/AndroidRuntime(554): Caused by: android.view.InflateException…
tagged with: android-relativelayout
tagged with: android
has comment: http://stackoverflow.com/comment/32203449
has title: Specify Layout Top margin for overlay action bar
upvote count: 6
type: AnsweredQuestion
tagged with: android-actionbar
tagged with: overlay
type: Question
tagged with: java

http://stackoverflow.com/q/21483841
tagged with: android
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/21484313
type: Question
has body: I have Gridview with images. above the image I have text(hello) and I can to show images(without text) to my gridview .now I want if I click gridview's 5th element I want to hide 5th image's text.meybe problem solution is gridview.setOnItemClickListener but I do not know how I can do this I wrote some code witch can to show toast message by position, but I do not know how I can to hide text by position gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Toast.makeText(getApplicationContext(), "Cliked" + position, Toast.LENGTH_SHORT).show(); } });
upvote count: 0
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/21484097
favorite count: 0
tagged with: gridview
has title: Android gridview change background by position
type: UnansweredQuestion

http://stackoverflow.com/q/21372556
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: properties-file
accepted answer: http://stackoverflow.com/a/22705991
has title: spring - inject property to a pojo class
tagged with: dependency-injection
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22705991
has body: How would you inject a value from a .properties file to a pojo class? What I want to achieve is everytime I get an instance of this class, it will return to me an instance with that value already injected to it. I put it in a .properties file instead of within the java class itself for I'll be needing it for easy change on configuration later. I'm currently trying adding this annotation @Value("${myfield.name}") on my variable on my pojo class to no avail. Any help is appreciated. Thanks!
answer count: 1
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/32297150
comment on: http://stackoverflow.com/a/21408144
has text: Sorry, I meant indented to a new tab or 4 spaces (not new line).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32212607
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21361207
has text: from the book --"To maintain the singleton guarantee, you have to declare all instance fields transient and provide a readResolve method (Item 77). Otherwise, each time a serialized instance is deserialized, a new instance will be created, leading, in the case of our example, to spurious Elvis sightings. To prevent this, add this readResolve method to the Elvis class". According to the author, if i dont implement readResolve(), singletong is broken. But i see its not broken, and i am getting the same object(reference is same). This is what i fail to understand.
score: 0

http://stackoverflow.com/q/21484837
linked to: http://stackoverflow.com/q/3298066
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32446190
favorite count: 0
has comment: http://stackoverflow.com/comment/32496188
tagged with: linux
accepted answer: http://stackoverflow.com/a/21528900
tagged with: reporting-services
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Windows services authentication using Kerberos from Java program on linux
type: Question
has answer: http://stackoverflow.com/a/21528900
has body: Hie everyone, I am struggling with a problem of authentication for a few days now. I work on a web app on tomcat7/java7/linux and I need to access a Windows SSRS server from this app. When I run the code on my windows machine, everything work just fine, authentication is done by Windows and I just use: InputStream pdfInStream = new BufferedInputStream(pdfUrl.openStream(), bufferSize); On the linux server, I use Kerberos through GSS-API javax.security.auth.login.LoginContext and I am able to authenticate against the Kerberos server: LoginContext .login() works just fine. And now I am stuck here, Windows authentication in Java suggest a deprecated tool, Oracle documentation kept me days without getting to the point, SPNEGO (http://spnego.sourceforge.net/) doesn't seem to address my problem. Thanks in advance! Refs: Oracle documentation: docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/tutorials/BasicClientServer.html docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/tutorials/ClientServer.html docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/tutorials/AcnAndAzn.html HTTP tools from apache: http://hc.apache.org/
tagged with: kerberos

http://stackoverflow.com/a/21375718
answers question: http://stackoverflow.com/q/21375659
type: AcceptedAnswer
has body: new String() is an expression that produces a String ... and a String is immutable, no matter how it is produced. (Asking if new String() is mutable or not is nonsensical. It is program code, not a value. But I take it that that is not what you really meant.) If I create a string object as String c = ""; is an empty entry created in the pool? Yes; that is, an entry is created for the empty string. There is nothing special about an empty String. (To be pedantic, the pool entry for "" gets created long before your code is executed. In fact, it is created when your code is loaded ... or possibly even earlier than that.) So, I was wanted to know whether the new heap object is immutable as well, ... Yes it is. But the immutability is a fundamental property of String objects. All String objects. You see, the String API simply does not provide any methods for changing a String. So (apart from some dangerous and foolish1 tricks using reflection), you can't mutate a String. and if so what was the purpose?. The primary reason that Java String is designed as an immutable class is simplicity. It makes it easier to write correct programs, and read / reason about other people's code if the core string class provides an immutable interface. An important second reason is that the immutability of String has fundamental implications for the Java security model. But I don't think this was a driver in the original language design ... in Java 1.0 and earlier. Going by the answer, I gather that other references to the same variable is one of the reasons. Please let me know if I am right in understanding this. No. It is more fundamental than that. Simply, all String objects are immutable. There is no complicated special case reasoning required to understand this. It just >>is&lt;&lt;. For the record, if you want a mutable "string-like" object in Java, you can use StringBuilder or StringBuffer. But these are different types to String. 1 - The reason these tricks are (IMO) dangerous and foo…
score: 105
type: Answer
upvote count: 105
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21375659

http://stackoverflow.com/a/21409939
has body: In BufferedReader reader = new BufferedReader(new FileReader("finalfile"))) the parameter to the FileReader constructor is hard coded as "finalfile" - you need to use the variable instead: BufferedReader reader = new BufferedReader(new FileReader(finalfile))) ^^^^^^^^^^^ You also need to move String finalfile = ""; before the first try block, otherwise it is out of scope when you are creating the FileReader. Also, there is no need to query the operating system and manually set the directory path separator. If you really need to, use File.separator. Otherwise, simply use the forward slash - this is working cross-platform. It is good to see that you are using try-with-resources - however, you should do it consequently; simply create all required resources in the try statement, and then there is no need to explicitly close them: try (BufferedReader reader = new BufferedReader(new FileReader(finalfile)); FileWriter writer = new FileWriter("output.txt")) { ... // reader and writer will be auto-closed } catch (IOException e) { System.out.print("Error : " + e); }
answers question: http://stackoverflow.com/q/21409898
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/29000349
type: Answer
has body: I have this recursive function, which works: public void swap2List(){ root = swap2List(root); //pass the root node } private Node swap2List(Node current){ if(current == null || current.next == null){ return current; } else{ Node temp = current; Node temp2 = current.next.next; current = current.next; current.next = temp; temp.next = swap2List(temp2); } return current; }
answers question: http://stackoverflow.com/q/21491635
score: 0

http://stackoverflow.com/q/21420608
tagged with: java
has comment: http://stackoverflow.com/comment/32316373
type: Question
has answer: http://stackoverflow.com/a/21470129
answer count: 1
has comment: http://stackoverflow.com/comment/35220875
score: 0
tagged with: android
has title: Slow build Android Maven Project
accepted answer: http://stackoverflow.com/a/21470129
tagged with: maven
tagged with: android-maven-plugin
has body: I have a multi module Maven project and I need help to optimize the time spent to build my Android module. When running the goals "clean install" or "verify" concluded that the Android project is consuming most of the time. The summary of time spent on builds is shown below: [INFO] ------------------------------------------------------------------ [INFO] Building M-SPLearning Parent 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------ [INFO] ------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] M-SPLearning Entity ................... SUCCESS [1.710s] [INFO] M-SPLearning Repository ............... SUCCESS [0.226s] [INFO] M-SPLearning Service .................. SUCCESS [0.115s] [INFO] M-SPLearning RESTful .................. SUCCESS [2.925s] [INFO] M-SPLearning Android .................. SUCCESS [38.153s] &lt;&lt; The Problem [INFO] M-SPLearning Parent ................... SUCCESS [0.000s] [INFO] ------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------ [INFO] Total time: 44.430s [INFO] Finished at: Tue Jan 28 23:24:54 BRST 2014 [INFO] Final Memory: 24M/137M [INFO] ------------------------------------------------------------------ The full output console can be accessed here. Like to know if there are ways to improve the time spent in the build of the Android project, because I need run the build procedure (programmatically) in one of my RESTful services and 45~60 seconds is too long to wait the response. The project source code is stored on GitHub. Already, thanks!
type: AnsweredQuestion

http://stackoverflow.com/comment/32260051
has text: If you search through all your files (`grep -r 'thisIsTheTargetRef'`) you have to find where this bean is being defined... you must have missed something.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21389064

http://stackoverflow.com/comment/32308665
type: AnswerComment
comment on: http://stackoverflow.com/a/21414362
type: Comment
score: 0
has text: Android Studio was indeed causing the issue, after strugling for a few minutes to understand how gradle was working, I compiled manually ( command prompt) and got a library that was working this time, it has been successfully included into my apk. Thank you very much !

http://stackoverflow.com/a/21353024
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: In your case, If I was a user and I would see a crash issue I would downvote too, but I wouldn't be so annoyed if your app gives me something like "We are improving something bla bla" and I would wait for it. It's best check those situations such as downtime,no internet etc and let the user know about it.
score: 1
accepted answer of: http://stackoverflow.com/q/21352904
answers question: http://stackoverflow.com/q/21352904
downvote count: 0

http://stackoverflow.com/a/21497939
score: 1
has comment: http://stackoverflow.com/comment/32452481
has comment: http://stackoverflow.com/comment/32452564
has body: In Maths constructor you have forgotten parenthesis () Do like this public Maths() { add = a; subtract = s; multiply = m; divide = d; }
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21497934
type: Answer
answers question: http://stackoverflow.com/q/21497934
downvote count: 0

http://stackoverflow.com/q/21451142
has title: LinearLayout Buttons not appearing when device orientation changed to Horizontal?
tagged with: java
linked to: http://stackoverflow.com/q/21312718
has body: Here is the xml in which ScrollView layout size will vary means it will zoom image on button click but my top headers and footer will always be in same position irrespective of zoom values....... XML <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/btn_zoomIn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:src="@drawable/zoomin1" /> <ImageView android:id="@+id/btn_zoomout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:src="@drawable/zoomin1" /> <com.example.imagetouchview.TouchImageView android:id="@+id/imagezoom" android:layout_width="fill_parent" android:layout_height="400dp" android:layout_gravity="center"> </com.example.imagetouchview.TouchImageView> <ImageView android:id="@+id/btn_email_fatwa" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/zoomin1" android:layout_weight="1"/> <ImageView android:id="@+id/btn_share_fatwa" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/zoomin1" android:layout_weight="1"/> <ImageView android:id="@+id/btn_save_fatwa" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/zoomin1" android:layout_weight="1"/> this layout is fine in vertical orientation while when device orientatio changes to Horizontal the bottom buttons are invisible.I am following Salmans Ayub Answer For Image Zoomin and Out
type: Question
has answer: http://stackoverflow.com/a/21451887
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/4858026
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/32347009
score: 1
type: Comment
type: QuestionComment
has text: @tobias_k [why not](http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3), may I ask (specifically _Example 8.1.3-2. Inner Class Declarations_)?
comment on: http://stackoverflow.com/q/21438559

http://stackoverflow.com/comment/32498561
type: Comment
has text: There is no way to specify a Server in UserPrincipalLookupService. I think the **%logonserver%** environment variable shows the current connected Domain-Controller. But i want to set many ACL's remote, so the Remote and my Computer have probebly not the same DC.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21502014

http://stackoverflow.com/a/21416271
has comment: http://stackoverflow.com/comment/32528888
accepted answer of: http://stackoverflow.com/q/21415551
has comment: http://stackoverflow.com/comment/32353237
answers question: http://stackoverflow.com/q/21415551
upvote count: 2
has body: You have to add mapping for BaseEntity as well: &lt;class name="xxx.BaseEntity " abstract="true"&gt; You can also try to use annotations and just set packagesToScan property
has comment: http://stackoverflow.com/comment/32312661
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32310533
downvote count: 0

http://stackoverflow.com/a/21440637
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Please check the image's height because the layout is correct AFAICS, there is nothing else. :D
has comment: http://stackoverflow.com/comment/32352837
accepted answer of: http://stackoverflow.com/q/21361680
upvote count: 2
answers question: http://stackoverflow.com/q/21361680

http://stackoverflow.com/a/21419618
upvote count: 2
has comment: http://stackoverflow.com/comment/32314989
has comment: http://stackoverflow.com/comment/32327608
has comment: http://stackoverflow.com/comment/32314629
downvote count: 0
has body: The easiest solution would be: public static void main(String[] args) { int b[] = {2,3,1,0,5}; int highest = Integer.MIN_VALUE; int highest2nd = Integer.MIN_VALUE; for(int i :b ) if (i&gt;=highest) { highest2nd = highest; highest = i; } else if (i&gt;= highest2nd) highest2nd = i; System.out.println(highest2nd); } Then you walk through the list only once, which is the best you can do from a 'Big O' standpoint. PS: depending on whether you want the second highest unique value, or the value that is stricly lower than the highest value, you could choose to put i&gt;highest in the if-statement, instead of i&gt;=highest.
type: Answer
answers question: http://stackoverflow.com/q/21419508
score: 2

http://stackoverflow.com/comment/32281035
type: AnswerComment
comment on: http://stackoverflow.com/a/21401007
has text: Have you added launcher activity in your manifest ? Which is your launcher activity ?
type: Comment
score: 0

http://stackoverflow.com/q/21359986
score: 0
answer count: 1
has title: Weird behaviour of Java List
accepted answer: http://stackoverflow.com/a/21360078
has body: I have this requirement to show the amount with thousand separator. I have this POJO class with these two methods which I call according to my requirements public Integer getTotalAmount() { return totalAmount; } public String getTotalAmountWithSeparator() { return String.format("%,d", totalAmount); } public void setTotalAmount(Integer totalAmount) { this.totalAmount = totalAmount; } now when I use this method getTotalAmountWithSeparator() in my another class which looks like this and I do a println to see if the amount is being shown properly(which it does). List&lt;SupplierOrderDetails&gt; list = SupplierOrderDetailBussinessLogic.getInstance().getSupplierOrderDetailsFromsupplierOrder(supplierOrder); DataProviderBuilder dpb = new DataProviderBuilder(); // add heading data dpb.add("so", supplierOrder.getSupplierOrderNo()); dpb.add("sn", supplierOrder.getSupplier().getPerName()); dpb.add("sec", supplierOrder.getSection().getAlternateName()); dpb.add("od", supplierOrder.getSupplierOrderCreated().toString()); // add table data dpb.addJavaObject(list, "data"); here is the actual method getSupplierOrderDetailsFromsupplierOrder(supplierOrder); which gets the data from the db. @SuppressWarnings("unchecked") public List&lt;SupplierOrderDetails&gt; getSupplierOrderDetailsFromsupplierOrder(SupplierOrder supplierOrderDetails){ Session hibernateSession = HibernateUtills.getInstance().getHibernateSession(); Criteria criteria = hibernateSession.createCriteria(SupplierOrderDetails.class); criteria.add(Restrictions.eq("supplierOrderID", supplierOrderDetails)); List&lt;SupplierOrderDetails&gt; models = criteria.list(); System.out.println(" models.size() " + models.size()); for (int i = 0; i &lt; models.size(); i++) { if (models.get(i).getId() != null) { models.get(i).getProductID().getProductCode(); models.get(i).getProductID().getBrandName(); models.get(i).getPurchasePrice(); models.get(i).getOrderQty(); models.get(i).getTotalAmountWithSeparator(); System.out.println(models.get(i).g…
has answer: http://stackoverflow.com/a/21360078
tagged with: jakarta-ee
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21512282
has comment: http://stackoverflow.com/comment/32478374
answer count: 0
tagged with: java
has body: I am not good with arrays.In the below code there are 2 methods which takes the data from two 2D Arrays.The first method COMBINATION is working correctly.But the second Method doesn't. Am I doing anything wrong in the array Declaration ??? The Below Methods takes the KeyEvent from the Array &amp; perform the Keypress &amp; keyRelease according to the KeyEvents in the array. For Example : Combination.UNICODE_COPY, KeyEvent.VK_CONTROL, KeyEvent.VK_C The above line presses CTRL+C. It performs the Copy Function. I think that in the Second Method i am passing 3 KeyEvents.Is that a Problem ??? private static final int[][] COMBINATION = { { Combination.UNICODE_CUT, KeyEvent.VK_CONTROL, KeyEvent.VK_X }, { Combination.UNICODE_COPY, KeyEvent.VK_CONTROL, KeyEvent.VK_C }, { Combination.UNICODE_PASTE, KeyEvent.VK_CONTROL, KeyEvent.VK_V } }; private static final int[][] COMBINATIONS = { { Combinations.UNICODE_TASK, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_DELETE } }; private void keyboardCombination(Combination action) { boolean exception = false; for (int i = 0; i &lt; COMBINATION.length; i++) { if (action.unicode == COMBINATION[i][0]) { exception = true; this.application.getRobot().keyPress(COMBINATION[i][1]); this.application.getRobot().keyPress(COMBINATION[i][2]); // this.application.getRobot().keyPress(COMBINATION[i][3]); this.application.getRobot().keyRelease(COMBINATION[i][1]); this.application.getRobot().keyRelease(COMBINATION[i][2]); // this.application.getRobot().keyRelease(COMBINATION[i][3]); break; } } if (!exception) { pressUnicode(this.application.getRobot(), action.unicode); } } private void keyboardCombinations(Combinations action) { boolean exception = false; for (int i = 0; i &lt; COMBINATIONS.length; i++) { if (action.unicode == COMBINATIONS[i][0]) { exception = true; this.application.getRobot().keyPress(COMBINATIONS[i][1]); this.application.getRobot().keyPress(COMBINATIONS[i][2]); this.application.getRobot().keyPress(COMBINATIONS[i][3]); this.applicat…
tagged with: methods
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/32478053
score: 0
has title: Stuck in using 2D arrays?
has comment: http://stackoverflow.com/comment/32478058
tagged with: multidimensional-array
type: UnansweredQuestion

http://stackoverflow.com/comment/32343347
type: Comment
has text: @cjmalacaman No problem at all. Being a beginner is perfectly cool, we all had to start somewhere. Just remember the best way to get assistance (especially on this site) is to be as specific as possible about the problem you're having. Best of luck in your endeavours (and future stackoverflow-ing). Also, don't forget to upvote good / helpful answers, and "accept" the answer that helped you the most (by clicking the green checkmark to the left of the answer).
comment on: http://stackoverflow.com/a/21436143
score: 0
type: AnswerComment

http://stackoverflow.com/a/21482930
downvote count: 0
type: Answer
has body: You could create a data structure that maps Class instances to values that are associated with that class instead of a particular instance of that class, but like other people are saying, this is probably too hypothetical to be of any value.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21482816

http://stackoverflow.com/q/21442914
has answer: http://stackoverflow.com/a/21442969
favorite count: 0
possible better answer: http://stackoverflow.com/a/21442961
accepted answer: http://stackoverflow.com/a/21442969
has comment: http://stackoverflow.com/comment/32355237
has answer: http://stackoverflow.com/a/21442961
answer count: 5
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21443056
has comment: http://stackoverflow.com/comment/32355182
has body: Basicly, I am getting an ArrayOutOfBounds exception on line 19. I tried just pritning the array's contents without assigning any values(commented out the wile loop) but still the same error, anyone have a fix? package com.company; import java.util.Random; public class Main { static int[][] Placer = new int[2][2]; //create multi-dimenstional array to hold the numbers public static void main(String[] args) { Random random = new Random(); //intiallise new Random object int intsAssigned = 0; //will keep track of the ammount of ints assigned. //Assign all of the index's a random int, not the most practical way. while(intsAssigned != 9){ int currentColumn = 0; Placer[currentColumn][0] = random.nextInt(20); Placer[currentColumn][1] = random.nextInt(20); Placer[currentColumn][2] = random.nextInt(20); currentColumn++; intsAssigned + 3; } printNumbers(); } //Print all of the index's public static void printNumbers(){ int numbersPrinted = 0; int currentColumn = 0; int currentRow = 0; while(numbersPrinted != 9){ System.out.println(Placer[currentColumn][currentRow]); System.out.println(Placer[currentColumn][++currentRow]); System.out.println(Placer[currentColumn][currentRow + 2]); currentColumn++; } } }
type: Question
has answer: http://stackoverflow.com/a/21443128
tagged with: arrays
has title: Array out of bounds exception, can't find the issue
has comment: http://stackoverflow.com/comment/32355333
score: 0
has answer: http://stackoverflow.com/a/21443133

http://stackoverflow.com/a/21415188
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21415017
has body: In Java a container of type Collection, by definition, has no order and can therefore not be sorted. Only its child List can be ordered. Consequently the Collections#sort method expects an object of type List as first argument, but you are providing a Collection. Change Collection&lt;String&gt; emails = new ArrayList&lt;String&gt;(Arrays.asList(emailArray)); into List&lt;String&gt; emails = ...

http://stackoverflow.com/comment/32233980
type: Comment
has text: You are right, it's too heavy for my needs. However, PyDev is not available for Linux, only as a plugin for Eclipse. As I said earlier,for the moment (pre-Java), I only need a lightweight IDE like Geany, but need the formatting support of PyDev
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21372210

http://stackoverflow.com/comment/32386825
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21460740
type: Comment
has text: I dont think this will work for social media sites will it?

http://stackoverflow.com/comment/32324318
type: Comment
has text: And why are you using a Canvas?
comment on: http://stackoverflow.com/q/21425754
score: 0
type: QuestionComment

http://stackoverflow.com/a/27239331
has comment: http://stackoverflow.com/comment/42964318
answers question: http://stackoverflow.com/q/21401839
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: I realize the post is bit old and probably resolved. Just wanted to updated anyway if someone else encounter the same issue. The underlying problem is multiple jar resolution/conflict. Weblogic references and loaded the EL classes from the system provided jars listed below (located in the modules directory) glassfish.el_*.jar javax.jsp_1*.jar In my case I need to instruct weblogic server to load classes of the below listed packages from the jar located within the application (weblogic-application.xml in ear) <prefer-application-packages> javax.el.* com.sun.el.* </prefer-application-packages> one can provide the same configuration in weblogic.xml if it's just web-app. http://docs.oracle.com/cd/E24329_01/web.1211/e21049/weblogic_xml.htm

http://stackoverflow.com/q/21373550
has comment: http://stackoverflow.com/comment/32235537
downvote count: 0
has body: i am trying to run a wordcount job in hadoop.but always getting a class not found exception.I am posting the class that i wrote and the command i using to run the job 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(); 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; { 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); job.setJarByClass(WordCount.class); } } the wordcount.j…
has answer: http://stackoverflow.com/a/35455080
favorite count: 0
has answer: http://stackoverflow.com/a/23240277
has answer: http://stackoverflow.com/a/22345407
has answer: http://stackoverflow.com/a/23690896
has comment: http://stackoverflow.com/comment/32273235
answer count: 9
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32232280
has answer: http://stackoverflow.com/a/31610150
tagged with: java
has answer: http://stackoverflow.com/a/25815181
has answer: http://stackoverflow.com/a/38145962
type: Question
tagged with: hadoop
tagged with: debugging
upvote count: 12
has answer: http://stackoverflow.com/a/31218015
has title: Class Not Found Exception in Mapreduce wordcount job
has answer: http://stackoverflow.com/a/38822396
score: 12
has comment: http://stackoverflow.com/comment/32235684

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/21500692

http://stackoverflow.com/comment/32434840
score: 0
type: Comment
has text: what is the error you are getting?
type: QuestionComment
comment on: http://stackoverflow.com/q/21488119

http://stackoverflow.com/comment/32226370
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21368123
type: Comment
has text: The switch statement is coming up with an error "Cannot switch on a value of type Agent. Only convertible int values, strings or enum variables are permitted"

http://stackoverflow.com/comment/32564359
comment on: http://stackoverflow.com/a/21538216
score: 0
type: AnswerComment
type: Comment
has text: Given the theory of kmeans (not my code in particular), 0.25 and 0.75 are not guaranteed. When I ran it on my grayscale image, I got 0.1 and 0.6 as centroids for the selected image. So in that case you were wrong. However, in some other case, it the centroids may be 0.25 and 0.75. So no, you do not understand it correctly because it will vary from image to image. Some greyscale images will have centroids at 0.25 and 0.75, others will not.

http://stackoverflow.com/q/21457691
tagged with: android
score: -2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21457899
tagged with: dynamic
tagged with: java
downvote count: 3
upvote count: 1
type: Question
has body: I am a beginner in Android and hoping to achieve text being show when the weather temperature is at various temperatures. For example, if it is 5 degrees, then the text will show the user to "wear a coat". The code is working fine, but struggling to implement this dynamic text feature. Any help will be greatly appreciated! Java Code: public class AdviseMe extends Activity { private TextView cityText; private TextView condDescr; private TextView temp; private TextView press; private TextView windSpeed; private TextView windDeg; private TextView textview1; private TextView hum; private ImageView imgView; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.adviseme); String city = "London,UK"; cityText = (TextView) findViewById(R.id.cityText); condDescr = (TextView) findViewById(R.id.condDescr); temp = (TextView) findViewById(R.id.temp); hum = (TextView) findViewById(R.id.hum); press = (TextView) findViewById(R.id.press); windSpeed = (TextView) findViewById(R.id.windSpeed); windDeg = (TextView) findViewById(R.id.windDeg); imgView = (ImageView) findViewById(R.id.condIcon); JSONWeatherTask task = new JSONWeatherTask(); task.execute(new String[]{city}); } private class JSONWeatherTask extends AsyncTask&lt;String, Void, Weather&gt; { @Override protected Weather doInBackground(String... params) Weather weather = new Weather(); String data = ( (new WeatherHttpClient()).getWeatherData(params[0])); try { weather = JSONWeatherParser.getWeather(data); weather.iconData = ( (new WeatherHttpClient()).getImage(weather.currentCondition.getIcon())); } catch (JSONException e) { e.printStackTrace(); } return weather; } @Override protected void onPostExecute(Weather weather) { super.onPostExecute(weather); if (weather.iconData != null &amp;&amp; weather.iconData.length &gt; 0) { Bitmap img = BitmapFactory.decodeByteArray(weather.iconData, 0, weather.iconData.length); imgView.setImageBitmap(img); } cityText.setText(weather.location.getCity() + "…
accepted answer: http://stackoverflow.com/a/21457899
has title: Dynamic text depending on weather temperature - android
answer count: 1
tagged with: textview
favorite count: 0

http://stackoverflow.com/comment/32353730
has text: @skiwi I have updated my answer with an explication about `(?i)`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21441913
type: Comment

http://stackoverflow.com/q/21415414
has title: Changing a semi-specific value in an array - Java
has comment: http://stackoverflow.com/comment/32306352
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32306325
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21416058
tagged with: arrays
answer count: 1
score: 0
has body: I was wondering if I could get some quick help on some java code. I created an array and each position/seat has a specific 'price'. I need to write a program that asks the user to either pick a seat or price. I've already completed the first half of finding a specific seat location picked by the users input and replacing it with 0 but I've been having trouble with the second half of taking the users desired seat price and changing it to 0. There are multiple seats at the price they choose so I just need to pick a random one and change it to 0. I'll cut out a bunch of code to make it easier to read but basically what I need help with is towards the bottom: Scanner in = new Scanner(System.in); String seat = ""; String price = ""; int[][] seating = new int[][] { { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, { 10, 10, 20, 20, 20, 20, 20, 10, 10, 10 }, { 10, 10, 20, 20, 20, 20, 20, 10, 10, 10 }, { 10, 10, 20, 20, 20, 20, 20, 10, 10, 10 }, { 10, 10, 20, 20, 30, 30, 20, 20, 10, 10 }, { 20, 20, 30, 30, 40, 40, 30, 30, 20, 20 }, { 20, 30, 30, 40, 50, 50, 40, 30, 30, 20 }, { 30, 40, 50, 50, 50, 50, 50, 50, 40, 30 }, }; System.out.println("\nHere is a map of the current seating:\n"); printArray(seating); System.out.println("\nWould you like to pick a seat or a price?\n"); String decision = in.nextLine(); if(decision.equals("price")) { System.out.println("\nWould you like to pay 10, 20, 30, 40, or 50 dollars?\n"); int pickedPrice = in.nextInt(); //HELP HERE //replace a random seat with the selected price to 0 in the array } I've only come here as a last resort as I've looked all over the place and couldn't find any help. Thanks in advance, I really appreciate it!

http://stackoverflow.com/comment/32362678
type: QuestionComment
score: 0
has text: Is all your code in the same package? Or are there different packages here?
comment on: http://stackoverflow.com/q/21446851
type: Comment

http://stackoverflow.com/a/21412622
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21391185
answers question: http://stackoverflow.com/q/21391185
score: 1
has body: I managed to work it out myself in the end. Just apply the following style to a TextView: style="?android:attr/listSeparatorTextViewStyle"
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21474797
answers question: http://stackoverflow.com/q/21471542
has body: I think it would be helpful if you post the actual WSDL you have problems with. I assume the WSDL was generated with TIBCO Businessworks. TIBCO supports exposing WSDL's with JMS Transport bindings a long while in a proprietary way before a SOAP over JMS standard from W3C was defined. CXF implemented the W3C standard so it won't understand the binding and you ll have to do some hand wiring for the transport of your client like described e.g. here: http://cxf.apache.org/docs/using-the-jmsconfigfeature.html
score: 0
type: Answer

http://stackoverflow.com/a/21445268
has comment: http://stackoverflow.com/comment/32359475
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21445224
has comment: http://stackoverflow.com/comment/64310807
answers question: http://stackoverflow.com/q/21445224
has comment: http://stackoverflow.com/comment/32360068
type: Answer
has comment: http://stackoverflow.com/comment/64197912
has comment: http://stackoverflow.com/comment/32359581
has comment: http://stackoverflow.com/comment/32359701
score: 19
upvote count: 19
has comment: http://stackoverflow.com/comment/32359811
has comment: http://stackoverflow.com/comment/32359494
has comment: http://stackoverflow.com/comment/32359628
has body: If it is not interrupting it will simply tell the future that is is cancelled. You can check that via isCancelled() but nothing happens if you don't check that manually. Below example code shows how you could do it. private static FutureTask&lt;String&gt; task = new FutureTask&lt;String&gt;(new Callable&lt;String&gt;() { @Override public String call() throws Exception { while (!task.isCancelled()) { System.out.println("Running..."); Thread.sleep(1000); } return "The End"; } }); public static void main(String[] args) throws InterruptedException { new Thread(task).start(); Thread.sleep(1500); task.cancel(false); } The task is started, and after 1.5 iterations told to stop. It will continue sleeping (which it would not if you interrupted it) and then finish.

http://stackoverflow.com/q/21390040
has comment: http://stackoverflow.com/comment/32262334
has comment: http://stackoverflow.com/comment/32262118
has comment: http://stackoverflow.com/comment/32261829
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32266909
has comment: http://stackoverflow.com/comment/32261756
has body: I am trying to call a method from one class that is contained in another class. However I do not know the object name to call, so I cannot use the command ClassName.objectName.methodName() Also .this command does not work either since .this references objects within its own class. I have tried numerous combinations of code but all gave me compiler errors. This is the line that I am trying to run: averageVector[i]=averageVector[i]+(FeatureVector.featureAt(i)); FeatureVector is the class that contains the object. If you need more information let me know. Thanks in advance. Full codes as requested: Class name: Cluster: public FeatureVector getCentroid(){ int numberOfVectors; double [] averageVector; numberOfVectors=this.getSize(); averageVector=new double [this.featureV[0].getSize()]; for (int i=0; i&lt;numberOfVectors;i++){ averageVector[i]=averageVector[i]+(FeatureVector.this.featureAt(i)); } for (int i=0; i&lt;averageVector.length; i++){ averageVector[i]=(averageVector[i]/numberOfVectors); } FeatureVector centroid = new FeatureVector (numberOfCentroids, averageVector); return FeatureVector.centroid; } class FeatureVector: class FeatureVector { private double [] elems; //... //constructor FeatureVector (String newName, double [] newElems){ name=newName; double [] elems=new double [newElems.length]; for (int i=0; i &lt; newElems.length; i++){ elems[i]=newElems[i]; } and the method in FeatureVector: public double featureAt(int index){ return elems[index]; }
has comment: http://stackoverflow.com/comment/32261954
has comment: http://stackoverflow.com/comment/32261922
has title: Calling a method from a different class and not knowing the name of the object
has comment: http://stackoverflow.com/comment/32261673
has comment: http://stackoverflow.com/comment/32261814
tagged with: methods
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/32262186
tagged with: java
has comment: http://stackoverflow.com/comment/32261824
has comment: http://stackoverflow.com/comment/32261753
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/21392645
has comment: http://stackoverflow.com/comment/32262280
answer count: 1
has comment: http://stackoverflow.com/comment/32261934

http://stackoverflow.com/q/21435137
has body: Are there any methods or capabilities built in Java application servers (i.e. Weblogic or JBoss) or, probably, in load balancers (i.e. F5) to enable and configure HTTP requests throttling for my application? Let's say, I have a Java web application with no throttling algorithms implemented in it. And I want to add a throttling feature to limit a number of requests to N per M seconds. One possible way is to use external (to my Java app) tools with such requests throttling abilities. All I've found is about implementing own throttling mechanism in my application. Partly similar questions: throttling http api calls with delay Throttling method calls to M requests in N seconds Best way to implement request throttling in ASP.NET MVC?
upvote count: 3
tagged with: java
has title: Any out-of-box methods to implement request throttling in Java?
answer count: 1
tagged with: weblogic
has comment: http://stackoverflow.com/comment/32340898
tagged with: jboss
accepted answer: http://stackoverflow.com/a/21442149
type: AnsweredQuestion
score: 3
downvote count: 0
linked to: http://stackoverflow.com/q/15131671
favorite count: 0
type: Question
tagged with: throttling
linked to: http://stackoverflow.com/q/1407113
has answer: http://stackoverflow.com/a/21442149
linked to: http://stackoverflow.com/q/33969

http://stackoverflow.com/q/21498293
type: Question
possible better answer: http://stackoverflow.com/a/21498331
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/32453001
tagged with: swing
has answer: http://stackoverflow.com/a/21498331
has comment: http://stackoverflow.com/comment/32453132
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/21498434
upvote count: 0
has comment: http://stackoverflow.com/comment/32453024
tagged with: exception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32461649
tagged with: jdbc
score: -2
has body: i try to insert value in MySQL database from this code if(jTextFieldName.getText().isEmpty() || jTextFieldLastName.getText().isEmpty() || jTextFieldBirthDay.getText().isEmpty() || jTextFieldEmail.getText().isEmpty() || jTextFieldUserName.getText().isEmpty() || jPasswordField1.getPassword().length == 0){ JOptionPane.showMessageDialog(this,"فیلد هارا پر کنید"); return; } // String name = jTextFieldName.getText(); // String lastname = jTextFieldLastName.getText(); // String email = jTextFieldEmail.getText(); // String username = jTextFieldUserName.getText(); // char[] password = jPasswordField1.getPassword(); String sql = String.format(" INSERT INTO register VALUES (\'%S\' , \'%S\',\'%S\', \'%S\' ,\'%S\' ,\'%S\')" , jTextFieldName.getText() ,jTextFieldLastName.getText(),jTextFieldBirthDay.getText() ,jTextFieldEmail.getText(), jTextFieldUserName.getText(), String.valueOf(jPasswordField1.getPassword()) ); try { java.sql.Statement s = con.createStatement(); s.executeQuery(sql); JOptionPane.showMessageDialog(this, ".: موفق :."); } catch (SQLException ex) { JOptionPane.showMessageDialog(this,"اطلاعات اشتباه وارد شده"); Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex); } when run this code i recived this exception : Feb 01, 2014 4:29:05 PM Qolak.RegisterForm jButtonSubmitActionPerformed SEVERE: null java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929) at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:438) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1379) at Qolak.RegisterForm.jButtonSubmitActionPerformed(RegisterForm.java:199) at Qolak.RegisterForm.access$100(RegisterForm.java:18) at Qolak.RegisterForm$2.actionPerformed(Registe…
favorite count: 0
has answer: http://stackoverflow.com/a/21498434
has comment: http://stackoverflow.com/comment/32453021
has title: I try connect my java program to MySQL database , and i received this exception

http://stackoverflow.com/comment/33506235
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22080316
type: Comment
has text: That looks useful. I need to check whether commons-config provides a way to maintain the inheritance, and whether we can merge those.

http://stackoverflow.com/a/21426779
type: Answer
answers question: http://stackoverflow.com/q/21425778
score: 0
has body: I do not have a very in depth knowledge of linux, but I do know shell scripting to some extent. based on that here are the commands that should work for you: First connect to linux server using ftp (you would need to supply your credentials): ftp [IP Address of Linux] Now to see which directory you are in use command pwd, then to change your present working directory make use of cd command. Once you are in you desired directory set the mode to binary with this command: bin Then finally you can copy the file using this command: get example.ls If you want to download multiple files you can use mget command with wildcards (e.g. mget *.ls to donload all files with ls extension). Hope this helps.

http://stackoverflow.com/comment/32446591
has text: That didn't work - it caused it to evaluate as a bad password
comment on: http://stackoverflow.com/a/21494132
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21434035
has body: Context : We are developping a EJB 3 stand alone application on Glassfish v3.1.2.2 . Problem : When connecting from a Windows workstation to Glassfish, the end user is prompted with the Windows "add firewall rule dialog". This is unacceptable behavior to us. This application will be deployed on thousands of workstations and our end-users may or may not have administrative rights and may or may not understand the dialog. Setup : We used the Oracle Glassfish 3.1 documentation here to run the client application in stand-alone mode. Specifically, we copied the files under as-install/modules to the client, and added gf-client.jar to the classpath. Everything works fine as you can see from the screenshot below. Thoughts : The client application should not need to open a ServerSocket (I think this is what triggers the dialog) In fact, the client application does not use the ServerSocket (as seen in the short, selft-contained example I posted below) The opened ServerSocket port differs every time. I checked this by matching the process' PID and the output of netstat -ano which looks something like this : tasklist.exe : Image Name PID Session Name Session# Mem Usage ========================= ======== ================ =========== ============ java.exe 118692 Console 7 88.736 K netstat -ano : Proto Local Address Foreign Address State PID TCP 0.0.0.0:52641 0.0.0.0:0 LISTENING 118692 It seems odd to me this port would change every time : note that there used to be a bug in netstat, but it should not apply to Windows 7 ( see here ) In any case, the dialog poppup appears, which I think means something wants to LISTEN on the client. The EJB module is available on github here , the client application is available here add-firewall-exception-popup http://belgian-united-gaming.be/obasi-ssce-gf.png Please advise &amp; thank you for your help.
tagged with: glassfish-3
answer count: 0
score: 1
tagged with: java
type: Question
has title: Prevent glassfish standalone client from asking for a firewall exception
tagged with: ejb
downvote count: 0
tagged with: windows-firewall
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/32451423
comment on: http://stackoverflow.com/a/21496902
type: AnswerComment
score: 0
type: Comment
has text: ya i updated it.. but still i get the same `NullPointerException` error.

http://stackoverflow.com/comment/32250270
type: QuestionComment
comment on: http://stackoverflow.com/q/21383686
score: 0
has text: @assylias I've written the example myself, using Eclipse 3.7.1 and Java SDK 1.7.0_40
type: Comment

http://stackoverflow.com/a/21399936
has comment: http://stackoverflow.com/comment/32279441
type: Answer
has comment: http://stackoverflow.com/comment/32279115
has comment: http://stackoverflow.com/comment/32279954
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32279110
has body: Try this if (arrayListB.containsAll(arrayListA))
answers question: http://stackoverflow.com/q/21399900
score: 0

http://stackoverflow.com/comment/51711951
score: 0
has text: @JustinNiessner Uncle Bob explains exactly the contrary of your opinion: http://blog.8thlight.com/uncle-bob/2014/01/27/TheChickenOrTheRoad.html?utm_source=hootsuite&utm_campaign=hootsuite
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21482652

http://stackoverflow.com/comment/32325344
has text: Is there anything simpler this seems like an overkill..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21418001
score: 0

http://stackoverflow.com/q/21394568
tagged with: java-2d
type: UnansweredQuestion
has body: I have a collections of agents (objects), when the simulator begins each agent performs a act() method which updates their location in the environment (2D Array). My paintComponent(Graphics g) is overridden in a different class (which basically iterates through the 2D array and draws a rectangle colour corresponding to the type of agent). But the actual collection is in the simulator class which run independently by the user clicking a button from the GUI. If I put the repaint() method at the end of the paintComponent(Graphics g). It only updates the JPanel canvass twice, once when the application start-up and second when I click the run button that starts simulation. How do I have the JPanel canvass update automatically with the new image when all the agents perform the act method. Or perhaps when a change happens in a collection to a agent draw the new location on the canvass and remove the old one ?
linked to: http://stackoverflow.com/q/3066590
answer count: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/32270503
type: Question
has comment: http://stackoverflow.com/comment/32270436
tagged with: agent-based-modeling
score: 0
has comment: http://stackoverflow.com/comment/32272370
has title: Updating the JPanel Canvass from change in the collection

http://stackoverflow.com/q/21467403
has comment: http://stackoverflow.com/comment/32398745
has comment: http://stackoverflow.com/comment/32399256
has comment: http://stackoverflow.com/comment/32399057
has title: Java XML String with attributes to NodeList (parsing)
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32399352
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32398911
type: Question
tagged with: java
has body: I have a string, whose contents is an XML document. Here is an example of a string. String xmlContent = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;" + "&lt;Service oem=\"myOem\" agent=\"myAgent\" version=\"0.5.5.0\" build=\"30-01-2014-11-46\" /&gt;"; I want to convert this string to a NodeList. A Google search led to this article. I tried the following code: DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlContent)); Document doc = db.parse(is); NodeList oNodeService = doc.getElementsByTagName("Service"); The problem is that I get a rip on the "db.parse(is)" line. The problem seems to be that this method does not support XML attrihutes. The error message is: [Fatal Error] :1:70: Element type "Service" must be followed by either attribute specifications, "&gt;" or "/&gt;". org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 70; Element type "Service" must be followed by either attribute specifications, "&gt;" or "/&gt;". at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at PkgNetAccelerator32.MainEvents.ShowHtsInfo(MainEvents.java:1575) How can I successfully convert this XML string to a NodeList? UPDATE: Hmm, the failure is specific to the XML string. I gave a shortened version above. I removed all attributes that cause no crashes. String xmlContent = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;Service hostname=\"sarah-linux.localdomain\"uname=\"Linux sarah-linux.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux\" /&gt;"; If I were to hazard a guess, I would say it is the period or the dash. I wanted to get this update in first.
has answer: http://stackoverflow.com/a/70417768
score: 0
has comment: http://stackoverflow.com/comment/32399211
tagged with: nodelist
has comment: http://stackoverflow.com/comment/32398655
has comment: http://stackoverflow.com/comment/32398779
answer count: 1
has comment: http://stackoverflow.com/comment/32399190
has comment: http://stackoverflow.com/comment/32399471

http://stackoverflow.com/q/21450522
tagged with: initialization
favorite count: 0
accepted answer: http://stackoverflow.com/a/21454131
has title: Dynamically initialize window in ZK
tagged with: zk
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21454131
score: 1
tagged with: java
has body: Is it possible to initialize a window that I've already put in a page with a .zul spicified dynamically? I do like this: &lt;n:div id = "content"&gt; &lt;window id="content_wnd"&gt; &lt;/window&gt; &lt;/n:div&gt; - it is at the main window and i want, for example initialize this "content_wnd" window by "/login_wnd.zul": content_wnd = (Window)Executions.createComponents( "/login_wnd.zul", null, null); and after it executes, a new window appears in the bottom of the page, not in the &lt;n:div&gt; &lt;/n:div&gt; block, where the "content_wnd" is placed. What's wrong here and what is the correct way to dynamically put a window into a specified place of the page?
type: Question
tagged with: window
answer count: 1
upvote count: 1

http://stackoverflow.com/a/21508182
score: 0
answers question: http://stackoverflow.com/q/21507894
type: Answer
has body: Try to use By.lintext instead of xpath - By.linkText("Exclude Out of Stock") As Amith mentions, click would automatically scroll. Before trying out js, try using the Actions methods. Movetoelement should also work.

http://stackoverflow.com/a/62723937
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21439619
has body: /* Assume that the length of the col[0] will be the same for all cols. Notice: that we are access salaries[j] for each iteration of j while [i] same the same. */ public void printColsValues() { for(int i = 0; i &lt; array[0].length; i++) { for(int j = 0; j &lt; array.length; j ++) { System.out.println(arr[j][i]); } } }

http://stackoverflow.com/q/21358693
type: Question
possible better answer: http://stackoverflow.com/a/21358768
has comment: http://stackoverflow.com/comment/32205882
tagged with: java
score: 4
has answer: http://stackoverflow.com/a/21358820
accepted answer: http://stackoverflow.com/a/21358820
answer count: 3
has title: Make a text based game into an executable jar - Java
has body: I was just wondering how one would go about making a text-based, console game into an executable jar. From what I've seen on the rest of this website, I would need to use JTextField and JTextPane. I also know that to make it runnable it would need to create its own console. I do not care how complicated it is, so long as it is simple enough to understand. If this would be way, way to advanced could you please point me in the right direction to learning how to accomplish this. If this is a duplicate of a question somewhere else, please just point me in the direction; I've searched and cannot find any questions that are simple.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21358768
upvote count: 4
tagged with: text
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21358753

http://stackoverflow.com/q/21502667
tagged with: return
has answer: http://stackoverflow.com/a/33509460
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21502717
has body: I am beginner in Java i am learning about Java methods in my tutorial there is this code: public class JavaLessonSix { static double myPI = 3.14159; public static void main(String[] args){ addThem(1, 2); } public static int addThem(int a,int b){ int c = a + b; System.out.println(c); return c; } } I did not really understood what return statement means. Could you please describe to me what the return statement means in Java..?
has answer: http://stackoverflow.com/a/21502964
tagged with: java
has comment: http://stackoverflow.com/comment/32461055
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/32461001
score: 0
has answer: http://stackoverflow.com/a/21502765
has title: Return statement in Java methods
has answer: http://stackoverflow.com/a/21502769

http://stackoverflow.com/a/34193682
upvote count: 2
has body: So I ran into this issue, and I thought I would add some additional details for those who might have the same problem. I had a collection of dependencies, and one imported org.javassist:javassist:3.18.1-GA, while the other imported javassist:javassist:3.11.0.GA. Because of the different groups (it would seem that javassist:javassist became org.javassist:javassist), the build tool wasn't excluding one in favour of the other, and my WAR file had both. I had to manually exclude the old javassist dependency, and once it was removed everything was fine.
answers question: http://stackoverflow.com/q/21454931
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/32311312
score: 0
type: Comment
has text: maybe you could have a condition to stop the program in the event the `video.read(frame);` never returns `false` ?
type: AnswerComment
comment on: http://stackoverflow.com/a/21417995

http://stackoverflow.com/a/21436838
score: 1
answers question: http://stackoverflow.com/q/21402414
has comment: http://stackoverflow.com/comment/32422824
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32446970
downvote count: 0
has comment: http://stackoverflow.com/comment/32487014
type: Answer
upvote count: 1
has body: These come from the Header.html.ftl file in the webroot component and use values like this: ${sri.buildUrl(scriptLocation).url} There are many URLs generated like this with the full URL including hostname and such. When not running locally you'll almost always need to set the external hostname and ports in the Moqui Conf XML file. For example: &lt;webapp-list&gt; &lt;webapp name="webroot" http-host="www.mydomain.com" http-port="80" https-enabled="false"&gt; &lt;root-screen host=".*" location="component://webroot/screen/webroot.xml"/&gt; &lt;/webapp&gt; &lt;/webapp-list&gt; Note that this still has https-enabled="false". If you set that to true also set the @https-host and @https-post attributes. Note that if you leave any of http-host, http-port, https-host, or https-port empty they will default to the hostname and port on the HTTP request. This is the way to handle it for virtual hosting for multi-tenant or multi-root screen setups. For this to work it is necessary that any load balancer or other other proxy (such as mod-proxy on httpd) be setup to pass through this HTTP request information.
accepted answer of: http://stackoverflow.com/q/21402414

postorder
type: Tag
tags question: http://stackoverflow.com/q/21493660
tag name: postorder

http://stackoverflow.com/comment/32422295
has text: The easiest way might be to select the max(id) value, and then use it at the next insert
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21481193
score: 0

http://stackoverflow.com/comment/32452318
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21497866
has text: It should be && rather than ||

http://stackoverflow.com/comment/136343181
type: Comment
has text: BTW the same situation may happen after adding in a NavigableSet.subset
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21498127

http://stackoverflow.com/a/21394470
answers question: http://stackoverflow.com/q/21394413
score: 0
has body: There are multiple problems here. For starters, I'd suggest: 1) Lose the "size" member variable 2) Substitute ArrayList&lt;String&gt; list for member variable "String[] list" 3) Use list.size() instead of a separate "size" variable 4) You can lose (or simplify) your "add()" method, too. Just use list.add() instead. 5) Step through the debugger. Verify "list" gets added to as you expect, when you expect. FINALLY 6) Step through the debugger for "toString()". Make sure "list" is has the size and contents you expect. 'Hope that helps...
type: Answer

http://stackoverflow.com/comment/32358401
comment on: http://stackoverflow.com/q/21444359
type: Comment
type: QuestionComment
has text: Start up `sqlite3` in a command window and do `.schema employeeInfo`.
score: 1

http://stackoverflow.com/q/21505569
type: AnsweredQuestion
has title: Convention for compiling and executing Java apps from shell?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32712771
type: Question
duplicate of: http://stackoverflow.com/q/4225815
answer count: 1
has answer: http://stackoverflow.com/a/21505963
has body: What is the convention that is followed for compiling and executing Java apps from the shell? As a specific use case, I'm teaching some kids how to read Java source and picked minicraft (which is a commented version of Notch's Ludum Dare 22 entry). This is pretty exciting for them, but I've had my feet out of the Java realm for about 10 years and frankly I'd like to simultaneously teach them how to use the shell and less robust (ie, non IDE) editors before jumping into Eclipse and such. I'd like to understand: A) What shell command would you execute to compile and run the app (and from which project folder; ie, miniventure or miniventure/src or miniventure/src/com/mojang/ld22) and B) what is the rationale to follow in knowing how to craft projects and the shell java and javac args for future reference when digging into other projects from src such as this?
favorite count: 0
tagged with: javac
upvote count: 3
downvote count: 2
accepted answer: http://stackoverflow.com/a/21505963

hashset
tags question: http://stackoverflow.com/q/21362616
tags question: http://stackoverflow.com/q/21377639
tags question: http://stackoverflow.com/q/21468595
tags question: http://stackoverflow.com/q/21371626
tags question: http://stackoverflow.com/q/21431281
type: Tag
tag name: hashset

http://stackoverflow.com/q/21452832
favorite count: 0
has comment: http://stackoverflow.com/comment/32373498
has comment: http://stackoverflow.com/comment/32375108
score: 2
has comment: http://stackoverflow.com/comment/32372916
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/32373429
type: UnansweredQuestion
has body: I am working on a big project with a complex codebase written in java. I want to understand a particular piece of code and i thought getting a sequence diagram of the entry point method would give me a good idea. I use intelliJ and i looked for a plugin which could do this and i found 'SequencePlugin' but unfortunately it is not working in intelliJ 8.1.4. Can i achieve what i am trying to in any other way? Is there a standard approach to follow when trying to understand a complex codebase other than by debugging?
type: Question
has title: Understand a complex code base using a sequence diagram
tagged with: codebase
has comment: http://stackoverflow.com/comment/32375087
tagged with: java
tagged with: sequence-diagram
upvote count: 2
has comment: http://stackoverflow.com/comment/32372823
tagged with: intellij-idea

http://stackoverflow.com/a/21373929
accepted answer of: http://stackoverflow.com/q/21373865
answers question: http://stackoverflow.com/q/21373865
has comment: http://stackoverflow.com/comment/32243302
has comment: http://stackoverflow.com/comment/32232912
has comment: http://stackoverflow.com/comment/32232856
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32232680
upvote count: 13
has comment: http://stackoverflow.com/comment/32243518
has comment: http://stackoverflow.com/comment/32232798
has comment: http://stackoverflow.com/comment/32258408
type: Answer
has comment: http://stackoverflow.com/comment/32232945
downvote count: 0
has comment: http://stackoverflow.com/comment/32240796
score: 13
has comment: http://stackoverflow.com/comment/32232752
has body: Floating point numbers lose precision as you do more operations. Generally, you get the highest precision by adding the smallest numbers first. (So the result does depend on the order of operations) In addition to maintaining the same order of operations, you'll also have to use strictfp to get the same result on different platforms. Or better yet, don't use floating points: use a BigDecimal instead.
has comment: http://stackoverflow.com/comment/32240857
has comment: http://stackoverflow.com/comment/32232821

http://stackoverflow.com/a/21410662
has comment: http://stackoverflow.com/comment/32306555
has comment: http://stackoverflow.com/comment/32306775
score: 0
answers question: http://stackoverflow.com/q/21409923
has comment: http://stackoverflow.com/comment/32318673
type: Answer
has body: FTPClient Documentation states that public boolean enterRemoteActiveMode(InetAddress host,int port) throws IOException Set the current data connection mode to ACTIVE_REMOTE_DATA_CONNECTION . Use this method only for server to server data transfers. This method issues a PORT command to the server, indicating the other server and port to which it should connect for data transfers. You must call this method before EVERY server to server transfer attempt. The FTPClient will NOT automatically continue to issue PORT commands. You also must remember to call enterLocalActiveMode() if you wish to return to the normal data connection mode. Hope this helps!
has comment: http://stackoverflow.com/comment/32299632
has comment: http://stackoverflow.com/comment/32302297

http://stackoverflow.com/comment/32724052
type: Comment
comment on: http://stackoverflow.com/a/21506255
has text: Obviously, you can. Or what do you think is done in the above code?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21463443
has comment: http://stackoverflow.com/comment/32391272
has comment: http://stackoverflow.com/comment/32391395
score: 0
has comment: http://stackoverflow.com/comment/32391446
answer count: 1
has comment: http://stackoverflow.com/comment/32391931
tagged with: regex
has comment: http://stackoverflow.com/comment/32391233
has answer: http://stackoverflow.com/a/21463873
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32392138
has comment: http://stackoverflow.com/comment/32391284
has comment: http://stackoverflow.com/comment/32391338
has comment: http://stackoverflow.com/comment/32391388
has body: I need to be able to create a regular expression that will search through any string in Java and match this particular expression. Reg Match: ./ ADD NAME= &lt;--- I need to match this regular expression in any string that I read into the file and it normally would be in position 1 through 13 I am looking for this in the first 10 characters of any string because I have to return the name that follows the equals sign to make a file name with so the whole line would looking like the following. Question: Why does my expression not match in any of the strings? File Line: ./ ADD NAME=FILE02 ...more records would go here... ./ ADD NAME=FILE332 ...more records would go here... ./ ADD NAME=FILE3 ...more records would go here... ./ ADD NAME=FILE-1A ...more records would go here... Code: private void locatedFileName(String s) { Pattern p = Pattern.compile("./ ADD name="); Matcher m = p.matcher(s); boolean b = m.matches(); if (b) { System.out.println("True"); } else { System.out.println("False"); } } **private void locatedFileName(String s) { if (s.matches("./ ADD name=")) { System.out.println("True"); } else { System.out.println("False"); } }** All the Code: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class test { test(){ } private void locatedFileName(String s) { if (s.matches("./ ADD name=")) { System.out.println("True"); } else { System.out.println("False"); } } private void testReadTextFile() { try { BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\itpr13266\\Desktop\\TestFile.txt")); String line = null; //Will read through the file until EOF while ((line = reader.readLine()) != null) { System.out.println(line); locatedFileName(line); //test to see if the "./ Add name=" is found in any of the strings } } catch (IOException e) { System.out.println("Try-Catch Message - " + e.getMessage()); e.printStackTrace(); } } public static void main(String[] a) { test t = new test(); t.testReadTextFile(); } } Newest C…
type: Question
has comment: http://stackoverflow.com/comment/32391572
has comment: http://stackoverflow.com/comment/32391185
tagged with: java
has title: Regular expression searching a string?
accepted answer: http://stackoverflow.com/a/21463873

http://stackoverflow.com/comment/32457549
type: Comment
comment on: http://stackoverflow.com/a/21500834
score: 2
type: AnswerComment
has text: this may be true, but there's WAY more than this one issue

http://stackoverflow.com/a/21496918
upvote count: 1
answers question: http://stackoverflow.com/q/21496738
type: Answer
downvote count: 0
score: 1
has body: the access point for java is the main method.. every program must access from a main method. and in main method, you need to create an instance of your class to use the method inside main method like following: public static void main(String [] args){ Elevator elevator = new Elevator(); elevator.move(1); ... } and also public int (int carry) // Setting carry into the elevator is not valid format in Java, you have to define a method name like public int setCarry(int carry) // Setting carry{ //your code }

http://stackoverflow.com/a/22204960
answers question: http://stackoverflow.com/q/21375066
type: Answer
has body: When instantiating your ServerAccess objects, give them the logger you want them to use like so: public class MainController { static void main (String[] args){ Logger l1 = Logger.getLogger("log4j.logger.com.ef.ThreadOne"); Logger l2 = Logger.getLogger("log4j.logger.com.ef.ThreadTwo"); ServerAccess t1 = new ServerAccess(l1); ServerAccess t2 = new ServerAccess(l2); t1.start(); t2.start(); } Then, within ServerAccess, use that logger like so: public class ServerAccess extends Thread { private final Logger logger; public ServerAccess(Logger logger){ this.logger = logger; } public void Start() { logger.debug("Debug Statement"); } }
score: 0

http://stackoverflow.com/comment/126583611
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21410759
has text: That's the way to go. :)
type: Comment

http://stackoverflow.com/q/21425783
has comment: http://stackoverflow.com/comment/32324229
possible better answer: http://stackoverflow.com/a/21425842
answer count: 9
has answer: http://stackoverflow.com/a/21425842
has answer: http://stackoverflow.com/a/21426020
has answer: http://stackoverflow.com/a/21425843
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21426041
has title: Which class implements iterator's Next() method?
tagged with: java
has answer: http://stackoverflow.com/a/21425835
type: Question
accepted answer: http://stackoverflow.com/a/21425843
tagged with: iterator
has body: my question may be newbish or even repetitive, but still i haven't found the answer yet. iterator() method returns an iterator, which has several methods, say, next(). But where are these methods implemented? Interfaces cannot implement methods, right? For example: Set keys = selector.selectedKeys(); Iterator it = keys.iterator(); While (it.hasNext()) Also, it is not a reference to an object, right? What is it then?
has comment: http://stackoverflow.com/comment/32325327
has answer: http://stackoverflow.com/a/21425904
has answer: http://stackoverflow.com/a/21426050
has answer: http://stackoverflow.com/a/21425878
score: 0
has answer: http://stackoverflow.com/a/21425832
has comment: http://stackoverflow.com/comment/32324436

http://stackoverflow.com/a/21425187
has body: May be your method signature is careting problem. public native AlacFile create_alac2(int samplesize , int numchannels ); Try once, public native AlacFile createAlac2(int samplesize , int numchannels );//remove '-' here May be its splitting create and alac2.
accepted answer of: http://stackoverflow.com/q/21413158
answers question: http://stackoverflow.com/q/21413158
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21413253
has comment: http://stackoverflow.com/comment/32324944
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21413309
score: 1
tagged with: java
tagged with: certificate
has body: I wanted to implement TLS to my Java application (which currently implements no kind of encryption). Then I read a little bit more about TLS and saw, that I should use certificates. So my question is: Is TLS also secure if I don't use certificates? And then: If it isn't secure without: How do I create such a certificate? What are good CAs? Where can I get a certificate for free? And how can I implement the certificate into my server application in Java? Please note that I'd need a certificate just for one server. Not for me or for an email address.
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32324821
has answer: http://stackoverflow.com/a/21745786
tagged with: ssl
has comment: http://stackoverflow.com/comment/32323120
has answer: http://stackoverflow.com/a/21745527
tagged with: security
answer count: 3
tagged with: ca
has title: TLS secure without certificate?
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/32263470
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21388146
has text: should i write textview id instead of textviewabove in your code??

http://stackoverflow.com/comment/32321933
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21424489
has text: It's not a very efficient solution, but I really doubt that the system would spend a lot of time doing this. Computers are very very fast.
type: Comment

http://stackoverflow.com/comment/32273053
comment on: http://stackoverflow.com/q/21396032
has text: @George: I read just now that I must use 0xff to give only unsigned values. Is that true?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21473113
has body: I was able to solve my problem like this. import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; import javax.swing.JFrame; import java.lang.Math; public class main extends JPanel{ public void paintComponent(Graphics g){ //super.paintComponent(g); int ancho = getWidth(); int alto = getHeight(); int r, gg, b; double pitagorazo, hypotenuse; Color miColor; for(int i=0; i&lt;800; i++){ for(int j=0; j&lt;600; j++){ pitagorazo = Math.pow(i,2)+Math.pow(j,2); hypotenuse = Math.sqrt(pitagorazo); hypotenuse=hypotenuse/3; if(hypotenuse &gt; 255) hypotenuse = 255; System.out.println(hypotenuse); r = 255-(int)hypotenuse; pitagorazo = Math.pow((255-i),2)+Math.pow(j,2); hypotenuse = Math.sqrt(pitagorazo); hypotenuse=hypotenuse/3; if(hypotenuse &gt; 255) hypotenuse = 255; gg = 255-(int)hypotenuse; pitagorazo = Math.pow(i,2)+Math.pow((255-j),2); hypotenuse = Math.sqrt(pitagorazo); hypotenuse=hypotenuse/3; if(hypotenuse &gt; 255) hypotenuse = 255; b = 255-(int)hypotenuse; miColor = new Color(r,gg,b); g.setColor(miColor); g.fillRect(i,j,1,1); } } } public static void main(String args[]){ main panel = new main(); JFrame application = new JFrame(); application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); application.add(panel); application.setSize(800, 600); application.setVisible(true); } } Here is the result : https://www.dropbox.com/s/ptsbiz0lxehcta8/Screenshot%202014-01-30%2023.35.23.png
upvote count: 1
answers question: http://stackoverflow.com/q/21423670
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/21353474
has answer: http://stackoverflow.com/a/21353587
tagged with: java
has title: Android: Exception using Closeable interface with Socket
has body: When I try to close a socket through its Closeable interface, I get an exception: new java.net.Socket().close(); // no error ((java.io.Closeable) new java.net.Socket()).close(); // Throws: java.lang.IncompatibleClassChangeError: interface not implemented Why is that? The problem is only on Android devices, not on Java programs running on desktop.
upvote count: 5
type: UnansweredQuestion
answer count: 1
downvote count: 0
favorite count: 0
type: Question
tagged with: interface
tagged with: sockets
score: 5
tagged with: android

http://stackoverflow.com/a/21378062
answers question: http://stackoverflow.com/q/21377859
downvote count: 0
type: Answer
has body: There isn's anything called variable overriding. That is why you are getting the same result in both the cases.
score: 9
upvote count: 9

http://stackoverflow.com/q/21438050
has body: We are using a solr embeded instance for Java SolrJ. I want to add a multivalued field to a document. The multivalued field is a coma separated String. In Java I want to do: solrInputDocument.addField(Field1, "value1,value2,value3"); The definition for Field1 in the schema is as follow &lt;field name="Field1" type="multiValuedField" indexed="true" stored="true" multiValued="true" required="false"/&gt; &lt;fieldType name="multiValuedField" class="solr.TextField" positionIncrementGap="100"&gt; &lt;analyzer type="index"&gt; &lt;tokenizer class="solr.ClassicTokenizerFactory"/&gt; &lt;/analyzer&gt; &lt;/fieldType&gt; With this configuration we were expecting that when we invoke the addField method Solr was able to check that it is a multiValuedField and so it converts the String into an arrayList with the different values. Instead we are getting an arraylist with just one value that is in fact the original string added to the document. Question: should be the tokenizer taking care of this, or should we do it ourselves when we are adding multivalued fields to the document? Thanks.
tagged with: solrj
type: UnansweredQuestion
score: 6
has title: Add multiValued field to a SolrInputDocument
upvote count: 6
answer count: 4
tagged with: tokenize
tagged with: java
has answer: http://stackoverflow.com/a/21580650
type: Question
has answer: http://stackoverflow.com/a/21537752
has answer: http://stackoverflow.com/a/27863623
downvote count: 0
has answer: http://stackoverflow.com/a/21517151
favorite count: 0

http://stackoverflow.com/comment/32251725
type: QuestionComment
comment on: http://stackoverflow.com/q/21384551
has text: I have done it lots of time...
type: Comment
score: 0

http://stackoverflow.com/comment/32277713
has text: Where is `sendinfo()` called?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21399093

http://stackoverflow.com/comment/32463685
type: AnswerComment
type: Comment
has text: Try this: `(550/500)*3.8*1`. It's hard to get what you want if you only give 1 example.
comment on: http://stackoverflow.com/a/21503438
score: 0

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/21467832

http://stackoverflow.com/q/21374028
has comment: http://stackoverflow.com/comment/32232819
has answer: http://stackoverflow.com/a/21374108
downvote count: 0
has comment: http://stackoverflow.com/comment/32233294
has comment: http://stackoverflow.com/comment/32232927
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32233382
has comment: http://stackoverflow.com/comment/32232960
has comment: http://stackoverflow.com/comment/32232959
has answer: http://stackoverflow.com/a/21374100
has comment: http://stackoverflow.com/comment/32232900
has comment: http://stackoverflow.com/comment/32232869
answer count: 4
score: 2
tagged with: list
upvote count: 2
has answer: http://stackoverflow.com/a/21374144
has comment: http://stackoverflow.com/comment/32233033
tagged with: java
has answer: http://stackoverflow.com/a/21374167
tagged with: collections
type: Question
has title: How to replace a element in list of objects from another list
has comment: http://stackoverflow.com/comment/32232844
has body: I have a List of Images List&lt;Image&gt; images = getImages(); Image.java public class Image { private String imageId; // getter and setter methods // ... } And I have a List&lt;String&gt; imageIds to replace the imageId in each Image object. What would be the best way to do it?

http://stackoverflow.com/q/21355834
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21356176
has comment: http://stackoverflow.com/comment/32199867
score: -3
tagged with: regex
has title: Regex and java to ignore keywords and string inside quotation
type: AnsweredQuestion
has body: I'm searching for keywords that has to start with a letter followed by a letter or a character or nothing Things I am looking for: x, x2, xx, and so on the regular expression i have is [A-Za-z][A-Za-z0-9]+|[a-zA-Z] I need to ignore words such as INT, WRITE, READ and so on, not sure how to implement also if it comes across a string with quotation, I need it to ignore whatever that is inside the quotation? any help? Thanks in advance.
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/32200524
accepted answer: http://stackoverflow.com/a/21356176
type: Question
has comment: http://stackoverflow.com/comment/32200042
has comment: http://stackoverflow.com/comment/32199918
has comment: http://stackoverflow.com/comment/32199901
upvote count: 0

http://stackoverflow.com/comment/32243518
type: AnswerComment
comment on: http://stackoverflow.com/a/21373929
type: Comment
has text: @Radiodef: These are long-established meanings used by professionals. Using them interchangeably is sloppy and obscures meaning. The two concepts are quite different, and we need different words to distinguish them.
score: 1

http://stackoverflow.com/comment/32208925
type: Comment
type: QuestionComment
has text: where do u think that ur data would be store if u don't has a memory for it.
comment on: http://stackoverflow.com/q/21360912
score: 0

http://stackoverflow.com/q/21486576
tagged with: servlets
has comment: http://stackoverflow.com/comment/32431993
downvote count: 0
favorite count: 0
tagged with: pooling
upvote count: 1
has body: I am having a slight problem with using JDBC tomcat pool. I have properly defined the resource in context.xml, as well as referring to it in web.xml. Now in my Database access method, I would like to somehow get a data source for when a user get something from the database. However, when I type this in: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource) envCtx.lookup("jdbc/testDB"); I get the error message "InitialContext cannot be resolved to a type". What is the problem here?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21490301
score: 1
tagged with: java
tagged with: mysql
type: Question
has title: Tomcat jdbc pool doesn't work
has comment: http://stackoverflow.com/comment/32438828
has answer: http://stackoverflow.com/a/21490301
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/32237614
comment on: http://stackoverflow.com/q/21375150
has text: free means without buy. Please give code if it can be possible through iText or PDFBox for how to resize the existing PDF page.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32292172
type: Comment
has text: not working. tried it with checked and unchecked boxes, with and without the .project-file in the folder, .. :/
comment on: http://stackoverflow.com/a/21407214
score: 1
type: AnswerComment

http://stackoverflow.com/a/21453153
type: Answer
answers question: http://stackoverflow.com/q/21452966
downvote count: 0
has comment: http://stackoverflow.com/comment/32375775
has body: List&lt;? extends T&gt; indicates that anything can comes out of it can be cast to T, so the true list could be any of the following: List&lt;T&gt; List&lt;T2&gt; List&lt;T3&gt; etc You can see that even a new T cannot safely be added to such a collection because it could be a List&lt;T2&gt; which T cannot be put into. As such, such List&lt;? extends T&gt; cannot have non null entries added to them. In this case you may simply want List&lt;T&gt; So why would you ever use this?! This contravariance can be useful for method parameters or returns, in which a collection will be read, rather than added to. A use for this could be to create a method that accepts any collection that holds items that are T, or extend T. public static void processList(Collection&lt;? extends Vector3d&gt; list){ for(Vector3d vector:list){ //do something } } This method could accept any collection of objects that extends Vector3d, so ArrayList&lt;MyExtendedVector3d&gt; would be acceptable. Equally a method could return such a collection. An example of a use case is described in Returning a Collection&lt;ChildType&gt; from a method that specifies that it returns Collection&lt;ParentType&gt;.
score: 10
has comment: http://stackoverflow.com/comment/32375658
upvote count: 10

http://stackoverflow.com/comment/32439604
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21490590
has text: Pretty sure there was a clause in the java specs that says something like "recommended means you really should do it" and how it's not a requirement because you don't HAVE to do it if absolutely don't want to.

http://stackoverflow.com/a/21414039
type: AcceptedAnswer
downvote count: 0
has body: First of all, don't use == to compare Strings, but instead use the .equals(...) method. As has been well discussed on this site, == checks if one object is one and the same as another object; it checks for identity, whereas the equals (or equalsIgnoreCase) method checks if the Strings have the same chars in the same order, which is what you're interested in. Next of all, be sure that you're calling your method on a variable, on an instance, not on the class java.AWT.Panel. Note that variable names should begin with a lower case letter. Do this anyway to avoid confusing yourself and others. The key to this exercise is getting a valid reference to the JPanel whose background color you want to change. This object should be assigned to a non-static class field so that other methods can get a handle to it and call methods on it. Edit Regarding your updated code, your problem is here: // likely in some constructor or method Object[] colourchoice = {"Default", "Orange"}; String UserInput = (String) JOptionPane.showInputDialog(null, "Please choose a colour","ColourChoice",JOptionPane.PLAIN_MESSAGE, null,colourchoice, "Default"); if (UserInput == "Orange") Panel.setBackground(Color.ORANGE); GUIDesign window = new GUIDesign(); window.setVisible(true); window.setSize(100, 100); JPanel Panel = new JPanel(); // ***** here window.setContentPane(Panel); Problems: Don't name your variable "Panel". Again variable names should begin with a lower case letter. Since you're declaring this variable inside of a method or constructor, this means that *it is visible only inside the same variable or constructor. Again the variable should be declared at the class level as a non static variable. You're still using == to compare Strings after getting recommendations not to do so -- why? e.g., public class MyGui { private JPanel myContentPane = new JPanel(); MyGui() { // add myContentPane to the GUI } Now you can use the myContentPane anywhere in the class. Edit 2 For example... import java.awt.…
has comment: http://stackoverflow.com/comment/32304644
has comment: http://stackoverflow.com/comment/32306048
type: Answer
has comment: http://stackoverflow.com/comment/32304093
answers question: http://stackoverflow.com/q/21414007
has comment: http://stackoverflow.com/comment/32305429
accepted answer of: http://stackoverflow.com/q/21414007
has comment: http://stackoverflow.com/comment/32305370
upvote count: 2
has comment: http://stackoverflow.com/comment/32305516
has comment: http://stackoverflow.com/comment/32304853
has comment: http://stackoverflow.com/comment/32305334
has comment: http://stackoverflow.com/comment/32304197
has comment: http://stackoverflow.com/comment/32303952
has comment: http://stackoverflow.com/comment/32305582
has comment: http://stackoverflow.com/comment/32304605
has comment: http://stackoverflow.com/comment/32303891
score: 2
has comment: http://stackoverflow.com/comment/32305049

http://stackoverflow.com/a/21375809
score: 7
downvote count: 0
has body: From the Java Oracle documentation: Strings are constant; their values cannot be changed after they are created. And again: String buffers support mutable strings. Because String objects are immutable they can be shared. Generally speaking: "all primitive" (or related) object are immutable (please, accept my lack of formalism). Related post on Stack Overflow: Immutability of Strings in Java Is Java String immutable? Is Java "pass-by-reference" or "pass-by-value"? Is a Java string really immutable? String is immutable. What exactly is the meaning? what the reason behind making string immutable in java? About the object pool: object pool is a java optimization which is NOT related to immutable as well.
answers question: http://stackoverflow.com/q/21375659
type: Answer
upvote count: 7

http://stackoverflow.com/q/21469472
score: 0
has answer: http://stackoverflow.com/a/21510424
answer count: 1
tagged with: binary-data
tagged with: io
has title: Reading the Binary Data from JMeter sampler
tagged with: jmeter
type: UnansweredQuestion
type: Question
tagged with: beanshell
tagged with: java
has body: Trying to read the Binary data response from JMeter sampler and deserialize it in the BeanShlll Post Processor. The flow is, controller first sends a request to a webservice, which returns binary data. When I view that in the JMeter, I see some junk chars. I need to convert this to the actual object (my custom object) in the BeanShell script. This is what I tried. But no luck. Or may be I am trying something dumb. PS: Newbie with IO stuff. import java.io.ObjectOutputStream; import com.package.MyClass; MyClass myObj = new MyClass(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); myObj = ois.readObject(); It does not work. It does not show anything. Any help?

http://stackoverflow.com/a/21449074
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21447229
has body: This is a known shortcoming in the Android Google Maps API. Take a look here for some workarounds.
answers question: http://stackoverflow.com/q/21447229
has comment: http://stackoverflow.com/comment/32369834
type: AcceptedAnswer

http://stackoverflow.com/q/21391683
has answer: http://stackoverflow.com/a/21391814
type: Question
tagged with: arraylist
score: 0
answer count: 3
has title: The Swedish Chef Translator
tagged with: parsing
has body: So the context is, I have a CS project where input is taken in either word or sentence form, and then it is translated to what The Swedish Chef from The Muppets would say. I decided to take the input as one line of string, and send that line into a parser, which in turn would build an array out of translations of the input's letters. The conditions for what gets changed are defined within. the current error I am getting: (while using "INPUT" as input) Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 3, Size: 1 at java.util.ArrayList.rangeCheckForAdd(Unknown Source) at java.util.ArrayList.add(Unknown Source) at SwedishTranslator.parseString(SwedishTranslator.java:62) at SwedishTranslator.main(SwedishTranslator.java:12) Currently it is supposed to just print the array, I wanted to worry about formatting after the fact. The code: Sorry for the walls of text but I can't find where the issue is exactly and I figured I would give it a shot here. Thanks in advance.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21391923
has answer: http://stackoverflow.com/a/21391760
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/32265039
tagged with: methods

http://stackoverflow.com/comment/32366692
comment on: http://stackoverflow.com/a/21429695
type: AnswerComment
score: 0
type: Comment
has text: Yes 'small.txt' might be having other delimiters other than 'spaces', actual line splitting is happening only when I use split("[\\s]+"). Thanks for your help Peter. I request you to add regular expression based split() i.e [split("[\\s]+")] to your code, this will factor all kinds of separators and thus your code will work in all conditions.

http://stackoverflow.com/q/21367871
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32224146
linked to: http://stackoverflow.com/q/16084324
tagged with: manifest
has body: So the java applets on my website stop working. I try updating browsers on all my computers (mac and windows), still the problem persists. Then as I did more research, I learn that I have to change my manifest. Does anyone have an example of what the new manifest should look like? Is there anything else I need to do? Please, please, provide an example. I have been reading about the new requirements, but I am still not clear on how to implement the changes.
tagged with: security
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
type: UnansweredQuestion
has title: How do I get my java applets to work again
tagged with: permissions
score: 1
has answer: http://stackoverflow.com/a/21370639
tagged with: java

http://stackoverflow.com/a/21510053
downvote count: 0
answers question: http://stackoverflow.com/q/21509969
type: Answer
score: 2
has body: Yes, you can avoid the condition in two ways - using a switch, and using a Map: With a switch statement: if (opp.length() != 1) // Show error, and exit. switch(opp.charAt(0)) { case '+': System.out.println(String.format("%d %s %d = %d", first, opp, second, first + second)); break; case '-': System.out.println(String.format("%d %s %d = %d", first, opp, second, first - second)); break; case '*': System.out.println(String.format("%d %s %d = %d", first, opp, second, first * second)); break; default: // Show error... break; } With a Map&lt;K,V&gt; and a special-purpose interface: interface Operation { int calc(int a, int b); } Map&lt;String,Operation&gt; ops = new HashMap&lt;String,Operation&gt; { {"+", new Op() {public calc(int a, int b) {return a+b;}}} , {"-", new Op() {public calc(int a, int b) {return a-b;}}} , {"*", new Op() {public calc(int a, int b) {return a*b;}}} }; ... Operation op = ops.get(opp); if (op == null) // Report an error and exit System.out.println(String.format("%d %s %d = %d", first, opp, second, op(first, second)));
upvote count: 2

http://stackoverflow.com/comment/32292623
type: AnswerComment
comment on: http://stackoverflow.com/a/21407461
type: Comment
score: 1
has text: @krystah You don't wake *objects*, but *threads*. You'll never get it right if you don't understand the concepts.

http://stackoverflow.com/comment/103698195
has text: @CopyandPaste I mention in my answer two types: "raw correctness" type of validation: s the data actually making any sense): e.g are required fields filled in, are Integers positive numbers, etc. Then there is the business validation, which might be far more complex than simply checking a couple of properties for null, e.g, whether you have a capacity for an order, which might even involve a database call something that you might separate from the "raw" validation and put in a validation service or something of the sorts. javax.* suits the "raw" than the other type but it's not a 100% rule.
comment on: http://stackoverflow.com/a/21408197
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21418101
has body: how to add javascript to the below code such that i can refresh it to obtain any entries without refreshing the whole page &lt;label for="textarea"&gt; &lt;blockquote&gt; &lt;ul&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;Session Progress&lt;/strong&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/ul&gt; &lt;/blockquote&gt; &lt;/label&gt; &lt;p&gt; &lt;textarea name="textarea" cols="88" rows="33" id="textarea"&gt;&lt;/textarea&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;
score: 0
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21418919
accepted answer: http://stackoverflow.com/a/21418919
tagged with: java
possible better answer: http://stackoverflow.com/a/21418136
has answer: http://stackoverflow.com/a/21418136
tagged with: servlets
type: Question
answer count: 2
has title: Javascript for the jsp
tagged with: jsp
tagged with: javascript

http://stackoverflow.com/comment/32236153
has text: Hello, i have edited the answer. Also make sure you have the required permissions to read files.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21375845
score: 0

http://stackoverflow.com/comment/32287990
score: 0
type: AnswerComment
has text: Yeah loading a large bitmap like 1920x1080 will probably cause the overload. Google's guide to this might be of some help http://developer.android.com/training/displaying-bitmaps/index.html
comment on: http://stackoverflow.com/a/21404741
type: Comment

http://stackoverflow.com/comment/32190312
has text: @Bohemian I am sure that all the elements are of the same type. Let me try to find the original array and update it.
comment on: http://stackoverflow.com/a/21350193
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21382725
has body: I have the following problem: I'm building a Java/JSF/Hibernate/Spring project over an existing old FoxPro System, sharing the same MySQL Database 4.1. My problem is that the OLD system saves the NO DATE as 0000-00-00 instead of NULL. So I solved the READING problem with zeroDateTimeBehavior=convertToNull, and works perfectly. But, now I want to save some dates, and if I save NULL the old system may not work properly, so I want to save the 0000-00-00 while the old system is still in service. What I tried and didn't work: Changing the database using NOT NULL and DEFAULT 0000-00-00 but still saving NULL. Using a second date as String with @column annotation pointing to the same field of the database. The @column that is a Date with (insertable=false,updatable=false) and the String with (insertable=true,updatable=true) still using the java.util.Date field. Mysql 4.1 doesn't have triggers I wanted to create one after insert null convert to 0000-00-00 So what I need is to save a 0000-00-00 when java.util.Date saves a NULL date, to keep both systems working. Thanks in advance.
score: 1
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
tagged with: date
has comment: http://stackoverflow.com/comment/33476978
has title: JPA/Hibernate Save 0000-00-00 Date in Mysql
type: Question
tagged with: null
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21403782
has answer: http://stackoverflow.com/a/61295182
has comment: http://stackoverflow.com/comment/32285902
has comment: http://stackoverflow.com/comment/32285808
downvote count: 0
tagged with: palindrome
has title: The fastest method of determining if a string is a palindrome
has answer: http://stackoverflow.com/a/21404085
has comment: http://stackoverflow.com/comment/32285753
has comment: http://stackoverflow.com/comment/32286010
has answer: http://stackoverflow.com/a/21404398
has comment: http://stackoverflow.com/comment/32285840
answer count: 7
linked to: http://stackoverflow.com/q/504103
has answer: http://stackoverflow.com/a/21403969
favorite count: 0
has comment: http://stackoverflow.com/comment/32285744
has answer: http://stackoverflow.com/a/21404276
has answer: http://stackoverflow.com/a/21446805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32285837
has comment: http://stackoverflow.com/comment/32285803
has answer: http://stackoverflow.com/a/21403867
upvote count: 7
has body: I need an algorithm that verify with the fastest possible execution time, if a string is a palindrome ( the string can be a proposition with uppercase or lowercase letter, spaces etc.). All of this in Java. I got a sample : bool isPalindrome(string s) { int n = s.length(); s = s.toLowerCase(); for (int i = 0; i &lt; (n / 2) + 1; ++i) { if (s.charAt(i) != s.charAt(n - i - 1)) { return false; } } return true; } I transformed the string in lowercase letter using .toLowerCase() function, but I don't know how much it affects the execution time . And as well I don't know how to solve the problem with punctuation and spaces between words in a effective way.
has comment: http://stackoverflow.com/comment/32286177
tagged with: performance
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/32285701
type: Question
linked to: http://stackoverflow.com/q/7569335

http://stackoverflow.com/comment/32301204
score: 0
comment on: http://stackoverflow.com/q/21412443
type: Comment
type: QuestionComment
has text: Are you trying to _build_ it on the server?

http://stackoverflow.com/a/21449961
type: Answer
has body: I think what you looking for if I do understand what you trying to get is something o this sort ? package snippet; import java.util.HashMap; import java.util.Map.Entry; import java.util.Scanner; public class Snippet { public static void main(String[] arg) { countCharacters(); } private static void countCharacters() { Scanner thisString = new Scanner(System.in); System.out.println("Hello there! Please type in a few words and enter 'Done' when you are finished"); String line = "", lettersToSearchFrom = ""; while (!("Done").equals(line)) { line = thisString.nextLine(); lettersToSearchFrom += line; } thisString.close(); //Since "Done" takes up 4 characters, it will be removed int beginPoint = lettersToSearchFrom.length()-4; int endPoint = lettersToSearchFrom.length(); //Replaces the last line entered which is "Done" as its not part of the letters to search from char[] characters = lettersToSearchFrom.toLowerCase().substring(0,beginPoint).toCharArray(); System.out.println(lettersToSearchFrom); HashMap&lt;Character, Integer&gt; map = new HashMap&lt;Character, Integer&gt;(); //This is where the counting happens for (char key : characters) { if (map.containsKey(key)) { int frequency = map.get(key); frequency++; map.put(key, frequency); } else { map.put(key, 1); } } // Display frequency for each character ignoring case for (Entry&lt;Character, Integer&gt; item : map.entrySet()) { System.out.println(item.getKey() + " = " + item.getValue()); } //To display the frequency of a specific character you can just retrieve from map //The following is if we searching specifically for "A" and not "a" //Please keep in mind that everything was made to lower case so a '0' should be return for value of "A" //since it is not contained int frequency = map.get("A")==null?0:map.get("A"); System.out.println("Number of occurences for 'A' is "+frequency); } }
score: 0
answers question: http://stackoverflow.com/q/21449095

http://stackoverflow.com/comment/45843506
score: 9
type: AnswerComment
has text: @SaintHill but then you have to write it out, giving the parameter a name
type: Comment
comment on: http://stackoverflow.com/a/22492361

http://stackoverflow.com/comment/32392118
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21463867
has text: I want it to outprint how many palindromes there are as in figure wise aswell as telling me which ones are valid palindromes

http://stackoverflow.com/comment/32429134
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21396680
type: AnswerComment
has text: Is the cause of the error I posted because the JNLP file is looking for resources on the work computer? If so, is it possible to copy those resources to the Home computer? I also searched .jar and copied those hits just in case.

http://stackoverflow.com/a/21447663
type: Answer
has comment: http://stackoverflow.com/comment/32364223
answers question: http://stackoverflow.com/q/21447262
score: 0
has body: { "employees":[ { "firstName":"John", "lastName":"Doe" }, { "firstName":"Anna", "lastName":"Smith" }, { "firstName":"Peter", "lastName":"Jones" } ] } Your opening and closing braces are missing. that is not a valid json array, The above is a sample array format

http://stackoverflow.com/comment/32401503
type: Comment
comment on: http://stackoverflow.com/a/21468864
has text: @AWT Oh noooooooo. I could have sworn that split() worked on whitespace by default. Corrected!
type: AnswerComment
score: 0

http://stackoverflow.com/q/21375940
has answer: http://stackoverflow.com/a/21383845
accepted answer: http://stackoverflow.com/a/21375986
favorite count: 0
possible better answer: http://stackoverflow.com/a/21383845
has answer: http://stackoverflow.com/a/51770327
type: AnsweredQuestion
score: 2
has title: Does LockSupport.park(Object) releases monitor lock of blocker object
upvote count: 2
has body: I'm trying to assert whether or not, using LockSupport.park(Object blocker) realeases the monitor lock object of blocker. That is : if called in a section synchronized on blocker, will the monitor lock of blockerbe released ? Here's a junit test I made that make me think it's the case. I know a Thread is in state WAITING as a consequence of calling Òbject.waitor LockSupport.park()which looks to me like the same underlying mechanism is used. However, the javadoc doesn't explicitly clarifies my question, so i'm not sure. final Object blocker = new Object(); final Thread thread = new Thread() { @Override public void run() { synchronized(blocker) { while(!interrupted()) { assertTrue(holdsLock(blocker)); LockSupport.park(blocker); } } } }; try { thread.start(); while(thread.getState() != Thread.State.WAITING) Thread.sleep(100); assertEquals(0, ManagementFactory.getThreadMXBean().getThreadInfo(thread.getId()).getLockedMonitors().length); } finally { thread.interrupt(); }
type: Question
has answer: http://stackoverflow.com/a/21375986
tagged with: java
tagged with: concurrency
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/32287422
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21403867
has text: @maaartinus I wanted to reply something like that to your comment, but Andrey was at least 0.1s faster. Again.

http://stackoverflow.com/comment/32473239
type: Comment
type: QuestionComment
score: 0
has text: Post the Java code from activities as well.
comment on: http://stackoverflow.com/q/21509560

jaxb
tags question: http://stackoverflow.com/q/21490247
tags question: http://stackoverflow.com/q/21453203
tags question: http://stackoverflow.com/q/21428362
tags question: http://stackoverflow.com/q/21488119
tags question: http://stackoverflow.com/q/21405994
tags question: http://stackoverflow.com/q/21477934
tags question: http://stackoverflow.com/q/21489843
tags question: http://stackoverflow.com/q/21472583
tags question: http://stackoverflow.com/q/21464049
tags question: http://stackoverflow.com/q/21407573
tags question: http://stackoverflow.com/q/21490230
tags question: http://stackoverflow.com/q/21378375
tags question: http://stackoverflow.com/q/21462425
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/21471310
tags question: http://stackoverflow.com/q/21504816
tags question: http://stackoverflow.com/q/21374744
tags question: http://stackoverflow.com/q/21503962
tags question: http://stackoverflow.com/q/21462677
tags question: http://stackoverflow.com/q/21374978
tags question: http://stackoverflow.com/q/21384550
tags question: http://stackoverflow.com/q/21382202
tags question: http://stackoverflow.com/q/21393323
tags question: http://stackoverflow.com/q/21453968
tags question: http://stackoverflow.com/q/21452150
tags question: http://stackoverflow.com/q/21387170
tags question: http://stackoverflow.com/q/21370135

http://stackoverflow.com/comment/32212221
type: Comment
comment on: http://stackoverflow.com/a/21362773
score: 0
type: AnswerComment
has text: +1 Do you need to define a binding to `x` anywhere?

instantiation
type: Tag
tags question: http://stackoverflow.com/q/21492208
tags question: http://stackoverflow.com/q/21371082
tag name: instantiation

http://stackoverflow.com/comment/32306604
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21415413
has text: What does the method parseDiv do?
score: 0

http://stackoverflow.com/q/21365643
favorite count: 0
has answer: http://stackoverflow.com/a/21365774
answer count: 1
has body: I have my mailing service with has constructor argument and implements an interface public class MailServiceImpl implements MailService { private MailBo mail; public MailBO getMail() { return Mail; } public void setMail(MailBO Mail) { this.Mail = Mail; } public MailServiceImpl(MailBo mail) { throw exception if from and to address is not here this.mail = mail; } public void sendMail(){ use mail object to send mail here } } so now i am trying to write a test which i want to create Mailserviceimpl instance autowired with constructor argument passed in it. i followed this link to autowire object with constructor, but i am getting below exception Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.model.MailBO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} my test class public class MailServiceImplTest { @Autowired private MailService mailServiceImpl; @Test public void testSendValidMail(){ //test } } EDIT:- adding spring context &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;context:component-scan base-package="com.service" /&gt; &lt;/beans&gt; EDIT 2:- i want my mailbo loaded with some values and inject as constructor object to mailserviceimpl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32217460
upvote count: 1
tagged with: spring
tagged with: autowired
tagged with: spring-mvc
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32217361
has title: Spring auto-wire dependency which has constructor argument
has comment: http://stackoverflow.com/comment/32217220
type: Question
has comment: http://stackoverflow.com/comment/32217421
downvote count: 0

http://stackoverflow.com/comment/32235518
comment on: http://stackoverflow.com/q/21375255
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your answer! Could you provide more details? Thanks in advance ^^ I'm just a newbie here :D

http://stackoverflow.com/comment/32467913
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21506344
has text: There is no variable named `myTextArea` that is in scope at that point in the code. There is, however, one named `textArea` but that might not solve OP's problem.

http://stackoverflow.com/comment/32429556
type: QuestionComment
type: Comment
has text: I wonder why the file extension is 'CFG'. Is the input a real, valid, structured XML file? Then you can parse the file as a DOM tree, modify the nodes, and write it back as an XML file. It's a comparatively high effort, but ... (I don't want to mention any quick&dirty solutions involving things like BufferedReader#readLine and String#replace for now... )
score: 0
comment on: http://stackoverflow.com/q/21484990

http://stackoverflow.com/q/21412443
has body: I am trying to install a project on Ubuntu server but I am receiving the following error: [ERROR] Failed to execute goal on project db: Could not resolve dependencies for project com.company.soft.prod:db:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: commons-codec:commons-codec:jar:1.5, mysql:mysql-connector-java:jar:5.1.26, org.springframework:spring-jdbc:jar:3.2.4.RELEASE, org.springframework:spring-beans:jar:3.2.4.RELEASE, org.springframework:spring-core:jar:3.2.4.RELEASE, org.springframework:spring-tx:jar:3.2.4.RELEASE, org.springframework:spring-orm:jar:3.2.4.RELEASE, aopalliance:aopalliance:jar:1.0, org.hibernate:hibernate-core:jar:3.5.1-Final, antlr:antlr:jar:2.7.6, commons-collections:commons-collections:jar:3.1, dom4j:dom4j:jar:1.6.1, xml-apis:xml-apis:jar:1.0.b2, javax.transaction:jta:jar:1.1, org.hibernate:hibernate-entitymanager:jar:3.5.1-Final, org.hibernate:hibernate-annotations:jar:3.5.1-Final, org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final, cglib:cglib:jar:2.2, asm:asm:jar:3.1, javassist:javassist:jar:3.9.0.GA, org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final, org.springframework:spring-context:jar:3.2.4.RELEASE, org.springframework:spring-aop:jar:3.2.4.RELEASE, org.springframework:spring-expression:jar:3.2.4.RELEASE, com.existanze.libraries:orm:jar:0.0.3, joda-time:joda-time:jar:1.6.2, com.jolbox:bonecp:jar:0.7.1.RELEASE, com.google.guava:guava:jar:r08: The repository system is offline but the artifact commons-codec:commons-codec:jar:1.5 is not available in the local repository. I have to say that locally I am not facing any problem with dependencies resolution. What I am developing is a mavenized Spring MVC multi-project in Netbeans. Now that I am trying to deploy it to the server I receive this error. I tried also mvn clean install -U to update SNAPSHOT but it still does not work. I don't know what else to do, so at this point I need some expert help. Thank you very much.
tagged with: ubuntu
score: 0
has comment: http://stackoverflow.com/comment/32301337
has comment: http://stackoverflow.com/comment/32301204
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21412734
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/32301929
has title: Maven artifacts cannot be resolved when trying to install to Ubuntu
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32301198

antlr
tags question: http://stackoverflow.com/q/21470293
tag name: antlr
type: Tag

http://stackoverflow.com/q/21473696
has answer: http://stackoverflow.com/a/21473927
has title: Android Display date from one week to another like (Thursday to Thursday )
possible better answer: http://stackoverflow.com/a/21473941
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21676492
accepted answer: http://stackoverflow.com/a/21676492
has body: I have been stuck on this issue for the last two days. My issue is this: how can I display the date from one week to another week (Thursday to Thursday)? For example: 1/30/2014 to 2/6/2014 or 30 jan 2014 to 6 feb 2014 when week is complete then it's change Like: 2/6/2014 to 2/13/2014 or 6 feb 2014 to 13 feb 2014 Any help or sample code will be highly appreciated.
upvote count: 1
tagged with: android-date
tagged with: android-datepicker
has answer: http://stackoverflow.com/a/21473941
linked to: http://stackoverflow.com/q/18272306
favorite count: 0
answer count: 3
tagged with: android

http://stackoverflow.com/q/21365456
tagged with: java
has comment: http://stackoverflow.com/comment/32217413
tagged with: web-applications
has title: Modular web application with Spring
type: Question
has comment: http://stackoverflow.com/comment/32217375
has answer: http://stackoverflow.com/a/21365998
has body: I want to create a web application splitted in extensions structured like this: Core Backend A - depending on Core (&amp; possibly Backend B) Backend B - depending on Core &amp; Backend A Frontend A - depending on Backend A &amp; B Frontend B - depending on Backend A &amp; B They should run in a Tomcat. Now my problem is that I still want to provide the ability to inject services from the extensions it depends on. Also, the two frontends should use the same instance of each service defined in the backend extension. It would be a cool feature if the configuration of the Extensions could happen completely annotation-based (WebApplicationInitializer and @Configuration). What I've tried: Creating the Core- and Backend-Extensions as WebApplications does not work, as they then have their own ClassLoaders and Contexts, no injection possible Exporting the extensions as libraries to the tomcat and including them into each Frontend-WebApplication does not ensure that the services are the same, also the annotation-based configuration does not work Whats the best way to solve this?
answer count: 1
downvote count: 0
tagged with: tomcat
tagged with: modular
favorite count: 0
upvote count: 2
tagged with: spring
accepted answer: http://stackoverflow.com/a/21365998
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/21397534
upvote count: 1
accepted answer: http://stackoverflow.com/a/21398118
has title: Embedded HornetQ with persistence enabled fails to start with programmatic config
tagged with: hornetq
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21398118
has body: I'm trying to run HornetQ embedded in my app. Configuring programatically results in this error. So I've been trying to set config via xml file. The server starts successfully, but I get an error trying to create the client session. Here's my code to starup ClientSession session = null; try { EmbeddedHornetQ embedded = new EmbeddedHornetQ(); try { embedded.start(); } catch (Exception ex) { log.error("Error starting MQServer", ex); throw new RuntimeException(ex); } ClientSessionFactory sessionFactory = HornetQClient.createServerLocatorWithoutHA( new TransportConfiguration( InVMConnectorFactory.class.getName())).createSessionFactory(); session = sessionFactory.createSession(); final String queueName = "queue.exampleQueue"; session.createQueue(queueName, queueName, true); }catch(Exception ex) { log.error("error", ex); } return session; When it trys to connect, I get this error: WARNING: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal Jan 27, 2014 9:13:49 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging) Jan 27, 2014 9:13:49 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: Waiting to obtain live lock Jan 27, 2014 9:13:49 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: Using NIO Journal Jan 27, 2014 9:13:49 PM org.hornetq.core.logging.impl.JULLogDelegate warn WARNING: Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this. Jan 27, 2014 9:13:49 PM org.hornetq.core.logging.impl.JULLogDelegate info INFO: Waiting to obtain live lock Jan…
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/21399979
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21399559
answers question: http://stackoverflow.com/q/21399559
type: Answer
upvote count: 4
has body: No, the functionality is the same. It's just included in the jre and the jdk, and if you happen to have several of them, you'll have several keytool.exes.
downvote count: 0

http://stackoverflow.com/comment/32261756
comment on: http://stackoverflow.com/q/21390040
score: 0
type: Comment
type: QuestionComment
has text: You'll need to give more information I think, what are "features" you certainly at least have to have some expectations about the object. Do you have an array of them? Is there only one? You don't need the object at all maybe, you can call a method in `FeatureVector` to return the object(s)?

http://stackoverflow.com/comment/32200132
type: QuestionComment
comment on: http://stackoverflow.com/q/21355853
has text: Very good question, thanks. Reflection API has two parts: look up and invoke. And I actually do not want to use the "invoke" part which is slow. My motivation was to avoid using something that may introduce slowdown/overhead.
score: 0
type: Comment

http://stackoverflow.com/comment/32249119
comment on: http://stackoverflow.com/q/21383139
has text: @Radiodef Never know could have had an error with his initialization of the List.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21391198
type: Answer
has body: There are several options here, but this is likely the simplest and should work: View.OnClickListener mStopListener5 = new View.OnClickListener() { @Override public void onClick(final View arg0) { String resultString=SvenMethods.calcCorrectedTimesTest(names, gphArray); Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)", Toast.LENGTH_LONG).show(); textResult.setText(resultString); } }
score: 0
answers question: http://stackoverflow.com/q/21390864

http://stackoverflow.com/comment/87917023
score: 2
comment on: http://stackoverflow.com/q/21488056
type: Comment
type: QuestionComment
has text: Seems like [this answer](https://stackoverflow.com/a/22492361/1746118) could be the ultimate solution adapted in JDK/11 as well.

http://stackoverflow.com/a/21507745
type: Answer
upvote count: 3
score: 3
has body: This seems to work perfectly, to move the pawns one by one from the starting position to meeting in a front at the center of the board. For better help sooner, post a Minimal Complete Tested and Readable Example (like this code) that behaves differently. This MCTRE is based on code seen in Making a robust, resizable Swing Chess GUI. import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.*; import java.net.URL; import javax.imageio.ImageIO; public class AnimatedChessGui { private final JPanel gui = new JPanel(new BorderLayout(3, 3)); private JButton[][] chessBoardSquares = new JButton[8][8]; private Image[][] chessPieceImages = new Image[2][6]; private JPanel chessBoard; private final JLabel message = new JLabel( "Chess Champ is ready to play!"); private static final String COLS = "ABCDEFGH"; public static final int QUEEN = 0, KING = 1, ROOK = 2, KNIGHT = 3, BISHOP = 4, PAWN = 5; public static final int[] STARTING_ROW = { ROOK, KNIGHT, BISHOP, KING, QUEEN, BISHOP, KNIGHT, ROOK }; public static final int BLACK = 0, WHITE = 1; private Timer timer; AnimatedChessGui() { initializeGui(); } public void animateChessPieces() { timer = new Timer(1000, new ActionListener() { int count = 0; @Override public void actionPerformed(ActionEvent e) { if (count % 2 == 0) { chessBoardSquares[count/2][1].setIcon(null); chessBoardSquares[count/2][3].setIcon(new ImageIcon( chessPieceImages[BLACK][PAWN])); } else { chessBoardSquares[count/2][6].setIcon(null); chessBoardSquares[count/2][4].setIcon(new ImageIcon( chessPieceImages[WHITE][PAWN])); } count++; if (count == 16) { timer.stop(); } } }); timer.start(); } public final void initializeGui() { // create the images for the chess pieces createImages(); // set up the main GUI gui.setBorder(new EmptyBorder(5, 5, 5, 5)); JToolBar tools = new JToolBar(); tools.setFloatable(false); gui.add(tools, BorderLayout.PAGE_START); Action newGameAction = new AbstractAction("New") …
answers question: http://stackoverflow.com/q/21507506
downvote count: 0

http://stackoverflow.com/a/21425148
has body: Of course it is because you are iterating one time extra than the length of an array. If the length of your array is 3. Your array stores elements like array[0], array[1] and array[2]. Index of an array or any list Map Set starts from 0. Use for(int a = 0; a &lt; array1.length;a++)
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/21425108
score: 2
downvote count: 0

http://stackoverflow.com/comment/32424693
type: AnswerComment
has text: Perfect! That did exactly what I wanted. GET /*route controllers.MainController.fault(route) public static Result fault(String url){ return badRequest(url+" not found"); }
comment on: http://stackoverflow.com/a/21482630
score: 0
type: Comment

http://stackoverflow.com/q/21424931
type: Question
has answer: http://stackoverflow.com/a/21425239
tagged with: jsp
tagged with: dao
score: 0
has answer: http://stackoverflow.com/a/21425385
has body: I'm Trying to implement a feature in my application like, On the first request to the container, if the database fails to connect, it should redirect to an error page instead of showing index.jsp. I have a singleton DBConnectionManager class, which handles the database connection in the constructor also a method to return connection object. I have a servlet Context Listener. So when the context is initialized, it would call the DBConnectionManager constructor and initializes the database connection. I will retrieve and use the same connection object in all my model DAO. Now my problem is how do i handle the connection error and redirect it to error.jsp page from DBConnectionManager or servlet context listener. Where should i place that condition for redirection. For Reference: DBConnectionManager.java=> public DBConnectionManager(String url,String user,String pass) { //constructor called by servlet context listener. this.DBURL=url; this.user=user; this.pass=pass; try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { log.info("Class Not Found :"+e); return; } try { log.info("-------url recieved :"+url); log.info("-------username received :"+user); log.info("--------password received :"+pass); con = DriverManager.getConnection(url,user,pass); log.info("con initialised.."); } catch (SQLException e) { //Exception caught here successfully. log.info("Problem in connecting :"+e); return; } if (con != null) { log.info("Connected Successfully to database"); } else { log.info("Mysql not connected.:&lt;"); } public Connection getConnection() { //Method called in every DAOmodel to return the instance of the connection object. //Where DAO uses this connection object to query database. return this.con; } Here comes my Servlet Context Listener=> public void contextInitialized(ServletContextEvent servletContextEvent) { ServletContext ctx=servletContextEvent.getServletContext(); String url=ctx.getInitParameter("DBURL"); String user=ctx.getInitParameter("…
has answer: http://stackoverflow.com/a/21425008
answer count: 4
type: UnansweredQuestion
has title: How to redirect to an error page when database connection fails?
has answer: http://stackoverflow.com/a/21425055
tagged with: java
tagged with: servlets

http://stackoverflow.com/a/21458767
score: 1
has comment: http://stackoverflow.com/comment/32382697
has comment: http://stackoverflow.com/comment/32382564
downvote count: 0
has comment: http://stackoverflow.com/comment/32383065
type: Answer
has comment: http://stackoverflow.com/comment/32382906
answers question: http://stackoverflow.com/q/21458345
upvote count: 1
has body: You can find that out only under the assumption that the code creates and immediately throws an EOFException. But the follwoing could also throw an EOFException: class Foo { ... public void iAmHarmless(Exception x) { if (x != null) throw x; } ... } Or how about the follwoing, to defeat aliteralminds method: class XYException extends EOFException { ... } class Foo { public void surprise() { throw new XYException().super(); } } Joking aside - methods from many classes may throw EOFException simply because of inheritance. A grep for "EOFException" gives only the very base classes. But you must consider all subclasses thereof. Example: java.util.jar.JarInputStream

http://stackoverflow.com/a/21472382
answers question: http://stackoverflow.com/q/21472314
has body: If one layout should support all screens then, your app theame should be similer for tabs and mobiles never use fixed values for layouts like (ex:300dp , 15dp), all are wrap , match , fill depends on requirement, make all the icons, images in 2 or 4 different sizes NOTE: if you have minor changes for smaller to larger device ui, then in on create get the device height and width , make your changes (images, layout widths etc..) runtime from java If your app is not similer from small to big devices Use layout(mobiles) ,layout-large(7 inch tabs) layout-xlarge(10 inch tabs)
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/a/21439340
has comment: http://stackoverflow.com/comment/32351311
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/32353734
has body: I think a better test would be to avoid the initial costs/latency incurred in starting up the JVM and loading the classes. Something like: public class TestDynamoDBMain { public static void main(String[] args) { try { AWSCredentials credentials = new PropertiesCredentials(new File("aws_credentials.properties")); AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials); DynamoDBMapper mapper = new DynamoDBMapper(client); // Warm up for (int i=0; i &lt; 10; i++) { testrun(mapper, false); } // Time it for (int i=0; i &lt; 10; i++) { testrun(mapper, true); } } catch (Exception e) { e.printStackTrace(); } } private static void testrun(DynamoDBMapper mapper, boolean timed) { long start = System.nanoTime(); Model model = mapper.load(Model.class, "hashkey1", "rangekey1"); if (timed) System.out.println( TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) + " (ms) to load Model"); } } Furthermore, you may consider enabling the default metrics of the AWS SDK for Java to see the fine grain time allocation in Amazon CloudWatch. For more details, see: http://java.awsblog.com/post/Tx1O0S3I51OTZWT/Taste-of-JMX-Using-the-AWS-SDK-for-Java Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/21420766
score: 4

http://stackoverflow.com/q/21354748
score: 0
has answer: http://stackoverflow.com/a/21386394
has answer: http://stackoverflow.com/a/21354783
tagged with: constructor
type: UnansweredQuestion
tagged with: android
has title: Warning This method has a constructor name
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32197876
has body: I am using a class named A in android development, this warning pops out when I create a class named: private Intent a() // This method has a constructor name { b.setDrawingCacheEnabled(true); Bitmap bitmap = b.getDrawingCache(); Intent intent = new Intent("android.intent.action.SEND"); intent.setType("image/jpg"); ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); bitmap.compress(android.graphics.Bitmap.CompressFormat.JPEG, 100, bytearrayoutputstream); File file = new File((new StringBuilder()) .append(Environment.getExternalStorageDirectory()) .append(File.separator).append("temp_file.jpg").toString()); try { file.createNewFile(); FileOutputStream fileoutputstream = new FileOutputStream(file); fileoutputstream.write(bytearrayoutputstream.toByteArray()); fileoutputstream.close(); } catch (IOException ioexception) { ioexception.printStackTrace(); } intent.addFlags(0x80000); intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file)); a.startActivity(Intent.createChooser(intent, "Share via: ")); return intent; } what should I do?

http://stackoverflow.com/comment/32289195
score: 0
type: Comment
type: QuestionComment
has text: I can't really believe that both versions are actually on the classpath if its the exact same dependency with the same artifact and groupId. Maven should manage that and only include one. So far, it all looks like expected behavior and you're trying to fix a problem that is not really a problem.
comment on: http://stackoverflow.com/q/21405791

http://stackoverflow.com/a/21394893
score: 3
answers question: http://stackoverflow.com/q/21394583
downvote count: 0
type: Answer
upvote count: 3
has body: Using loops, as shown in another answer, will make life much easier. There is a more critical logic error in your code: You round the output of Math.random(), which gives a float between 0 and 1, and round that to get an integer. The following table shows what output you'll get from your code in respect to the RNG: | Math.random() output | Resulting Integer | | 0 ~ 0.04999 | 0 | | 0.05 ~ 0.14999 | 1 | | ...... | ..... | | 0.95 ~ 0.99999 | 10 | See the problem? 0 and 10 appear only half as much as the other numbers. You should either floor() the output, or use Random.nextInt() to generate a uniform distribution of ints.

http://stackoverflow.com/comment/118278502
type: Comment
has text: `session.setProxy(new ProxyHTTP(proxyName, proxyPort));` this worked fow me. thank you
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/38373564

http://stackoverflow.com/comment/32319087
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21422684
has text: Just change the image path for different durations

http://stackoverflow.com/q/21498658
has answer: http://stackoverflow.com/a/21498888
tagged with: swing
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32453712
accepted answer: http://stackoverflow.com/a/21499285
has title: How can I can change background colour in java when user clicks on a spot on my application window?
type: Question
has body: Currently I have made text labels and placed them on my window, instructed them to perform action upon mouseClick, but this has increased my coding as I have several locations the user can change colour from. Below, is one of the label codes I came up up; JLabel label_1 = new JLabel(""); label_1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { contentPane.setBackground(Color.CYAN); } }); label_1.setEnabled(false); label_1.setBounds(0, 0, 19, 19); contentPane.add(label_1); but this is adding unnecessary code to my program, what I want is when the user clicks on a portion of the window say middle (about 1 cm spot) give or take few mm the background colour changes. I think it can be done by adding a listener for mouseClicked on the content pane itself and then telling the code once a spot is clicked change colour to contentPane.setBackground(Color.CYAN); I have 2 spots I want to change colour from. I cannot figure out out to tell my code so that if a specific area is clicked it changes the background colour of the window. Thanks. -----Edit----- I am using a contentPane at the moment to add elements on my window, my code for that currently looks like this setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 584, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); Can't I just add a mouse listenter event to getBound location of user click using this, for example add this piece of code to my previous one code that adds contentPane contentPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { } and in the public void mouseClicked(MouseEvent e) { } add if statements i.e. if (getBound(0,0,20,20)) contentPane.setBackground(Color.CYAN); Something along the lines of this, this isn't working.
answer count: 2
possible better answer: http://stackoverflow.com/a/21498888
has answer: http://stackoverflow.com/a/21499285
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/32454658
has comment: http://stackoverflow.com/comment/32453758

http://stackoverflow.com/comment/32463997
type: QuestionComment
has text: Question not clear enough. What are you exactly trying to achieve.
score: 0
comment on: http://stackoverflow.com/q/21504241
type: Comment

http://stackoverflow.com/comment/32473955
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21509674
type: AnswerComment
has text: This is compile time error. I think it caused by library dependency, but I can't figure out why.

http://stackoverflow.com/comment/32311635
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21418037
has text: logs : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver (...) java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/jdbc (...) java.lang.NullPointerException at (DbManager.java:21) at (RegServlet.java:69) (...) java.lang.NullPointerException at ConnectionManager.close(ConnectionManager.java:64) at DbManager.Insert(DbManager.java:35) (...) at java.lang.Thread.run(Unknown Source) Connection Opened Closing Connection

http://stackoverflow.com/comment/32320303
comment on: http://stackoverflow.com/a/21423495
has text: thank you for the reply. How would I access my IMEI through another class? I did your suggested modifications. It says "The method get_dev_id(Context) in the type IMEI is not applicable for the arguments (AsyncSendData)"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21492619
has comment: http://stackoverflow.com/comment/32443390
score: 0
tagged with: java
has body: Im a student learning Java and this is part of my program and it is supposed to get the length of a string but the strings are all in an array. I try to run this in eclipse and it says i get an error where it sayslength = name[x].length() can someone let me know if there is a way to fix this public class GuessName { Random random = new Random(); Scanner scan = new Scanner(System.in); String[] name = new String[10]; int x,length; char guess1,guess2,guess3; public void names() { name[0] = "MARK"; name[1] = "CHARLIE"; name[2] = "MEG"; name[3] = "KYLE"; name[4] = "JUSTIN"; name[5] = "KATARINA"; name[6] = "JOEL"; name[7] = "KEVIN"; name[8] = "MICHAEL"; name[9] = "JENNA"; name[10] = "GREG"; } public void start() { x = random.nextInt(10); length = name[x].length(); }
has comment: http://stackoverflow.com/comment/32443364
has title: getting a length of a string from a variable array java
accepted answer: http://stackoverflow.com/a/21492808
has comment: http://stackoverflow.com/comment/32443391
has comment: http://stackoverflow.com/comment/32443343
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32443326
has comment: http://stackoverflow.com/comment/32443302
has comment: http://stackoverflow.com/comment/32443329
has comment: http://stackoverflow.com/comment/32443339
possible better answer: http://stackoverflow.com/a/21492842
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21492842
has comment: http://stackoverflow.com/comment/32443359
has comment: http://stackoverflow.com/comment/32443311
has answer: http://stackoverflow.com/a/21492808

http://stackoverflow.com/comment/32247134
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21381895
type: Comment
has text: @JBNizet I have uploaded the code that I have tried. Of course, I have tried to limit as much code as possible to avoid confusion.

http://stackoverflow.com/a/21408855
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21408620
has body: You code is not the recommended way of doing things, but that aside, it works. You do not set a color to paint with, and you draw a single dot. You probably just didnt see it (I had to look twice). It draw a single black pixel at 200, 200.
score: 3
upvote count: 3

http://stackoverflow.com/a/21430419
upvote count: 0
answers question: http://stackoverflow.com/q/21429621
has comment: http://stackoverflow.com/comment/32336668
score: -1
downvote count: 1
has body: Normally, if we need to pass parameters to a thread, we can use either of the two approaches mentioned below: Create a custom Runnable like this: public class MyRunnable implements Runnable{ private MyCustomObj obj; public MyRunnable( MyCustomObj obj) { this.obj = obj; } public void run() { System.out.println("Name:" + obj.name ); } } and then MyCustomObj x = new MyCustomObj(); x.name = "test"; Thread t = new Thread(new MyRunnable(x)); t.start(); 2.Create custom thread like below: public class MyThread extends Thread{ private MyCustomObj obj; public MyThread( MyCustomObj obj) { this.obj = obj; } public void run() { System.out.println("Name:" + obj.name ); } } and then MyThread t = new MyThread(x); t.start(); Hope this helps you
type: Answer

http://stackoverflow.com/comment/83690790
score: 1
comment on: http://stackoverflow.com/a/24803500
has text: Which /tmp directory?
type: AnswerComment
type: Comment

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/21494944
tags question: http://stackoverflow.com/q/21385649

http://stackoverflow.com/comment/32286809
has text: In my case they wont change, so this works. But yes if I did need to change it, I could just add another string to the array.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21403147
type: Comment

http://stackoverflow.com/comment/32288409
comment on: http://stackoverflow.com/q/21402896
type: Comment
type: QuestionComment
score: 1
has text: please make an answer about start() method. to accept it. maybe your answer help somebody else too.

http://stackoverflow.com/comment/32361526
has text: Variable color HAS to be in class NewCar, it's a requirement.
type: Comment
comment on: http://stackoverflow.com/a/21446155
score: 0
type: AnswerComment

http://stackoverflow.com/q/21369586
has answer: http://stackoverflow.com/a/21370296
accepted answer: http://stackoverflow.com/a/21370296
type: AnsweredQuestion
tagged with: java
has body: Is it possible to link directly to a paragraph from a text link (perhaps using "linkify")? For example, I have a table of contents with the following: Definition signs &amp; symptoms treatment etc. In the same layout I have the text or headings that which correspond to these entries. I want a click on the text in the table of contents to jump to that specific heading in my content: e.g. I click on "signs &amp; symptoms" and this jumps directly to the section marked "signs and symptoms" in the content. Thanks. &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:background="#ffffff" 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=".Atherosclerosis" tools:ignore="UselessParent,ScrollViewCount" &gt; &lt;ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;LinearLayout android:id="@+id/tablecontentlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="#FAFAD2" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="16sp" android:textStyle="bold" android:textColor="#000000" android:text="@string/table" /&gt; &lt;TextView android:id="@+id/definitionid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="15sp" android:textStyle="bold" android:textColor="#4682B4" android:text="@string/Definition" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="15sp" android:textStyle="bold" andro…
type: Question
tagged with: android-layout
score: 0
tagged with: android
answer count: 1
has title: linkify text to a paragraph heading

http://stackoverflow.com/comment/32406962
comment on: http://stackoverflow.com/q/21471954
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
score: 0

http://stackoverflow.com/q/21405916
has body: the code that i have: the JPANEL JPanel dadosdaparte = new JPanel(new MigLayout("fillx")); adding to JPANEL dadosdaparte.setBorder(BorderFactory.createTitledBorder("Dados da Parte")); dadosdaparte.add(lblnomedaparte, "span, split 2"); dadosdaparte.add(tfnomedaparte, "growx, wrap"); dadosdaparte.add(lblnacionalidade, "split 7"); dadosdaparte.add(cboxNacionalidade); adicionaNacionalidades(); dadosdaparte.add(lblcirg); dadosdaparte.add(tfcirg); dadosdaparte.add(lblcpfcnpj); dadosdaparte.add(tfcpfcnpj); dadosdaparte.add(cpfcnpjinvalido, "wrap"); the miglayout cheat sheet or help, i just saw the positioning of the cell, not the alignment of the itens inside the cell, if someone can help me, i appreciate
has title: MigLayout alignment of elements
tagged with: layout
answer count: 1
tagged with: alignment
score: 0
accepted answer: http://stackoverflow.com/a/21406773
has answer: http://stackoverflow.com/a/21406773
tagged with: swing
tagged with: miglayout
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21425997
has answer: http://stackoverflow.com/a/21426053
has title: How to enter a non static method from a static one
type: Question
has answer: http://stackoverflow.com/a/21426048
has body: CollegeTester.java:10: error: non-static method getCommand() cannot be referenced from a static context getCommand();//goes to command ^ How would I enter this method. Making it public static void only causes more problems import java.util.Scanner; public class CollegeTester { public String name; Scanner input = new Scanner(System.in); public static void main(String[] args) { getCommand();//goes to command } //Ask user for a command public void getCommand() { // do stuff } }
has comment: http://stackoverflow.com/comment/32324642
upvote count: 0
has answer: http://stackoverflow.com/a/21426018
tagged with: static
has comment: http://stackoverflow.com/comment/32324525
linked to: http://stackoverflow.com/q/11282093
tagged with: non-static
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21426039
possible better answer: http://stackoverflow.com/a/21426018
downvote count: 2
tagged with: methods
has comment: http://stackoverflow.com/comment/32324585
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/21426037
score: -2
accepted answer: http://stackoverflow.com/a/21426037
tagged with: java

http://stackoverflow.com/q/21433499
tagged with: pointers
has title: Null Pointer exception when creating Frame object reference
tagged with: exception
answer count: 0
has comment: http://stackoverflow.com/comment/32337534
type: UnansweredQuestion
has body: I'm having trouble figuring out why I'm getting a NPE for the following code: package kiboltgame; import java.applet.Applet; import java.awt.Color; import java.awt.Frame; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.net.URL; public class StartingClass extends Applet implements Runnable, KeyListener { private Robot robot; private Image image, character; private Graphics second; private URL base; public static void main(String args[]) { StartingClass sc = new StartingClass(); sc.init(); } @Override public void init() { setSize(800, 480); setBackground(Color.BLACK); setFocusable(true); addKeyListener(this); Frame frame = (Frame) this.getParent().getParent(); frame.setTitle("Q-Bot Alpha"); try { base = getDocumentBase(); } catch (Exception e) { // TODO: handle exception } // Image Setups character = getImage(base, "data/character.png"); } @Override public void start() { robot = new Robot(); Thread thread = new Thread(this); thread.start(); } @Override public void stop() { // TODO Auto-generated method stub } @Override public void destroy() { // TODO Auto-generated method stub } @Override public void run() { while (true) { robot.update(); repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void update(Graphics g) { if (image == null) { image = createImage(this.getWidth(), this.getHeight()); second = image.getGraphics(); } second.setColor(getBackground()); second.fillRect(0, 0, getWidth(), getHeight()); second.setColor(getForeground()); paint(second); g.drawImage(image, 0, 0, this); } @Override public void paint(Graphics g) { g.drawImage(character, robot.getCenterX() - 61, robot.getCenterY() - 63, this); } @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: System.out.println("Move up"); break; case KeyEvent.VK_DOWN: System.out.println("Move down"); break; case KeyEvent.VK_LEFT: robot.mov…
tagged with: java
type: Question
score: 0
tagged with: null
has comment: http://stackoverflow.com/comment/32361108

http://stackoverflow.com/q/21493225
type: Question
has comment: http://stackoverflow.com/comment/32444380
has comment: http://stackoverflow.com/comment/32444441
has title: MVC Resource causes 404 Not Found with Spring MVC & Tiles
downvote count: 0
favorite count: 0
has body: I have a working MVC application with tiles. However, I am having trouble with the MVC Resource. If I do not include the mvc:resources in my xml file or refer to it in the html to the CSS files, I can successfully view the pages. However, if I add the resource tags in, it gives me a "The requested resource is not available" error - preventing me from seeing the page at all. Could you assist me in determining the cause for this? I have tried to follow the documentation and the myriad of tutorials for it - however it doesn't seem to work. Thanks! EDIT: I know there are multiple questions addressing this - I have browsed through the vast majority of them (both on and off Stack Overflow) and tried solutions with no success. EDIT: After some troubleshooting, I determined that my controllers are successfully accessed (by seeing the logging data). It cannot find "/ContactManagement/WEB-INF/jsp/layout.jsp". This only occurs once I refer to . I commented out the CSS file references in my views; however, that does not fix it. Mapping is completed for all the controllers now, as well as the mvc:resources mapping. It's just the .jsp files that it is having trouble accessing. In my configuration file, I include the MVC resources through <mvc:resources mapping="/resources/**" location="/resources/" /> I refer to in in the html as <link href="<c:url value='/resources/css/default.css'/>" rel="stylesheet" /> My file structure is -WebContent ---resources ------css ------js ------images ---WEB-INF ------jsp ------spring-servlet.xml ------tiles.xml Here is my spring-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.o…
has comment: http://stackoverflow.com/comment/32444435
type: UnansweredQuestion
tagged with: css
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/32444474
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/32444362
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/32483626
comment on: http://stackoverflow.com/a/21512811
score: 1
has text: Yeah http://www.philipthegreat.com/control_1.html is working fine in my system, which browser you are using, try google chrome, or check your browser supports java runtime or not, if not install the plugins to support java
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/58782898
comment on: http://stackoverflow.com/a/21509172
score: 0
type: Comment
has text: @assylias, sorry that i was trying to modify your answer :). I was thinking it would be nice to point out that we don't need to initialize array too. such as boolean[] records = new boolean[5]; this will make sure all the booleans default as false itself.
type: AnswerComment

http://stackoverflow.com/a/21448734
has body: I suspect you're looking for List.indexOf: int index = fib.indexOf(45); // index is now 3 indexOf returns -1 if the value isn't found in the list. Note that temp isn't a member of ArrayList, and if you use fib.get(4) it will return 50, not 45 - because the index is 0-based, not 1-based.
type: Answer
has comment: http://stackoverflow.com/comment/32365895
answers question: http://stackoverflow.com/q/21448720
has comment: http://stackoverflow.com/comment/32365927
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32365859
has comment: http://stackoverflow.com/comment/32365828
has comment: http://stackoverflow.com/comment/32365862
downvote count: 0

http://stackoverflow.com/a/21393653
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21392994
score: 1
has body: Your problem is that there is no way for Jackson to know that a JSON String or Number should map to java.util.Date, if all you say is "map to java.lang.Object". But you can force use of type information to make this possible; annotation to use is @JsonTypeInfo, and you can add that next to field like so: @JsonTypeInfo(...) private Object[] objects;
downvote count: 0

http://stackoverflow.com/a/22705991
upvote count: 1
downvote count: 1
has body: I was able to make this work: @Value("${myfield.name}") But you would need to annotate your class with any of @Component, @Service etc. And you would need the property-placeholder tag on your xml ofcourse.
has comment: http://stackoverflow.com/comment/58582165
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21372556
answers question: http://stackoverflow.com/q/21372556
score: 0

http://stackoverflow.com/comment/33885051
comment on: http://stackoverflow.com/q/21363007
score: 0
type: Comment
type: QuestionComment
has text: nm check out this... http://stackoverflow.com/questions/3519978/logging-framework-incompatibility

http://stackoverflow.com/q/21481989
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/32425310
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/32431181
has answer: http://stackoverflow.com/a/21482312
has body: I was wondering while fixing the CheckStyle infos if that leads to any performance improvement. I understand that info cannot be taken seriously but still any comment will be appreciated. I personally do not think they offer any such improvement but I can be wrong hence better to seek expert advice :)
has title: Does fixing the Checkstyle INFOs improve performance of the Java code
has comment: http://stackoverflow.com/comment/32423796
has answer: http://stackoverflow.com/a/21483000
tagged with: checkstyle
score: 0
possible better answer: http://stackoverflow.com/a/21483000
has comment: http://stackoverflow.com/comment/32434087
accepted answer: http://stackoverflow.com/a/21482312
type: Question

http://stackoverflow.com/q/21499954
tagged with: file-io
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21500404
type: Question
tagged with: sockets
score: -1
tagged with: java
has body: How can a file on a server be read or be written on by a client. What is the procedure for implementing read/write lock using sockets programming in Java? (If there is a post on stackoverflow that answers this question already please refer me to that because I cannot find it).
has comment: http://stackoverflow.com/comment/32463731
answer count: 1
downvote count: 1
has title: Implementing read-lock and reading a file on a server or implemeting write lock and writing on a file on server
type: UnansweredQuestion

http://stackoverflow.com/a/21367668
type: Answer
accepted answer of: http://stackoverflow.com/q/21366750
has body: Here's what the code should do. Each Person in the table should have a primary key, which identifies it uniquely. Let's call it id. The first page should be implemented as a ListPersons servlet. This servlet would read rows from the database using a query, create a Person instance for each row, populate a List&lt;Person&gt;, and store it in a request attribute. Then the servlet should forward the request and response (using the request dispatcher) to the listPersons.jsp JSP. The JSP should then use the JSTL to iterate over the list of persons and display each person in an HTML table row. Each row should contain a link to the person edit page. The URL of this link should look like /myApp/editPerson?id=&lt;theIDOfThePersonToEdit&gt; Such a link can easily be generated using the JSTL: &lt;a href="&lt;c:url value='/editPerson'&gt; &lt;c:param name='id' value='${person.id}'/&gt; &lt;/c:url&gt;"&gt;Click here to edit the person&lt;/a&gt; You should have a second servlet mapped to /editPerson. This servlet would get the ID of the person to edit from the id request parameter, and would use a SQL query to retrieve the person information. It would create an instance of Person with this information a,d store it in a request attribute. It would then dispatch to editPerson.jsp. This JSP would then generate a form, pre-populated with the person stored in the request attribute. This form would contain a hidden field containing the ID of the edited person. The form would post to a servlet (which could be the same or another one), which would validate the information, update the database row, and the redirect (using response.sendRedirect()) to, for example, the ListPersons servlet URL.
has comment: http://stackoverflow.com/comment/32327332
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21366750

http://stackoverflow.com/q/21352771
answer count: 4
has answer: http://stackoverflow.com/a/21353033
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/32194787
type: Question
has comment: http://stackoverflow.com/comment/32194766
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21352881
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21353297
accepted answer: http://stackoverflow.com/a/21353297
has comment: http://stackoverflow.com/comment/32194513
has body: I try to make a class to play FLAC files. For this I use jFlac. So, for playing a song, I need to do: Player p = new Player(); p.decode("PATH_TO_FLAC"); And I put that in the run() method of my class. If I start the thread, that's works. But I wonder how to make a pause. I have no control over the loop which is made in p.decode();, so I can't use wait and notify. But Thread.suspend() is deprecated. I don't know what to do. My class: public class FLACPlayer implements Runnable { /** * Path of the song */ private String file; private org.kc7bfi.jflac.apps.Player player; /** * The thread launching the player */ private Thread playerThread; /** * Constructor: initialize the player * * @param str * The path of the file to play */ public FLACPlayer(String str) { file = str; player = new org.kc7bfi.jflac.apps.Player(); this.playerThread = new Thread(this, "AudioPlayerThread"); } public void play() { playerThread.start(); } @Override public void run() { try { player.decode(file); } catch (IOException | LineUnavailableException e) { } } Thanks!
downvote count: 0
has title: How to suspend a thread without control over the loop in run method
tagged with: flac
favorite count: 0
possible better answer: http://stackoverflow.com/a/21353033
has answer: http://stackoverflow.com/a/21352957

http://stackoverflow.com/comment/44444604
comment on: http://stackoverflow.com/a/27921723
has text: Very interesting question. Same as you I faced this same problem in the past...after working around and going through every possible tweaks and settings to mess around....I finally found out it was the problem with account permission...user policy and subgroups. In my situation I was able to fix it. Please let me know if you find a solution for yours. Does this solve the problem or thr is more to it. Thanks.
type: AnswerComment
score: 0
type: Comment

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/21441608
type: Tag

http://stackoverflow.com/a/21374960
score: 5
type: AcceptedAnswer
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21374925
has body: Official tutorial, found by ... googling: http://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL oracle = new URL("http://www.oracle.com/"); BufferedReader in = new BufferedReader( new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
accepted answer of: http://stackoverflow.com/q/21374925

http://stackoverflow.com/q/21421016
tagged with: encryption
has answer: http://stackoverflow.com/a/21426437
tagged with: aes
score: 1
tagged with: java
has body: I was given this key in hex String: "140b41b22a29beb4061bda66b6747e14" and requested to decrypt an one block cipher with an AES implementing a ECB. As we know, the key must be 16 bytes long. But the given key contains elements which correspond to characters larger than one byte (e.g. 0xb2 whose char value is ² corresponding to 2 bytes). In fact, if I convert the hex String key into a key String I obtain " A²*)¾´Úf¶t~ ", then if I apply the method key.getBytes().length what I get is that the key is 21 bytes long. My question is: is there any way to encrypt a 16 bytes long ciphertext with an AES given this key in Java?
upvote count: 1
type: Question
has title: One block cipher decryption with an AES and long key
answer count: 1
downvote count: 0
tagged with: block-cipher
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32378878
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21454764
has text: Do I really have to use Custom resource? I was thinking of putting something like this in the .java class that extends WebPage `WebResponse response = (WebResponse) getRequestCycle().getResponse(); response.setContentType("text/plain"); response.write(responseToClient); getRequestCycle().setResponse(response); response.close();`
score: 0

http://stackoverflow.com/comment/32359539
type: AnswerComment
score: 0
type: Comment
has text: If a type's contract defines an equivalence relation which specifically allows instances of different subtype to compare equal, then every subtype must define its equals method to test for that equivalence relation and no other. Otherwise, nothing about the LSP suggests that it must be possible to create an instance of any particular class which reports itself as equivalent to any other object, whether that object be of that same class or a different one. An object's `getClass()` 'value' is no less legitimate a basis of comparison than would be anything else.
comment on: http://stackoverflow.com/a/21408707

http://stackoverflow.com/a/21372145
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21371676
has body: It sounds like you should wrap the JTextArea and the Classes you want get the methods from together in another class. If there are multiple different classes and methods, you can create a switch statement within this new class to return the correct method. If this is the case, I would consider redesigning my project to try to prevent the need for such a class.

http://stackoverflow.com/comment/47198536
has text: This might be a step in the right direction. Also, I can't use a Priority Queue for this, as the Search Algorithm itself is also generic. I need to be able to switch between Depth-First-Search, Breadth-First-Search, Greedy-Search, Uniform-Cost-Search, A*, and whatever else I want.
comment on: http://stackoverflow.com/a/21516882
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21392344
has comment: http://stackoverflow.com/comment/32266863
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32266764
has comment: http://stackoverflow.com/comment/32293899
has comment: http://stackoverflow.com/comment/32306350
upvote count: 1
has comment: http://stackoverflow.com/comment/32268141
type: Question
has comment: http://stackoverflow.com/comment/32308668
has answer: http://stackoverflow.com/a/21393379
has comment: http://stackoverflow.com/comment/32268322
possible better answer: http://stackoverflow.com/a/21393840
tagged with: batch-file
answer count: 2
has answer: http://stackoverflow.com/a/21393840
downvote count: 0
has title: Why aren't my Windows batch files processing when Java executes them?
tagged with: cmd
has comment: http://stackoverflow.com/comment/32267563
favorite count: 0
accepted answer: http://stackoverflow.com/a/21393379
tagged with: windows
linked to: http://stackoverflow.com/q/7248405
has body: I have 2 folders, each containing dozens of batch files (*.bat). The batch files containing text similar to either del /f/q F:\MEDIA\IMAGE99\2010\270\z\4034\123.tif > nul del /f/q F:\MEDIA\IMAGE99\2010\266\z\3025\456.tif > nul del /f/q F:\MEDIA\IMAGE99\2010\267\z\3025\789.tif > nul del /f/q F:\MEDIA\IMAGE99\2010\286\z\9025\101.tif > nul del /f/q F:\MEDIA\IMAGE99\2010\272\z\6029\112.tif > nul del /f/q F:\MEDIA\IMAGE99\2010\258\z\4034\134.tif > nul or rmdir /q F:\MEDIA\IMAGE99\2010\270\z\4034 rmdir /q F:\MEDIA\IMAGE99\2010\266\z\3025 rmdir /q F:\MEDIA\IMAGE99\2010\267\z\3025 rmdir /q F:\MEDIA\IMAGE99\2010\286\z\9025 rmdir /q F:\MEDIA\IMAGE99\2010\272\z\6029 rmdir /q F:\MEDIA\IMAGE99\2010\258\z\4034 In Java, I list each batch File in each folder, and cycle through the list, executing each batch file as follows: public static boolean batch(File file) { boolean handled = false; Process process = null; try { process = Runtime.getRuntime().exec("cmd /c start " + file); handled = process.waitFor() == 0; } catch (Exception ex) { // handling removed for example purposes } return handled; } After the method returns, I delete the batch file. The problem is, none of the commands within my batch files run (the files and folders I request deleted or removed are not), and the Java process simply continues and deletes batch file itself. The batch files are located in folder d:\working\spaced folder\purge\batch_files\ Having written this out, I suspect my problem is that I'm passing a file path with a space in it to the exec() method. Is my suspicion correct? If so, how do I resolve it? If not, what might the problem be? I'm going to look into Java: Execute /cmd /c start path-with-spaces\program.exe now that I've considered it. UPDATE Per the comments below, I've changed my code, but now the output hangs at waitFor() and the batch file is not being processed (the files I request deleted are still there). Code: String commandString = "cmd /c \"" + file +"\""; logger.info("COMMAND " + …
has comment: http://stackoverflow.com/comment/32268844
has comment: http://stackoverflow.com/comment/32269062
has comment: http://stackoverflow.com/comment/32268089
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32266228

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/21411620

http://stackoverflow.com/q/21471542
has answer: http://stackoverflow.com/a/21475338
tagged with: tibco
tagged with: client
type: UnansweredQuestion
tagged with: java
tagged with: web-services
type: Question
has answer: http://stackoverflow.com/a/21474797
score: 0
answer count: 2
has body: I have been given WSDL and XSD files for Tibco Web service. Along with that I have Tibco queue details. I need to hit the Tibco sync queue and get the response from the queue. My question is hot to create the java stub(client) with appropriate endpoint address. When I create the stub using CXF, it says "nvalid endpoint address" while I running the stub client. There is another option to send request to queue using spring's WebServiceTemplate. But to construct the input XML message. Does any one call the Tibco webservice from Java? Which is the best way?
has title: Calling tibco webservcie from java client

http://stackoverflow.com/a/21429713
has body: For addition you can use add(Mat src1, Mat src2, Mat dst) And for multiplication use multiply(Mat src1, Scalar src2, Mat dst) See more option on OpenCV Java Documentation
score: 2
answers question: http://stackoverflow.com/q/21428793
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32331431
type: Answer

http://stackoverflow.com/comment/32359347
type: AnswerComment
type: Comment
has text: Thanks! The space was unnecessary and I'm not entirely sure why I added it but removing it solved my problem... such a school boy error! :(
comment on: http://stackoverflow.com/a/21445183
score: 0

http://stackoverflow.com/comment/32320668
score: 0
has text: you can passed this two values into Constructor in your AsyncTak like : AsyncTask(Context,movie,reservation )
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21423537

http://stackoverflow.com/comment/32234117
has text: You mean to say the jar contain external library ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21374719
score: 0

http://stackoverflow.com/comment/32373413
score: 0
comment on: http://stackoverflow.com/q/21453308
type: Comment
type: QuestionComment
has text: So your question isn't "How does Random work?", but rather "How can I have a function that selects one of three numbers with exactly equal probability?" ?

http://stackoverflow.com/comment/32602764
comment on: http://stackoverflow.com/q/21506270
type: Comment
type: QuestionComment
has text: YES I need a java based solution
score: 0

http://stackoverflow.com/comment/32246055
type: QuestionComment
score: 0
has text: @ᴍarounᴍaroun I think he refers to the inner loop and by nothing happens, he says that the outer loop doesn't print
comment on: http://stackoverflow.com/q/21381564
type: Comment

http://stackoverflow.com/a/21498386
has comment: http://stackoverflow.com/comment/32453194
has comment: http://stackoverflow.com/comment/32453262
score: 1
has comment: http://stackoverflow.com/comment/32453215
has body: You need to change the while condition of the do-while loop. Currently it is looping if the number is within the range, but your requirement is the exact reverse of it. while (!(number &gt; 0 &amp;&amp; number &lt; 10)); // Keep looping if the number is outside the range. Note: The Integer.parseInt() will throw a java.lang.NumberFormatException if the improper inputs are not handled properly.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32453239
answers question: http://stackoverflow.com/q/21498351
downvote count: 0
has comment: http://stackoverflow.com/comment/32453272

http://stackoverflow.com/a/21365150
has body: The answer lies in how each application manages JPA related operations. By definition, JPA in just an API. There are different JPA provider available on the market such as Hibernate, OpenJPA, EclipseLink, ... So depending on the default JPA provider that each application server uses, you could encounter some discrepancies in the way some operations are handled. FYI: according to JBoss AS 6 documentation, it is absolutely normal that you get a RollbackException as it is thrown when the commit() method fails JBoss RollbackException documentation
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21364962

http://stackoverflow.com/a/21378485
accepted answer of: http://stackoverflow.com/q/21377776
has body: Try this regex validator: <message key="register.validation.email" /> ^['_a-z0-9-\+]+(\.['_a-z0-9-\+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|cat)$ <message key="register.validation.email.format" /> ${false} ${true} It has also caseSensitiveExpression parameter and trimExpression parameters applied. More about regex validator you can find in the documentation.
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/32293584
has comment: http://stackoverflow.com/comment/32243203
has comment: http://stackoverflow.com/comment/32244333
type: Answer
has comment: http://stackoverflow.com/comment/32243094
has comment: http://stackoverflow.com/comment/32242960
has comment: http://stackoverflow.com/comment/32243311
answers question: http://stackoverflow.com/q/21377776
has comment: http://stackoverflow.com/comment/32243175

http://stackoverflow.com/a/21499957
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21499861
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32468911
type: Answer
answers question: http://stackoverflow.com/q/21499861
has body: I think you need to put placeholders in the query string where you want to insert variable values, e.g. instead of BETWEEN TO_DATE ('args[0]', 'yyyy/mm/dd') you would put BETWEEN TO_DATE (?, 'yyyy/mm/dd') and then call st.setString(1, args[0]); before executing the query, and similarly for other parameters. You may want to review how to use prepared statements.
score: 1

http://stackoverflow.com/a/21483496
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21482811
has body: A high-level analogy: Portlet Container Desktop Windowing System ========================================================== Portlet Window JSF Widget Framework JSF tag Widget The portlet provides an API that allows a application to receive and respond to requests from the container. It does not specify what you use to render your portlet views or how the application organizes its data. In this, a portlet is similar to a servlet. JSF provides a means for specifying views, navigating between them, and interacting with a model layer. A specialized portlet acts as a JSF controller/container - typically a portlet bridge.
answers question: http://stackoverflow.com/q/21482811
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/32406732
comment on: http://stackoverflow.com/q/21471663
score: 0
type: QuestionComment
type: Comment
has text: Did you try doing `interface ValidateValue<O extends ValidateValue<O>> extends Validator<O>`

http://stackoverflow.com/comment/32270552
has text: If `playAgain` is a single character, use `char`.
comment on: http://stackoverflow.com/q/21394716
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32260422
score: 1
comment on: http://stackoverflow.com/q/21389270
has text: Can you show us how you are using this regex? It seems to be working fine for me.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32473417
has text: @MrAsstastic Notice that invoke the method using `()` where the provided code does not.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21509648

http://stackoverflow.com/a/21423126
has comment: http://stackoverflow.com/comment/32319820
accepted answer of: http://stackoverflow.com/q/21422827
type: Answer
has body: The answer is - it depends. Yes, I would also recommend that you start by making your variables private, there are cases where this may not be required, but lets stay on subject and only ever allowing access to them via getters Now assuming your have a public getter for your instance field, this raises the potentially that some one else will want to override this method and change it in some way, maybe return a calculated value based on new values they have introduced or what ever. If the private field is part of any internal calculation or changes the state of the object logic in some way, then you start having problems, as you are now ignoring the value that is returned by the getter, which would produce undesirable results. In this case, you must consider the value returned by the getter over the private field.
answers question: http://stackoverflow.com/q/21422827
upvote count: 3
has comment: http://stackoverflow.com/comment/32319848
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32339924
downvote count: 0

http://stackoverflow.com/comment/32558496
type: AnswerComment
score: 0
type: Comment
has text: Is it normal that I would still need to add an IOException to the close-statement?
comment on: http://stackoverflow.com/a/21512289

http://stackoverflow.com/a/21493233
type: Answer
has body: Your mistake is an input mismatch. That mean that your entering something that java don't expect As your using a.nextInt(); if you introduce anything else as a double (0.0....) it gives you the exception. The easiest solution is to use a.nextDouble(); But of course valueA and valueB must be changed for double. It will also fix a integer conversion bug that you have. Also you should change your variables to char add = '+' ; char minus = '-'; char multiply = '*'; char divide = '/';
answers question: http://stackoverflow.com/q/21493068
accepted answer of: http://stackoverflow.com/q/21493068
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32261934
has text: This is the method in FeatureVector: `public double featureAt(int index){ return elems[index]};`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21390040

http://stackoverflow.com/q/21513856
has comment: http://stackoverflow.com/comment/32481572
has answer: http://stackoverflow.com/a/21513934
has comment: http://stackoverflow.com/comment/32481019
score: 0
has title: ArrayIndexOutOfBound Error
has comment: http://stackoverflow.com/comment/32480989
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21514070
has answer: http://stackoverflow.com/a/21513947
has body: Please bear with me. I am new to java but I am struggling to code ..but I am sure I will overcome it one day so please help me .. String array - Palindrome is what i am working on to build up my logical sense in java. This is what I have written so far public class Strings1 { public static void main(String[] args) { String[] str = {"dadad", "Boomot", "mojmom"}; String[] str1=str; String[] str2={}; int i=0; int j=0; int k=0; char c='0'; char e='0'; int s = str.length; System.out.println("number of elements in the array" + s); try{ x: for(; i&lt;s; i++){ y: for( j=i,k=str[i].length()-1; k&gt;=0; j++,k--){ //j=0; k=5 c = (str[i].charAt(j)); // 0 e = (str[i].charAt(k)); //5 if(c==e) { str2[k] = Character.toString(c); continue; } else break y; } System.out.println(str[2]); } }catch (Exception ex){ ex.printStackTrace(); } } } Error :- ------------ number of elements in the array3 java.lang.ArrayIndexOutOfBoundsException: 4 at Strings1.main(Strings1.java:25) how should I go about it? Please help.
tagged with: java
linked to: http://stackoverflow.com/q/12678781
has answer: http://stackoverflow.com/a/21514076
type: Question
has answer: http://stackoverflow.com/a/21513906

http://stackoverflow.com/comment/32236884
type: QuestionComment
has text: you can use ArrayList instead of String Array
score: 0
comment on: http://stackoverflow.com/q/21376281
type: Comment

http://stackoverflow.com/comment/32282099
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21399996
has text: @ZhehaoChen if lifespan of your reference to it doesn't extend over return from paint() method, then it is not really "outside" and this is not a special kind.

http://stackoverflow.com/a/21481177
score: 0
has body: Your code is neat and looks fine. Did you print and check the values of first two arrays? Since you already had the line double[] array3 = new double[4]; there won't be a problem with your for loop. Just print the first two arrays.
type: Answer
answers question: http://stackoverflow.com/q/21481073

http://stackoverflow.com/a/75041473
score: 0
has body: you can try overriding the paintComponent method of JPanel like so: import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JPanel; public class UpsideDownJPanel extends JPanel { public UpsideDownJPanel() {} public void paintComponent(Graphics graphics) { Graphics2D g = (Graphics2D) graphics; int x = this.getWidth() / 2; int y = this.getHeight() / 2; g.rotate(Math.toRadians(180.0), x, y); super.paintComponent(g); } } You can also change the degree u want to rotate it
answers question: http://stackoverflow.com/q/21485488
type: Answer

http://stackoverflow.com/a/21503632
has body: I think this is a duplicate question, but, you typically only use System.out.println() in servlets for debugging purposes and what not. Try outputting everything to the logs, by using log.info("some message") or log.error("some error message")
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32474993
has comment: http://stackoverflow.com/comment/32465025
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21503559
has comment: http://stackoverflow.com/comment/32463008

http://stackoverflow.com/comment/32389327
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21461316
type: AnswerComment
has text: And do you have any idea, how to initialise it better? Now it finally loads my text objects and when it comes to load images, it crashes. So the issue is definietly there

http://stackoverflow.com/comment/32359572
type: AnswerComment
has text: @Xbit specifying the initial capacity does not affect its behaviour at all, only its performance
score: 1
type: Comment
comment on: http://stackoverflow.com/a/21444997

http://stackoverflow.com/a/41126417
type: Answer
answers question: http://stackoverflow.com/q/21382090
score: 0
has body: before you use code need to get permission to read and write on the storage. Insert code before the application tag on manifest: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; i do not know java code sorry.

http://stackoverflow.com/comment/32203401
has text: +1, but a native thread isn't 'optimized to correspond to the operating system': it is *provided* by the operating system.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21357700
type: Comment

http://stackoverflow.com/comment/32476917
type: QuestionComment
has text: Maybe get it from tasklist
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21511626

http://stackoverflow.com/comment/32295364
comment on: http://stackoverflow.com/q/21407966
has text: @AchimSchmitz would this be done in the main method, or the floor_sorting method?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32416467
comment on: http://stackoverflow.com/q/21477732
type: QuestionComment
has text: How about `titleAndBodyContainer.replaceAll("\\.(\\s)", " $1");`? This will replace fullstops followed by a whitespace character with a space followed by the same whitespace character.
score: 0
type: Comment

http://stackoverflow.com/q/21398999
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/62729728
type: Question
score: 0
answer count: 2
has body: I have a table having 40 columns and one bean corresponding to that table. But on page I am displaying only 10 fields. When the page is rendered, by debugging, I can see the bean is getting populated by all fields from the table and I am adding it in Model using model.addAttribute("emp", emp) . But after changing some fields on page, when I submit the page again, I see only those fields are getting populated who are appearing on the page. Rest are not though the bean is in "session" scope. I have one controller which is called when I submit the page. Thats something like below @RequestMapping({"/update.html"}) public String updateData(@ModelAttribute("emp") Employee emp){ // All fields of Employee bean are not getting populated } I wrote in JSP something like below. &lt;jsp:useBean class="com.Employee" id="emp" scope="request" /&gt; Note :- I tested with scope="session" as well. So my question is, Even after putting bean in SESSION scope, why I am not getting it in my controller. So is @ModelAttribute changing my bean scope any how??
has title: What is the Scope of Bean declared in @ModelAttribute annotation
has answer: http://stackoverflow.com/a/21399618
type: UnansweredQuestion
tagged with: modelattribute
has comment: http://stackoverflow.com/comment/32278008

http://stackoverflow.com/a/21377922
has body: If you want a regexp like the below figure : You can change your regexp like this : (^['_a-z0-9-\\+]+(?:\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(?:\.[a-z0-9-]+\.?)*(?:[a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|cat)$) DEMO and Explanation
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21377776

weblogic
tags question: http://stackoverflow.com/q/21399433
tags question: http://stackoverflow.com/q/21389346
tags question: http://stackoverflow.com/q/21401839
tags question: http://stackoverflow.com/q/21435137
tags question: http://stackoverflow.com/q/21478221
tags question: http://stackoverflow.com/q/21390370
tag name: weblogic
tags question: http://stackoverflow.com/q/21441578
tags question: http://stackoverflow.com/q/21395334
type: Tag

javafx-webengine
tags question: http://stackoverflow.com/q/21480758
type: Tag
tag name: javafx-webengine

http://stackoverflow.com/comment/32196549
has text: Different file types contain different information. You can't simply throw all of the bytes into a single file and hope that it works. You'll need to find a library that was written to modify MP3/MP4/AVI/etc files appropriately and use that.
comment on: http://stackoverflow.com/q/21354022
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/32221844
comment on: http://stackoverflow.com/a/21363668
score: 0
type: AnswerComment
type: Comment
has text: Thanks for answering. But the question is not about what `\\` is for in a Java string literal.

http://stackoverflow.com/a/21365042
score: 6
accepted answer of: http://stackoverflow.com/q/21364994
answers question: http://stackoverflow.com/q/21364994
has comment: http://stackoverflow.com/comment/32219352
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 6
has body: This expression game = true assigns true togame and the result of this expression is always true. What you intended as to test if the previous value of game was true while(game == true) or much simpler while(game) Usually you give it a better name like while(running) {

http://stackoverflow.com/q/21418265
answer count: 3
has answer: http://stackoverflow.com/a/21784870
has answer: http://stackoverflow.com/a/21419249
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has body: Considering the following example: assertEquals( "I am expecting this value on one line.\r\nAnd this value on this line", "I am expecting this value on one line.\nAnd this value on this line" ); Are there any tweaks or plugins to\in Eclipse that could help to identify the extra '\r' (or for that matter other non-printable) characters in a String comparison? The current result comparison does not really help me to identify the problem:
has answer: http://stackoverflow.com/a/21819427
has title: non printable characters in Eclipse junit view
tagged with: unit-testing
type: Question
linked to: http://stackoverflow.com/q/2220366
tagged with: testing
linked to: http://stackoverflow.com/q/220547
tagged with: java
tagged with: eclipse
tagged with: junit
downvote count: 0

http://stackoverflow.com/comment/32447367
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis I update my question. Please notice
comment on: http://stackoverflow.com/q/21494762

http://stackoverflow.com/a/21425731
type: Answer
has comment: http://stackoverflow.com/comment/32325543
has comment: http://stackoverflow.com/comment/32324581
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32324677
upvote count: 1
answers question: http://stackoverflow.com/q/21425695
has comment: http://stackoverflow.com/comment/32325363
has comment: http://stackoverflow.com/comment/32324940
has body: You need to pass a reference to t1 to t2, and the code that t2 is running needs to call t1.join().
has comment: http://stackoverflow.com/comment/32324183
has comment: http://stackoverflow.com/comment/32324357

http://stackoverflow.com/comment/32360868
has text: if i do that i get a cycle error Message:" SEVERE: Mapped exception to response: 500 (Internal Server Error) javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: MusicLibrary [id=1, description=IdidUpdateTheMusicLibrary, musicSongs=[music.service.MusicSong@bf3973b5]] -> music.service.MusicSong@bf3973b5 -> MusicLibrary [id=1, description=IdidUpdateTheMusicLibrary, musicSongs=[music.service.MusicSong@bf3973b5]]]"
type: AnswerComment
comment on: http://stackoverflow.com/a/21445857
type: Comment
score: 0

http://stackoverflow.com/a/21441453
upvote count: 10
has body: I'd suggest using health checks functionality from Metrics. You could set up a number of classes that extend HealthCheck class and implement check() method. These health check implementations would be Spring managed beans themselves and could autowire Spring beans and validate them. Then configure HealthCheckServlet to monitor application state. Also check metrics-spring project. It will make Spring and Metrics integration simpler. If you are using Java Spring configuration you might have a Metrics config like this that extends MetricsConfigurerAdapter from metrics-spring @Configuration @EnableMetrics public class MetricsConfig extends MetricsConfigurerAdapter { } And then @Import(value = {MetricsConfig.class}) to your Spring config. You also need and implementation of ServletContextListener to wire up HealthCheckServlet and Spring. This HealthCheckContextListener should be added to your web.xml public class HealthCheckContextListener extends HealthCheckServlet.ContextListener implements ServletContextListener { private WebApplicationContext context; public HealthCheckContextListener(WebApplicationContext context) { this.context = context; } public HealthCheckContextListener() {} @Override public void contextInitialized(ServletContextEvent event) { this.context = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext()); event.getServletContext().setAttribute(HealthCheckServlet.HEALTH_CHECK_REGISTRY, context.getBean(HealthCheckRegistry.class)); } @Override protected HealthCheckRegistry getHealthCheckRegistry() { return (HealthCheckRegistry) context.getBean(HealthCheckRegistry.class); } }
has comment: http://stackoverflow.com/comment/74641512
downvote count: 0
answers question: http://stackoverflow.com/q/21439101
type: Answer
has comment: http://stackoverflow.com/comment/32438325
has comment: http://stackoverflow.com/comment/32423999
score: 10

http://stackoverflow.com/comment/32370919
comment on: http://stackoverflow.com/a/21451543
type: AnswerComment
type: Comment
has text: android.database.sqlite.SQLiteException: unrecognized token: "1ANDperson_id" (code 1): , while compiling: DELETE FROM attendance WHERE training_id=1ANDperson_id= ? Get this error!!!
score: 0

http://stackoverflow.com/comment/32492365
type: Comment
comment on: http://stackoverflow.com/a/21497296
has text: @FD_, I am not sure, if String line; allocate memory to line. Does it?Pls, let me know. Thnks
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32477359
comment on: http://stackoverflow.com/q/21511850
has text: Any sequence of character even if it has no meaning.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21357451
tagged with: java
has comment: http://stackoverflow.com/comment/32203028
tagged with: dom
type: Question
upvote count: 4
has body: I am trying to get a html node from a file that will later be used to count all of its descendants. I am having issues with retrieving the element from the DOM. here are the steps i have taken so far. First here is my html code: Inbox Logout Second I built this function that will return and parse the file into a document. public static Document buildDocument(String file){ try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document document = docBuilder.parse(file); return document; } catch (ParserConfigurationException | SAXException | IOException ex) { System.out.println("the exception is: " + ex.toString()); } return null; } Next in my main method I tried to set a Node object to a document elemet by way of getElementById like: public Document doc = buildDocument("myHTMLFile"); org.w3c.dom.Node node = doc.getElementById("header");//the id of an html element Correct me if I am wrong but this should result in the retreival of the node. However it is returning a null value. I do not understand why it is not returning the correct value. NOTE: that when debugging the code the document does contain all of the correct data as far as I can tell.
tagged with: javascript
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/21357691
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/32202954
has answer: http://stackoverflow.com/a/21357586
has comment: http://stackoverflow.com/comment/32203009
possible better answer: http://stackoverflow.com/a/21357636
linked to: http://stackoverflow.com/q/9071568
has title: not able to get an element using the document.getElementById, returning null
has answer: http://stackoverflow.com/a/21357636
has comment: http://stackoverflow.com/comment/32202995
accepted answer: http://stackoverflow.com/a/21357691
type: AnsweredQuestion

http://stackoverflow.com/comment/32422227
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21481073
has text: @Jordan.McBride Please provide your code for adding values in `array1` and `array2`, the code you have posted looks fine. So the issue might be while assigning the values.

http://stackoverflow.com/comment/32804878
type: Comment
comment on: http://stackoverflow.com/a/21480214
has text: Yes, I just now have observed that when you press the mouse on a button at a particular point and then release at other point in the same button, you will see an ActionEvent generated but not a mouse click.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21496828
tagged with: aop
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21516457
type: Question
has body: Is it possible to decorate POJOs with fields and getters+setters, with annotations? Let's say I have a class like edited: public abstract class Human { //to be extended by classes like Male, Female private String name; private String identificationNumber; private String mailingAddress; public void setName(String name) {...} public String getName() {...} public void setIdentificationNumber(String number) {...} public String getIdentificationNumber() {...} public void setMailingAddress(String address) {...} public String getMailingAddress() {...} } and I also have another class like edited: public abstract class Animal { //to be extended by classes like Dog, or Wolf private String name; private String furColor; private String ferocityIndex; public void setName(String name) {...} public String getName() {...} public void setFurColor(String color) {...} public String getFurColor() {...} public void setFerocityIndex(String index) {...} public String getFerocityIndex() {...} } If there's a scenario where I need to create a Werewolf (hybrid of Human and Animal), essentially I need to "extend" both classes. I already understand that I could've used interfaces for both abstract classes, but that would mean re-implementing the getters and setters, and having the field implementation replicated to all implementing class. I want to be able to define both Human and Animal as annotations, so the Werewolf class can look like: @Human @Animal public class Werewolf { } and I should be able to see the getters and setters from the main class like: public static void main(String[] args) { Werewolf jonathan = new Werewolf(); jonathan.getName(); //should be Werewolf's not Human's implementation or Animal implementations //if jonathan has a different animal name, @Animal should implement animalName, not name jonathan.getFerocityIndex(); //should be here jonathan.getIdentificationNumber(); //should also be here } My project currently uses spring, so Spring AOP is not out of the question as …
has answer: http://stackoverflow.com/a/21497188
score: 0
tagged with: annotations
has title: Using annotations (with AOP?) to inject fields (with getters and setters) into POJO
tagged with: java
tagged with: pojo

http://stackoverflow.com/a/21383418
has comment: http://stackoverflow.com/comment/35903795
answers question: http://stackoverflow.com/q/21382848
type: Answer
has comment: http://stackoverflow.com/comment/32249654
accepted answer of: http://stackoverflow.com/q/21382848
has body: If you are using eclipse 3.x, it is not possible. With 4.x should be possible (since Eclipse 4 no longer has an editor area, which must be defined for a perspective, so that you can also put editors in a ViewStack.). You may find something useful in Vogella's article.
has comment: http://stackoverflow.com/comment/35202227
score: 0
has comment: http://stackoverflow.com/comment/32329326
has comment: http://stackoverflow.com/comment/32249989
type: AcceptedAnswer

http://stackoverflow.com/q/21470474
favorite count: 0
has comment: http://stackoverflow.com/comment/32404378
linked to: http://stackoverflow.com/q/714791
has title: Writing Methods for a Person class
score: -3
has comment: http://stackoverflow.com/comment/32404400
has comment: http://stackoverflow.com/comment/32404315
has body: I am trying to write a constructor and a method that satisfies the following output and I am having trouble getting started. 4.9 20.0 0 false 4.9' person with $20.00 and 0 tickets 4.9' person with $20.00 and 3 tickets 4.9' person with $20.00 and 1 tickets 4.9' person with $20.00 and a pass This is the test code: public class Person2Tester { public static void main(String args[]) { Person mary; mary = new Person(4.9f, 20.00f); System.out.println(mary.height); System.out.println(mary.money); System.out.println(mary.ticketCount); System.out.println(mary.hasPass); System.out.println(mary); // Notice the money is properly formatted mary.ticketCount = 3; System.out.println(mary); mary.useTickets(2); // You have to write this method System.out.println(mary); mary.hasPass = true; System.out.println(mary); } } And this is the code I have so far: public class Person { float height; float money; int ticketCount; boolean hasPass; public Person()//empty constructor { height = 0.0f; money = 0.0f; ticketCount = 0; hasPass = false; } public Person(float h, float m) { height = h; money = m; ticketCount = 0; hasPass = false; } public String toString() { return(this.height + " person with " + this.money + " and " + this.ticketCount + " tickets"); } } Here is my finished code. Thanks to everyone who helped. public String toString() { if(hasPass) { return(this.height + "' person with $" + this.money + " and has a pass"); } else { return(this.height + "' person with $" + this.money + " and " + this.ticketCount + " tickets"); } } public void useTickets(int numTickets) { if(this.ticketCount &gt;= numTickets) { this.ticketCount -= numTickets; } }
has comment: http://stackoverflow.com/comment/32404531
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21470644
tagged with: java
has answer: http://stackoverflow.com/a/21470644
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/21470510
has comment: http://stackoverflow.com/comment/32405828
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/32405007
has comment: http://stackoverflow.com/comment/32404902
has comment: http://stackoverflow.com/comment/32404312
tagged with: boolean
answer count: 2
downvote count: 4
accepted answer: http://stackoverflow.com/a/21470510
tagged with: drjava
has comment: http://stackoverflow.com/comment/32404398

http://stackoverflow.com/comment/32212787
type: Comment
type: QuestionComment
has text: @Giulio Piancastelli: Right... for this to work you have to be actually using OneJar (I guess it gets registered somehow with URL).
comment on: http://stackoverflow.com/q/21362659
score: 0

http://stackoverflow.com/comment/32471624
type: Comment
comment on: http://stackoverflow.com/a/21392579
type: AnswerComment
score: 0
has text: @immibis: It may be worthwhile to note that many hashed collections will work just fine with small numbers of items even with all-one-value hash functions. If a collection contains hundreds of items, a good hash function will make a major difference in performance. If thousands, a huge difference. But if it contains three items, or even twelve, even a hash function which always returns the same number will work decently.

http://stackoverflow.com/comment/32331850
comment on: http://stackoverflow.com/q/21428545
has text: @TomLord, your interpretation is correct. I want to replace a certain string of characters within the <context>. This string of characters may occur zero or more times and I don't know in advance how many matches there will be.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21398842
has comment: http://stackoverflow.com/comment/32295843
type: Question
has comment: http://stackoverflow.com/comment/32295926
has answer: http://stackoverflow.com/a/21851911
has body: I have a Java Swing program with a dialog that i want to design in a better way. A window in the program has a button where user needs to click that button to open a small dialog to select a couple of customers names then save his selection where then i do some action on that selection in the main window. The problem is in designing that small dialog. The user can do 2 actions inside it : Enable the customers' names he wants to use. Select a customer name to edit or delete it from the database. Here is the initial dialog design : ------------------------------> My initial thinking to accomplish this is : To enable a name to use it in the main window user has to tick its selection box (i.e. Name 3). To edit or delete a name user has to highlight the label of the name itself then click the Edit button. So highlighting a name will not tick(enable) it (i.e. Name 2). My 2 questions are : Will the user be familiar with this behavior(He can do two actions on each list item). In Java Swing should i use a JList of (JCheckBox + JLabel) items to accomplish this, or use a JTable ?
accepted answer: http://stackoverflow.com/a/21851911
answer count: 2
has comment: http://stackoverflow.com/comment/32277857
possible better answer: http://stackoverflow.com/a/21901429
linked to: http://stackoverflow.com/q/19766
has comment: http://stackoverflow.com/comment/32278408
has answer: http://stackoverflow.com/a/21901429
tagged with: jlist
has comment: http://stackoverflow.com/comment/32277677
linked to: http://stackoverflow.com/q/21358240
has comment: http://stackoverflow.com/comment/32277513
type: AnsweredQuestion
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/32278742
tagged with: swing
has title: Java - Dialog design brainstorming

google-play
tags question: http://stackoverflow.com/q/21432626
type: Tag
tag name: google-play

http://stackoverflow.com/a/21400172
answers question: http://stackoverflow.com/q/21400067
score: 1
upvote count: 1
has body: String key=""; while (keys.hasNext()) { key= keys.next() JSONObject jsonObj = jObj.getJSONObject(String.valueOf(key)); nids.add(key)); System.out.println(jsonObj); listitems.add(jsonObj.getString(attributeName)); } use of key.next() twice is problem
downvote count: 0
type: Answer

http://stackoverflow.com/a/21380750
answers question: http://stackoverflow.com/q/21380560
type: Answer
has body: XML is very unforgiving. This: &lt;xsl:for-each select="language-list/language"&gt; needs to be: &lt;xsl:for-each select="languages-list/language"&gt;
upvote count: 14
type: AcceptedAnswer
downvote count: 0
score: 14
accepted answer of: http://stackoverflow.com/q/21380560

http://stackoverflow.com/q/21398631
has comment: http://stackoverflow.com/comment/32279619
upvote count: 2
tagged with: multithreading
tagged with: android
linked to: http://stackoverflow.com/q/19289812
type: AnsweredQuestion
tagged with: performance
linked to: http://stackoverflow.com/q/47605
tagged with: android-progressbar
score: 1
tagged with: java
downvote count: 1
type: Question
has title: Fast processing of data
has answer: http://stackoverflow.com/a/21524217
has answer: http://stackoverflow.com/a/21399923
has body: My application gets data every 80 milliseconds (I asked my boss today and he said 80 ms is okay, but perfect would be 2ms - 20ms, so even faster than I thought). I need to work with the messages that are incoming, so I tried to handle them with if clauses and every time the if clause is true there is a new text set in a TextView like that: if (data.equalsIgnoreCase(test)) { TextView tv = (TextView) findViewById(R.id.textview); tv.setText(" 30 % "); } The problem is, that the data are incoming that fast and the if clauses seem not "fast" enough to handle it. the TextView only changes when I stop the transmission of messages, then after a short "waiting" the TextViewchanges. Is there something to make it more "Realtime" ? I didn't find something helpful via google and my programming skills are very weak only to prevent more downvotes EDIT: I now found out, that I have to check 768 different values (all hexcodes). So there would be 768 if-statements. That would definetly break down the speed. Problem is, I cant "wait" to do first the if-statement and then get the next message. The messages just flow in. I just updated my code and use now ProgressBar instead of a TextView if (data.equalsIgnoreCase(TEST)){ mProgressBar.setProgress(0); } EDIT2: Added Thread code class RxThread extends Thread { private static final String TEST = "0 0 0 0 0 40 0 0 "; private static final String TEST2 = "0 1 0 0 0 41 0 0 "; private static final String TEST3 = "2 bb 0 0 2 fb 0 0 "; private static final String TEST4 = "2 bd 0 0 2 fd 0 0 "; private static final String TEST5 = "2 be 0 0 2 fe 0 0 "; Handler myHandler = new Handler(); final Runnable r = new Runnable() { public void run() { demoRxMsg = new MessageStructure(); while (rxChannel.receiveMessage(demoRxMsg) == ReturnCode.SUCCESS) { String data = ""; String format = ""; rxChannel.receiveMessage(demoRxMsg); if (demoRxMsg.frameFormat == API_ADK.STANDARD_FRAME) { format = "SFF"; } else { format = "EFF"; } for (byte i = 0; i &lt; demoRxMsg.da…
answer count: 3
has answer: http://stackoverflow.com/a/21400118
accepted answer: http://stackoverflow.com/a/21524217
has comment: http://stackoverflow.com/comment/32496013
has comment: http://stackoverflow.com/comment/32279670
possible better answer: http://stackoverflow.com/a/21399923
favorite count: 0

http://stackoverflow.com/comment/32321609
type: Comment
comment on: http://stackoverflow.com/a/21424139
has text: @PaulHicks The resulted array will be ["", "p", "xmlProject", "bugs", ""]. I assume that "bugs" is the project's name.
score: 1
type: AnswerComment

bukkit
tag name: bukkit
type: Tag
tags question: http://stackoverflow.com/q/21448275

http://stackoverflow.com/comment/32212341
has text: @Darkhogg that's what I meant. Hopefully my update reflects this.
comment on: http://stackoverflow.com/q/21362657
score: 0
type: Comment
type: QuestionComment

calculus
tags question: http://stackoverflow.com/q/21366911
tag name: calculus
type: Tag

http://stackoverflow.com/a/21425575
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21421450
type: Answer
has body: As Amir Keibi Said, That was not the problem with the Serialization,The Actual Problem was with the Size of FPT Column in DataBase, I increased that From 1024 to 2000 and Everything Worked Fine. Now I Can Save Finger Prints In DataBase.
answers question: http://stackoverflow.com/q/21421450
score: 0

http://stackoverflow.com/q/21365282
answer count: 1
tagged with: serialization
has answer: http://stackoverflow.com/a/25001417
accepted answer: http://stackoverflow.com/a/25001417
type: AnsweredQuestion
has body: We can take use of readResolve and writeReplace methods to designate replacement objects for both Externalizable and Serializable instances... Just wanted to know couple of things: 1)Can readObject(ObjectInputStream is ) and writeObject(ObjectOutputStream os) methods be used in conjunction with readResolve() and writeReplace() for a Serilaizable class? Is it possible to replace the object and then perform modifications operations to the byte stream using readObject and writeObject 2)Exteralizable's writeExternal should explicitly coordinate with the supertype to save its state.Just wanted to know that is it true for Serializable super classes also(but not Externalizable) or the Serilizable classes state gets saved automatically when we write the instance to a stream?
tagged with: java
tagged with: externalizable
type: Question
has title: Questions regarding Externalizable and Serializable
score: 0

http://stackoverflow.com/comment/32260405
score: 0
has text: If you breakpoint the close() method you should see where it is being called.
type: Comment
comment on: http://stackoverflow.com/a/21365737
type: AnswerComment

http://stackoverflow.com/comment/32473153
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21508770
has text: @rokonoid *"javafx probably the talk of time now as oracle is pushing it"* Define 'pushing it'. Don't get me wrong, I've seen a few Oracle Blogs claiming it is the 'next big thing', but then I also saw Sun pushing technologies just as hard that ..vanished the next month. **My** definition of Oracle standing behind a technology is it making it into the Java Docs and Java Tutorial. What's yours?

http://stackoverflow.com/q/21388234
answer count: 2
has body: For example, in the following code, A implements interfaces I1, I2, ... In, and overrides their methods. But I found in A, it is a bit hard to read, and understand which methods are from which interfaces. Is there a better way to make the code easier to read? class A implements I1, I2, ..., In { @Override void methoda_in_I1() ... @Override void methodb_in_I1() ... @Override void methoda_in_I2() ... @Override void methodb_in_I2() ... ... @Override void methoda_in_In() ... @Override void methodb_in_In() ... }
downvote count: 0
tagged with: multiple-inheritance
has title: How to make a Java class implementing multiple interfaces easier to read
favorite count: 0
score: 2
tagged with: coding-style
has comment: http://stackoverflow.com/comment/32258607
upvote count: 2
has answer: http://stackoverflow.com/a/21388936
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21389039
has comment: http://stackoverflow.com/comment/32258973
has comment: http://stackoverflow.com/comment/32258678
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32258506

http://stackoverflow.com/comment/32403816
score: 0
type: Comment
type: QuestionComment
has text: I hadn't. Since it would be sitting within their data centre I figured the web service would only have firewall rules open to the relevant applications. However moving it off premsie would definitely mean mean more work in this area.
comment on: http://stackoverflow.com/q/21449450

http://stackoverflow.com/comment/32343084
type: AnswerComment
type: Comment
has text: Thank you! I apologize for any misunderstanding earlier on. I'm just a beginner in programming & I was just really desperate for help as I have to show my tutor my project and how its coming along, tomorrow morning. I have already made changes & it works now!
score: 1
comment on: http://stackoverflow.com/a/21436143

http://stackoverflow.com/comment/32208545
score: 0
type: Comment
has text: Thanks for letting know, but in this case `build.gralde` also needds to be modified, also now there is hard-coded classpath to care about.
comment on: http://stackoverflow.com/a/21360609
type: AnswerComment

http://stackoverflow.com/a/21457544
has comment: http://stackoverflow.com/comment/32381976
has comment: http://stackoverflow.com/comment/32381486
has comment: http://stackoverflow.com/comment/32381847
answers question: http://stackoverflow.com/q/21457397
has body: You are trying to execute a shell pipe with ProcessBuilder. That won't work. The pipe | is no valid argument for the ls command. You must start a shell new ProcessBUilder("sh"). And it works fine with args because your program do not get the pipe and the rest from the calling shell. Your program only gets ls -al.
downvote count: 0
has comment: http://stackoverflow.com/comment/32380558
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32380958
upvote count: 2

http://stackoverflow.com/comment/32288426
type: Comment
comment on: http://stackoverflow.com/a/21404217
type: AnswerComment
has text: are you using the exact line "cordinateList(i).getLati()" 'i' is a iterator variable
score: 0

http://stackoverflow.com/a/21463452
answers question: http://stackoverflow.com/q/21448275
has comment: http://stackoverflow.com/comment/32404385
has body: You need to provide the whole section of code, as somewhere your syntax is wrong, it's impossible to say without seeing all of it. Edit: Now the code is added: 'ten = 0' needs to change to 'ten == 0' in order to do the comparison correctly. you are missing a ')' on this line: (it should be after the zero) if (twenty == 0 { Also, I can't see where you've declared the variables ten and twenty, so try changing to this: int ten = rnd.nextInt(10); int twenty = rnd.nextInt(20); Finally, none of this code is in a method, it's just within the class file. Is it supposed to be invoked statically when the class is constructed? or when a method is called?
type: Answer
score: 0

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/21354935
type: Tag
tags question: http://stackoverflow.com/q/21423444
tags question: http://stackoverflow.com/q/21438412

init
tags question: http://stackoverflow.com/q/21494025
type: Tag
tag name: init

http://stackoverflow.com/a/21507842
has body: The solution seems to be to use open(AudioFormat,&nbsp;int) to open the line with a specified buffer size. line.open(fmt, buffer.length); Timing it again, we can see that write blocks much more consistently: sound: 22 paint: 24 sound: 21 paint: 24 sound: 20 paint: 22 sound: 21 paint: 23 sound: 20 paint: 23 And the animation is smooth.
type: Answer
answers question: http://stackoverflow.com/q/21507646
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21507646

http://stackoverflow.com/a/21467312
has body: Demo of this answer at IDEOne.com I came up with the following function. Read the comments to understand the logic behind it: public static boolean contains(int[] a, int[] b) { //Loop until there aren't enough elements left in a to match b. for (int i = 0; i &lt; a.length - b.length + 1; i++) { for (int j = 0; j &lt; b.length; j++) { //If the jth element of b doesn't match //the corresponding element of a, then move //to the next step in the sequence. if (a[i + j] != b[j]) break; //If we are at the end of the loop, return //true because that means we found a consecutive match. if (j == b.length - 1) return true; } } return false; //If we got here, there are no matches. }
has comment: http://stackoverflow.com/comment/32398679
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32398677
upvote count: 1
answers question: http://stackoverflow.com/q/21466924
type: Answer

http://stackoverflow.com/comment/32287279
type: AnswerComment
has text: As far as I know, the HorizontalScrollView has its own scrollbars. Why are you trying to duplicate this functionality by adding a SeekBar?
type: Comment
comment on: http://stackoverflow.com/a/21401980
score: 0

http://stackoverflow.com/a/21358416
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/21358354
type: Answer
accepted answer of: http://stackoverflow.com/q/21358354
has body: public void enableCheckboxes(){ Component [] c = gui.panel.getComponents(); for (Component c1 : c) { if (c1 instanceof JCheckBox) { c1.setEnabled(true); } } } I'd wondered when I'd use the instanceof operator. I kept seeing it lots of places. And I was unaware of the power of getComponents(). Makes me want to tackle Reflection soon. Thanks to Niemeyer's Learning Java, chapter 17--Using Swing Components. If there's another way--and surely there is--I hope to see it soon.

http://stackoverflow.com/comment/32393696
type: Comment
comment on: http://stackoverflow.com/a/21464882
has text: i knew that it is very hard, i want to know if exists a easy way
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32351390
comment on: http://stackoverflow.com/a/21437230
score: 0
type: AnswerComment
has text: Also I'll look at that question this evening. I'm at work and don't have time to really look at that one right now.
type: Comment

http://stackoverflow.com/a/21426339
has comment: http://stackoverflow.com/comment/32326079
answers question: http://stackoverflow.com/q/21365686
has comment: http://stackoverflow.com/comment/32325506
has body: The first error that I see is that you used the @Basic annotation for a relation. See the documentation for the allowed types of the Basic annotation. Instead use the @JoinColumn annotation (if you want to change any default settings). The second problem that I see is that you persist the entity anyway, no matter the ID. See the correct code with the problem (in repository): if (a.getId() != null) { entityManager.merge(a); } else { entityManager.persist(a);//this line should be in an ELSE branch (in your code it is not) }
has comment: http://stackoverflow.com/comment/32326208
type: Answer
has comment: http://stackoverflow.com/comment/32353722
score: 0

http://stackoverflow.com/q/21504331
has answer: http://stackoverflow.com/a/21506088
has comment: http://stackoverflow.com/comment/32467184
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32465356
type: Question
score: 3
tagged with: android-layout
tagged with: hdpi
has body: I'm trying to support all kind of screens on my project. I added the the respective graphics in the folders-drawables(ldpi,mdpi,Hdpi,xhdpi,xxhdpi),, And also the layouts folders(layout-small,layout,layout-large,layout-xlarge,layout-xxlarge). Here is the thing: When I open the app on the emulator,on a normal screen(mdpi),.everythings is right, But when I choose other emulator like one Hdpi/large,.the android system is not choosing the right graphics.(for example I open a Hdpi emulator and the system is choosing the normal graphics(mdpi). What do I need to do?,do I need to write some code to force the system choose the right graphics ?,really needing help !
tagged with: mdpi
tagged with: java
has comment: http://stackoverflow.com/comment/32467076
has title: How to force android choose the right layout for the screen sizes supported?
answer count: 1
favorite count: 0
upvote count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/32467197

http://stackoverflow.com/q/21409271
has answer: http://stackoverflow.com/a/21409701
has title: How to use Stream<E> instead of Collection<E> or List<E>?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32296195
score: 1
accepted answer: http://stackoverflow.com/a/21409701
favorite count: 0
type: Question
upvote count: 1
tagged with: lambda
answer count: 1
tagged with: java-8
tagged with: java-stream
tagged with: java
has body: Consider the following class I have currently: public interface Drawable { public void compileProgram(); public Program getProgram(); public int getDataSize(); public FloatBuffer putData(final FloatBuffer dataBuffer); public int getDataMode(); public static int countDataSize(final Collection&lt;Drawable&gt; drawables) { return drawables.stream().mapToInt((drawable) -&gt; drawable.getDataSize()).sum(); } public static FloatBuffer putAllData(final List&lt;Drawable&gt; drawables) { FloatBuffer dataBuffer = BufferUtils.createFloatBuffer(countDataSize(drawables) * 3); drawables.stream().forEachOrdered((drawable) -&gt; dataBuffer.put(drawable.putData(dataBuffer))); return (FloatBuffer)dataBuffer.clear(); } } Now take a look at countDataSize: I have as input Collection&lt;Drawable&gt;, because I do not care about the order, I just want to sum up their size. I use drawables.stream(), which would be redundant if I would've passed in a Stream&lt;Drawable&gt; argument. And next take a look at putAllData: As in put here I have List&lt;Drawable&gt; drawables, as the order this time does matter. I use drawables.stream() to access them, this happens in order with forEachOrdered(). I wush to use Stream&lt;Drawable&gt; as input, however does passing in a Collection&lt;Drawable&gt; or List&lt;Drawable&gt; even work then? If it does, how can I ensure that in the first case the order does not matter, while in the second case it does matter?
downvote count: 0

http://stackoverflow.com/comment/32343463
score: 1
comment on: http://stackoverflow.com/q/21433430
type: Comment
type: QuestionComment
has text: For the reasons you've already mentioned, Java will outperform Redis - you should try http://trove.starlight-systems.com/ if your sets contain the data types it supports; this will increase performance further by removing the costs of boxing/unboxing.

http://stackoverflow.com/comment/121454554
comment on: http://stackoverflow.com/q/21507858
score: 0
type: Comment
type: QuestionComment
has text: I was reading about HashSet in Java and I found out that HashSet is also a non synchronized class in Java.

http://stackoverflow.com/q/21377712
has title: Using the robot class in an if statement
has comment: http://stackoverflow.com/comment/32239849
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32239437
type: Question
tagged with: awtrobot
tagged with: accessibility
score: 0
has body: Hi im creating a game accessibility app which will take mouse input and convert it to arrow key press. I have a window split up into 4 sections and it prints out which sector the mouse is in now what i would like to do is take one of these if((e.getX() &gt; O &amp;&amp; e.getX() &lt; X1) &amp;&amp; (e.getY() &gt; O &amp;&amp; e.getY() &lt; Y1)) { statusBar.setText("Up"); } and instead of statusBar.setText("Up"); it does Robot r = new Robot(); r.keyPress('W'); r.keyRelease('W'); Any advice?

http://stackoverflow.com/q/21494944
score: 0
accepted answer: http://stackoverflow.com/a/21495066
answer count: 1
tagged with: wifi
linked to: http://stackoverflow.com/q/8083479
has body: what is the java code to get ip address and mac of devices connected to my wifi in laptop?? all i am getting here is realted to android. i need for desktop apllication. Wifimanager class only helps for andriod based project.
has answer: http://stackoverflow.com/a/21495066
has title: what is the java code to get ip address and mac of devices connected to my wifi in laptop?
duplicate of: http://stackoverflow.com/q/8083479
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32447662
tagged with: java
type: Question

http://stackoverflow.com/comment/32292673
comment on: http://stackoverflow.com/a/21388193
has text: used jaxb, making it transient is not efficient since data might be resent to the first application so transient mean version = 0 while in the first application it will be different than that.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21351565
has comment: http://stackoverflow.com/comment/32192818
downvote count: 0
has comment: http://stackoverflow.com/comment/32192717
has comment: http://stackoverflow.com/comment/32192619
has comment: http://stackoverflow.com/comment/32192724
upvote count: 6
has comment: http://stackoverflow.com/comment/32192513
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32192567
answers question: http://stackoverflow.com/q/21351495
has body: Make your class extend JFrame instead of JApplet. Have a constructor and call init() from there public Kueze(){ init(); } Have a main method that you instantiate Kueze int public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { new Keuze(); } }); } In your init() you'll also want to do the normal JFrame routine also public void init(){ .... setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } See the JFrame docs to see what those methods do SIDE NOTES You have alot of AWT going on in your program. You should really look into Creating a GUI with Swing Don't setSize(...). I already shows you how to pack() Why in the world is there so much going on in your paint method? The only thing you want in the paint method, are things that are actually doing the painting. call super.paint(g); right below the method public void paint UPDATE Your code is too long to post on here, so I'll give you the layout import java.awt.Button; import java.awt.Choice; import java.awt.Color; import java.awt.Event; import java.awt.Graphics; import java.awt.Label; import java.awt.Polygon; import java.awt.TextField; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Keuze extends JFrame { .... public Keuze(){ init(); } public void init(){ .... setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } .... public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { new Keuze(); } }); } }
has comment: http://stackoverflow.com/comment/32192537
accepted answer of: http://stackoverflow.com/q/21351495
has comment: http://stackoverflow.com/comment/32192692
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/32192404

http://stackoverflow.com/q/21395408
has comment: http://stackoverflow.com/comment/32271737
upvote count: 5
has comment: http://stackoverflow.com/comment/32272071
has body: This is probably a noob question, but I need to run a java application processing a large dataset. So I went about -Xmx14G, knowing that my machine has 16G of physical memory. A short while later, boom, I am being notified by my operating system that my startup disk is almost full. I checked my process, there's no OOM exception, just that it stalled. Checked my activity monitor, doesn't says the application runs at full memory capacity. How does the JVM reserves/use memory?
answer count: 2
score: 5
downvote count: 0
has title: How does Java reserve/use memory?
has comment: http://stackoverflow.com/comment/32272013
linked to: http://stackoverflow.com/q/8037920
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/21395477
has comment: http://stackoverflow.com/comment/32271827
tagged with: macos
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32290817
tagged with: java
possible better answer: http://stackoverflow.com/a/21395538
has answer: http://stackoverflow.com/a/21395538
has comment: http://stackoverflow.com/comment/32271899
type: Question
accepted answer: http://stackoverflow.com/a/21395477

http://stackoverflow.com/q/21464011
tagged with: cross-platform
type: Question
has body: I'm using the java libgdx game library and im curious if I can tell if a key is being HELD, not pressed and let go. I need to know this because I'm going to play a shorter mp3 file if it is just pressed and a longer one if it is held.
has title: Libgdx - Check if a key is being held down?
tagged with: libgdx
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21464249
score: 8
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/21464249
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21374292
upvote count: 5
has body: It is possible to implement double-checked locking (DCL) correctly in Java 5 and later. In Java 4 and earlier, it is not possible due to the fact that the behaviour of volatile with respect to synchronization was not properly specified (and in practice was inadequate). The code you included in your question is a correct implementation for DCL ... when run using a Java 5 JRE or later. But (IMO), it is not worth using DCL. Especially if you (or developers coming after you) don't completely understand how to do it if correctly / safely. The performance benefit is simply too small for this to be a worthwhile optimization in a real-life Java application. (And if it is, you are probably overusing / misusing singletons ... and that will bite you in other ways!) Ok, so imagine that our SingletonDemo class has non-final field. So, concurrent thread will be able to read default value instead of correct value specified in constructor? (The quoted JLS text is about an entirely different situation. It is about final fields. It is not relevant here. And you cannot infer the behaviour for non-final fields with synchronization from the behaviour of final fields without synchronization.) The answer to your question is No. The code in your question is doing enough to guarantee that a concurrent thread won't see the default value. To understand why, read the following: all of Section 17.4 of the JLS, and the last chapter of Goetz et al "Java Concurrency in Practice", which includes a section on DCL (if I remember correctly ...)
answers question: http://stackoverflow.com/q/21374188
downvote count: 0
type: Answer
score: 5

http://stackoverflow.com/q/21511189
tagged with: artificial-intelligence
has answer: http://stackoverflow.com/a/21520138
tagged with: java
tagged with: information-retrieval
type: Question
has answer: http://stackoverflow.com/a/21521205
tagged with: text-processing
score: 0
answer count: 2
has body: A short intro I had extracted a bunch of text from set of PDF files.. Those text are title of the document.. My objective is to classify the titles based on the terms appearing on it. That is if the title contains Car then it must be classified as automobile. Example for my objective Imagine the following titles: 1) DISTRIBUTED MESH NETWORK 2) MONITORING A SELF-CONTAINED SERVER RACK SYSTEM 3)SIDE PANEL FOR AN AUTOMOBILE 4) LOCATION-BASED VEHICLE MESSAGING SYSTEM Now , the above mentioned title have to classified as 1st title contains term Network , So classify as Networking 2nd title contains term Server, So classify as Networking 3rd title contains term automobile, So classify as automobile 4th title contains term vehicle , so classify as automobile This is what I need . My Works To achieve my objective I created a index of terms in text files for each category and matched it with a title .. if it contains a word in text files , then title get classified. For example Automobile.txt have car , gear , wheel , clutch. networking.txt have server,IP Address,TCP , RIP This is the Algorithm: String Classify (String title) { String area; if (compareWordsFrom ("Automobile.txt",title) == true ) area = "Auto"; if (compareWordsFrom ("Netoworking.txt",title) == true ) area = "Networking"; if (compareWordsFrom ("metels.txt",title) == true ) area = "Metallurgy"; return area; } My Problem My problem is , it is very difficult to find related words to build the index. That is , the field automobile have 1000 of related terms which difficult to find. To be precise , building index of terms manually is a heart-breaking process. My Need I need an automated way for my work . Do Natural Language Processing techniques able to do it. ? OR I is there is an ready-made library available ?
tagged with: nlp
has title: How to classify a string that belongs to a particular area using java?
type: UnansweredQuestion

http://stackoverflow.com/comment/32340114
score: 3
type: QuestionComment
type: Comment
has text: @T.J.Crowder I'm not great with these details, I don't want to get something wrong.
comment on: http://stackoverflow.com/q/21434845

http://stackoverflow.com/a/21391008
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21390823
has body: Enum type can have body like abstract methods and all enum constants should implement those abstract methods. Look at the JSL here http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9.2 and go to the section Example 8.9.2-4. Enum Constants with Class Bodies. You even can implement an ENUM with an interface rather having a abstract method in it. Something like public enum SourceStatusComparisonType implements StatusComparable.

http://stackoverflow.com/q/21358552
has comment: http://stackoverflow.com/comment/32205060
has body: can you please give the steps how to make simple program of jdbc on mac . I have eclipse on my mac .so I need steps what to do next so that can able to make program of jdbc ? I do lot of RND but they provide for windows.But I also download Mysql from this link http://dev.mysql.com/downloads/file.php?id=450342 and download workbench from this link http://dev.mysql.com/downloads/file.php?id=412161 Then can you please may I right ? or what next I have to do to make jdbc program ?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32205044
has answer: http://stackoverflow.com/a/21358655
has comment: http://stackoverflow.com/comment/32204953
favorite count: 0
has answer: http://stackoverflow.com/a/21358648
type: UnansweredQuestion
tagged with: jdbc
has title: How to save user name (simple example of jdbc) in java?
has comment: http://stackoverflow.com/comment/32204990
linked to: http://stackoverflow.com/q/6267392
tagged with: java
has comment: http://stackoverflow.com/comment/32205098
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32204968

http://stackoverflow.com/comment/32224218
score: 1
has text: Not sure I understood your overall purpose here, but if this purpose is to achieve "infinite" precision, then you can implement a RationalNumber class which will maintain a pair of BigIntegers {numerator,denominator}, so that you will "lose" information only when you print the number in decimal (or any other base) format.
comment on: http://stackoverflow.com/q/21368986
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32298043
type: Comment
score: 2
has text: @Nullpointer: In what way do you think that 08 is different to 8, in terms of integer values?
comment on: http://stackoverflow.com/q/21410770
type: QuestionComment

hibernate3
tags question: http://stackoverflow.com/q/21448831
type: Tag
tag name: hibernate3

http://stackoverflow.com/comment/32199226
has text: 1) If you've made changes to your current program, please show the code as an edit to your original question. 2) Please read up on Swing graphics which you can find [here](http://docs.oracle.com/javase/tutorial/uiswing/painting/index.html). Better to work with what you have rather than asking others to give you code.
score: 0
comment on: http://stackoverflow.com/q/21355082
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32315654
comment on: http://stackoverflow.com/a/21420309
has text: Thank you for your reply, I just realized that: formparams.add(new BasicNameValuePair("data.message", "testing")); Needed to be changed to: formparams.add(new BasicNameValuePair("data.price", "testing"));
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21457298
type: Answer
answers question: http://stackoverflow.com/q/21455903
has body: Obviously it's not possible to sum two documents this way. Each document has own structure of Elements (nodes, Leaves). To merge them properly you in fact need to copy all branches with sub nodes from one document instance ot another. The link shows how it could be done. http://java-sl.com/tip_merge_documents.html
accepted answer of: http://stackoverflow.com/q/21455903
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32407137
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21472055
has text: I think you need to take that up with whoever wrote the testcase, to understand under which conditions they expect which of these exceptions. Generally, Illegal Argument is thrown when the parameters are inherently unreasonable, and Illegal State is thrown when the action doesn't make sense given the current values of the object's fields (or those of objects it refers to). It sounds like the test is trying to draw that distinction... and the fact that you have no `else` for your second `if` looks suspicious to me.
score: 3

http://stackoverflow.com/comment/32288315
comment on: http://stackoverflow.com/a/21401576
score: 1
has text: So I was on the right way at least, thank you for making this more clear!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21440460
favorite count: 0
has answer: http://stackoverflow.com/a/21440606
has comment: http://stackoverflow.com/comment/32350565
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/21440612
has title: if overridden method's return type is primitive (e.g. double) ,can we change return type of overriding method (e.g. int ,char)?
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/18773840
has comment: http://stackoverflow.com/comment/32350616
has comment: http://stackoverflow.com/comment/32350598
type: Question
tagged with: overriding
downvote count: 0
has comment: http://stackoverflow.com/comment/32350596
has body: As shown below : Method to be overriden: double add (int a ,int b){ } Method overridding above method: int add(int a,int b){ }
answer count: 3
possible better answer: http://stackoverflow.com/a/21440552
has answer: http://stackoverflow.com/a/21440612
tagged with: polymorphism
has answer: http://stackoverflow.com/a/21440552

http://stackoverflow.com/comment/32219908
score: 0
comment on: http://stackoverflow.com/a/21365300
type: Comment
has text: Sorry, i have last two question about the code. 1) why message need 32 bit for first, why not 24 bits(because i was think 32bit,because 4 component, or because int?). 2) why doing `count <= 29` in `embedInteger` and why 29, same as `embedByte`, why `count <= 5` and why 5??
type: AnswerComment

http://stackoverflow.com/comment/32234152
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21374557
has text: You should ensure that You can connect to http://182.18.133.88/php/gprs_request.php?cmd=balance&username=xxxxx&password=xxxxx. by your phone or your emulator. Check your permission in Android Manifest and check your URL
score: 0

http://stackoverflow.com/q/21489814
has comment: http://stackoverflow.com/comment/32438792
has comment: http://stackoverflow.com/comment/32438596
score: 0
tagged with: scala
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has body: When running Java code that calls Scala, namely the Play library, I'm seeing this error when running the below test code. java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Deserializers$Base I looked up Deserializers$Base to find out it's part of the package, org.codehaus.jackson. Then, I saw that this package is part of the jackson-mapper-asl artifactId. Java // Main Foo foo = new Foo(); foo.do(); // <-- top of stack trace public class Foo { public String do() { List<JsValue> jsonList = new ArrayList<JsValue>(); // populate jsonList return JsonUtil.build(json); // <-- second line of stack trace } Scala object JsonUtil { import collection.JavaConverters._ def build(x: java.util.List[JsValue]): String = Json.obj("bar" -> x.asScala.toList).toString } } After adding this dependency to my POM, I still encountered the above error. Full stack trace: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/Deserializers$Base at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at play.api.libs.json.JacksonJson$module$.setupModule(JsValue.scala:460) at org.codehaus.jackson.map.ObjectMapper.registerModule(ObjectMapper.java:444) at play.api.libs.json.JacksonJson$.<init>(JsValue.scala:464) at play.api.libs.json.JacksonJson$.<clinit>(JsValue.scala) at play.api.libs.json.Json$.stringify(Json.scala:48) at p…
downvote count: 1
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/21504542
linked to: http://stackoverflow.com/q/17540942
has comment: http://stackoverflow.com/comment/32438639
has title: NoClassDefFoundError - Deserializers$Base
tagged with: playframework
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21389883
accepted answer of: http://stackoverflow.com/q/21389837
answers question: http://stackoverflow.com/q/21389837
type: Answer
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/32261582
has comment: http://stackoverflow.com/comment/32261467
has body: Double escape it: Pattern p = Pattern.compile("\\bis\\b"); Regex in Java requires you to doubly escape certain special regex symbols, one escaping for Java and another for underlying regex engine.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21390909
has comment: http://stackoverflow.com/comment/32265370
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32264478
has comment: http://stackoverflow.com/comment/32264850
answers question: http://stackoverflow.com/q/21390773
has body: You need to create array1 as a class variable in order for the whole class to have access to it. As a general rule of thumb, the scope of a variable last between the two brackets { } it is initialized in. In your two methods, you initialize array1 in those method, so the scope of array1 is in those methods only. Change the code to something like this: public class JavaApplication2 { int[] array1; public JavaApplication2() { } public static void main(String[] args) { JavaApplication2 obj = new JavaApplication2(); obj.method(); System.out.print(obj.array1[1]); } public void method() { array1 = new int[]{1, 1, 1, 1, 1}; } } It would be even better to initalize array1[] as private and have a getter method for it like this: public class JavaApplication2 { private int[] array1; public JavaApplication2() { } public static void main(String[] args) { JavaApplication2 obj = new JavaApplication2(); obj.method(); System.out.print(obj.getArray1().[1]); } public void method() { array1 = new int[]{1, 1, 1, 1, 1}; } public void getArray1() { return array1; } }

http://stackoverflow.com/a/21401558
answers question: http://stackoverflow.com/q/21400425
type: Answer
score: 0
has body: You can make your code a lot faster1 by changing the wordsArray to a HashSet, and using the contains(String) method to do the checks. (Make sure you convert words to upper case when you build the set.) However, I would point out that this approach doesn't scale. It is not practical to enumerate all possible "non-English or incorrect" words. You would be better off building a set containing all of the words that you are prepared to accept, and then eliminating the words not in the set. 1 - Currently, your inner loop takes time that is proportional to the number of words (N) in wordArray; i.e. O(N). If you use a HashSet, the operation takes O(1) time; i.e. roughly constant time.

http://stackoverflow.com/comment/32415588
type: AnswerComment
score: 0
type: Comment
has text: I forgot the `MyInternalFrame` class. I just added it
comment on: http://stackoverflow.com/a/21466699

http://stackoverflow.com/comment/32425472
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21481910
score: 0
has text: No need to get down on yourself :). I was just pointing out the problem I found. I recommend using an integrated development environment (IDE) in the future. Something like Eclipse would help you avoid this problem (or at least catch it immediately as it is created). Good luck!

http://stackoverflow.com/comment/32310066
type: Comment
comment on: http://stackoverflow.com/a/21417493
type: AnswerComment
score: 0
has text: True and I fixed this. Still the same error. I am working through the other comments. I am new to this so will keep researching.

http://stackoverflow.com/a/21446552
type: Answer
has body: Hints: You need two switch statements. One for the first if/else chain, and one for the second. (Though you could easily fold the two chains into one!) The syntax of a switch statement is illustrated in the Java Tutorial here. The following statement does nothing: if ( month &lt;= 3) ; It says "test if month is less or equal to 3, and then execute the empty statement. This is a "gotcha!" in Java syntax ... and one of the reasons that some people think that you should always use curly brackets with if and loop statements in Java and similar languages.
answers question: http://stackoverflow.com/q/21446481
score: 0

http://stackoverflow.com/comment/32325111
comment on: http://stackoverflow.com/q/21425781
type: Comment
has text: I have not, but I would prefer to "import as little as possible". Would this library come **instead** of the json library I'm already using, or **in addition** to that? Thanks.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32375825
score: 0
comment on: http://stackoverflow.com/q/21453879
type: Comment
type: QuestionComment
has text: What softwares should i use

http://stackoverflow.com/comment/32250065
has text: But seems that some how database is not opened. Try to put calling of you open() method in try-catch block catching SQLException exception and see if you will catch any exception. Could you try this and post the result?
type: AnswerComment
comment on: http://stackoverflow.com/a/21383294
score: 0
type: Comment

http://stackoverflow.com/a/21439204
downvote count: 0
answers question: http://stackoverflow.com/q/21439162
score: 5
has body: You state: My problem is that I'm reaching 1000 Line and this is stressful because all my code are in one file. I'm not liking this. You are quite right to not like this and to try to improve this set up as this type of program will be a monster to maintain, debug and enhance.. You then state: Inheriting from a JFrame class to another class and using the variables This is not what inheritance is for as objects of the child class will be a completely distinct entities from objects of the parent class, so you will not want to do this. Instead Remember to strive to enhance by composition rather than inheritance, meaning have classes contain fields of other classes. Avoid using the static modifier to make global-like variables as this will hog-tie your code. try to break out logical parts of your program from the visual, the GUI parts, And split up each specific logical part and each major GUI part into its own class. make sure all classes have decent setter and getter methods, and that the classes are written so that they communicate well with each other. A Swing specific recommendation is for you to avoid extending JFrame. Instead gear your Swing GUI's towards creating JPanels, panels which can be placed anywhere you want them, including in JFrames, JApplets, JDialogs, JOptionPanes, inside of other JPanels, in JTabbedPanes, as "cards" in a CardLayout-using JPanel,.... This will greatly improve the flexibility and enhance-ability of your program. For more specific help, please feel free to provide more details about your program and its code. Edit Sorry to be blunt, but you've come for advice on your code, and I have to inform you that it has some significant problems including: it contains more quite a bit of unnecessary redundency that makes it hard to follow and debug. You have grids of JTextFields, all of which can and should be replaced by three JTables, one for Meat, one for Chicken, and one for "other things". You use null layouts and absolute positioning, somet…
type: Answer
has comment: http://stackoverflow.com/comment/32363761
has comment: http://stackoverflow.com/comment/32364086
upvote count: 5

http://stackoverflow.com/a/21413278
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21408401
has body: Create a string from ddd and use replace(). ddd.toString().replace(aaa,"");
type: Answer

http://stackoverflow.com/comment/32236198
comment on: http://stackoverflow.com/a/21374889
score: 0
type: AnswerComment
has text: Use an appropriate table cell renderer as described in [Using Custom Renderers](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#renderer)
type: Comment

http://stackoverflow.com/q/21386047
linked to: http://stackoverflow.com/q/10947768
downvote count: 1
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/21386137
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32256158
has answer: http://stackoverflow.com/a/21386113
has comment: http://stackoverflow.com/comment/32254576
tagged with: java
has answer: http://stackoverflow.com/a/21386092
has body: interface A { } public class B { public static void main(String a[]) { Class c = Class.forName("A"); System.out.println(c.isInterface());//false Class c1 = A.class; System.out.println(c1.isInterface());//true } } o/p: false true expecting o/p: true true i wan't to know the difference in these two: Class.forName("A") and A.class Thanks a lot.
type: Question
has title: Reflection API, Class.forName() vs .class
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/32254475

http://stackoverflow.com/a/21391887
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21391821
has comment: http://stackoverflow.com/comment/32265586
has comment: http://stackoverflow.com/comment/32265529
downvote count: 0
has body: That's the default output when you print an array. If you want to see the actual content use Arrays.toString()
type: Answer

http://stackoverflow.com/comment/32377283
has text: If you raise a question and use the MOXy tag, the author of the library is pretty active on SO.
score: 0
comment on: http://stackoverflow.com/q/21444720
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32267176
has text: As you are trying to use a builder pattern with inheritance maybe [this post here](http://stackoverflow.com/questions/21210870/in-java-can-you-use-the-builder-pattern-with-required-and-reassignable-fields/21211472#21211472) might help, although it was a bit misplaced in that post as I understood the question fully after having posted this.
score: 1
comment on: http://stackoverflow.com/q/21392717
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21353704
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32197383
answer count: 2
has title: Creating components dynamically
possible better answer: http://stackoverflow.com/a/21355757
accepted answer: http://stackoverflow.com/a/21355868
tagged with: android
has answer: http://stackoverflow.com/a/21355868
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/21355757
has body: I am creating an application where I need to dynamically create elements. I'm using the following code in the onCreate () method. TextView product = new TextView (this); product.setText ("" + pName + ""); //Add TextView to LinearLayout ll.addView (product); Works fine, the problem is when I turn the phone, the items appear duplicated. What am I doing wrong?

http://stackoverflow.com/q/21354501
has comment: http://stackoverflow.com/comment/32197604
has comment: http://stackoverflow.com/comment/32197477
has answer: http://stackoverflow.com/a/21965954
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21965954
has comment: http://stackoverflow.com/comment/32197810
tagged with: java
score: 15
has comment: http://stackoverflow.com/comment/32197705
tagged with: class
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21354538
tagged with: recycle
has comment: http://stackoverflow.com/comment/32197930
has comment: http://stackoverflow.com/comment/32197757
has title: Typed Array should be recycled after use with #recycle()
tagged with: android
has comment: http://stackoverflow.com/comment/32197409
upvote count: 15
favorite count: 0
has body: My code is showing this warning message: Typed Array should be recycled after use with #recycle() for obtainedTypedArray Code: public View getView(int i, View view, ViewGroup viewgroup) { ImageView imageview; if (view == null) { imageview = new ImageView(b); imageview.setLayoutParams(new android.widget.AbsListView.LayoutParams(110, 110)); imageview.setPadding(1, 1, 1, 1); imageview.setAdjustViewBounds(false); imageview.setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP); } else { imageview = (ImageView)view; } imageview.setImageResource(a.getResources().obtainTypedArray(0x7f050000).getResourceId(i, -1)); //*warning*Typed Array should be recycled after use with #recycle() return imageview; }
downvote count: 0
possible better answer: http://stackoverflow.com/a/21354538

http://stackoverflow.com/comment/32402630
type: AnswerComment
type: Comment
has text: @Dudemister1999 If your idea is to return a Class so you can call its static methods, it just doesn't work that way. You cannot do, for example, `ChatUtil.class.someUtilMethod()`. Class objects are not for doing that. Even if you could do it, I don't really see what you gain from it.
comment on: http://stackoverflow.com/a/21469060
score: 0

http://stackoverflow.com/comment/32429928
type: QuestionComment
comment on: http://stackoverflow.com/q/21484983
score: 0
has text: com.badlogic.gdx.scenes.scene2d.ui.Image is an Actor of the scene2dUi, which holds a drawable (the image which you draw on the screen). You have to get this drawable with myImage.getDrawable(). Then you have to know which kind of drawable it is (for example a TextureRegionDrawable) and cast it to that. Then you have to look for methods in the drawable you have. Maybe they have methods, which give you the Bitmap back.
type: Comment

http://stackoverflow.com/comment/32264770
has text: The rest of the instructions were added to the OP
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21389223
score: 1

http://stackoverflow.com/comment/97307447
has text: " In its current form the code won't even compile as the return value is missing " - why would a void method return something? Am I missing something here?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21372025
type: Comment

http://stackoverflow.com/comment/32311365
comment on: http://stackoverflow.com/a/21417448
has text: thanks. I am completely new to sockets programming and i started learning java just four days ago. May be that why I dont understand your answer completely. Can you please point out the "strange things" :D. Also which read results are ignored and which reads are extra?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32235584
type: Comment
score: 0
has text: Thanks a lot. I should try it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21375401

http://stackoverflow.com/a/21387500
has body: Use android:onClick="" and android:Clickable="true" to make the Textview as a button
has comment: http://stackoverflow.com/comment/32257053
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/32257489
answers question: http://stackoverflow.com/q/21387425
upvote count: 4
has comment: http://stackoverflow.com/comment/32257156

http://stackoverflow.com/comment/32347121
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21432279
has text: Thanks for the help. I already figured it out. :)
score: 0

http://stackoverflow.com/comment/32348705
type: QuestionComment
has text: @John That post does not answer my question. The post discusses how to implement/simulate multiple inheritance using interfaces. My question is how to create dynamically a proxy class that can inherit methods from two different subclasses of the same parent class. I do not want to write any code to accomplish that using composition.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21437532

http://stackoverflow.com/comment/32393818
type: AnswerComment
comment on: http://stackoverflow.com/a/21461918
type: Comment
has text: Does `direct:validator` change the message body? since, if not, I don't think you need to use multicast at all...
score: 0

http://stackoverflow.com/comment/74707913
comment on: http://stackoverflow.com/a/21480036
score: 0
type: AnswerComment
type: Comment
has text: but why should we use getX(), getY() inside Actor? I mean why do we need actor at all if we still have to calculate positions based on some outer values..

http://stackoverflow.com/q/21499424
has answer: http://stackoverflow.com/a/21499611
type: Question
accepted answer: http://stackoverflow.com/a/21499487
answer count: 6
has comment: http://stackoverflow.com/comment/32455066
score: 0
tagged with: nullpointerexception
has body: I'm trying to get a simple note-taking app to work, but I keep on getting a nullPointerException when calling a certain method. The value from the textEdit in the dialog layout is retrieved just fine. I checked by logging the results. The problem occurs when I try to run the createNotes(content) method. public class Dialog extends Activity { NotesBean notesBean = null; public NotesDao datasource; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("log", "Running NotiMgr"); setContentView(R.layout.dialog); RelativeLayout layout = (RelativeLayout) findViewById(R.id.dialog_background); layout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { EditText mEdit = (EditText) v.findViewById(R.id.editText); String content = mEdit.getText().toString(); Log.v("EditText", content); //THIS IS WHERE THE ERROR OCCURS datasource.createNotes(content); finish(); } }); } This class deals with inserts, deletes and db related stuff. I've tried debugging, but it never reaches this class. public class NotesDao { public NotesBean createNotes(String content) { try { Log.v("createNotes", content); ContentValues values = new ContentValues(); values.put(DbHelper.COLUMN_CONTENT, content); long insertSeq = database.insert(DbHelper.TABLE_NOTES, null, values); Cursor cursor = database.query( DbHelper.TABLE_NOTES, //String table allColumns, //String[] columns DbHelper.COLUMN_SEQ + " = " + insertSeq, //String selection null, //String[] selectionArgs null, //String groupBy null, //String having null); //String orderBy cursor.moveToFirst(); NotesBean newNotes = cursorToNotes(cursor); cursor.close(); return newNotes; } catch (Exception e) { throw new RuntimeException(e); } } btw I have also confirmed that the db is opened through logcat... But it was in a different activity. Does that mean I should close it and open it again in this activity? Any help would be greatly appreciated! Thanks!
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/21499553
has comment: http://stackoverflow.com/comment/32456127
has answer: http://stackoverflow.com/a/21499486
has answer: http://stackoverflow.com/a/21499487
has answer: http://stackoverflow.com/a/21499527
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32467342
possible better answer: http://stackoverflow.com/a/21499519
tagged with: java
has title: NullPointerException when calling a method from a different class
has answer: http://stackoverflow.com/a/21499519

http://stackoverflow.com/comment/32278177
type: Comment
comment on: http://stackoverflow.com/a/21399048
type: AnswerComment
has text: first line of log shows null values but why its not coming inside if condition
score: 0

playframework
tags question: http://stackoverflow.com/q/21468483
tags question: http://stackoverflow.com/q/21452907
tags question: http://stackoverflow.com/q/21488545
tags question: http://stackoverflow.com/q/21482252
tags question: http://stackoverflow.com/q/21373467
tags question: http://stackoverflow.com/q/21435358
tags question: http://stackoverflow.com/q/21419825
tags question: http://stackoverflow.com/q/21482941
tags question: http://stackoverflow.com/q/21489814
tags question: http://stackoverflow.com/q/21386404
tags question: http://stackoverflow.com/q/21509812
tags question: http://stackoverflow.com/q/21506072
tags question: http://stackoverflow.com/q/21465975
type: Tag
tag name: playframework
tags question: http://stackoverflow.com/q/21367424

http://stackoverflow.com/comment/32428874
has text: You are right, condition `i < strand.length()` will never true, as the loop will break before this due to inside block `if` condition.
comment on: http://stackoverflow.com/a/21482410
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21441551
linked to: http://stackoverflow.com/q/6175753
has comment: http://stackoverflow.com/comment/32352692
has comment: http://stackoverflow.com/comment/32352645
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21442110
has comment: http://stackoverflow.com/comment/32353166
type: Question
linked to: http://stackoverflow.com/q/2631596
tagged with: junit4
tagged with: java
has answer: http://stackoverflow.com/a/21443214
has title: Mockito not allowing Matchers.any() with Integer.class
tagged with: matcher
upvote count: 4
has body: I am trying to unit test this method: /** * finds all widget descriptions containing specified text * @param searchText * @return */ @Transactional public List&lt;Integer&gt; returnWidgetIdsFromSearchWord(String searchText){ List&lt;Integer&gt; widgetIds = new ArrayList&lt;Integer&gt;(); MapSqlParameterSource args = new MapSqlParameterSource(); try{ widgetIds = (List&lt;Integer&gt;) jdbt.queryForList("SELECT idwidgets FROM descriptions " + "WHERE descriptiontext LIKE '%"+ searchText + "%'", args, Integer.class); }catch(Exception e){ } return widgetIds; } with this JUnit test: @Test public void testReturnWidgetIdsFromSearchWord(){ List&lt;Integer&gt; widgetIds = null; when(jdbt.queryForList(Matchers.anyString(), Matchers.any(MapSqlParameterSource.class), Matchers.any(Integer.class))).thenReturn(idList); widgetIds = (List&lt;Integer&gt;) dDao.returnWidgetIdsFromSearchWord("someText"); assertEquals(widgetIds, idList); } I have tried just use Integer.class without the Matcher - no luck because then it complains about needing 3 matchers. Any suggestions? And thanks
answer count: 3
has answer: http://stackoverflow.com/a/21442620
tagged with: mockito
possible better answer: http://stackoverflow.com/a/21443214
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/21442110
score: 4
favorite count: 0

http://stackoverflow.com/a/21413289
score: 5
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/21412807
downvote count: 0
has body: You can check and change these in the Settings. Tools -&gt; Options -&gt; Keymap Cool is e.g. auto-format. What is useful and what not is very dependent on your coding-stlye, teamwork etc. Also the actual shortcut can be configured, so it can be different on any computer. You can also create shortcuts like type sysout and then press Clt+Space. You find and can edit/add these here Tools -&gt; Options -&gt; Editor -&gt; Code Templates

http://stackoverflow.com/a/21495113
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Why don't you use some kind of framework for HTTP communication? In my experience Apache HTTP Client is excelent solution for such operations, it makes request very easy to implement eg. HttpPost post=new HttpPost("where_to_send_post_request_url") post.setEntity(createdURLEncodedEntity) // here you add your post parameters as entity response=client.execute(post); // execute your post String page=EntityUtils.toString(response.getEntity()); // get response as string content eg html EntityUtils.consume(response.getEntity()); // release connection etc. isn't that simple? You don't have to reinvent the wheel again:)
answers question: http://stackoverflow.com/q/21494962
score: 3
accepted answer of: http://stackoverflow.com/q/21494962

http://stackoverflow.com/comment/32340244
type: QuestionComment
comment on: http://stackoverflow.com/q/21434845
has text: You get my spiritual upvote for your non existing answer.
type: Comment
score: 1

http://stackoverflow.com/comment/32235900
score: 0
type: Comment
has text: THE ERRROR IS in added file LoginListService.java
comment on: http://stackoverflow.com/a/21375425
type: AnswerComment

http://stackoverflow.com/comment/32472240
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21508954
has text: What language? Tag it. Also fix the indentation
score: 0

http://stackoverflow.com/comment/32235115
type: AnswerComment
has text: @Acharya - I think you might find that on SunOS/Solaris that that the class *does* work. (The api talks about an ACL "model" ... not a specific implementation, and it would be weird for an Oracle Java not to support Oracle's flag-ship operating system properly.) But for old Linux systems, you might be out of luck ... unless you can find a Java 7 version that is advertised as "supported" for the old Linux platform.
type: Comment
comment on: http://stackoverflow.com/a/21361942
score: 0

http://stackoverflow.com/comment/32405065
comment on: http://stackoverflow.com/a/21470742
score: 0
type: AnswerComment
type: Comment
has text: yes, tried to run from eclipse editing the catalina.properties on ide and from command line and the common.loader looks like D:\\opt\\properties,/opt/properties,${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

http://stackoverflow.com/q/21409657
tagged with: inheritance
has answer: http://stackoverflow.com/a/21409882
score: 0
answer count: 3
duplicate of: http://stackoverflow.com/q/8790809
has answer: http://stackoverflow.com/a/21409822
linked to: http://stackoverflow.com/q/8790809
has body: I was messing the Java's Point2D.Double class and ran into some issues with changing the values of points when set equal to one-another first. This is how Points work in Java: /** Testing with Points */ System.out.println("Points: "); // Create a new point: Point2D.Double point1 = new Point2D.Double(1, 1); System.out.println(point1); // Create another new point, based on the old point Point2D.Double point2 = point1; System.out.println(point2); // Change point1, print both again. point1.setLocation(0, 1); System.out.println(point1); System.out.println(point2); The output of that code would be: Points: Point2D.Double[1.0, 1.0]Point2D.Double[1.0, 1.0]Point2D.Double[0.0, 1.0]Point2D.Double[0.0, 1.0] Notice point2 ends up with the value [0.0, 0.0], even though the only point changed was point1? Here is the same code again, but with primitive integers: /** Testing with Integers */ System.out.println("Integers: "); // Create a new integer (primitive) int integer1 = 1; System.out.println(integer1); // Create another new integer (primitive), based on the old int. int integer2 = integer1; System.out.println(integer2); // Change integer1, print both again. integer1 = 0; System.out.println(integer1); System.out.println(integer2); The output of this code would be: Integers: 1101 Only the Point2D class seems to carry values from class to class like that. The Point2D documentation for the setLocation function reads: Sets the location of this Point2D to the specified double coordinates. Notice the word THIS I was actually able to work around this problem with this code: Point2D.Double point2 = new Point2D.Double(point1.x, point1.y); but I still want to understand why the Point2D class works this way and what other classes have this same property. Thank you for reading, I look forward to reading your responses.
has answer: http://stackoverflow.com/a/21409832
accepted answer: http://stackoverflow.com/a/21409832
type: AnsweredQuestion
has title: Why do values of Point2D sometimes behave static?
tagged with: java
has comment: http://stackoverflow.com/comment/32297169
possible better answer: http://stackoverflow.com/a/21409822
type: Question
has comment: http://stackoverflow.com/comment/32297358
tagged with: variables

hql
tag name: hql
tags question: http://stackoverflow.com/q/21442221
type: Tag
tags question: http://stackoverflow.com/q/21451658
tags question: http://stackoverflow.com/q/21484978

http://stackoverflow.com/comment/32451656
type: AnswerComment
comment on: http://stackoverflow.com/a/21497178
score: 0
type: Comment
has text: could you help me by any chance set this up on here?

http://stackoverflow.com/a/21404352
downvote count: 0
answers question: http://stackoverflow.com/q/21404193
score: 5
type: AcceptedAnswer
type: Answer
has body: try Set&lt;MyClass&gt; doSomething(Set&lt;MyClass&gt; oldSet) { Set&lt;MyClass&gt; newSet =oldSet.getClass().newInstance(); return newSet; } This only works if concrete class of oldSet has a constructor without parameters.
upvote count: 5
has comment: http://stackoverflow.com/comment/32286772
accepted answer of: http://stackoverflow.com/q/21404193

http://stackoverflow.com/q/21490032
has comment: http://stackoverflow.com/comment/44036483
type: AnsweredQuestion
has body: I'm looking to export the contacts that are stored in the native database. I'm having trouble retrieving contacts from native database. Here is the query I would like to use : Get all the contacts that have at least a phone number or an email. Here is the query I am using : String dataWhere = ContactsContract.Data.MIMETYPE + "=? OR " + ContactsContract.Data.MIMETYPE + "=?"; String[] dataWhereValues = new String[]{ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE}; String[] dataProjection = new String[]{ContactsContract.Data.CONTACT_ID, ContactsContract.Data.LOOKUP_KEY, ContactsContract.Data.DISPLAY_NAME_PRIMARY, ContactsContract.Data.STARRED, ContactsContract.Data.MIMETYPE, ContactsContract.Data.DATA1, ContactsContract.Data.DATA2, ContactsContract.Data.DATA_VERSION}; Cursor data = getContentResolver().query(ContactsContract.Data.CONTENT_URI, dataProjection, dataWhere, dataWhereValues, ContactsContract.Data.CONTACT_ID); But this query gives me lots of weird contacts, and some of my contacts are also missing... Can anyone help me please ?
tagged with: java
has answer: http://stackoverflow.com/a/27836660
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/44077716
score: 0
has answer: http://stackoverflow.com/a/21491183
tagged with: contacts
has title: Android - How to retrieve contacts list as in native app?
accepted answer: http://stackoverflow.com/a/27836660
possible better answer: http://stackoverflow.com/a/21491183
tagged with: android

http://stackoverflow.com/comment/32461649
type: QuestionComment
has text: SQL injection. You should learn about it.
score: 0
comment on: http://stackoverflow.com/q/21498293
type: Comment

http://stackoverflow.com/comment/32458250
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21501207
has text: @Raghunandan thanks for the link!! This is what I was looking for! I had seen a method like that used before, but chose the one I was using because it looked simpler to code. However it seems my code isn't working... :)

http://stackoverflow.com/comment/32437381
score: 0
has text: 36^15 = 221,073,919,720,733,357,899,776, So this algorithm fails now I know that but how can I make something similar but not freeze the phone ?
comment on: http://stackoverflow.com/q/21488438
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21380147
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21375463
has comment: http://stackoverflow.com/comment/32251719
answers question: http://stackoverflow.com/q/21375463
has comment: http://stackoverflow.com/comment/32246095
type: AcceptedAnswer
downvote count: 0
has body: first of all, your main layout of home_screen should be FrameLayout, dont forget to give it some id, i.e. like this &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" 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=".HomeScreenActivity" android:id="@+id/activity_home_screen"&gt; &lt;!-- rest of your UI here --&gt; &lt;/FrameLayout&gt; Then in your onCreate create View variable and connect it to this layout by ID. From now on your setBackgroundColor() should work (below code with small changes works for me - i'm not refering to settings, but i call changeTheme() after some time with changed value) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screen); changeTheme(); } private void changeTheme() { SharedPreferences settings = getSharedPreferences(Settings, 0); View currentView = (View) findViewById(R.id.activity_home_screen); if (settings.getBoolean("Blue", true)) { currentView.setBackgroundColor(getResources().getColor(R.color.blue)); } else if (settings.getBoolean("Red", false)) { currentView.setBackgroundColor(getResources().getColor(R.color.red)); } }

readonly
tag name: readonly
tags question: http://stackoverflow.com/q/21457264
type: Tag

http://stackoverflow.com/comment/32267976
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21393235
has text: @Pshemo Yeah, I just wanted to not change too much so OP can find his way in this code.

http://stackoverflow.com/q/21363094
score: 0
has body: I am developing an app for android and for plotting a graph, I am making use of static arrays. This is the code static double[] forceatX; int size = (int) (x+5); //where X is another input by the user forceatX = new double[size]; int i=0; while (i&lt;x) { forceatX[i]+=w*((x/2)-i);//where w is another input i++; } now the problems is that sometimes, the loop does not execute the formula in the first line and returns a ZERO value after every cycle. However, the value of "i" increases after every cycle. When the loop DOES execute, instead of ADDING the new value to the present value at index "i", it OVERWRITES it and assigns the new value at that index. Any suggestion of modification to this code or a new approach will be appreciated :-)
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32212899
has comment: http://stackoverflow.com/comment/32212887
answer count: 0
has title: Static arrays in java
tagged with: java
has comment: http://stackoverflow.com/comment/32219807
type: Question
has comment: http://stackoverflow.com/comment/32216309
tagged with: arrays
has comment: http://stackoverflow.com/comment/32212907

http://stackoverflow.com/a/21502532
type: Answer
has comment: http://stackoverflow.com/comment/32469416
answers question: http://stackoverflow.com/q/21500681
has body: change your table schema CREATE TABLE `members` ( `id` int(10) unsigned NOT NULL auto_increment, `first_name` varchar(45) NOT NULL, `last_name` varchar(45) NOT NULL, `email` varchar(45) NOT NULL, `uname` varchar(45) NOT NULL, `pass` varchar(45) NOT NULL, `regdate` date NOT NULL, problem char(250) NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
score: 0

http://stackoverflow.com/q/21384495
downvote count: 0
has answer: http://stackoverflow.com/a/21384607
answer count: 3
favorite count: 0
has title: Image pattern recognition - Suggested environment?
has answer: http://stackoverflow.com/a/21384581
tagged with: pattern-recognition
upvote count: 2
type: UnansweredQuestion
has body: I need to do some work that include pattern recognition. Wanted to ask whether anyone can give me a suggestion of what language is stronger for image pattern recognition? Java, C#..
has answer: http://stackoverflow.com/a/21384803
score: 2
tagged with: java
type: Question
tagged with: c#

http://stackoverflow.com/comment/32200616
comment on: http://stackoverflow.com/q/21356277
type: QuestionComment
type: Comment
score: 7
has text: `if (found = false)` should be `if (found == false)` or even better `if (!found)`

http://stackoverflow.com/q/21368991
has body: I have the below piece of code that works fine when run from eclipse String str = "testing"; InputStream is = new ByteArrayInputStream(str.getBytes()); int length = is.available(); byte[] data = new byte[length]; is.read(data, 0, length); System.out.println("output "+new String(data)); When I break this code to post the data over network using Jerser client API and try read it back on the server using Jersey I don't get the value that I posted. The client code looks like this public static void main(String s[]) throws IOException { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); String str = "testingthi"; InputStream is = new ByteArrayInputStream(str.getBytes()); WebResource webResource = client.resource("http://192.168.1.15:8090/JersySample/resources/stream/upload"); ClientResponse response = webResource.type(MediaType.APPLICATION_OCTET_STREAM).post(ClientResponse.class,is); is.close(); } The code on the server looks like this @Consumes(MediaType.APPLICATION_OCTET_STREAM) public Response upload( InputStream is) { try{ int size = is.available(); byte data[] = new byte[size]; is.read(data,0,size); System.out.println(" Posted data is "+ new String(data)+" length is "+size+" stream size "+is.available()); is.close(); }catch (Exception e) { e.printStackTrace(); } return Response.ok().entity("Done").build(); } When I read the string using apache-commons-io API I do get the string value that I posted. Can someone explain why it doesn't work using the java.io API which was working in non-network situation?
has title: posting data over network doesn't work in java.io API
tagged with: jersey
answer count: 1
tagged with: java-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32224100
type: Question
has answer: http://stackoverflow.com/a/21369208
tagged with: java
score: 0

http://stackoverflow.com/comment/32340508
score: 0
comment on: http://stackoverflow.com/a/21434605
type: Comment
has text: you are welcome, kindly do specify best jstl/el tutorial on internet. didn't got "print the current action into system's out - there is no JSTL alternative" plz specify
type: AnswerComment

http://stackoverflow.com/a/21434433
has comment: http://stackoverflow.com/comment/32339650
type: Answer
score: 2
upvote count: 2
has body: The limits of your for-loops have been messed up, as well as the array elements that you accessed for comparison. I guess you wanted something like this... import java.util.Arrays; public class RowCompare { public static void main(String[] args) { String[] row1 = new String[10]; String[] row2 = new String[10]; String[][] fruit = {{"apple", "banana", "kiwi"},{"kiwi", "oranges", "grapes"}}; for (int i = 0; i &lt; fruit[0].length; i++ ) { for (int j = 0; j &lt; fruit[1].length; j++){ if(fruit[0][i].equals(fruit[1][j])) { row1[i] = fruit[0][i]; row2[j] = fruit[1][j]; System.out.println("Match found"); }else{ System.out.println("Not found"); } } } System.out.println("row1"); System.out.println(Arrays.deepToString(row1)); System.out.println("row2"); System.out.println(Arrays.deepToString(row2)); } } But you should probably describe what you want to do with the results. These fixed-size result arrays (String[10]) look dubious, and the currently sketched code can not easily be generalized for MORE than 2 rows. There is probably a MUCH more elegant solution using Sets and Lists ....
answers question: http://stackoverflow.com/q/21434258
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21434258
downvote count: 0

http://stackoverflow.com/comment/32336417
comment on: http://stackoverflow.com/a/21432623
type: AnswerComment
has text: Unfortunately it does not: `nested exception is java.io.FileNotFoundException: class path resource [applicationContextBase.xml] cannot be opened because it does not exist`
score: 0
type: Comment

http://stackoverflow.com/comment/32398811
comment on: http://stackoverflow.com/a/21467385
type: AnswerComment
has text: @GiuseppePes Because the compiler can't guarantee it. The method specification should.
score: 0
type: Comment

http://stackoverflow.com/comment/32266994
comment on: http://stackoverflow.com/q/21392717
score: 0
has text: Why are you trying to make it generic on T, when you just want to return `AbstractClass`?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32441072
has text: Any chance how i should go about that? Since its a void statement i cant return any information from it right?
comment on: http://stackoverflow.com/a/21491381
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32380273
has text: Parsing an array using GSON has been answered here: http://stackoverflow.com/questions/9853017/parsing-json-array-with-gson
comment on: http://stackoverflow.com/a/21455335
type: AnswerComment
score: 0
type: Comment

rgb
tags question: http://stackoverflow.com/q/21512748
type: Tag
tags question: http://stackoverflow.com/q/21382966
tags question: http://stackoverflow.com/q/21356767
tag name: rgb
tags question: http://stackoverflow.com/q/21353150

http://stackoverflow.com/comment/32477673
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21511981
has text: @CommonsWare Edited, sorry for my bad language.
type: QuestionComment

http://stackoverflow.com/a/21427144
has comment: http://stackoverflow.com/comment/59035899
accepted answer of: http://stackoverflow.com/q/21425012
has comment: http://stackoverflow.com/comment/57584295
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21425012
score: 96
has comment: http://stackoverflow.com/comment/66250099
type: Answer
has body: Sonar exclusions (like other sonar properties) have to be added to the &lt;properties&gt; section of the POM file. Like so (example from excluding jOOQ autogenerated code from current project): &lt;properties&gt; &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt; &lt;sonar.host.url&gt;http://www.example.com/&lt;/sonar.host.url&gt; &lt;sonar.jdbc.url&gt;jdbc:postgresql://www.example.com/sonar&lt;/sonar.jdbc.url&gt; &lt;sonar.jdbc.driver&gt;org.postgresql.Driver&lt;/sonar.jdbc.driver&gt; &lt;sonar.jdbc.username&gt;sonar&lt;/sonar.jdbc.username&gt; &lt;sonar.jdbc.password&gt;sonar&lt;/sonar.jdbc.password&gt; &lt;sonar.exclusions&gt;org/binarytherapy/generated/**/*, **/GuiceBindComposer.java&lt;/sonar.exclusions&gt; &lt;sonar.dynamic&gt;reuseReports&lt;/sonar.dynamic&gt; &lt;/properties&gt;
has comment: http://stackoverflow.com/comment/66215180
downvote count: 0
upvote count: 96
has comment: http://stackoverflow.com/comment/110706895
has comment: http://stackoverflow.com/comment/102013250

http://stackoverflow.com/a/21407099
upvote count: 0
has comment: http://stackoverflow.com/comment/32291596
score: -1
downvote count: 1
has body: Make your presentation as a standalone java program, and start it with Runtime.exec(). It will create a separate window.
answers question: http://stackoverflow.com/q/21406671
type: Answer

http://stackoverflow.com/comment/32458404
type: QuestionComment
has text: Change the `ImageSwitchers` width to `wrap_content`
score: 0
comment on: http://stackoverflow.com/q/21501267
type: Comment

http://stackoverflow.com/a/21388690
answers question: http://stackoverflow.com/q/21388479
downvote count: 0
has body: The Eclipse compiler compiles your code without errors. JavaC from JDK 7 (1.7.0_45) and JDK 8 (1.8.0-ea) also work. I think this is a bug in the JDK, most likely one related to bug #122881 (please note this one is fixed). I also found an issue in Google Protocol Buffer that points to another bug, but I can't find that one. You could compile it with Eclipse or JDK 7, or change the code so that it doesn't require this feature.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32259483

http://stackoverflow.com/comment/32212828
comment on: http://stackoverflow.com/q/21363051
type: Comment
has text: can you check when you create your jar you mentioned the main class name? did you used fatjar or other class archiver
score: 0
type: QuestionComment

http://stackoverflow.com/a/21446109
score: 0
type: Answer
has body: Could just re-init above your top for loop like this: while(difference &gt; epsilon){ formulaLong = 0;//reset for (int u = 0; u &lt;= N, u++){ for (int d = 0; d &lt;= N, d++){ formulaLong += Math.pow(E, -rT)*Math.pow(0.5, N)*productofVC[u][d]; } } } Not real sure how your while loop will ever stop though.
answers question: http://stackoverflow.com/q/21446011

http://stackoverflow.com/comment/32216650
has text: Ah, I'm stuck with some legacy code running on 6. Could this be a fixed feature?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21365193

http://stackoverflow.com/q/21489728
has answer: http://stackoverflow.com/a/21489761
has body: I'm putting text on screen with text.setText(text.getText().toString()+"binary message sent: "+ msg + "\n"); How can I remove the text from the screen?
has title: Android clear text
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21489761
possible better answer: http://stackoverflow.com/a/21489752
has answer: http://stackoverflow.com/a/21489752
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21489781
score: 0
tagged with: java
answer count: 3

http://stackoverflow.com/q/21399678
has comment: http://stackoverflow.com/comment/32280528
has answer: http://stackoverflow.com/a/21399907
accepted answer: http://stackoverflow.com/a/21399907
downvote count: 0
has body: My code is attempting to decompress an input stream read from a gzipped file. Here is the code snippet: InputStream is = new GZIPInputStream(new ByteArrayInputStream(fcontents.getBytes())); The file itself is fine: $cat storefront3.gz | gunzip 180028796 80026920 180028796 180026921 8002790180 800001 1800002 1800007 800008 800009 The data read in prior to the top code snippet via FileInputStream sure looks like gzip stuff (note the original file was storefront3.tsv): ��[�Rstorefront3.tsvu���0k{)�?�/FBģ��Y'��Q�a���s~���}6���d�{2+���O���D�m~�O�� But get the following: Caused by: java.io.IOException: Not in GZIP format at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:141) at java.util.zip.GZIPInputStream.&lt;init&gt;(GZIPInputStream.java:56) at java.util.zip.GZIPInputStream.&lt;init&gt;(GZIPInputStream.java:65) Here is a hex dump of the .gz file 23:40:44/storefronts:72 $od -cx storefront3.gz 0000000 037 213 \b \b 201 [ 347 R \0 003 s t o r e f 8b1f 0808 5b81 52e7 0300 7473 726f 6665 0000020 r o n t 3 . t s v \0 u 212 273 025 200 0 6f72 746e 2e33 7374 0076 8a75 15bb 3080 0000040 \f 003 k { 032 ) 200 ? 373 / F B ģ ** 302 131 030c 7b6b 291a 3f80 2ffb 4246 a3c4 cdc2 0000060 Y ' 261 200 Q 331 a 276 276 350 001 s ~ 222 262 175 2759 80b1 d951 be61 e8be 7301 927e dcb2 0000100 } 6 226 231 367 d 200 { 2 + 211 337 342 020 O 022 367d 9996 64f7 7b80 2b32 df89 10e2 f14f 0000120 022 343 035 246 D 211 m ~ 003 326 O 235 030 236 \0 \0 e312 a61d 8944 7e6d d603 9d4f 9e18 0000 0000140 \0 0000 UPDATE I also tried to use FileInputStream. Following gives same error GZIPInputStream strm = new GZIPInputStream(new FileInputStream(tmpFileName));
has comment: http://stackoverflow.com/comment/32280320
type: AnsweredQuestion
tagged with: gzip
score: 1
tagged with: java
tagged with: compression
has title: 'Not in gzip format" error when decompressing gzip inputstream in java
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/21401276
upvote count: 1
accepted answer: http://stackoverflow.com/a/21401898
downvote count: 1
type: Question
tagged with: passwords
has comment: http://stackoverflow.com/comment/32281441
tagged with: java
has comment: http://stackoverflow.com/comment/32283414
has body: I need to attribute a password to my system account (UTILISATEUR-PC/UTILISATEUR° using java code. Is there any java api or indication how to start to make this work?
answer count: 1
has comment: http://stackoverflow.com/comment/32285075
favorite count: 0
has answer: http://stackoverflow.com/a/21401898
score: 0
has title: How to add a password to a system user with java code
has comment: http://stackoverflow.com/comment/32296376
has comment: http://stackoverflow.com/comment/32288488
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32296105
tagged with: user-management

http://stackoverflow.com/comment/32446160
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21494053
has text: I am sorry for posting this...I cannot believe I missed that. Thank you.
type: Comment

http://stackoverflow.com/comment/32379840
has text: Do you think you can do it in Java :)? Check above comment http://stackoverflow.com/a/21456496/3248256
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21456813

http://stackoverflow.com/comment/56732994
score: 1
comment on: http://stackoverflow.com/a/21430792
type: AnswerComment
has text: @Wingzero Please refer theses. https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html; http://www.regular-expressions.info/modifiers.html
type: Comment

http://stackoverflow.com/a/21367125
upvote count: 4
has comment: http://stackoverflow.com/comment/32220220
has body: Decimal numbers give you 10 possibilities per byte. Hexadecimal numbers give you 16. If you could use all possible bit-patterns, you would have 256 possibilities per byte, equivalent to storing two hex digits in the space of one. Depending on how you store and retrieve your data, you may find that http://en.wikipedia.org/wiki/Base64 encoding avoids corruptions if e.g. you cannot store zero bytes, or some other bit patterns, such as bit patterns with the high bit set. There are possibilities for more sophisticated compression. One would simply to use a standard compressor, such as that provided in Java by package java.util.Zip, or equivalents in other languages. Another - if you know how common words are, would be to simply sort the words so that common words have low numbers, and therefore shorter numbers. You could also look up http://en.wikipedia.org/wiki/Huffman_coding. This would allow you to avoid having spaces between the numbers, and would also give shorter words shorter sequences of digits.
has comment: http://stackoverflow.com/comment/32221100
downvote count: 0
answers question: http://stackoverflow.com/q/21366983
score: 4
type: Answer

http://stackoverflow.com/comment/32232536
has text: why wouldn't you use `% 10`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21373842
score: 0

http://stackoverflow.com/a/21451250
type: Answer
answers question: http://stackoverflow.com/q/21450831
has body: You can create a jar with your java program and use php exec function for call this &lt;?php exec("java -jar sum1.jar num1 num2", $output); ?&gt;
has comment: http://stackoverflow.com/comment/32371041
has comment: http://stackoverflow.com/comment/32408977
has comment: http://stackoverflow.com/comment/32413149
score: 0

http://stackoverflow.com/comment/32225255
type: Comment
has text: Thanks, fixed it (I hope). Been working for 9 hours, can't see straight anymore.
type: AnswerComment
comment on: http://stackoverflow.com/a/21369456
score: 0

http://stackoverflow.com/comment/32290571
score: 0
type: AnswerComment
has text: Same way, just use a mobile UserAgent
type: Comment
comment on: http://stackoverflow.com/a/21396180

http://stackoverflow.com/comment/32301539
has text: I assume this jar is unsigned? if so you can just swap the files out with any zip editing tool. the manifest file is in the META-INF directory
score: 0
comment on: http://stackoverflow.com/q/21411834
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21397125
has title: Real size of a bare java.lang.Object in JVM
has answer: http://stackoverflow.com/a/21404153
downvote count: 0
has answer: http://stackoverflow.com/a/21397869
tagged with: jvm
possible better answer: http://stackoverflow.com/a/21397869
favorite count: 0
accepted answer: http://stackoverflow.com/a/21404153
tagged with: memory-management
upvote count: 3
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has body: According to Memory usage of Java objects: general guide : In Hotspot: a normal object requires 8 bytes of "housekeeping" space; arrays require 12 bytes (the same as a normal object, plus 4 bytes for the array length). Object size granularity In Hotspot, every object occupies a number of bytes that is a multiple of 8. If the number of bytes required by an object for its header and fields is not a multiple 8, then you round up to the next multiple of 8. This means, for example, that: a bare Object takes up 8 bytes; an instance of a class with a single boolean field takes up 16 bytes: 8 bytes of header, 1 byte for the boolean and 7 bytes of "padding" to make the size up to a multiple of 8; an instance with eight boolean fields will also take up 16 bytes: 8 for the header, 8 for the booleans; since this is already a multiple of 8, no padding is needed; an object with a two long fields, three int fields and a boolean will take up: 8 bytes for the header; 16 bytes for the 2 longs (8 each); 12 bytes for the 3 ints (4 each); 1 byte for the boolean; a further 3 bytes of padding, to round the total up from 37 to 40, a multiple of 8. My question: A bare java.lang.Object has no fields. So new Ojbect() will take 8bytes in heap. But when i test size of new Object() by using instrumentation agent util. System.out.println(MemoryUtil.deepMemoryUsageOf(new Object())); The result is 16, not 8. Can anybody tell me why? EDIT: As far as i known, the object header's size is 4byte on x86. And also object header contains the lock info for sync. // 32 bits: // -------- // hash:25 ------------&gt;| age:4 biased_lock:1 lock:2 (normal object) // JavaThread*:23 epoch:2 age:4 biased_lock:1 lock:2 (biased object) // size:32 ------------------------------------------&gt;| (CMS free block) // PromotedObject*:29 ----------&gt;| promo_bits:3 -----&gt;| (CMS promoted object) So an Object's Overhead is 4byte(object header) + 4byte(class pointer) = 8byte.
answer count: 2

http://stackoverflow.com/comment/32280421
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21399977
has text: Have a look at my answer
type: Comment

http://stackoverflow.com/q/21398033
answer count: 1
has comment: http://stackoverflow.com/comment/32276790
has comment: http://stackoverflow.com/comment/32287926
score: 0
has comment: http://stackoverflow.com/comment/32281016
has comment: http://stackoverflow.com/comment/32277497
has title: java.net.ConnectException During Reading Mail Attachment From Java Code
tagged with: email
has body: I have a Java Code to Read Mail Attachment from the Mail and Store it in a Folder in my System. Every time I compile and run the code from the terminal I get a java.net.ConnectException: Connection timed out Exception. ReadMailSample.java import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import javax.mail.Address; import javax.mail.BodyPart; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.NoSuchProviderException; import javax.mail.Part; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Store; import javax.mail.Flags.Flag; import javax.mail.search.FlagTerm; public class ReadMailSample { Properties properties = null; private Session session = null; private Store store = null; private Folder inbox = null; private String userName = "arindam@etranssolutions.com";// provide user name private String password = "etrans1@";// provide password String downloadDirectory = "/data/My Documents"; public ReadMailSample() { } public void readMails() { properties = new Properties(); properties.setProperty("mail.host", "216.12.193.230"); //properties.setProperty("mail.port", "995"); properties.setProperty("mail.transport.protocol", "imaps"); session = Session.getInstance(properties, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(userName, password); } }); try { store = session.getStore("imaps"); store.connect(); inbox = store.getFolder("INBOX"); inbox.open(Folder.READ_ONLY); Message messages[] = inbox.search(new FlagTerm( new Flags(Flag.SEEN), false)); ; System.out.println("Number of mails = " + messages.length); for (int i = 0; i &lt; messages.length; i++) { Message message = messages[i]; Address[] from = message.getFrom(); System.out.println("----------------------…
has comment: http://stackoverflow.com/comment/32365687
has comment: http://stackoverflow.com/comment/32276376
has comment: http://stackoverflow.com/comment/32276300
has answer: http://stackoverflow.com/a/21448876
accepted answer: http://stackoverflow.com/a/21448876
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32286820
has comment: http://stackoverflow.com/comment/32281584
type: Question
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/32286726
has comment: http://stackoverflow.com/comment/32276595
has comment: http://stackoverflow.com/comment/32276404

http://stackoverflow.com/a/21664329
score: 1
has body: If you want to implement this special behavior only for one class, you can create additional type with the same properties set. I am not sure that this is a real answer for your question, but see my below example. POJO class with property: @JsonDeserialize(using = SpecialJsonDeserializer.class) class Special { private String name; //getters, setters, toString } Deserializer with inner type: class SpecialJsonDeserializer extends JsonDeserializer&lt;Special&gt; { @Override public Special deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { InnerSpecial innerSpecial = jp.readValueAs(InnerSpecial.class); return innerSpecial.createRealSpecial(); } private static class InnerSpecial { public String name; public Special createRealSpecial() { Special special = new Special(); // copy other properties, add additional code special.setName(name); return special; } } } And simple usage: public class JsonProgram { public static void main(String[] args) throws IOException { Special special = new Special(); special.setName("ye"); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(special); System.out.println(json); System.out.println(mapper.readValue(json, Special.class)); } } I think, this is a little bit less hack than yours but it is still hack.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21470428
upvote count: 1

http://stackoverflow.com/q/21388954
has title: On Android, there is a way to know the list of the used apps?
tagged with: android
favorite count: 0
upvote count: 0
downvote count: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: I would like to know if there is a way to find out the apps used on Android. Exemplo : opened calendar, opened music player, etc; Obs 1: It's not the list of openned apps. Would be more like a "log" Obs 2: If there any mistake, sorry by my english.
has answer: http://stackoverflow.com/a/21389313
accepted answer: http://stackoverflow.com/a/21389313
score: -2
answer count: 1

http://stackoverflow.com/q/21513812
tagged with: blob
tagged with: java
type: UnansweredQuestion
has body: Code:- package jdbc; import java.io.File; import java.io.FileReader; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.util.Properties; public class Storing_Clob { public static void main(String[] args) throws Exception { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Properties p = new Properties(); p.put("user", "system"); p.put("password", "password"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",p); PreparedStatement pstmt = con.prepareStatement("update myclob set CLOB_VALUE=? where ID = 100"); URL url = Storing_Clob.class.getResource("/images/clob1.txt"); File file = new File(url.toURI()); FileReader fr = new FileReader(file); pstmt.setCharacterStream(1,fr,(int)file.length()); System.out.println("File size: "+(int)file.length()); System.out.println("No of rows affected: "+pstmt.executeUpdate()); con.close(); } } OutPut:- Length of string: 5395 Error:- Exception in thread "main" java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java) at oracle.jdbc.ttc7.Oall7.receive(Oall7.java) at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java) at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java) at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java) at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java) at jdbc.Storing_Image.main(Storing_Image.java:39) Erroneous Line:- System.out.println("No of rows affected: "+pstmt.executeUpdate()); I am trying to store a blob file(image) into the myblob table.The table has only one field - BLOB. Can any body please explain the re…
tagged with: oracle10g
has comment: http://stackoverflow.com/comment/32481708
has answer: http://stackoverflow.com/a/21581200
type: Question
has comment: http://stackoverflow.com/comment/32481294
score: 0
has title: Error in updating BLOB file
answer count: 1

http://stackoverflow.com/q/21451008
has body: I am completely new to Java environment. I am facing an issue after executing a Jar file. I am using Eclipse KEPLER for Java programming. I exported my project using File-&gt;Export -&gt;Runnable Jar file. The jar file is created. When I launched the jar using Java - jar file names. In jar I got some errors which I have attached to these questions. I looked at this invalid SHA1 signature file digest and tried the same. I am still getting the issue. Error : Exception in thread "main" java.lang.SecurityException:invalid SHA1 Signature file digest for com/microsoft/sqlserver/jdbc/SQLServerException.class
has answer: http://stackoverflow.com/a/54873658
favorite count: 0
has comment: http://stackoverflow.com/comment/32376417
has answer: http://stackoverflow.com/a/34508510
has comment: http://stackoverflow.com/comment/32373961
accepted answer: http://stackoverflow.com/a/21452931
has comment: http://stackoverflow.com/comment/32369725
type: AnsweredQuestion
score: 3
tagged with: sha1
linked to: http://stackoverflow.com/q/8176166
upvote count: 3
tagged with: java
has title: Java Security Exception Invalid SHA1 Jar file
has answer: http://stackoverflow.com/a/21452931
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/34508510
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/32375118
tagged with: sql-server
has comment: http://stackoverflow.com/comment/32374193
answer count: 3
has comment: http://stackoverflow.com/comment/32374481

http://stackoverflow.com/comment/32412829
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21475629
has text: I'm sure a script can be made that lists the import statements of each source file only, and can filter out the ones from the JDK and the application itself. I'd make it a linux shell script for maximum flexibility and online documentation, if you're one Windows you can use Cygwin to run it.

http://stackoverflow.com/comment/32422603
score: 2
comment on: http://stackoverflow.com/a/21481390
type: AnswerComment
type: Comment
has text: Increasing java heap space is by no means a fix, only a temporary stop-gap.

http://stackoverflow.com/comment/32337442
has text: Okay that sounds very well. I tried it but I don't understand how to access different words.. Can you show me an example maybe?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21433359

http://stackoverflow.com/a/21418550
has comment: http://stackoverflow.com/comment/32313002
has body: Your problem is here. get(j).compareTo(get(j+1)) When j is the index of the last thing on the list, this is making you compare to null, which throws the exception. In the loop, instead of comparing j &lt; length(), you need to compare j &lt; length() - 1, so that you avoid the case where j is the last thing on the list.
score: 2
has comment: http://stackoverflow.com/comment/32312043
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21418468
upvote count: 2

http://stackoverflow.com/q/21362642
score: 0
has comment: http://stackoverflow.com/comment/32212009
accepted answer: http://stackoverflow.com/a/21362866
answer count: 1
tagged with: netbeans-7
tagged with: jinternalframe
has title: displaying jInternalFrame from another jinternalFrame over desktop pane in netbeans
has comment: http://stackoverflow.com/comment/32212387
type: AnsweredQuestion
tagged with: netbeans
has body: I want to display jInternalFrame1 over a desktop pane in a jFrame.jInternalFrame1 contains a Button for displaying jInternalFrame2 over the desktop pane by removing jInternalFrame1. public class main extends javax.swing.JFrame { a aa=new a();//jInternalFrame1 public main() { initComponents(); jDesktopPane1.add(aa); aa.setVisible(true); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new main().setVisible(true); } }); } private javax.swing.JDesktopPane jDesktopPane1; } code under button in jInternalFrame1; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: b bb=new b();//jInternalFrame2 this.dispose(); bb.setVisible(true); } But this code is not displaying the jInternalFrame2.I have seen many solutions for this.But I dont understand how to add these into the desktop pane.sorry for my poor English. Thank you
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/21362866
type: Question

http://stackoverflow.com/q/21478341
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/28771063
favorite count: 0
accepted answer: http://stackoverflow.com/a/28771063
upvote count: 7
type: Question
type: AnsweredQuestion
score: 7
tagged with: java
has title: Process Amazon SQS messages from queue asynchronously in Java
has body: I am having hard time figuring out how to process messages from Amazon SQS. I am trying to implement following: Listener on SQS Process message from queue and add it to DB Delete processed message from queue What bothers me a lot is how to implement step 2. I have class SQSConnector and ProfileDao. Right now I want simple implementation, by initializing SQSConnector in ProfileDao and receiving messages from queue. My idea is to start new thread, start polling messages and when queue is empty interrupt the thread from ProfileDao. What's the best way of returning/processing messages (callback function?), and if there is another way of doing this I am open for options. Thank you
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21382091
accepted answer of: http://stackoverflow.com/q/21378295
answers question: http://stackoverflow.com/q/21378295
type: Answer
upvote count: 4
downvote count: 0
has body: Got it! It's an error on SWT wiki: xulrunner 24.x requires SWT 4.4. I've installed swt-4.4M5 and now I can embed xurlrunner 24 64bit
score: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/32332465
comment on: http://stackoverflow.com/q/21428558
has text: Yes that is evident since it's printing the correct data. Isn't this the format you need?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32241250
type: Comment
type: QuestionComment
score: 0
has text: It is very standard in codenameone: [multibutton](http://www.codenameone.com/using-multibutton.html)
comment on: http://stackoverflow.com/q/21378084

http://stackoverflow.com/q/21406265
upvote count: 147
has comment: http://stackoverflow.com/comment/32290120
has answer: http://stackoverflow.com/a/21406600
has answer: http://stackoverflow.com/a/43112126
has answer: http://stackoverflow.com/a/68260328
has comment: http://stackoverflow.com/comment/43708834
tagged with: java
accepted answer: http://stackoverflow.com/a/21406600
has answer: http://stackoverflow.com/a/35320306
tagged with: gradle
answer count: 7
has answer: http://stackoverflow.com/a/57251619
has answer: http://stackoverflow.com/a/40155234
tagged with: testing
has body: I have a a Java program which reads a System property System.getProperty("cassandra.ip"); and I have a Gradle build file that I start with gradle test -Pcassandra.ip=192.168.33.13 or gradle test -Dcassandra.ip=192.168.33.13 however System.getProperty will always return null. The only way I found was to add that in my Gradle build file via test { systemProperty "cassandra.ip", "192.168.33.13" } How Do I do it via -D
possible better answer: http://stackoverflow.com/a/35320306
score: 147
has answer: http://stackoverflow.com/a/76247559
linked to: http://stackoverflow.com/q/23689054
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: How to give System property to my test via Gradle and -D
type: Question

http://stackoverflow.com/a/21353531
answers question: http://stackoverflow.com/q/21353339
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21353339
has body: You can't create the panel and set the BoxLayout in one statement (like you do for the BorderLayout). You need to use two statements since the BoxLayout needs a reference to the panel that you want to use as a BoxLayout. 1) Read the section from the Swing tutorial on How to Use Box Layout. It will show you how to create a panel using a BoxLayout and how to add components to the panel. 2) Or, you can check out the Box class. It is a convenience class that will allow you to create a container using a BoxLayout in a single statement. Box timing = new Box(...); timing.add( t ); Take a look at the table of contents for the tutorial as it contains many tutorial on basic Swing functionality.
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/21368320
has answer: http://stackoverflow.com/a/21368332
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32222681
has title: Main program in java can not open Spring bean configuration file
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21368332
type: Question
has comment: http://stackoverflow.com/comment/32222607
has body: I just started to learn Spring Framework, installed Eclipse and added Spring and Maven. I made my first program, of course, Hello World but using spring beans. Everything was "by the book", I made some class, let's say Person, and main class that will instantiate it through beans in xml spring beans configuration file. I made beans.xml file right in my project just like in book example, and wrote following code: package maven.aplikacije.Person; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class App { public static void main( String[] args ) { ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml"); Person helloBean = (Person)ac.getBean("person"); helloBean.sayHello(); } } This is a beans.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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;bean id = "person" class = "maven.aplikacije.Person.Person"&gt;&lt;/bean&gt; &lt;/beans&gt; However, it does not work. It lists following error (among others): INFO: Loading XML bean definitions from class path resource [Person/beans.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [Person/beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [Person/beans.xml] cannot be opened because it does not exist I tried to write ApplicationContext ac = new ClassPathXmlApplicationContext("Person//beans.xml"); and plenty more different versions but nothing works. Of course, I also defined Person class. :) Why doesn't program "see" beans.xml file? Thank you in advance!
has comment: http://stackoverflow.com/comment/32278033
answer count: 1
tagged with: javabeans
has comment: http://stackoverflow.com/comment/32222421

http://stackoverflow.com/a/21401538
answers question: http://stackoverflow.com/q/21390878
has body: I am doing right now, what you want to do. I have a Project which is deployable on OpenShift and on my local installation of the jboss 7.1. It is very strange that eclipse shows your jboss as always starting. I would recommend to delete the server in eclipse and try to add it again. Also you can add the project in the servers view. For that you right click your server and choose "Add and Remove...". You can choose the Project, add it to the server and eclipse is deploying it.
score: 0
type: Answer

http://stackoverflow.com/q/21378837
has title: How parsethrough jsonarray and store each column in textbox
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21449460
type: Question
has comment: http://stackoverflow.com/comment/32255568
has comment: http://stackoverflow.com/comment/32259172
tagged with: jsp
tagged with: jquery
score: 0
has body: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> ` Insert title here Send an HTTP GET request to a page and get the result back i am trying to get data from db create jsonarray from resultset and use it to populate text box when a tables row is clicked so far i have displayed the data using alert and i am getting the exact data but i want to access column by column and populate corresponding text <%@page import="org.json.JSONObject"%> <%@page import="java.lang.Thread.State"%> <%@page import="org.json.JSONArray "%> <%@page import="org.json.JSONObject" %> <%@ page language="java" import="java.io.*,java.sql.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here <% try{ Class.forName("com.mysql.jdbc.Driver"); String mySqlUrl = "jdbc:mysql://localhost:3306/permit"; Connection con = DriverManager.getConnection(mySqlUrl ,"root","moodle123"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from enterprisemaster where enterpriseId=1001"); JSONArray respJson = new JSONArray(); java.sql.ResultSetMetaData rsmd = rs.getMetaData(); int numColumns = rsmd.getColumnCount(); while (rs.next()) { JSONObject obj = new JSONObject(); for (int i = 1; i < numColumns + 1; i++) { String columnName = rsmd.getColumnName(i); obj.put(columnName, rs.getString(columnName)); } respJson.put(obj); } respJson.toString(); out.println(respJson); } catch(Exception e) { System.out.println(e); } %> the out put from the alert box is this Insert title here [{"phone":"0471-2318922,0435-6203","fax":"0471- 2315893","website":"www.ksidc.org","enterpriseName":"KERALA STATE INDUSTRIAL DEVELOPMENT CORPORATION LIMITED","enterpriseId":"1001","factoryAddress":"","isActive":"1","category":"Financial Services","chairmanName":"Sri.T.K.A.Nair","administrativeDept":"Industries Department","incorporationDate":"21/07/1961","email":"ksidc@vsnl.com","incorporationAct":"Companies Act,1956","mdName":"Sri.Alkesh Kum…
answer count: 1
has answer: http://stackoverflow.com/a/21449460

jakarta-ee
tags question: http://stackoverflow.com/q/21441578
tags question: http://stackoverflow.com/q/21439553
tags question: http://stackoverflow.com/q/21359986
tags question: http://stackoverflow.com/q/21463646
type: Tag
tags question: http://stackoverflow.com/q/21416462
tags question: http://stackoverflow.com/q/21380809
tags question: http://stackoverflow.com/q/21496076
tags question: http://stackoverflow.com/q/21370852
tags question: http://stackoverflow.com/q/21401032
tags question: http://stackoverflow.com/q/21470045
tags question: http://stackoverflow.com/q/21496465
tags question: http://stackoverflow.com/q/21411274
tags question: http://stackoverflow.com/q/21365508
tags question: http://stackoverflow.com/q/21446883
tags question: http://stackoverflow.com/q/21416912
tags question: http://stackoverflow.com/q/21454925
tags question: http://stackoverflow.com/q/21404209
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/21511326
tags question: http://stackoverflow.com/q/21415177
tags question: http://stackoverflow.com/q/21477139
tags question: http://stackoverflow.com/q/21481669
tags question: http://stackoverflow.com/q/21448288
tags question: http://stackoverflow.com/q/21363423
tags question: http://stackoverflow.com/q/21383984
tags question: http://stackoverflow.com/q/21481867
tags question: http://stackoverflow.com/q/21422464
tags question: http://stackoverflow.com/q/21388977
tags question: http://stackoverflow.com/q/21470054
tags question: http://stackoverflow.com/q/21368008
tags question: http://stackoverflow.com/q/21367855
tags question: http://stackoverflow.com/q/21386131
tags question: http://stackoverflow.com/q/21398613
tags question: http://stackoverflow.com/q/21485194
tags question: http://stackoverflow.com/q/21404315
tags question: http://stackoverflow.com/q/21390770
tags question: http://stackoverflow.com/q/21474634
tags question: http://stackoverflow.com/q/21397816
tags question: http://stackoverflow.com/q/21475651
tags question: http://stackoverflow.com/q/21454898
tags question: http://stackoverflow.com/q/21426711
tags question: http://stackoverflow.com/q/21453373
tags question: http://stackoverflow.com/q/21513124
tags question: http://stackoverflow.com/q/21394479
tags question: http://stackoverflow.com/q/21405606
tags question: http://stackoverflow.com/q/21496987
tags question: http://stackoverflow.com/q/21390643
tags question: http://stackoverflow.com/q/21430653
tags question: http://stackoverflow.com/q/21376484
tags question: http://stackoverflow.com/q/21456080
tags question: http://stackoverflow.com/q/21469653
tags question: http://stackoverflow.com/q/21389064
tags question: http://stackoverflow.com/q/21497350
tags question: http://stackoverflow.com/q/21406511
tags question: http://stackoverflow.com/q/21452581
tags question: http://stackoverflow.com/q/21375902
tags question: http://stackoverflow.com/q/21478666
tags question: http://stackoverflow.com/q/21483995
tags question: http://stackoverflow.com/q/21376195
tags question: http://stackoverflow.com/q/21449646
tags question: http://stackoverflow.com/q/21368583
tags question: http://stackoverflow.com/q/21368316
tags question: http://stackoverflow.com/q/21399103

http://stackoverflow.com/comment/32425342
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21477621
has text: I would like to reference symbols that are in the _same_ compilation unit as the code that is generated from the DSL code. Compilers for languages like Scala or Kotlin can process mixed code that references each other and I wanted to see whether there's a general approach to doing that without re-implementing part of a Java compiler.

http://stackoverflow.com/comment/32282738
has text: @Vach I didn't mention these parameters at all - I just commented that they won't solve the problem instead of just delaying it. In my opinion the best way to spot a memory leak is to reduce the given memory given the parameters presented by lakshman to a bare minimum and then use a profiler to produce heapdumps which you then can start to analyze in more detail. Why you should reduce the memory? As this will force GC sooner and your problem will probably occur earlier. Moreover the heapdumps will not occupy to much disk-space too.
comment on: http://stackoverflow.com/q/21376629
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32538764
has text: `You will only be able to do this using a custom view in your action bar` i'll google this. but if you have a quick link, i'll be grateful.
type: Comment
comment on: http://stackoverflow.com/a/21502044
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32335719
has text: Tim if i replace all whitespace with ".*", when in editText i write "table brown", the search return nothing, the array is empty.. What am I doing wrong?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21432110
score: 0

http://stackoverflow.com/comment/32392260
comment on: http://stackoverflow.com/q/21458255
has text: I managed to do it, not that hard apperantly
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21358895
has comment: http://stackoverflow.com/comment/32206783
type: Answer
has body: If you're really that new to programming, I would suggest to use an IDE (development environment) like for instance Netbeans or Eclipse and create a new JFrame form. You can then use the design view to graphically design your interface, IE drag your button on the screen. No need to go around programming frames. All you need to code is the implementation; what happens after you click the button. After you posted the code, I had another look and this is what I've found: Both classes have main methods. I ran both and each opened up a different window for me. Typically, you'll only want one main method. It's the main method! It's the starting point of your program and you can of course only have one starting point. At this time, your program is going to do two different things depending on what main method you run. Still, this isn't your issue, because both mains are running for me. I think you must have the wrong version of java or something?
has comment: http://stackoverflow.com/comment/32206330
score: 0
has comment: http://stackoverflow.com/comment/32205726
answers question: http://stackoverflow.com/q/21358791

http://stackoverflow.com/comment/32441271
type: QuestionComment
score: 0
has text: @eddie_j You are confusing finalizers and finally blocks. They are two different concepts.
comment on: http://stackoverflow.com/q/21490590
type: Comment

http://stackoverflow.com/comment/32353103
type: Comment
type: AnswerComment
has text: How do you retrieve the list of users per address? What's the foreign key in the users table?
comment on: http://stackoverflow.com/a/21436950
score: 0

http://stackoverflow.com/a/36162041
type: Answer
answers question: http://stackoverflow.com/q/21383734
score: 2
upvote count: 2
downvote count: 0
has body: You should be able to simply swap the schema declaration from 2.4 to 3.0. Scientific method Initially I set off to prove it by doing diff between 2.4 and 2.5 and another one comparing 2.5 and 3.0. I have convinced myself that the differences between 2.4 and 2.5 are only additive and the name space have shifted from j2ee to javaee. However xsd schema for 3.0 is smaller then 1/3rd of the other two versions. Not sure how to proceed in this case (any ideas welcome!) You can download all schemas from here and do the comparison yourself: web xml v2.4 xsd schema web.xml v2.5 xsd schema web.xml v3.0 xsd schema Not so scientific method Here are the what's new articles describing each new version of the standard: What's new in Servlet 2.4 What's new in Servlet 2.5 What's new in Servlet 3.0 If you read in, the changes to web.xml descriptor mentioned in the articles are minute. What I would do is simply list all the elements in your original web.xml and confirm that they do exist in this document describing the 3.0 schema. Hope this helps!

http://stackoverflow.com/comment/32230066
type: AnswerComment
score: 0
type: Comment
has text: Did you add all the `listNew` elements to newly created collection
comment on: http://stackoverflow.com/a/21371059

http://stackoverflow.com/q/21399662
has comment: http://stackoverflow.com/comment/32278661
has title: Return result of thread to a separate thread
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21401479
tagged with: multithreading
has body: For example if I have thread A and thread B. Thread A is my main thread where most of the application runs but when I need a value fetched from MySQL or another external source I create a new thread (thread B). What is the best way of returning the value from thread B to thread A for further processing without causing thread A to wait until the value is available?
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21402758
type: Question
linked to: http://stackoverflow.com/q/14148422
has answer: http://stackoverflow.com/a/21399921
has answer: http://stackoverflow.com/a/21401479
possible better answer: http://stackoverflow.com/a/21399719
answer count: 6
has answer: http://stackoverflow.com/a/21400102
has answer: http://stackoverflow.com/a/21399719
has answer: http://stackoverflow.com/a/21399989

http://stackoverflow.com/comment/47864465
score: 0
type: Comment
has text: Is there a clear/clean informative page about how the pack files works?
comment on: http://stackoverflow.com/a/21494340
type: AnswerComment

http://stackoverflow.com/comment/32225088
has text: Don't compare String values using `==`. Use `equals()`.
comment on: http://stackoverflow.com/q/21369734
score: 12
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21413818
favorite count: 0
has title: Determine position of arguments in drools
possible better answer: http://stackoverflow.com/a/21454450
has answer: http://stackoverflow.com/a/21454450
downvote count: 1
has answer: http://stackoverflow.com/a/21423862
type: AnsweredQuestion
tagged with: java
has body: I am executing drools rules with such parameters. session.execute(Arrays.asList(new Object[]{fileName,tableName})); where fileName and tableName = String But when I run some rule: rule"A" when $fileName: String() $tableName: String() then System.out.println($fileName + " " + $tableName); end I have fileName in BOTH arguments. fileName = fileName tableName = fileName How can I declare them, to have correct argument values in the rule ?
score: -1
type: Question
answer count: 2
tagged with: drools
upvote count: 0
accepted answer: http://stackoverflow.com/a/21423862

http://stackoverflow.com/q/21513962
has answer: http://stackoverflow.com/a/21513978
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21513976
has title: Incompatible operand types
has comment: http://stackoverflow.com/comment/32481183
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32481154
has answer: http://stackoverflow.com/a/21513974
score: 0
answer count: 3
has body: I have created a class and its child. Now, I need to check if the child is the instance of parent but I get Incompatible operand types. class Vehicle { } class Car extends Vehicle { } public class Test { public static void main(String[] args) { Vehicle v = new Vehicle(); Car c = new Car(); if (c instanceof v) { } } }

shorthand
tags question: http://stackoverflow.com/q/21484584
tag name: shorthand
type: Tag

http://stackoverflow.com/comment/32231986
has text: Read tutorial on Java for beginners.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21365098

http://stackoverflow.com/comment/32208884
has text: Hello friend, I have also tried Netbeans with the same steps, but not generated, and does not indicate an error me ...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21360681
type: AnswerComment

http://stackoverflow.com/q/21392969
upvote count: 11
favorite count: 0
answer count: 5
tagged with: emoticons
score: 11
accepted answer: http://stackoverflow.com/a/21405222
type: AnsweredQuestion
has body: Like the title says. I want to find out if a given java String contains an emoticon. I can't use Character.UnicodeBlock.of(char) == Character.UnicodeBlock.EMOTICONS since that requires API level 19. I found this code for iOS but it isn't really applicable since it looks like java and objective-c handle surrogate pairs in different manners. The documentations I've looked through tell me that: A char value, therefore, represents Basic Multilingual Plane (BMP) code points, including the surrogate code points, or code units of the UTF-16 encoding I'm not quite sure what that means. Does that simply mean that they also include the BMP point as their first number? According to Wikipedia the emoticon set lies between 0x1f600 and 0x1f64f but I don't know how to check if the char is in that range. I had hoped that something like this would work but it didn't if (0x1f600 &lt;= a &amp;&amp; a &lt;= 0x1f64f) { Print.d("Unicode", "groovy!"); } So how do I go about this?
tagged with: java
has answer: http://stackoverflow.com/a/74800286
has answer: http://stackoverflow.com/a/21405222
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/72574688
possible better answer: http://stackoverflow.com/a/49849418
has title: Detecting if a character in a String is an emoticon (using Android)
tagged with: android
has answer: http://stackoverflow.com/a/21395585
has answer: http://stackoverflow.com/a/49849418

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/21436891
tags question: http://stackoverflow.com/q/21409865
tags question: http://stackoverflow.com/q/21423292
tags question: http://stackoverflow.com/q/21366491
tags question: http://stackoverflow.com/q/21360377
tags question: http://stackoverflow.com/q/21407607
tags question: http://stackoverflow.com/q/21487089
tags question: http://stackoverflow.com/q/21392994
tags question: http://stackoverflow.com/q/21420259
tags question: http://stackoverflow.com/q/21388183
tags question: http://stackoverflow.com/q/21462677
tags question: http://stackoverflow.com/q/21476352
tags question: http://stackoverflow.com/q/21438188
tags question: http://stackoverflow.com/q/21380475
tags question: http://stackoverflow.com/q/21404252
tags question: http://stackoverflow.com/q/21354429
tags question: http://stackoverflow.com/q/21494240
tags question: http://stackoverflow.com/q/21389178
tags question: http://stackoverflow.com/q/21410243
tags question: http://stackoverflow.com/q/21402385
tags question: http://stackoverflow.com/q/21385635
type: Tag
tags question: http://stackoverflow.com/q/21354546
tags question: http://stackoverflow.com/q/21370135
tags question: http://stackoverflow.com/q/21479713
tags question: http://stackoverflow.com/q/21488545
tags question: http://stackoverflow.com/q/21377014
tags question: http://stackoverflow.com/q/21435707
tags question: http://stackoverflow.com/q/21440646
tags question: http://stackoverflow.com/q/21455143
tags question: http://stackoverflow.com/q/21351406
tags question: http://stackoverflow.com/q/21453203
tags question: http://stackoverflow.com/q/21414869
tags question: http://stackoverflow.com/q/21482378
tags question: http://stackoverflow.com/q/21402950
tags question: http://stackoverflow.com/q/21470428
tags question: http://stackoverflow.com/q/21465337
tags question: http://stackoverflow.com/q/21425781
tags question: http://stackoverflow.com/q/21372618
tags question: http://stackoverflow.com/q/21367158
tags question: http://stackoverflow.com/q/21494821
tags question: http://stackoverflow.com/q/21395699
tags question: http://stackoverflow.com/q/21390915
tags question: http://stackoverflow.com/q/21373467
tags question: http://stackoverflow.com/q/21447262
tags question: http://stackoverflow.com/q/21373498
tags question: http://stackoverflow.com/q/21492529
tags question: http://stackoverflow.com/q/21415887
tags question: http://stackoverflow.com/q/21482979
tags question: http://stackoverflow.com/q/21413738
tags question: http://stackoverflow.com/q/21438744
tags question: http://stackoverflow.com/q/21429424
tags question: http://stackoverflow.com/q/21460461
tags question: http://stackoverflow.com/q/21388925
tags question: http://stackoverflow.com/q/21509973
tags question: http://stackoverflow.com/q/21371390
tags question: http://stackoverflow.com/q/21383019
tag name: json
tags question: http://stackoverflow.com/q/21474028
tags question: http://stackoverflow.com/q/21511484
tags question: http://stackoverflow.com/q/21505997
tags question: http://stackoverflow.com/q/21353134
tags question: http://stackoverflow.com/q/21393792
tags question: http://stackoverflow.com/q/21361318
tags question: http://stackoverflow.com/q/21435990
tags question: http://stackoverflow.com/q/21499012
tags question: http://stackoverflow.com/q/21385450
tags question: http://stackoverflow.com/q/21431399
tags question: http://stackoverflow.com/q/21444795
tags question: http://stackoverflow.com/q/21373988
tags question: http://stackoverflow.com/q/21497856
tags question: http://stackoverflow.com/q/21495272
tags question: http://stackoverflow.com/q/21485923
tags question: http://stackoverflow.com/q/21477707
tags question: http://stackoverflow.com/q/21447604
tags question: http://stackoverflow.com/q/21378837
tags question: http://stackoverflow.com/q/21400067
tags question: http://stackoverflow.com/q/21465370
tags question: http://stackoverflow.com/q/21475267
tags question: http://stackoverflow.com/q/21504142

http://stackoverflow.com/q/21450329
has body: I have a 2d int array. I want it to be written in a CSV file. I used the following code BufferedWriter writer = new BufferedWriter(new FileWriter("filecsv.csv")); for(int index11 = 0; index11 &lt; a.length; index11++) { for(int subIndex1 = 0; subIndex1 &lt; 2; subIndex1++) { writer.write(a[index11][subIndex1]); System.out.print(","); } System.out.println(); } My output should be like 1,2 3,4 5,6 but nothing is written in my CSV file and also in the console window nothing gets printed. Can someone tell me what I did wrong?
has answer: http://stackoverflow.com/a/21450501
has answer: http://stackoverflow.com/a/21450445
has comment: http://stackoverflow.com/comment/32368660
has answer: http://stackoverflow.com/a/21450399
accepted answer: http://stackoverflow.com/a/21450399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32368594
tagged with: java
has comment: http://stackoverflow.com/comment/32368552
type: Question
possible better answer: http://stackoverflow.com/a/21450501
tagged with: arrays
has comment: http://stackoverflow.com/comment/32368554
has title: How to write array into file with column seperated values
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/comment/32310180
score: 0
has text: I managed to rebuild my client side and now it's ok. The threads are killed more often so I don't get so many in one time. But I would like to know how to: 1. Set a maximum life time of a thread 2. Create a threadpool of max ~1000 threads.
type: Comment
comment on: http://stackoverflow.com/a/21354770
type: AnswerComment

http://stackoverflow.com/comment/32299659
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21410359
has text: I updated my question with some background detail. Don´t grudge me for being insane ;-)

http://stackoverflow.com/q/21388479
linked to: http://stackoverflow.com/q/9704219
tagged with: inheritance
has title: How to rectify? -- "both define getObjectCopy(), but with unrelated return types" -- but it's *one* function
linked to: http://stackoverflow.com/q/21421576
possible better answer: http://stackoverflow.com/a/21388690
has answer: http://stackoverflow.com/a/21388690
tagged with: interface
has comment: http://stackoverflow.com/comment/32259784
has comment: http://stackoverflow.com/comment/32259675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32259008
has answer: http://stackoverflow.com/a/21388819
tagged with: oop
has comment: http://stackoverflow.com/comment/32259634
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21388819
type: Question
answer count: 2
has body: I have the following interface heirarchy (with all non-relevant functions stripped out). I am getting this error when trying to compile it: types ValidLineGettable and ValidateValue&lt;java.lang.String&gt; are incompatible; both define getObjectCopy(), but with unrelated return types This is all derived from the same function--not two different functions with the same name, the same function in the same interface. How do you deal with interfaces that must inherit from two different interfaces that themselves must inherit from a singular base interface? There are two SO questions I've found regarding different functions that happen to have the same name Inherit method with unrelated return types Java - Method name collision in interface implementation In my case it's the same function, both conceptually and in name. (Although I am interested in opinions on if the Copyable interface is a good idea to begin with...it's in a lot of code that I use, and has worked well for me...I am mostly interested in the general inheritance/design question.) I am not clear on how to best deal with this. I would appreciate any advice. Thank you. public interface Copyable { Copyable getObjectCopy(); } interface ValidateValue&lt;O&gt; extends Copyable { //Other functions... @Override ValidateValue&lt;O&gt; getObjectCopy(); } //For classes that may be able to be Decorated into a TextLineValidator interface ValidLineGettable extends Copyable { //Other functions... ValidLineGettable getObjectCopy(); } interface TextLineValidator extends ValidateValue&lt;String&gt;, ValidLineGettable { //Other functions... @Override TextLineValidator getObjectCopy(); } The error: C:\java_code\Copyable.java:17: types ValidLineGettable and ValidateValue&lt;java.lang.String&gt; are incompatible; both define getObjectCopy(), but with unrelated return types interface TextLineValidator extends ValidateValue&lt;String&gt;, ValidLineGettable { ^ 1 error Tool completed with exit code 1
linked to: http://stackoverflow.com/q/2598009

http://stackoverflow.com/a/21419360
answers question: http://stackoverflow.com/q/21419112
has body: Without looking in the code I know that a HashMap requires, at minimum, a base object, a hashtable array, and individual objects for each hash entry. Generally an int value would have to be stored as an Integer object so that's more objects. Let's assume you have 30 unique characters: 32 bytes for the base object 256 bytes for a minimum-size hashtable array 32 bytes for each of the 30 table entries 16 bytes (if highly optimized) for each of 30 Integers 32 + 256 + 960 + 480 = 1728 bytes. That's for a minimal, non-fancy implementation. The array of 256 ints would be about 1056 bytes.
type: Answer
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/21426027
downvote count: 0
has body: The problem is your spinner view so change your code android.R.layout.simple_spinner_dropdown_item to android.R.layout.simple_spinner_item. eg : ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(ListSpinners.this, android.R.layout.simple_spinner_item, list);
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21360823

http://stackoverflow.com/comment/32387391
comment on: http://stackoverflow.com/q/21461130
score: 0
type: Comment
has text: my programme is actually a bank programme. i want it to be for example "I deposit 70$ at 8:15:17" and "I withdraw 50$ at 8:15:30" but now the displayed time just keep showing the same timing.
type: QuestionComment

http://stackoverflow.com/q/21351569
has comment: http://stackoverflow.com/comment/32192309
has answer: http://stackoverflow.com/a/51496807
score: 1
tagged with: java
tagged with: eclipse
has body: Hello I want an intent on my expandable list view.. but every time I click on a child.. it just shows a TOAST.. and does not go on my intent.. my intents are on the last part of the code.. any help is highly appreciated.. import java.util.ArrayList; import android.app.ExpandableListActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; public class LessonsMenu extends ExpandableListActivity implements OnChildClickListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); ExpandableListView expandbleLis = getExpandableListView(); expandbleLis.setDividerHeight(2); expandbleLis.setGroupIndicator(null); expandbleLis.setClickable(true); setGroupData(); setChildGroupData(); NewAdapter mNewAdapter = new NewAdapter(groupItem, childItem); mNewAdapter .setInflater( (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), this); getExpandableListView().setAdapter(mNewAdapter); expandbleLis.setOnChildClickListener(this); } public void setGroupData() { groupItem.add("Audio"); groupItem.add("Camera"); groupItem.add("External Storage"); groupItem.add("Input"); groupItem.add("Security"); groupItem.add("Sensors"); groupItem.add("Dalvik"); groupItem.add("Bluetooth"); groupItem.add("DRM"); groupItem.add("Encryption"); groupItem.add("Graphics"); groupItem.add("Media"); groupItem.add("Kernel"); groupItem.add("Power"); } ArrayList&lt;String&gt; groupItem = new ArrayList&lt;String&gt;(); ArrayList&lt;Object&gt; childItem = new ArrayList&lt;Object&gt;(); public void setChildGroupData() { ArrayList&lt;String&gt; child = new ArrayList&lt;String&gt;(); child.add("Implementation"); child.add("Latency Measure"); child.add("Design"); childItem.add(child); c…
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21351876
upvote count: 1
type: Question
has title: Intents on child on Expandable ListView

http://stackoverflow.com/comment/32198118
comment on: http://stackoverflow.com/q/21354828
score: 0
type: Comment
has text: Try cleaning and re-executing?
type: QuestionComment

http://stackoverflow.com/a/21489337
has comment: http://stackoverflow.com/comment/32437552
has body: For uploading file you should use post and multipart request amd to delete - delete.
downvote count: 1
has comment: http://stackoverflow.com/comment/32437683
has comment: http://stackoverflow.com/comment/32438234
has comment: http://stackoverflow.com/comment/32437330
upvote count: 1
answers question: http://stackoverflow.com/q/21489231
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32711985

http://stackoverflow.com/comment/50897286
type: Comment
comment on: http://stackoverflow.com/a/21405044
score: 0
type: AnswerComment
has text: @bobbel: `In general, Java objects consuming the same size of memory in a 32 as in a 64-bit VM.` Are you sure? Objects are referenced ultimately via a memory pointer. Object references will be larger, as will the space needed to reference any objects the original object defines as properties or fields.

el
tags question: http://stackoverflow.com/q/21480040
type: Tag
tag name: el

http://stackoverflow.com/comment/32272108
type: Comment
has text: `BETWEEN` isn't an `INTERVAL`. It's an operator. `INTERVAL` lets you say things like `1 month 1 day`, working with dates as dates and intervals, not just counts of days or date literals.
score: 1
comment on: http://stackoverflow.com/a/21379203
type: AnswerComment

http://stackoverflow.com/q/21447228
answer count: 2
score: 5
has body: I was testing my android app on device by enabling device show layout boundaries in developer option on device. I check my listview with inflated view with textviews , rating bar and other views clearly seen as shown below . later I tried twitter app but surprise to see only single view ??? anyone know how to get twitter like single view on listview ??
tagged with: layout
upvote count: 5
downvote count: 0
tagged with: listview
has answer: http://stackoverflow.com/a/21447934
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has title: Layout And Views Visibility on app
has answer: http://stackoverflow.com/a/21447686

http://stackoverflow.com/comment/32344590
type: QuestionComment
comment on: http://stackoverflow.com/q/21437180
score: 1
has text: @membersound There's also [System.lineSeparator()](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#lineSeparator()). You might use anything as a delmititer, so it's up to you to write your constants file (if you want one).
type: Comment

http://stackoverflow.com/q/21361806
has comment: http://stackoverflow.com/comment/32210451
tagged with: matrix
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: Having some trouble with neighbors(int parameter) in Adjacency Matrix (java)
accepted answer: http://stackoverflow.com/a/21362017
type: Question
has comment: http://stackoverflow.com/comment/32210709
has comment: http://stackoverflow.com/comment/32210495
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32210830
has body: I need a step in the right direction. I have been trying to figure this one out for the past few hours. I've setup my adjacency matrix but can't figure out how the neighbors(int i) method can figure how many adjacent vertices are incident to vertice i, and then get neighbors to return a collection of those incident vertices in integer form. Code is like public class Graph { // Setup privately modified variables which will define the graph // These two parameters are storage variables for edges and vertices private int vertex; private int edge; // This will be the adjacency matrix to represent out graph, this will represent edges. private static boolean[][] adj_Matrix_Edges; // This will be an array to store the vertices. private int[] adj_Matrix_Vertices; // first step will be to setup the graph, using this constructor public Graph() { // Initialize the scanner for user's input on vertices. Scanner scan = new Scanner(System.in); // define local variable for user input. int num_vertices; num_vertices = vertex; // ask for user input System.out .println("Please enter how many nodes will be on the graph: "); num_vertices = scan.nextInt(); // make a runtime exception for nonnegative values. if (num_vertices &lt; 0) { throw new RuntimeException( "Number of vertices cannot be a nonnegative value");} System.out.println("There are now " + num_vertices + " vertices in the graph."); // Vertices are stored in a one dimensional array. adj_Matrix_Vertices = new int[num_vertices]; // A graph is created based on the user's specifications, N X N or (n^2) graph. adj_Matrix_Edges = new boolean[num_vertices][num_vertices]; } //This method validates whether or not two vertices are adjacent, returns true if adjacent false otherwise. public boolean adjacent(int i, int j) { if (adj_Matrix_Edges[i][j] == true) { System.out.println("The vertex " + i + " and vertex " + j + " are adjacent."); return true;} else{ System.out.println("The vertex " + i + " and vertex " + j + " are not adjacent"); …
has comment: http://stackoverflow.com/comment/32210821
has answer: http://stackoverflow.com/a/21362017

http://stackoverflow.com/a/42022747
downvote count: 2
answers question: http://stackoverflow.com/q/21457105
upvote count: 0
score: -2
type: Answer
has body: Note: I have executed this and its working fine now.It will give you the size and clicking on every link.It was a issue where you need to go inside the Frame. It has a Frame where you need to switch. Please copy and paste and execute it. Hope you find your answer.

http://stackoverflow.com/q/21479809
has title: What tool would you use to complete this task to reformat java code?
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21480252
has comment: http://stackoverflow.com/comment/32419984
has comment: http://stackoverflow.com/comment/32419980
favorite count: 0
has comment: http://stackoverflow.com/comment/32420278
has comment: http://stackoverflow.com/comment/32419839
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21480102
accepted answer: http://stackoverflow.com/a/21480252
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21480102
tagged with: macros
has body: Here is my problem. Our company has decided to move from a proprietary data access system to using spring data access. Most of our code changes is simply changing how we call stored procs. For example. Input: public DataSet myMethodName1(Integer inputint1) { DAOInfo info = _newDAOInfo(); info.setProperty(PROP_PROCNAME, "sp_name"); info.addParameter("sp_param1", PARAMETER_TYPE_INPUT, DATATYPE_INT, inputint1); return _executeDAO(info); } public DataSet myMethodName2(String inputchar1, String inputchar2) { DAOInfo info = _newDAOInfo(); info.setProperty(PROP_PROCNAME, "sp_name"); info.addParameter("sp_param1", PARAMETER_TYPE_INPUT, DATATYPE_CHAR, inputchar1); info.addParameter("sp_param2", PARAMETER_TYPE_INPUT, DATATYPE_CHAR, inputchar2); return _executeDAO(info); } Output: public DataSet myMethodName1(Integer inputint1) { SimpleJdbcCall jdbcCall = new SimpleJdbcCall (dataSource).withProcedureName("sp_name"); jdbcCall.setReturnValueRequired(true); jdbcCall.declareParameters(new SqlParameter("sp_param1", Types.INTEGER)); jdbcCall.declareParameters(new SqlReturnResultSet(DATASET_PARAMETER_NAME, new DataSetResultSetExtractor())); Map&lt;String, Object&gt; in = new HashMap&lt;String, Object&gt;(); in.put("sp_param1", profileId); return executeSP(jdbcCall, inputint1); } public DataSet myMethodName2(String inputchar1, String inputchar2) { SimpleJdbcCall jdbcCall = new SimpleJdbcCall (dataSource).withProcedureName("sp_name"); jdbcCall.setReturnValueRequired(true); jdbcCall.declareParameters(new SqlParameter("sp_param1", Types.CHAR)); jdbcCall.declareParameters(new SqlParameter("sp_param2", Types.CHAR)); jdbcCall.declareParameters(new SqlReturnResultSet(DATASET_PARAMETER_NAME, new DataSetResultSetExtractor())); Map&lt;String, Object&gt; in = new HashMap&lt;String, Object&gt;(); in.put("sp_param1", inputchar1); in.put("sp_param2", inputchar2); return executeSP(jdbcCall, in); } I am not asking for anyone to solve the problem. I am simply looking for suggestion of tool or tools th…
downvote count: 1
has comment: http://stackoverflow.com/comment/32419958
has comment: http://stackoverflow.com/comment/32419906
tagged with: text-editor

http://stackoverflow.com/a/22954538
type: Answer
accepted answer of: http://stackoverflow.com/q/21489147
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21489147
has body: Goto Project Menu and Select Clean Option. If issues still persist, ask your admin to help you out. They may have to check if the classpath is set correctly at the Integration server level, or may be an IS re-start would also help.
upvote count: 1

http://stackoverflow.com/a/21363424
answers question: http://stackoverflow.com/q/21363115
score: 0
type: Answer
has body: Use a BufferedWriter wrapped around a FileWriter. Iterate over the elements of the set and write each element to the BufferedWriter. Make sure you close the writer.

http://stackoverflow.com/comment/32358139
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21444427
has text: Red Hat Enterprise Linux Server release 6.3 (Santiago)

http://stackoverflow.com/a/21368673
has body: Just add: &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; to your manifest
type: Answer
accepted answer of: http://stackoverflow.com/q/21368324
answers question: http://stackoverflow.com/q/21368324
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32372700
comment on: http://stackoverflow.com/a/21434038
score: 0
has text: Thank you, do you know any documentation for cypher queries in java, because the official documentation for cypher queries in java, is little..thanks.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21452147
has comment: http://stackoverflow.com/comment/32371504
answers question: http://stackoverflow.com/q/21452075
type: Answer
accepted answer of: http://stackoverflow.com/q/21452075
downvote count: 0
score: 7
has body: See this table: Access Levels Modifier | Class | Package | Subclass | World -------------+--------+-----------+-----------+-------- public | Y | Y | Y | Y protected | Y | Y | Y | N no modifier | Y | Y | N | N private | Y ← | N | N | N
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/q/21507513
tagged with: recursion
tagged with: composite
tagged with: components
tagged with: java
has answer: http://stackoverflow.com/a/21509867
type: Question
tagged with: jsf-2
score: 0
answer count: 1
has title: composite component recursive passing backing bean
has body: I everyone i'm trying to make a recursive menu using composite components but i cant figure out how to pass a backingbean in to the same composite component well mi code looks like this &lt;composite:interface&gt; &lt;composite:attribute name="bean" required="true"/&gt; &lt;composite:attribute name="node" required="true"/&gt; &lt;/composite:interface&gt; &lt;cc:implementation&gt; &lt;--some code here--&gt; &lt;c:if test="#{not empty cc.attrs.bean.obtainsubmenu(cc.attrs.node)}"&gt; &lt;c:foreach items="cc.attrs.bean.obtainsubmenu(cc.attrs.node)" var="submenu"&gt; &lt;!--some other code here--&gt; &lt;menu:recursivemenu bean="#{cc.attrs.bean}" node="#{submenu.idOpc}" /&gt; &lt;/c:foreach&gt; &lt;/c:if&gt; &lt;/cc:implementation&gt; the method obtainsubmenu only returns a list of objects the method looks something like this public List&lt;myObject&gt; obtainsubmenu(Long id){ return mymap.get(id); //where my maps is parametized this way Map&lt;Long, List&lt;MyObject&gt; } For the first level of my menu it looks to work just fine the problem is when it tries to call itself to do the recursive it is not pasing the object reference as it should and i'm getting an stackoverflow exception cause because the map is null is there a way to do this?? Tanks for the help!!
type: UnansweredQuestion

http://stackoverflow.com/comment/32218075
comment on: http://stackoverflow.com/a/21364012
score: 0
type: AnswerComment
type: Comment
has text: Thanks. This is the way to go. I wish there was a simple switch for this but as an alternative perhaps we'll need to the rethink the whole idea of using that particular Javadoc page for other than strictly Java people. Dunno. But thanks.

http://stackoverflow.com/comment/32422622
score: 0
comment on: http://stackoverflow.com/a/21481260
type: AnswerComment
has text: Do you realize this will only compile if you use an object reference before `instanceof`? In other words, it will always print `Yes!` (well unless str is `null`).
type: Comment

http://stackoverflow.com/a/21361812
type: Answer
has body: If you don't have android:onClick in your xml, the onClick will only be called once. This is called three times at least, because of the way onTouch works: It can be used to track touch movements - It continuously reports the touch position together with the current action - ACTION_DOWN, ACTION_MOVE or ACTION_UP. And that's the reason why you are seeing it being called three times. If you check event.getAction(), you'll see the three actions above will each appear once. To avoid this behaviour, just check the action. Typically you want to make sure it's ACTION_UP: if (Event.getAction() == MotionEvent.ACTION_UP) { ....
answers question: http://stackoverflow.com/q/21361650
score: 0

http://stackoverflow.com/q/21377323
has body: I recently made a switch from Netbeans 7 to IntelliJ 13 and so far I'm very happy. However in Netbeans I found the code-completion to be a bit better, despite reading nothing but praise for IntelliJs code-completion. My code-completion in IntelliJ just shows parameter types, not names. I have attached picture to show you. As you can see, Netbeans show the entire function declaration, which is useful if you don't know every method by heart or just forgot if "is name or address first?". Is there a way to make IntelliJ behave the same way? //EDIT: I use Windows 7, my IntelliJ is community version 13.0, build #IC-133.193
has title: IntelliJs code-completion doesn't show parameters names
has comment: http://stackoverflow.com/comment/32238753
tagged with: java
has comment: http://stackoverflow.com/comment/32238650
type: Question
has answer: http://stackoverflow.com/a/21377428
tagged with: intellij-idea
tagged with: code-completion
score: 0
has comment: http://stackoverflow.com/comment/32238675
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/32441709
type: Comment
comment on: http://stackoverflow.com/a/21491647
has text: Then kindly accept the answer to close the question as resolved :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/21491381
type: Answer
has comment: http://stackoverflow.com/comment/32441072
has body: You already have a readScores function which reads in a list of the player 1 and player 2 scores. Based on that, you can easily go through those Arrays and determine which player won each game.
has comment: http://stackoverflow.com/comment/32441316
has comment: http://stackoverflow.com/comment/32441435
has comment: http://stackoverflow.com/comment/32441143
score: 0
answers question: http://stackoverflow.com/q/21491288
has comment: http://stackoverflow.com/comment/32441766
has comment: http://stackoverflow.com/comment/32441260

http://stackoverflow.com/q/21497227
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/21497438
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32451333
has body: I need to extract exam results from a website, my program should enter the register number on the webpage and should read the resulting webpage...i tried something.. but my program returns the same webpage where i enter the register number. below is my code.. kindly help me to sort out.. package javaapplication3; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class JavaApplication3 { /** * @param url * @param params * @return */ public void post(String url, Map&lt;String, String&gt; params) { //Check if Valid URL if(!url.toLowerCase().contains("http://")) { System.out.println("not valid link"); } StringBuilder bldr = new StringBuilder(); try { //Build the post data StringBuilder post_data = new StringBuilder(); //Build the posting variables from the map given for (Iterator iter = params.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String key = (String) entry.getKey(); String value = (String)entry.getValue(); if(key.length() &gt; 0 &amp;&amp; value.length() &gt; 0) { if(post_data.length() &gt; 0) post_data.append("&amp;"); post_data.append(URLEncoder.encode(key, "UTF-8")); post_data.append("="); post_data.append(URLEncoder.encode(value, "UTF-8")); } } // Send data URL remote_url = new URL(url); URLConnection conn = remote_url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(post_data.toString()); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; while ((inputLine = rd.readLine()) != null) { bldr.append(inputLine); System.out.println(inputLine); } wr.close(); rd.close(); } catch (Exception e) { //Handle Error e.printStackTrace(); } } public static void main(Str…
has title: POST ing data to a website from java
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/32451438
score: 0
tagged with: http-post
answer count: 1
has answer: http://stackoverflow.com/a/21497438

http://stackoverflow.com/a/21500829
has comment: http://stackoverflow.com/comment/32489444
downvote count: 0
has comment: http://stackoverflow.com/comment/32463406
has body: The only way to create a thread in Java is by creating a Thread object and starting it. Quoting java language specification: The only way for a user to create a thread is to create an object of this class; each thread is associated with such an object. A thread will start when the start() method is invoked on the corresponding Thread object. Runnable and Callable are two interfaces that the JDK uses for submitting code to be executed in threads. For example, in its various java.util.concurrent classes.
upvote count: 11
has comment: http://stackoverflow.com/comment/32489379
type: Answer
score: 11
answers question: http://stackoverflow.com/q/21500772

http://stackoverflow.com/q/21500912
possible better answer: http://stackoverflow.com/a/21501005
tagged with: java
score: -1
answer count: 3
has body: Hello i defined the following Fish class with the following private attributes(basically its just a class that contains a string indicting the type of fish and an integer containing its size in centimeters. I also created get methods for each attribute,a constructor that takes the size and species of the fish and a toString() method that returns a string in the following format: A 10cm Pike ): public class Fish { private int size; private String species; public int getSize() { return this.size; } public String getSpecies() { return this.species; } public Fish(int s, String p) { size = s; species = p; } public String toString() { return("A " + this.size + " cm " + this.species); } } Then I defined a Pond class that defines the following private attributes: fish ­- an array which will contain all Fish objects that are in the pond numFish -­ an int indicating the # of fish that are currently in the pond and this what I did: (if I am wrong please let me know) public class Pond { private int numFish; private Fish [] fishes; } now what I am having trouble with in particular is creating a constructor that takes the capacity of the pond, where the capacity is the maximum number of fish that can be stored in the pond at any time. I am not really sure how to create an array as a parameter of a constructor. Also I am having trouble with creating a method called isFull() which returns a boolean indicating whether or not the pond has reached its capacity of fish. Any help is appreciated, thank you so much!
has title: How to create a constructor that takes the capacity of a class that contains an integer and an array of objects
downvote count: 1
tagged with: arrays
favorite count: 0
accepted answer: http://stackoverflow.com/a/21500955
has answer: http://stackoverflow.com/a/21501005
has answer: http://stackoverflow.com/a/21500932
type: AnsweredQuestion
upvote count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/21500955
tagged with: methods
type: Question
tagged with: object

http://stackoverflow.com/q/21360791
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21360830
has body: I am trying to ignore the words with the first letter capital and add other words to the List. But unfortunately, it really didn't remove anything and all the words are added into the List. What is wrong here? import java.io.*; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import java.util.List; public class Main { private char[] capLetters = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; private StringBuffer strBuffer = new StringBuffer(""); private List &lt;String&gt; wordList= new ArrayList(); public Main() { File f =new File("C:/xxx/COMMON.txt"); try { BufferedReader br = new BufferedReader(new FileReader(f)); String str = ""; int number =0; while((str=br.readLine())!=null) { //Remove the words with first letter capital for(int i=0;i&lt;capLetters.length;i++) { if(str.charAt(0)==capLetters[i]) { } else { wordList.add(str); break; } } number++; } System.out.println(number); for(int i=0;i&lt;wordList.size();i++) { System.out.println(wordList.get(i)); } } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { // TODO code application logic here System.out.println("Netbeans Version"); new Main(); } }
answer count: 6
tagged with: java-io
tagged with: arraylist
has answer: http://stackoverflow.com/a/21360865
score: 0
accepted answer: http://stackoverflow.com/a/21360837
has title: Removing words if the first letter is capital
has answer: http://stackoverflow.com/a/21360820
has answer: http://stackoverflow.com/a/21360895
has answer: http://stackoverflow.com/a/21360837
has answer: http://stackoverflow.com/a/21360846
tagged with: io
possible better answer: http://stackoverflow.com/a/21360820
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/a/24448831
score: 3
answers question: http://stackoverflow.com/q/21418936
has body: Since there is no answer accepted here I thought I'll show how I am doing it. I have a class that extends BroadcastReceiver like you should if you are following UrbanAirship. In this class I recieve the notifications: public class IntentReceiver extends BroadcastReceiver { private static final String logTag = "PushUA"; private String pushToken; public static String APID_UPDATED_ACTION_SUFFIX = ".apid.updated"; @Override public void onReceive(Context context, Intent intent) { Log.i(logTag, "Received intent: " + intent.toString()); String action = intent.getAction(); if (action.equals(PushManager.ACTION_PUSH_RECEIVED)) { int id = intent.getIntExtra(PushManager.EXTRA_NOTIFICATION_ID, 0); logPushExtras(intent); } else if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) { Log.i(logTag, "User clicked notification. Message: " + intent.getStringExtra(PushManager.EXTRA_ALERT)); logPushExtras(intent); String url= intent.getStringExtra("url"); //Here you get your extras ... Might help someone:)
upvote count: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32415324
type: AnswerComment
type: Comment
has text: Ah, thank you very much indeed, exactly what I was looking for, I just didn't know how to write that syntax-wise.
comment on: http://stackoverflow.com/a/21476668
score: 0

http://stackoverflow.com/comment/32361369
score: 2
has text: You probably want to include that _does_ something with the value of `formulaLong` before resetting it to zero though.
comment on: http://stackoverflow.com/q/21446011
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21398352
favorite count: 0
tagged with: android
score: 2
has body: I am trying to get my Android phone (NexusOne) to connect to two bluetooth chips simultaneously. I have read various responses on the internet concluding that this may or may not be able to be done. People who have gotten it working say it works by establishing multiple RFcomm connections, like two connect threads in parallel. I am not sure how to go about doing this. I have my connect code which will only connect to one chip at the moment. Ideas? package com.example.connect; public class ConnectThread extends Activity { static BluetoothSocket mmSocket; static BluetoothSocket mmSocket2; static BluetoothDevice mmDevice; static BluetoothDevice mmDevice2; static InputStream mmInputStream; static OutputStream mmOutputStream; static BluetoothAdapter mBluetoothAdapter; static BluetoothAdapter mBluetoothAdapter2; TextView myLabel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_connect_thread); Button button = (Button)this.findViewById(R.id.button1); myLabel = (TextView)findViewById(R.id.textView1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(ConnectThread.this, "Connection in progress", Toast.LENGTH_SHORT).show(); myLabel.setText("Connection in progress"); try { findBT2(); openBT2(); findBT(); openBT(); } catch (IOException ex) { } } });} void findBT2() { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if(mBluetoothAdapter == null) { myLabel.setText("No bluetooth adapter available"); } if(!mBluetoothAdapter.isEnabled()) { Intent enableBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBluetooth, 0); } Set&lt;BluetoothDevice&gt; pairedDevices = mBluetoothAdapter.getBondedDevices(); if(pairedDevices.size() &gt; 0) { for(BluetoothDevice device2 : pairedDevices) { if(device2.getName().equals("H-C-2010-06-01")) { mmDevice2 = device2; myLabel.setText("Bluetooth Device Found"); br…
upvote count: 2
type: UnansweredQuestion
tagged with: java
has title: Android phone bluetooth connection to two chips
type: Question
has answer: http://stackoverflow.com/a/21719475
has comment: http://stackoverflow.com/comment/32282799
answer count: 1
downvote count: 0

php
tags question: http://stackoverflow.com/q/21405635
tags question: http://stackoverflow.com/q/21513898
tags question: http://stackoverflow.com/q/21476960
tags question: http://stackoverflow.com/q/21398650
tags question: http://stackoverflow.com/q/21462332
tags question: http://stackoverflow.com/q/21409533
tag name: php
tags question: http://stackoverflow.com/q/21428002
tags question: http://stackoverflow.com/q/21505176
tags question: http://stackoverflow.com/q/21374732
tags question: http://stackoverflow.com/q/21449995
tags question: http://stackoverflow.com/q/21406924
tags question: http://stackoverflow.com/q/21356096
tags question: http://stackoverflow.com/q/21499012
tags question: http://stackoverflow.com/q/21450831
tags question: http://stackoverflow.com/q/21374925
tags question: http://stackoverflow.com/q/21360492
tags question: http://stackoverflow.com/q/21373281
tags question: http://stackoverflow.com/q/21494962
tags question: http://stackoverflow.com/q/21483272
tags question: http://stackoverflow.com/q/21474246
tags question: http://stackoverflow.com/q/21417413
tags question: http://stackoverflow.com/q/21436891
tags question: http://stackoverflow.com/q/21464561
tags question: http://stackoverflow.com/q/21491536
tags question: http://stackoverflow.com/q/21363210
tags question: http://stackoverflow.com/q/21397422
tags question: http://stackoverflow.com/q/21496151
type: Tag

http://stackoverflow.com/comment/32286709
comment on: http://stackoverflow.com/a/21404351
score: 0
type: AnswerComment
has text: I have a lot of data that are multi-lingual and I would need an automated way to do it, I had already done this thing with iOS, but I can not replicate it in Android.
type: Comment

http://stackoverflow.com/comment/32477480
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21511392
has text: That's not a compilation error. That's Eclipse trying to help you (but confusing you instead) and not finding a table with that name in the database associated (or not) with the project. Ignore the error.

http://stackoverflow.com/comment/32334562
score: 2
has text: Implement both and let one call the other one.
comment on: http://stackoverflow.com/q/21431834
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21494185
answers question: http://stackoverflow.com/q/21494025
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: Yeah a hybrid class is definitely possible. You can just wrap your content in a subclass of JPanel and then call it from your starting class as follows: public class StartingClass extends JApplet { public static void main(String[] args) { JFrame window = new JFrame("Application Name"); MyPanel content = new MyPanel(); window.setContentPane(content); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.pack(); window.setVisible(true); } public void init() { MyPanel content = new MyPanel(); setContentPane(content); } }

http://stackoverflow.com/q/21455690
has answer: http://stackoverflow.com/a/40635535
type: Question
has title: DependsOnGroups Fails with cyclic dependencies exception
answer count: 2
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: testng
has body: I'm currently writing integration test where i have to check some conditions before my tests can run. public class TheClassWhichContainsIT { @Test(dependsOnGroups = { "init" }) public void thisIsTheFirstTest() { System.out.printf("Test"); } @Test(groups = "init") public void checkIfWeAreOnWindows() { throw new SkipException("Not on windows"); } } The above example works as expected if the SkipException is thrown than the tests will be marked as skipped and not a failed as i like it. So based on Cedric Beust's blog i want to refactor my integration tests into the following: @Test(dependsOnGroups = { "init" }) public class TheClassWhichContainsIT extends IntegrationTestBase { public void thisIsTheFirstTest() { System.out.printf("Test"); } } @Test(groups = "init") public class IntegrationTestBase { public void checkIfWeAreOnWindows() { throw new SkipException("ignore"); } } But if i try to run my tests i got the following: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2. 16:test (default-test) on project testngtest: Execution default-test of goal org .apache.maven.plugins:maven-surefire-plugin:2.16:test failed: There was an error in the forked process [ERROR] org.testng.TestNGException: [ERROR] The following methods have cyclic dependencies: [ERROR] TheClassWhichContainsTest.thisIsTheFirstTest()[pri:0, instance:de.akdb.k m.tests.TheClassWhichContainsTest@3603820e] [ERROR] [ERROR] at org.testng.internal.Graph.topologicalSort(Graph.java:148) [ERROR] at org.testng.internal.MethodHelper.topologicalSort(MethodHelper.java:26 1) [ERROR] at org.testng.internal.MethodHelper.sortMethods(MethodHelper.java:317) [ERROR] at org.testng.internal.MethodHelper.collectAndOrderMethods(MethodHelper. java:59) [ERROR] at org.testng.TestRunner.initMethods(TestRunner.java:481) [ERROR] at org.testng.TestRunner.init(TestRunner.java:235) [ERROR] at org.testng.TestRunner.init(TestRunner.java:205) [ERROR] at org.testng.TestRunner.&lt;init&gt;(TestRunner.java:153) [ER…
tagged with: java
has answer: http://stackoverflow.com/a/51854223

http://stackoverflow.com/comment/32366539
comment on: http://stackoverflow.com/q/21449131
score: 0
type: Comment
type: QuestionComment
has text: import `android.util.Log` instead of `org.apache.commons.logging.Log`

http://stackoverflow.com/comment/32474683
type: Comment
type: QuestionComment
has text: None of the suggestions at the bottom worked.
comment on: http://stackoverflow.com/q/21508650
score: 0

http://stackoverflow.com/comment/32316157
comment on: http://stackoverflow.com/q/21420495
score: 0
type: Comment
type: QuestionComment
has text: That's a lot of code to look through, if you could narrow down the problem a little bit that'd be great.

http://stackoverflow.com/comment/32459953
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21502095
has text: what about creating a method for that??? I don't see that difference
score: 5

http://stackoverflow.com/comment/32289562
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21403991
score: 0
has text: Each test method that is run adds one to the count of methods as reported in Jenkins. a) You might not have each method annotated with `@Test`. b) Only one method being run. c) All other methods might be skipped. In other words, you didn't show us the important stuff.

http://stackoverflow.com/q/21503081
has body: buyPass(TicketBoothbooth) ­ This method simulates the person buying a ride pass from the given booth object. It should modify the person and the booth in the appropriate way, and then return a boolean indicating whether or not the transaction was successful. The transaction is successful ONLY if the booth has a pass available AND the person has enough money for the pass. This is what I have so far under the person class. public class Person{ float height; float money; int ticketCount; boolean hasPass; public Person(){ height = 0.0f; money = 0.0f; ticketCount = 0; hasPass = false; } public Person(float h, float m) { height = h; money = m; ticketCount = 0; hasPass = false; } public String toString(){ if(hasPass) { return(this.height + "' person with $" + this.money + " and has a pass"); } else { return(this.height + "' person with $" + this.money + " and " + this.ticketCount + " tickets"); } } public void useTickets(int numberOfTickets){ if(this.ticketCount &gt;= numberOfTickets) { this.ticketCount -= numberOfTickets; } } public int buyPass(TicketBooth booth){ if (boolean availablePasses || money &lt; 16.50){ boolean message_3 = false; return message_3; } } } and this is what i have under the TicketBooth class public class TicketBooth { float moneyMade; int availablePasses; int availableTickets; static final double TICKET_PRICE = 0.50; static final double PASS_PRICE = 16.50; public TicketBooth() { moneyMade = 0.0f; availablePasses = 0; availableTickets = 0; } public TicketBooth(int passes) { moneyMade = 0.0f; availablePasses = passes; availableTickets = 0; } public TicketBooth(int passes, int tickets) { moneyMade = 0.0f; availablePasses = passes; availableTickets = tickets; } public String toString(){ String message_2; message_2 = "Ticket booth with " + availablePasses + " passes and " + availableTickets + " tickets"; return message_2; } public boolean sellPass() { if (availablePasses &gt; 0) { moneyMade = moneyMade + 16.50f; availablePasses--; return true; } else{ re…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21503116
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/32461689
has title: Add the following instance methods to the Person class
downvote count: 3
has answer: http://stackoverflow.com/a/21503302
type: UnansweredQuestion
score: -3
upvote count: 0

http://stackoverflow.com/a/21461908
accepted answer of: http://stackoverflow.com/q/21461240
type: AcceptedAnswer
has body: The java doc of create method says it all The argument to create(Class) must be a class literal because the Production Mode compiler must be able to statically determine the requested type at compile-time. This can be tricky because using a Class variable may appear to work correctly in Development Mode. http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/GWT.html#create(java.lang.Class) In short you cannot dynamically create instance, the class type must be statically know at compile time. GWT.create(YourClass.class)
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21461240
score: 1

http://stackoverflow.com/comment/32374763
score: 2
has text: What's your R&D says? Have you tried to search it on SO first and then on Google?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21454126

http://stackoverflow.com/comment/32461278
score: 0
has text: It works like a champ now. What I had to do is put the thread to sleep, I tried 5 seconds, and it worked. This is what I did in my main: sfx.init(); sfx.TEST.play(); Thread.sleep(3000);'code' Thank You, for your feedback and help.
type: AnswerComment
comment on: http://stackoverflow.com/a/21446928
type: Comment

http://stackoverflow.com/comment/32288147
type: AnswerComment
type: Comment
score: 0
has text: @maaartinus 10 points for Griffondor, I've edited! Good call!
comment on: http://stackoverflow.com/a/21403867

http://stackoverflow.com/comment/32242907
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21378375
type: QuestionComment
has text: Hi! Deinum thanks for the reply, which JaxB annotation should be used on the employee in resource class to access employee data

http://stackoverflow.com/q/21501075
answer count: 2
has comment: http://stackoverflow.com/comment/32459812
downvote count: 0
has answer: http://stackoverflow.com/a/25234411
favorite count: 0
has answer: http://stackoverflow.com/a/21501122
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
has title: Error: Invalid start tag LinearLayout
tagged with: java
has body: So, I thought to make my app compatible with tablets, so I copied my xml's to the values-sw600dp folder, but I get this error Invalid start tag LinearLayout. Can you guys tell me what did I do wrong? I get the error where this line is: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
has comment: http://stackoverflow.com/comment/32457914

http://stackoverflow.com/q/21353455
has answer: http://stackoverflow.com/a/21353668
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/21353548
favorite count: 0
has comment: http://stackoverflow.com/comment/32195660
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: I have a list of items, each item has a price field. some items have price equal to 999. When sorting, I want the elements that have price == 999 to always be at the bottom of the list, whether the sort direction is ascending or descending. I have tired the the code below and it works for sorting low to high (ascending) but not when descending. Collections.sort(itemList, new Comparator&lt;Item&gt;() { @Override public int compare(Item o1, Item o2) { if(sort == 4){ // Low to High return Double.compare(o1.getPrice(), o2.getPrice()); }else{ // High to Low return Double.compare(o2.getPrice(), o1.getPrice()); } } });
has title: How can I ignore a certain value when sorting so it always appears at the bottom of the sorted list
type: Question
possible better answer: http://stackoverflow.com/a/21353488
has answer: http://stackoverflow.com/a/21353488
has answer: http://stackoverflow.com/a/21353548

http://stackoverflow.com/comment/80265781
has text: NB that both methods still work on kitkat, just `evaluateJavascript` is preferred because it's got a callback so is more easily asynchronous...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/32822611
type: Comment

http://stackoverflow.com/comment/32335171
has text: yeah i already check my arraylists
comment on: http://stackoverflow.com/q/21431857
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32341539
has text: packages with uppercase names are specially a problem when you work with windows and linux with the same project ;-)
type: Comment
comment on: http://stackoverflow.com/a/21435019
type: AnswerComment
score: 0

http://stackoverflow.com/a/21670595
answers question: http://stackoverflow.com/q/21371110
accepted answer of: http://stackoverflow.com/q/21371110
upvote count: 5
has body: TextField uses a private internal InputListener, that gets initialized in the constructor and cannot be easily overwritten. The relevant code that changes the focus is during the keyTyped method of this listener: public boolean keyTyped (InputEvent event, char character) { [...] if ((character == TAB || character == ENTER_ANDROID) &amp;&amp; focusTraversal) next(Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT)); [...] } One easy solution would be to disable focus traversals all together and set a com.badlogic.gdx.scenes.scene2d.ui.TextFieldListener that automatically does the traversals instead: TextField textField textField.setFocusTraversal(false); textField.setTextFieldListener(new TextFieldListener() { @Override public void keyTyped(TextField textField, char key) { if ((key == '\r' || key == '\n')){ textField.next(Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT)); } } }); If you need to be able to enable and disable focus traversals using TextFields setFocusTraversal method, there would also be a quite hacky solution by wrapping the internal InputListener inside your own listener when it is added to the TextField (but I would not recommend this): class MyTextField extends TextField{ class InputWrapper extends InputListener{ private final InputListener l; public InputWrapper(InputListener l) { super(); this.l = l; } @Override public boolean handle(Event e) { return l.handle(e); } @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return l.touchDown(event, x, y, pointer, button); } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { l.touchUp(event, x, y, pointer, button); } @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { l.touchDragged(event, x, y, pointer); } @Override public boolean mouseMoved(InputEvent event, float x, float y) { return l.mouseMoved(event, x, y); } @O…
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32794009
has comment: http://stackoverflow.com/comment/32757252
type: Answer

http://stackoverflow.com/comment/32351948
score: 0
type: Comment
has text: do you think this will work? `URLEncoder.encode(str, "UTF-8");`
comment on: http://stackoverflow.com/a/21441135
type: AnswerComment

http://stackoverflow.com/comment/32446823
type: QuestionComment
has text: whats the range of numbers over which you want to find the distribution ?
type: Comment
comment on: http://stackoverflow.com/q/21494455
score: 0

http://stackoverflow.com/comment/32239027
type: QuestionComment
comment on: http://stackoverflow.com/q/21377027
score: 0
has text: See [this post][1] that explains how to create the JBoss module with the driver. [1]: http://stackoverflow.com/questions/12403428/how-to-connect-jboss-as-7-1-1-with-postgresql
type: Comment

http://stackoverflow.com/a/21419270
score: 2
has body: Create a Filter (this way you not copy and paste on each servlet) and then use a static (http://www.caveofprogramming.com/frontpage/articles/java/java-for-beginners-static-variables-what-are-they/) int. public class urlFilter implements Filter { @Override public void init(FilterConfig config) throws ServletException { } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException { myStaticVariable ++; } @Override public void destroy() { } } then on the web.xml urlRewriteFilter com.example.UrlRewriteFilter urlFilter /*
upvote count: 2
has comment: http://stackoverflow.com/comment/32313862
answers question: http://stackoverflow.com/q/21419184
downvote count: 0
type: Answer

http://stackoverflow.com/a/21431078
has comment: http://stackoverflow.com/comment/32370620
has comment: http://stackoverflow.com/comment/32370488
upvote count: 2
type: Answer
downvote count: 1
has body: @NamedQuery( name="REI_BODY", query="SELECT *, (SELECT AMT FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '01') AMT_01, (SELECT AMT FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '02') AMT_02, (SELECT SGN_CD FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '01') SGN_01, (SELECT SGN_CD FROM REI_AMT_INFO I WHERE I.REI_ID=T.REI_ID AND AMT_TYPE_CD = '02') SGN_02, FROM REI_BODY T" ) CHECK THE LINK
score: 1
answers question: http://stackoverflow.com/q/21430282

http://stackoverflow.com/a/21457876
has body: If this is for a library or something, I'd recommend to use both. The getAllPositiveNumbers and getAllNegativeNumbers methods could call the getAllNumbers method, like so: public int[] getAllNumbers(int[] array, boolean positive) { //... } public int[] getAllPositiveNumbers(int[] array) { return getAllNumbers(array, true); } Otherwise use whichever you prefer.
answers question: http://stackoverflow.com/q/21457695
score: 0
type: Answer

http://stackoverflow.com/q/21433559
tagged with: exception
type: UnansweredQuestion
has body: I am trying to check if another class has a member variable called "list" in it, and I want a boolean to tell me if that class has it or not. If the class has "list", the boolean returns true and everything is good. But if the class DOESN'T have "list" in it, it doesn't return false but it causes an error: public static void main(String[]args) throws NoSuchFieldException, SecurityException{ boolean has = Person.class.getDeclaredField("list")!=null; System.out.println(has); } The error: Exception in thread "main" java.lang.NoSuchFieldException: list at java.lang.Class.getDeclaredField(Unknown Source) at test.main(test.java:21) Line 21 is where I declared the boolean has. So I have 2 questions: How do I return false if there ISNT "list" in class Person? If the varible exists, how can I make it into an object?
upvote count: 1
has answer: http://stackoverflow.com/a/21433631
has answer: http://stackoverflow.com/a/21433620
type: Question
has answer: http://stackoverflow.com/a/21434039
has answer: http://stackoverflow.com/a/21433687
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21433640
has answer: http://stackoverflow.com/a/21433627
has title: How to check if class has variable and declare it in other class
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/21434017

http://stackoverflow.com/comment/32477380
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21511540
has text: @user3043278: then use a JList. The [tag:swing] info section will have a link to the Swing tutorials where you'll want to read up on using JLists. If you want to sort the Students though, a JTable may be better for this.
type: Comment

http://stackoverflow.com/q/21472494
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21486403
tagged with: android-library
tagged with: maven-central
has title: Android- Importing external libraries with Android Studio
downvote count: 0
score: 1
tagged with: java
tagged with: import
type: Question
has body: I am new in Android and AndroidStudio, so I`m if this question seems a little bit idiot. I want to import this project https://github.com/timroes/EnhancedListView/wiki but I cannot make this work. I follow the steps and the .arr was added sucessfully to /build, but I still cant use the classes. For some reason there is no .jar of this project in my external libraries folder. I have to do something else to get the lib into External Libraries folder? Here is my build.gradle buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.0.0" defaultConfig { minSdkVersion 7 targetSdkVersion 19 } } dependencies { compile 'com.android.support:support-v4:19.0.0' compile 'com.android.support:gridlayout-v7:19.0.0' compile 'com.android.support:appcompat-v7:19.0.0' compile 'de.timroes.android:EnhancedListView:0.2.0@aar' }
upvote count: 1
tagged with: android

http://stackoverflow.com/q/21453141
type: Question
tagged with: criteria
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21457873
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: spring
has title: how to generate meta model from entity?
has body: I was trying to do this with hibernate tools, Also with maven like this: br.com.ingenieux.maven.annomojo org.jfrog.maven.maven-plugin-anno 1.4.1 org.bsc.maven maven-processor-plugin process process generate-sources target/metamodel org.codehaus.mojo build-helper-maven-plugin 1.3 add-source generate-sources add-source target/metamodel I read posts in this forum, but they do not help. Can someone help me to make it? I am confused ( I need meta model for creating criteria) P.s. this link doesn't say how to make it: http://hibernate.org/orm/tooling/. I read a lot of info about it, but cannot figure it out...
tagged with: maven

http://stackoverflow.com/comment/32378447
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21456357
has text: please clean your project and try again
score: 0

http://stackoverflow.com/a/21395333
type: Answer
upvote count: 3
has body: Basically, when the "rest" button is clicked, you should be restarting the Timer to start over again. } else if (e.getSource() == jb_reset) { timer.stop(); cycleNum = 0; gridContent_reset(); // Restart the timer... timer.start(); this.repaint(); } As to the second half of your question, basically, you need to check if the JPanel at cells[x][y] contains any children and keep randomizing the x/y values into it doesn't (or you hit some kind of limit, so as to prevent the possibility of an infinite loop) Another approach might be to randomize a list (possibly containing the JPanel for each cell) and simply pop off the first element when you want to add food and add it back in when no food exists (within that cell) You should break you code down so that, at the very least, the model and view are separated. The model would contain information about the state of the game, where as the view would be responsible for rendering it. This will help simplify much of the logic as you shouldn't care about what is going on the screen when you want to determine where to place food.
answers question: http://stackoverflow.com/q/21395148
downvote count: 0
score: 3

http://stackoverflow.com/q/21365400
type: Question
has title: action bar background is shown in middle of the screen
has body: I have changed the background of the action bar but it looks like this: (I cant post image because I dont have more than 10 reputation) I have the stock action bar and my actionbar background is shown in middle of the screen. I dont know how can I describe it better. Do you know what is the problem? here is my styles.xml: <?xml version="1.0" encoding="utf-8"?> manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> and the layout.xml <RelativeLayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:background="@drawable/loginbackground" tools:context=".loginActivity" > <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView1" android:layout_marginTop="22dp" android:layout_toLeftOf="@+id/textView1" android:text="@string/loginEmail" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#ffffff" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView2" android:layout_marginTop="16dp" android:layout_toLeftOf="@+id/textView1" android:text="@string/loginSifre" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#ffffff" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android…
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21365615
favorite count: 0
tagged with: android
tagged with: android-actionbar
has answer: http://stackoverflow.com/a/21365615
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/32327571
type: AnswerComment
comment on: http://stackoverflow.com/a/21427591
type: Comment
has text: How could i knw its example or requirement ? If you want to scale the items then also u need to use the same logic.
score: 0

http://stackoverflow.com/a/38502240
has body: I guess if multiple threads are calling this method while it is executing, all of them will hit the database. The simplest solution I see is to make your service call the Dao in a synchronized block.
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21467439
downvote count: 1

http://stackoverflow.com/a/21490159
has comment: http://stackoverflow.com/comment/32542174
type: Answer
downvote count: 0
has body: In servlet environment the &lt;s:form&gt; tag uses ServletUrlRenderer class to render form url. If configuration for the action specified in action attribute cannot be found then literal value (w/o parameters) of an action attribute will be used. Note: you need to use action name w/o extension in order that it can be found in configuration. So some_action?foo=bar will be set with parameters in form if you have some_action in configuration, but some_action.action?foo=bar won't be found because of .action extension and parameters will be stripped.
score: 1
accepted answer of: http://stackoverflow.com/q/21478791
answers question: http://stackoverflow.com/q/21478791
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/32570431
type: Comment
has text: I'm sorry, I misunderstood your wording. The example you outlined is indeed a possible case, and those are the results you are seeing. However, I may have also misunderstood your question. So I need some clarification. Where do you intend for the re-coloring to occur? Is this to recolor the image passed to the dithering algorithm, or will the dithering algorithm be using this adjusted palette for it's creation of the image. The kmeans half answers the former, while the nested for loops (I believe) can be used to answer the latter.
type: AnswerComment
comment on: http://stackoverflow.com/a/21538216
score: 0

http://stackoverflow.com/comment/32418739
type: AnswerComment
comment on: http://stackoverflow.com/a/21476372
type: Comment
has text: Agian i got one issue like i have an imageview ImageView topbarCalender = (ImageView) view.findViewById(R.id.pf_topbarCalender); I want to click on it the same way button.But my test is failing.Is it the correct way to access the ImageView
score: 0

file
type: Tag
tags question: http://stackoverflow.com/q/21374282
tags question: http://stackoverflow.com/q/21460708
tags question: http://stackoverflow.com/q/21384806
tags question: http://stackoverflow.com/q/21352740
tags question: http://stackoverflow.com/q/21419532
tags question: http://stackoverflow.com/q/21487325
tag name: file
tags question: http://stackoverflow.com/q/21387916
tags question: http://stackoverflow.com/q/21435403
tags question: http://stackoverflow.com/q/21405564
tags question: http://stackoverflow.com/q/21412668
tags question: http://stackoverflow.com/q/21489101
tags question: http://stackoverflow.com/q/21488985
tags question: http://stackoverflow.com/q/21357057
tags question: http://stackoverflow.com/q/21503825
tags question: http://stackoverflow.com/q/21359665
tags question: http://stackoverflow.com/q/21505408
tags question: http://stackoverflow.com/q/21474424
tags question: http://stackoverflow.com/q/21375559
tags question: http://stackoverflow.com/q/21409898
tags question: http://stackoverflow.com/q/21430298
tags question: http://stackoverflow.com/q/21367984
tags question: http://stackoverflow.com/q/21385450
tags question: http://stackoverflow.com/q/21474749
tags question: http://stackoverflow.com/q/21459553
tags question: http://stackoverflow.com/q/21411622
tags question: http://stackoverflow.com/q/21479105
tags question: http://stackoverflow.com/q/21489817
tags question: http://stackoverflow.com/q/21409622
tags question: http://stackoverflow.com/q/21489231
tags question: http://stackoverflow.com/q/21479971
tags question: http://stackoverflow.com/q/21366901

http://stackoverflow.com/a/27555449
downvote count: 0
has body: Copy-paste behavior on Mac is much improved in JMeter 2.12.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21414435
answers question: http://stackoverflow.com/q/21414435
type: Answer
score: 2

http://stackoverflow.com/a/21378418
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21378206
has comment: http://stackoverflow.com/comment/32247420
has comment: http://stackoverflow.com/comment/32244293
answers question: http://stackoverflow.com/q/21378206
score: 1
has comment: http://stackoverflow.com/comment/32246700
has comment: http://stackoverflow.com/comment/32246879
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32247444
has comment: http://stackoverflow.com/comment/32241555
has comment: http://stackoverflow.com/comment/32240716
has comment: http://stackoverflow.com/comment/32247234
has body: Redundant data are pretty bad as redundancy leads to time and memory overhead and also to programming errors. Modifying a third party method is bad as i means redoing it when it gets upgraded. Somehow all solutions are bad, but you should always measure it. Is the garbage a real problem? I'd switch to using Vector2 everywhere, if possible. You could also recycle existing Vector and fill it with your data. This eliminates the garbage problem, but there's still the cost for copying. The final solution is up to you. I doubt that anybody could say for sure what's best for you.

struts2
tags question: http://stackoverflow.com/q/21386324
tags question: http://stackoverflow.com/q/21444856
tags question: http://stackoverflow.com/q/21457264
tags question: http://stackoverflow.com/q/21401976
tags question: http://stackoverflow.com/q/21422464
tags question: http://stackoverflow.com/q/21429962
tags question: http://stackoverflow.com/q/21354429
tags question: http://stackoverflow.com/q/21372160
tag name: struts2
tags question: http://stackoverflow.com/q/21430653
tags question: http://stackoverflow.com/q/21486930
tags question: http://stackoverflow.com/q/21474140
tags question: http://stackoverflow.com/q/21497350
tags question: http://stackoverflow.com/q/21472507
tags question: http://stackoverflow.com/q/21478791
tags question: http://stackoverflow.com/q/21377776
tags question: http://stackoverflow.com/q/21498035
tags question: http://stackoverflow.com/q/21436825
tags question: http://stackoverflow.com/q/21473809
tags question: http://stackoverflow.com/q/21501706
tags question: http://stackoverflow.com/q/21424957
type: Tag
tags question: http://stackoverflow.com/q/21427845
tags question: http://stackoverflow.com/q/21397554
tags question: http://stackoverflow.com/q/21399433

http://stackoverflow.com/a/21410416
has comment: http://stackoverflow.com/comment/32333481
type: Answer
has comment: http://stackoverflow.com/comment/36198036
has comment: http://stackoverflow.com/comment/32331702
upvote count: 1
answers question: http://stackoverflow.com/q/21408602
score: 1
has body: You should use listViev.setOnItemClickListener() once, instead of calling v.setOnClickListener() for all list items.
has comment: http://stackoverflow.com/comment/32324259
downvote count: 0

http://stackoverflow.com/comment/32309924
score: 0
type: Comment
has text: Just FYI - I explicitly declare variables 'price' and 'seller' since I was getting compile errors. But I assume that should not matter since the variables would bu updated based on the contents of the text file.
type: QuestionComment
comment on: http://stackoverflow.com/q/21417407

http://stackoverflow.com/comment/32326121
comment on: http://stackoverflow.com/a/21426359
has text: How to get package name
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21511665
type: Answer
has body: It is not obvious, as the compiler (or JVM) cannot know if you really want floats or integers. I'd argue that floating point math is hard, if you consider all the corner cases. Floats are inprecise by design, whereas with integers, you get exact results. If you can stick to exact results it is often better to do so and resort to floats only when explicitly needed. For example, if you need to compare the equality of two variables, with floats you have to give it some boundaries and definitions as to what you consider to be equal. With integers there is no need for this, it is self-evident. There are sevaral programming languages where this kind of explicit separation does not happen, possibly javascript and PHP being the most popular. They choose to autoconvert the datatypes on the fly. It causes some considerable overhead and additional issues in the long run, when you need to know exactly what is this variable you have in your hands. Still other programming languages exist that don't even have these different data types. Maybe everything there is just an object. This is one way of solving it.
has comment: http://stackoverflow.com/comment/32477208
score: 0
answers question: http://stackoverflow.com/q/21511616
has comment: http://stackoverflow.com/comment/32477066
has comment: http://stackoverflow.com/comment/32477026

http://stackoverflow.com/a/21392779
type: Answer
score: 7
upvote count: 7
type: AcceptedAnswer
downvote count: 0
has body: First, some terminology: (.toString (some.Example.)) is a call to the toString method of the newly constructed some.Example instance. (-toString (some.Example.)) is a regular Clojure function call, with -toString being the name of a Clojure Var storing a function and (some.Example.) being its sole argument. :gen-class arranges things so that the -toString Var backs the toString method; that is, any call to the toString method of a some.Example instance results in a call to -toString. So it is indeed the case that just calling -toString directly is equivalent. However, before you can call a Clojure function by referring to the Var in which it's stored, you need to make sure the namespace in which this Var lives has been loaded (not a problem here, given that you were able to construct an instance of some.Example) and then either refer to the Var by its fully-qualified name, or else use refer, use, require or alias to make it possible to refer to it by a shorter name: (some.Example/-toString ...) (use '[some.Example :only [-toString]]) (-toString ...) (require '[some.Example :refer [-toString]]) (-toString ...) (require '[some.Example :as se]) (se/-toString ...) ;; refer and alias are typically not used directly If you say -toString without first using refer, use or require as shown above1, Clojure will attempt to resolve the symbol -toString to a Var in the current namespace (typically user in REPL sessions; with lein repl it may be the :main namespace from your defproject form). 1 That's speaking about the REPL. In a source file, you'd typically use :use or :require in your ns form; the syntax is the same as for use / require minus the quoting.
accepted answer of: http://stackoverflow.com/q/21392494
answers question: http://stackoverflow.com/q/21392494

android-emulator
tags question: http://stackoverflow.com/q/21375069
tags question: http://stackoverflow.com/q/21399093
type: Tag
tags question: http://stackoverflow.com/q/21499862
tag name: android-emulator

exacttarget
tag name: exacttarget
type: Tag
tags question: http://stackoverflow.com/q/21414596

http://stackoverflow.com/q/21413608
has body: I don't understand what is happening in this code. Re-post from before with code included. Can someone please explain what is happening here? I understand conceptually that the list is being re-ordered one item at a time, but I just cant grasp this code. import java.io*; public class Example { public static void main(String[] args) throws IOException { int age[] = new int[10]; int i, j; int smallest; int temp; String line; BufferedReader in; in = new BUfferedReader(new InputStreamReader(System.in)); for(i = 0; i&lt;= 9; i++) { System.out.println("Enter an age: "); line = in.readline(); age[i] = Integer.valueOf(line).intValue(); } for(i = 0; i&lt;= 9, i++) { smallest = i; for(j = 1; j&lt;=9; j++) { if(age[j] &lt; age[smallest]) { smallest = j; } } for (i = 0; i&lt;=9; i++) { System.out.println(age[i]); } } } }
tagged with: sorting
has comment: http://stackoverflow.com/comment/32303641
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32303304
has comment: http://stackoverflow.com/comment/32303244
has title: Java Selection Sort Confusion
tagged with: selection-sort
has answer: http://stackoverflow.com/a/21413682
accepted answer: http://stackoverflow.com/a/21413682
possible better answer: http://stackoverflow.com/a/21662470
has answer: http://stackoverflow.com/a/21662470
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32303883
has comment: http://stackoverflow.com/comment/32303355
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/32303327

http://stackoverflow.com/a/21422111
accepted answer of: http://stackoverflow.com/q/21407003
type: Answer
answers question: http://stackoverflow.com/q/21407003
score: 1
upvote count: 1
has body: Printing modes are responsible for scaling the output and spreading it across pages. You can print your table in one of the following modes: table1.print(PrintMode.NORMAL); OR table1.print(PrintMode.FIT_WIDTH); Have a look How to Print Tables.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21395596
has comment: http://stackoverflow.com/comment/32272139
has answer: http://stackoverflow.com/a/21395639
upvote count: 1
downvote count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21395635
has comment: http://stackoverflow.com/comment/32272150
has comment: http://stackoverflow.com/comment/32272946
possible better answer: http://stackoverflow.com/a/21395635
has comment: http://stackoverflow.com/comment/32272187
has comment: http://stackoverflow.com/comment/32272182
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32272131
has body: I am replacing a character in a string. There has to be a better way to do this, right? public static String eqEq(String stringIn) { char[] stringArray; stringArray = stringIn.toCharArray(); for (int i = 0; i &lt; stringIn.length(); i++){ if(stringArray[i] == '='){ stringArray[i] = '?'; } } String sReturn = new String(stringArray); return sReturn; }
has comment: http://stackoverflow.com/comment/32272223
type: Question
has comment: http://stackoverflow.com/comment/32272107
has title: Replacing a character in a string
has answer: http://stackoverflow.com/a/21395634
accepted answer: http://stackoverflow.com/a/21395634
score: 0
answer count: 3

http://stackoverflow.com/comment/32385127
score: 0
has text: Have you seen Textfield.TextfieldFilter? Is this what you are looking for?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21459636

http://stackoverflow.com/comment/32402323
type: Comment
has text: What should happen with a string like `"x foobarbaz y"`?
comment on: http://stackoverflow.com/q/21469286
score: 3
type: QuestionComment

http://stackoverflow.com/a/58197933
downvote count: 0
answers question: http://stackoverflow.com/q/21487219
type: Answer
has body: I ran into that issue trying to call org.jdbi.v3.core.result.ResultIterable#one in the Evaluate expression window during a debugging session. IntelliJ showed the following error message No such instance method: 'one' while the code was just running fine when I did not have a debugger attached. It turned out that my Project language level in IntelliJ was no set properly (can be set under Project settings -> Project). The one method is implemented as a default method in an interface. My JAVA_HOME was properly set to a JDK 12 but the Project language level was set to 6. After adjusting the Project language level to 12 the error was gone and I could step through the method.
score: 1
upvote count: 1

http://stackoverflow.com/q/21500084
accepted answer: http://stackoverflow.com/a/21501536
score: 0
has body: I want to know if is possible to generate Java classes with leve package by a xsd file. I know jaxb parser but it didn´t generate to me level package, all files are in the same package.
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has title: Generate java classes from a xsd file with leve package
has answer: http://stackoverflow.com/a/21501536
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: xml-parsing

http://stackoverflow.com/comment/32332455
has text: No problem, see http://stackoverflow.com/questions/3617687/is-it-possible-to-dynamically-define-column-names-in-hibernate-jpa/3618315
type: AnswerComment
comment on: http://stackoverflow.com/a/21428597
score: 0
type: Comment

http://stackoverflow.com/comment/32431117
has text: Using a LinkedList as a FIFO queue is, I think, logically more simple than managing an insertion location on an array. Every line, do list.addLast(line). if list.size() > 4, list.removeFirst(). done.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21468356
type: Comment

http://stackoverflow.com/a/21502726
score: 8
has comment: http://stackoverflow.com/comment/32461949
has body: When using images, you want to load them through URL with Class.getResource(), which returns a URL. Passing a String the the ImageIcon will cause the image to be looked up through the file system. Though this may work during development in your IDE, you'll come to find out it won't work at time of deployment. Better make the changes now. To use this method, you want do this ImageIcon icon = new ImageIcon(Images.class.getResource("/Users/georgebastow/Picture/background.jpg")); For this to work though, you file structure needs to look like this ProjectRoot src Users georgebastow Picture background.jpg A more common approach is just to put the image a reousrces folder in the src ProjectRoot src resources background.jpg And use this path ImageIcon icon = new ImageIcon(Images.class.getResource("/resources/background.jpg")); When you build, your IDE will transfer the images to the class path. Side Note Don't paint on top level containers like JFrame. Instead use JPanel or JComponent and override the paintComponent method. if using JPanel, you should also call super.paintComponent in the paintComponent method. Run you Swing Apps from the Event Dispatch Thread like this public static void main(String[] args) { SwingUtiliities.invokeLater(new Runnable(){ public void run() { new Images(); } }); } See Initial Thread Don't call Thread.sleep(). When running from the EDT (like you should), you will block it. Instead use a java.swing.Timer if it's animation you're looking for. Even if it's not animation, still use it! See this example for Timer program. Also as @mKorbel mentioned, you never add anything to the frame. UPDATE Run this example. I also forgot to mention, when you paint on JPanel you also want to override the getPreferredSize(). This will give your panel a size. src/resources/stackoverflow5.png import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; im…
has comment: http://stackoverflow.com/comment/32462593
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21502502
has comment: http://stackoverflow.com/comment/32462744
downvote count: 0
has comment: http://stackoverflow.com/comment/32462636
has comment: http://stackoverflow.com/comment/32462417
has comment: http://stackoverflow.com/comment/32462356
accepted answer of: http://stackoverflow.com/q/21502502
has comment: http://stackoverflow.com/comment/32462103
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/32461999
has comment: http://stackoverflow.com/comment/32462466
has comment: http://stackoverflow.com/comment/32462249
has comment: http://stackoverflow.com/comment/32462587
has comment: http://stackoverflow.com/comment/32462153
has comment: http://stackoverflow.com/comment/32462265
has comment: http://stackoverflow.com/comment/32462827
has comment: http://stackoverflow.com/comment/32462140
has comment: http://stackoverflow.com/comment/32462677

http://stackoverflow.com/q/21379171
has answer: http://stackoverflow.com/a/30838285
score: 4
possible better answer: http://stackoverflow.com/a/30838285
tagged with: java
answer count: 2
has body: I'm using a map store to persist my hazelcast distributed map in a database. In my test case, I start three hazelcast instances, each configured the same way: Config cfg = new Config(); cfg.setInstanceName("name"); hazelcast = Hazelcast.newHazelcastInstance(cfg); MapConfig mapConfig = new MapConfig("myMapName"); MapStoreConfig mapStoreConfig = new MapStoreConfig(); mapStoreConfig.setClassName(MyMapStore.class.getName()); mapStoreConfig.setWriteDelaySeconds(0); mapStoreConfig.setEnabled(true); mapConfig.setMapStoreConfig(mapStoreConfig); mapConfig.setBackupCount(2); hazelcast.getConfig().addMapConfig(mapConfig); IMap myMap = hazelcast.getMap("myMapName"); However, when I add values to the map, only the first Cluster member writes into the database, the MapStoreConfig is just set to Default values on each other node. But, if I change the code to the following, it works: Config cfg = new Config(); cfg.setInstanceName("name"); MapConfig mapConfig = new MapConfig("myMapName"); MapStoreConfig mapStoreConfig = new MapStoreConfig(); mapStoreConfig.setClassName(MyMapStore.class.getName()); mapStoreConfig.setWriteDelaySeconds(0); mapStoreConfig.setEnabled(true); mapConfig.setMapStoreConfig(mapStoreConfig); mapConfig.setBackupCount(2); cfg.addMapConfig(mapConfig); hazelcast = Hazelcast.newHazelcastInstance(cfg); IMap myMap = hazelcast.getMap("myMapName"); Seems like the line hazelcast.getConfig().addMapConfig(mapConfig); is ignored. Tested with hazelcast v3.1.5.
accepted answer: http://stackoverflow.com/a/21380760
has answer: http://stackoverflow.com/a/21380760
has title: Hazelcast MapStoreConfig ignored
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: hazelcast
favorite count: 0
type: Question

http://stackoverflow.com/comment/32268403
type: AnswerComment
comment on: http://stackoverflow.com/a/21393235
type: Comment
has text: Wow, thanks! Today you helped me to understand how to keep the original value of a variable while working with recursive methods.
score: 0

http://stackoverflow.com/a/21426984
score: 0
has comment: http://stackoverflow.com/comment/32326559
has comment: http://stackoverflow.com/comment/32326371
type: Answer
has comment: http://stackoverflow.com/comment/32326282
has body: References die after scope, objects live as long as they are being used, by user or by (in your case)JVM.
answers question: http://stackoverflow.com/q/21426888

http://stackoverflow.com/q/21438221
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24616234
downvote count: 0
tagged with: cxf
score: 1
tagged with: java
type: Question
has body: I have two internal client libraries. One uses JAX-WS RI (I think its Metro now) and the other Apache CXF. Both of these clients need to be loaded in the same Web App. The reason both cannot use Metro is because one of the clients needs XmlBeans (despite my best attempts at XJB transforming the schema I could not get JAXB to work). The obvious solution I guess is to port the other client to CXF however what if I create a custom fake Provider that uses ThreadLocal variable that says which real provider to use then have a static method to set the ThreadLocal variable before using the client. Is that a bad idea?
has answer: http://stackoverflow.com/a/24616234
tagged with: java-metro-framework
upvote count: 1
answer count: 1
has title: Using Two different JAX-WS client implementations
favorite count: 0
tagged with: web-services

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/21433328
type: Tag

http://stackoverflow.com/a/21405019
answers question: http://stackoverflow.com/q/21404597
has comment: http://stackoverflow.com/comment/32291187
upvote count: 1
has comment: http://stackoverflow.com/comment/32290929
has body: I think it really depends on the type of package. Your example in not really a good one. I would advice structuring based on functionality, but rewrite the example as follows: com.example.vehicles.car com.example.vehicles.truck com.example.vehicles.bus com.example.vehicles.motorcycle but the following "things" are not vehicles - they are parts that can be used in vehicles: com.example.vehicleparts.transmission com.example.vehicleparts.interior com.example.vehicleparts.steering com.example.vehicleparts.electronics and now in your car you can use com.example.vehicleparts.transmission. However sometimes you might want to use package private fields and method, in that case you could put them all in one package to deal with it.
type: Answer
has comment: http://stackoverflow.com/comment/32290156
downvote count: 0
score: 1

http://stackoverflow.com/a/21499979
downvote count: 0
answers question: http://stackoverflow.com/q/21499495
has comment: http://stackoverflow.com/comment/32456652
has comment: http://stackoverflow.com/comment/32456142
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32456618
has comment: http://stackoverflow.com/comment/32456060
has body: As @kleopatra noted, follow java naming convention. variables start with lower case. Why in the world are you naming the JFrame ManagerInterface when the class name is ManagerInterface? Why in the world do you have two main methods? You only need it in the ManagerInterface, the launching class. Just make ShowEmployee subclass JInternalFrame. Then just add it to the JFrame (that you are going to name something else) that is in ManagerInterface public class ManagerInterface { private Frame frame; private ShowEmployees showEmployee; public ManagerInterface() { showEmployees = new ShowEmployees(); frame = new JFrame("MagagerInterface"); frame.add(new ShowEmployees()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativTo(null); frame.setVisible(true); } } public class ShowEmployees extends JInternalFrame { public ShowEmployees() { } } Adding on to 4. You should be adding JInternalFrame to JDesktopPanes and not JFrame JDesktopPane desktop; public ManagerInterface() { showEmployees = new ShowEmployees(); desktop = new JDesktopPane(); desktop.add(showEmployees); frame = new JFrame("MagagerInterface"); frame.setContentPane(desktop); .... } Run your Swing apps from the EDT public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { new ManagerInterface(); } }); } See Initial Threads The below doesn't cause a problem, but you should know that a parent can only have one parent container. So you trying to add the table to the frame and the scroll pane shouldn't be done. Just add the scroll pane frame.add(table); &lt;&lt;---------------------Get Rid of MEEEE! JScrollPane scroll = new JScrollPane(table); frame.getContentPane().add(scroll, BorderLayout.SOUTH); Here is a running example with all the above mentioned fixes. import javax.swing.*; public class ManagerInterface { public JFrame frame = new JFrame("Manager Interface"); private ShowEmployee showEmployee; private JDesktopPane desktop; publi…
type: Answer
accepted answer of: http://stackoverflow.com/q/21499495
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32456400
has comment: http://stackoverflow.com/comment/32456553

http://stackoverflow.com/q/21370128
tagged with: class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32225922
possible better answer: http://stackoverflow.com/a/21370152
has comment: http://stackoverflow.com/comment/32225918
has answer: http://stackoverflow.com/a/21370146
has comment: http://stackoverflow.com/comment/32225956
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32226584
tagged with: java
has title: What are reasons why java could "mix up" different instances of the same class?
has answer: http://stackoverflow.com/a/21370152
has body: I have code that looks like this: player a=new player(4,10,2,3,"You",'@'); player b=new player(4,10,12,3,"Him",'@'); a.pickUp(new weapon("Lightsaber",true,1,1)); System.out.println(a.getPlayerInventory()[0]); System.out.println(b.getPlayerInventory()[0]); However, at this point, the output of this code tells me that the content's of B's inventory also include a lightsaber. (The same object that player A has.) What are some possible reasons for this to occur in java? Could it have something to do with whether other methods are static or public/private or not? I did try googling it, but couldn't find anything (probably because I do not know what this problem is called.) Thank you for any help you can give me.
type: Question
has comment: http://stackoverflow.com/comment/32237942
has comment: http://stackoverflow.com/comment/32225908
accepted answer: http://stackoverflow.com/a/21370146

http://stackoverflow.com/q/21374557
has comment: http://stackoverflow.com/comment/32234152
tagged with: java
has comment: http://stackoverflow.com/comment/32233919
has answer: http://stackoverflow.com/a/21374671
type: Question
has comment: http://stackoverflow.com/comment/32234853
has answer: http://stackoverflow.com/a/21374727
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/9365829
has title: File Not Found Exception From HTTP Webservice URL
has body: I am using the following url to login into the android application http://182.18.133.88/php/gprs_request.php?cmd=balance&username=xxxxx&password=xxxxx. whenever i am calling this url in web browser the return xml is like this. 27.01.2014 11:54:54 AM true Your Credit Current Balance is 100.00. Please Recharge Soon. </root> So that i am parsing this particular xml file using sax parser.suppose if the result is true the user should login into application.It works perfectly in Android 4.0 and above.i tested it in 4.1.2 it works fine but i run this application in android 2.3.6 device it gets the following system error logs. 01-27 11:46:03.562: W/System.err(18991): java.io.FileNotFoundException: http://182.18.133.88/php/gprs_request.php?cmd=balance&username=RTxxxx&password=yyyy=balance&username=RTxxxx&password=yyyy 01-27 11:46:03.570: W/System.err(18991): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521) 01-27 11:46:03.570: W/System.err(18991): at java.net.URL.openStream(URL.java:645) 01-27 11:46:03.570: W/System.err(18991): at com.androidapp.paraservices.common.WebserviceCall.doInBackground(WebserviceCall.java:51) 01-27 11:46:03.570: W/System.err(18991): at com.androidapp.paraservices.common.WebserviceCall.doInBackground(WebserviceCall.java:1) 01-27 11:46:03.570: W/System.err(18991): at android.os.AsyncTask$2.call(AsyncTask.java:185) 01-27 11:46:03.570: W/System.err(18991): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) 01-27 11:46:03.570: W/System.err(18991): at java.util.concurrent.FutureTask.run(FutureTask.java:138) 01-27 11:46:03.570: W/System.err(18991): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) 01-27 11:46:03.578: W/System.err(18991): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) 01-27 11:46:03.578: W/System.err(18991): at java.lang.Thread.run(Thread.java:1019) 01-27 11:46:03.578: D/LOGINAC…
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/32337624
score: 0
has text: I understand I have to use try and catch. But what do I put in the bracket after catch is what I mean.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21433374

http://stackoverflow.com/comment/32253842
type: Comment
comment on: http://stackoverflow.com/q/21385429
has text: Ok so you have this image `GI_Background`, but what do you do with it? Do you add it to a label, do you paint it? I don't see you doing anything with it.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32478673
type: QuestionComment
has text: because you create a new object whenever hes fireing instead of using the same object if it's unused
comment on: http://stackoverflow.com/q/21509652
score: 0
type: Comment

composite
tags question: http://stackoverflow.com/q/21507513
type: Tag
tags question: http://stackoverflow.com/q/21437532
tag name: composite
tags question: http://stackoverflow.com/q/21478997

http://stackoverflow.com/comment/32458352
type: QuestionComment
comment on: http://stackoverflow.com/q/21500750
has text: @jb-nizet....added file content into main post
score: 0
type: Comment

http://stackoverflow.com/q/21491635
upvote count: 1
has comment: http://stackoverflow.com/comment/32441711
tagged with: nodes
type: Question
has answer: http://stackoverflow.com/a/29000349
answer count: 6
has answer: http://stackoverflow.com/a/26660786
has answer: http://stackoverflow.com/a/21492296
has body: I have written a code to swap elements of linkedList in Java. Currently, my code fails, i.e., it is not swapping elements. I am having difficulty on how to approach to this problem. Any tips? public void switchPairs(){ if (front==null || front.next==null) return ; ListNode temp=front; front=front.next; ListNode curr=front; while(curr.next!=null){ ListNode dummy = curr.next; curr.next=temp; temp.next=dummy; temp=temp.next; curr=dummy; } } Input : front -&gt; [3] -&gt; [7] -&gt; [4] -&gt; [9] -&gt; [8] -&gt; [12] / Expected output: front -&gt; [7] -&gt; [3] -&gt; [9] -&gt; [4] -&gt; [12] -&gt; [8] / my output: front -&gt; [7] -&gt; [3] -&gt; [4] -&gt; [9] -&gt; [8] -&gt; [12] /
downvote count: 0
tagged with: swap
score: 1
has title: swap pair elements in linked list implemented in Java
has answer: http://stackoverflow.com/a/26384703
favorite count: 0
has answer: http://stackoverflow.com/a/21492113
possible better answer: http://stackoverflow.com/a/21492113
type: AnsweredQuestion
tagged with: linked-list
accepted answer: http://stackoverflow.com/a/21492296
has answer: http://stackoverflow.com/a/24528115
tagged with: java
has comment: http://stackoverflow.com/comment/32441737
has comment: http://stackoverflow.com/comment/32441630

dll
tags question: http://stackoverflow.com/q/21401056
type: Tag
tag name: dll
tags question: http://stackoverflow.com/q/21486086

http://stackoverflow.com/a/21434470
has comment: http://stackoverflow.com/comment/32344215
has comment: http://stackoverflow.com/comment/32340655
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21433927
has body: You probably need to increase the security level for the agent. To be able to access the file system from the agent.
has comment: http://stackoverflow.com/comment/32340245
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21433927

http://stackoverflow.com/q/21446588
has answer: http://stackoverflow.com/a/21446652
downvote count: 12
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21446619
has body: I am missing the prime numbers, 2 and 3 from the output. public static ArrayList&lt;Integer&gt; findPrimes(int n){ ArrayList&lt;Integer&gt; primes = new ArrayList&lt;Integer&gt;(); for (int i = 2; i &lt; n; i++){ for(int x = i - 1; x &gt; 2; x--) if(i % x == 0) break; else if(x == 3 &amp;&amp; i != 4) primes.add(i); } return primes; } When I put n = 72, it prints good, but 2 and 3 are not being output. I have no clue why it keeps printing that. Any help would be great. As shown below. Output: Prime numbers: 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 Thanks! If you have another way, feel free to throw out, something I can learn from. Thanks a lot!
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21472233
has answer: http://stackoverflow.com/a/21472299
type: Question
has answer: http://stackoverflow.com/a/21472126
has title: Missing the 2 and 3 in Prime
tagged with: java
score: -12

http://stackoverflow.com/a/21511684
answers question: http://stackoverflow.com/q/21511616
has body: This is just part of the specification of Java as a C-type language. Per the specification, if integer values aren't promoted in an expression, then the result of the calculation is an integer. The language designers could have decided to make the result of all calculations floating point numbers, but decided not to, probably because that behavior for primitive types was not familiar to C and C++ programmers, and because it makes the operations slower.
score: 0
type: Answer

http://stackoverflow.com/comment/32427962
type: Comment
comment on: http://stackoverflow.com/a/21484048
has text: your screenshots were from mac right? I am running intellij on linux, the font in editor doesn't look so nice as yours... tried a lot googling... what font do you used and do you have some special java-opts/intellij options set? I just switched from eclipse to intellj two months ago.. the eclipse font rendering is much better I have to say.. (I used monaco anti-aliased in eclipse, it looked great)
type: AnswerComment
score: 0

http://stackoverflow.com/q/21421048
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21421183
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21421238
has body: I started experimenting with time and date pickers in Andrioid. My classes are as follows: Main.java package com.valgriz.testapplication2; import android.os.Bundle; import android.app.Activity; import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; public class Main extends FragmentActivity implements OnClickListener, OnItemSelectedListener { Button bPickTime; Button bPickDate; Spinner sTime; TimePickerFragment tpf; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bPickTime = (Button) findViewById(R.id.bPickTime); bPickDate = (Button) findViewById(R.id.bPickDate); sTime = (Spinner) findViewById(R.id.sTime); bPickTime.setOnClickListener(this); bPickDate.setOnClickListener(this); sTime.setOnItemSelectedListener(this); ArrayAdapter sAdapter = ArrayAdapter.createFromResource(this, R.array.sChoices1, android.R.layout.simple_spinner_item); sAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sTime.setAdapter(sAdapter); } public void onClick(View v) { if (v.getId() == R.id.bPickTime) { DialogFragment df = new TimePickerFragment(); df.show(getSupportFragmentManager(), "timePickerFragment"); } else if (v.getId() == R.id.bPickDate) { DialogFragment df = new DatePickerFragment(); df.show(getSupportFragmentManager(), "datePickerFragment"); } } public void onItemSelected(AdapterView&lt;?&gt; arg0, View v, int selection, long identification) { } public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } } TimePickerFragment.java package com.valgriz.testapplication2; import java.util.Calendar; import android.app.Dialog…
has title: How can I change the text of my Button from my TimePickerFragment class?
score: 0
answer count: 2

http://stackoverflow.com/a/21509000
type: Answer
has comment: http://stackoverflow.com/comment/32472496
upvote count: 9
has comment: http://stackoverflow.com/comment/32472399
accepted answer of: http://stackoverflow.com/q/21508954
has comment: http://stackoverflow.com/comment/32472473
score: 9
has comment: http://stackoverflow.com/comment/32472450
has comment: http://stackoverflow.com/comment/32472431
answers question: http://stackoverflow.com/q/21508954
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32472367
has body: String.split takes a regex to split on, so you can simply: String[] array = myString.split("\\+|\\-|\\*|\\/"); please give me some feedback Hope that helps .

http://stackoverflow.com/comment/32358375
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21444663
type: Comment
has text: @eagertoLearn: You just set the pointer to the beginning of the list to point to what was previously the second element.

http://stackoverflow.com/comment/32264112
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21390995
has text: Thank you. This is immensely helpful. This seems like the part of java that isn't covered in the java book that I've been reading such as "Head First Java". It's a clever and clean approach. Could you point me to a book that speaks of such clever and clean object oriented programming design using java please? Thank you!
score: 0

http://stackoverflow.com/comment/32436026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21488761
has text: i want to add values in to the table "templ". when the application loads its main activity.

http://stackoverflow.com/comment/32782186
type: AnswerComment
comment on: http://stackoverflow.com/a/21684150
type: Comment
has text: Can you test serializing your POJO using ObjectMapper writeValueAsString ?
score: 0

http://stackoverflow.com/comment/32273265
has text: What does the error say?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21396187

http://stackoverflow.com/comment/32227419
type: Comment
type: QuestionComment
has text: Things I played with: Implements Runnable, extends Thread in the ClientHandler.
comment on: http://stackoverflow.com/q/21365679
score: 0

http://stackoverflow.com/comment/32422252
comment on: http://stackoverflow.com/q/21481193
has text: Hibernate's sequence generation optimizers insert gaps even in normal behavior: the database's sequence is multiplied by, say, 100, and a single `nextval` "checks out" a packet of 100 IDs, which may or may not get used.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32295746
comment on: http://stackoverflow.com/q/21409397
type: Comment
type: QuestionComment
has text: even if you're a different person, the question is the same :)
score: 0

http://stackoverflow.com/a/21481643
type: Answer
has body: p and q are value copies of references. Within F, assigning p = q just changes what p is pointing to, not the actual object itself, or any value in the caller. p.x = 42 changes the field x to have the value 42 in the object referenced by p. Putting it all together, a will have its x field changed by Util.F, but b is not changed in any way.
score: 0
answers question: http://stackoverflow.com/q/21481571

http://stackoverflow.com/a/21465953
has comment: http://stackoverflow.com/comment/32396084
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/32396219
upvote count: 1
has comment: http://stackoverflow.com/comment/32396387
answers question: http://stackoverflow.com/q/21465574
has body: public boolean isHealthy(){ int counter = 0; ListElement&lt;T&gt; node = first; while(node.next != null){ counter++; node = node.next; } // this checks if the if statement fails // or not and returns the result(true/false) return if (counter == size); } You just have to check if the next element exists.
downvote count: 0
has comment: http://stackoverflow.com/comment/32396007

http://stackoverflow.com/q/21392757
linked to: http://stackoverflow.com/q/15450897
answer count: 1
tagged with: enums
has answer: http://stackoverflow.com/a/21392958
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32267679
has body: Consider I have several enums similar to the below: enum FooA { THREE(3), FOUR(4), SEVERN(7); private int x; private Foo(int x) { this.x = x; } } enum FooB { EIGHT(8), ONE(1), TEN(10); private int x; private Foo(int x) { this.x = x; } } If I wanted to add a method which returns x in every enum, should I: Add the method in to every enum? Create an abstract class which holds x and already has the getX method implemented. Create an interface which holds a getX method and implement it for every enum? The reason I ask this is because it seems to me as if using an abstract class or interface is over-doing it, especially if it's just for a single getter.
downvote count: 1
has title: Interfaces or abstract classes holding getters
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32267433
has comment: http://stackoverflow.com/comment/32267186
favorite count: 0
has comment: http://stackoverflow.com/comment/32267297
type: Question
has comment: http://stackoverflow.com/comment/32267551
upvote count: 1

http://stackoverflow.com/a/21411961
type: Answer
has body: You can check particular value, whether it is null or it has value. And then add your display logic as follows protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Get the message from the intent Intent intent = getIntent(); String message = null; // Create the text view TextView textView = (TextView) findViewById(R.id.display_message); if(intent != null){ message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); } if(message != null &amp;&amp; message.length() &gt; 0){ textView.setTextSize(40); textView.setText(message); }else{ textView.setTextSize(40); textView.setText(R.string.hello_world); } // Show the Up button in the action bar. setupActionBar(); }
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21411768
downvote count: 0

http://stackoverflow.com/comment/122999415
comment on: http://stackoverflow.com/a/44807065
type: Comment
has text: there is no need to add "SELECT s" ? can we start directly from "FROM"?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21406924
tagged with: php
has title: android file upload not working
type: AnsweredQuestion
has body: I have an app that uploads a file to a web server, that handles the file with some basic php, but it gives me a success, while the file is not stored. This is my code: package com.fancypants.upload; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { TextView messageText; Button uploadButton; int serverResponseCode = 0; ProgressDialog dialog = null; String upLoadServerUri = null; /********** File Path *************/ final String uploadFilePath = "/mnt/sdcard/"; final String uploadFileName = "curtain_call.jpg"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); uploadButton = (Button)findViewById(R.id.uploadButton); messageText = (TextView)findViewById(R.id.messageText); messageText.setText("Uploading file path :- '/mnt/sdcard/"+uploadFileName+"'"); /************* Php script path ****************/ upLoadServerUri = "http://androidapp.tisishare.be/upload/upload.php"; uploadButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog = ProgressDialog.show(MainActivity.this, "", "Uploading file...", true); new Thread(new Runnable() { public void run() { runOnUiThread(new Runnable() { public void run() { messageText.setText("uploading started....."); } }); uploadFile(uploadFilePath + "" + uploadFileName); } }).start(); } }); } public int uploadFile(String sourceFileUri) { String fileName = sourceFileUri; HttpURLConnection conn = null; DataOutputStream dos = null; String lineEnd = "\r\n"; String twoHyphens = "-…
score: 0
tagged with: java
type: Question
tagged with: upload
has answer: http://stackoverflow.com/a/21407489
answer count: 1
accepted answer: http://stackoverflow.com/a/21407489
tagged with: android

http://stackoverflow.com/comment/32444935
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21492728
has text: OK, so when I asked how you were testing size, I meant size of that object in memory. The 'removed' Socked Connects will remain in the heap until the Garbage Collector (GC) removes them. The GC will only do this every now and again.
type: Comment

http://stackoverflow.com/comment/32344369
type: Comment
type: QuestionComment
has text: @pamphlet 5, `Thread.sleep` works with milliseconds
comment on: http://stackoverflow.com/q/21437242
score: 0

http://stackoverflow.com/q/21435707
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32341878
has body: I have a table: Address(String ID, street, streetName, state, postalCode) I want to get the output as JSON data for only the state and postalCode columns. To do this, I tried to use Hibernate with the following query into my DAO layer: Query query = s.createQuery("select a.state, a.postalCode from Address a"); List list = query.list(); And I am getting output like: {"JSON":"success","authority":null,"gridModel":[1,2,3]} But my expected output is like the following: {"JSON":"success","authority":null,"gridModel":[{"state":"NY","postalCode":"123"},{"state":"VA","postalCode":"222"},{"state":"MD","postalCode":"159"}]} Code for that table: @Entity public class Address implements Serializable { @Id @GeneratedValue(...) @SequenceGenerator(...) @Column(name = "ID") String ID; String street; String streetName; String state; String postalCode; // getters and setters } struts.xml file code: &lt;action name="jsonFormatDate" class="com.example.ActionClass" method="jsonFormatDate"&gt; &lt;result type="json" /&gt; &lt;/action&gt; Can anybody tell me what I have to add / modify the code to get the above output? Do I need to do some extra mapping or modify the query etc. for getting that desired output? Thanks.
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32341828
has title: How to use Hibernate 'SELECT' query for JSON output to retrieve data form selected columns?
type: Question
has comment: http://stackoverflow.com/comment/32341986
score: 0
has comment: http://stackoverflow.com/comment/32342083
answer count: 0

http://stackoverflow.com/q/21360831
upvote count: 1
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/32208820
tagged with: java
has title: how to compare Frame and button width and length?
has body: in swing environment , i draw button and set action to move on my frame. when my button reached the corner of frame or button and frame length and width are equals ; do other action or something like that. my problem is i cant find any Component to compare the button and frame location or length and width . ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { x= x + 10 ; y=y + 10 ; jButtonMove.setLocation(x, y); } }; Timer t = new Timer(500 , al); t.start();
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21360952
type: Question
tagged with: frame
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32212464

http://stackoverflow.com/q/21363926
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/21364235
tagged with: search
answer count: 2
has comment: http://stackoverflow.com/comment/32214271
downvote count: 0
has title: Reusable method for searching
favorite count: 0
has answer: http://stackoverflow.com/a/21364235
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21364007
score: 1
has body: I have a Product class with fields named (String)code, (String)name, (Double)price and (Date)expiration with each own getter and setter method. I have another class ListProduct that contains a field List named productList. Below is a ListProduct class i created a method to return all the product searched by product name only. public List&lt;Product&gt; SearchItemByName(ListProduct list, String name) { List&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); for (Product prod : list.productList) { if (prod.getName().toLowerCase().contains(name.toLowerCase())) { products.add(prod); } } return products; } What I need to know is how to make the above a reusable method that can search the list not only by its name,like using lambda expression or anonymous method.
has comment: http://stackoverflow.com/comment/32214187
has answer: http://stackoverflow.com/a/21364007
upvote count: 1

http://stackoverflow.com/comment/32344258
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21437177
has text: You've only included the main method of what looks like a driver class, where is the Rectangle class?
score: 1

http://stackoverflow.com/comment/32471736
score: 2
has text: Yes. You can write everything in one line.
comment on: http://stackoverflow.com/q/21508682
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21382994
tagged with: java
tagged with: android-ndk
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/32249800
score: 0
has body: i have a method something like this in my code (java). public void DoSomeStuff() { Log.i(TAG,"1"); Log.i(TAG,"2"); Log.i(TAG,"3"); } This is called from C++ through JNI. I'm 100% sure the JNI works and has nothing to do with my problem. The problem is: Only the first line of the code runs (the output is "1"), and the rest gets ignored. It doesn't matter what i write in the first line... only that gets executed. There aren't any error messages, freezes, or any relevant information to help in debugging. I have also tried to clear the bin/gen folders but no success. The worst part is that, sometimes it works... and sometimes it doesn't. Thanks
has answer: http://stackoverflow.com/a/21383540
answer count: 1
has title: Strange androidNDK - java, only the first line of code is running
has comment: http://stackoverflow.com/comment/32272212
tagged with: visual-studio
tagged with: c++
type: UnansweredQuestion

http://stackoverflow.com/q/21429085
has comment: http://stackoverflow.com/comment/32329919
tagged with: java
has comment: http://stackoverflow.com/comment/32329958
accepted answer: http://stackoverflow.com/a/21429137
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2160788
type: Question
possible better answer: http://stackoverflow.com/a/21429126
has title: What exactly is ".class" in Java Source Code
has body: I was surfing in SO &amp; I found syntax in Java as below: String.class.getDeclaredField("value"); I could not understand how it works Example: In System.out.println(); out is static variable in System class of PrintWriter Can any one explain what String.class.getDeclaredField("value"); and it's returning object of Field class means? I just looked &amp; I couldn't find class property(field) in String class. What is it actually doing? Thanks in advance.
has answer: http://stackoverflow.com/a/21429126
tagged with: reflection
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21429137

http://stackoverflow.com/a/21350234
upvote count: 20
type: Answer
has comment: http://stackoverflow.com/comment/32190226
has body: The unordered() operation doesn't do any actions to explicitly unorder the stream. What it does is that it removes the constraint on the stream that it must remain ordered, thereby allowing subsequent operations to use optimizations that don't have to take ordering into consideration. You can read about this in the Java 8 docs: For sequential streams, the presence or absence of an encounter order does not affect performance, only determinism. If a stream is ordered, repeated execution of identical stream pipelines on an identical source will produce an identical result; if it is not ordered, repeated execution might produce different results. For parallel streams, relaxing the ordering constraint can sometimes enable more efficient execution. ... In cases where the stream has an encounter order, but the user does not particularly care about that encounter order, explicitly de-ordering the stream with unordered() may improve parallel performance for some stateful or terminal operations.
downvote count: 0
score: 20
has comment: http://stackoverflow.com/comment/90945749
answers question: http://stackoverflow.com/q/21350195
has comment: http://stackoverflow.com/comment/32190296

http://stackoverflow.com/comment/32712157
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21360091
score: 0
has text: i'm confused between PostConstruct & init() and PreDestroy & destroy(). One is called right at the beginning/end and the other one when everything regarding a class is available and set to do some operation.

http://stackoverflow.com/comment/32419685
comment on: http://stackoverflow.com/a/21479810
type: AnswerComment
score: 0
has text: @ᴍarounᴍaroun Where is doing this?
type: Comment

http://stackoverflow.com/a/21373071
has body: Joining to the projects of departments is necessary, because single project is later on needed in WHERE clause: p.location = :location Projects is a collection. Consequently e.projects is collection valued path expression. It is not possible navigate through collection valued path expression. Following construct is not expected to work, because collection does not have location property. e.projects.location = :location
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21372116
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21372116

http://stackoverflow.com/comment/33504500
comment on: http://stackoverflow.com/a/22086319
has text: Oh than you should specify on top that this is the solution of particular problem,and at the end this is the QA site..anyways..edit your question so that people avoids such mislead . If you mentioned so i would tried directly your posted solution ..!!!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32226952
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21360106
has text: You should use an IDE anyway. Rather than bare Eclipse, I recommend [Groovy/Grails Tool Suite](http://spring.io/tools/ggts), which is an Eclipse distribution that comes prepackaged with all of the Groovy toolkit (as well as Grails/Spring support, which you can ignore if you're not using it). I use it even though I'm not a Groovy person just because some of the tools I use (Logback) use Groovy DSLs for configuration, and GGTS gives me nice syntax highlighting and such.
type: QuestionComment

http://stackoverflow.com/comment/32444926
has text: Yes, clone should be o.k. (have to admit, I avoid clone cause its harder/tricky to use in many cases). And yes, call myHashCode in the constructor and set a final field.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21492933
score: 0

http://stackoverflow.com/q/21450374
tagged with: java
type: Question
has body: there! My idea is too plain but I couldn't find a solution. I am used to build web projects using maven. I asseble a project and deploy it into jboss, start AS and watch a result throught web-browser. I used to use JSP. Now I decided to study build web-proj using GWT/SmartGWT technology. I've looked throught the Internet and come across a lot of explanation examples. Some of them are based on using Ant, some of them - used Eclipse + GWT plugin. I prefer to use Intellij IDEA. I saw that IDEA contains GWT-application where I can create a simple HelloWorld project. But this is injected in IDEA, and I can easily run it from IDEA. I mean it is not suit for me, cosa I want to assemble it using maven, and deploy it into jboss on my own. I really can't do it and don't realize how to manage it. I hope you'll give me an example or a link where I can get how to build a project by my "scheme")
answer count: 1
has title: Maven + Jboss + SmartGWT application
has answer: http://stackoverflow.com/a/21450470
score: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/21450470
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/32444192
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21493062
has text: Please tag your questions with the language you're using, it will help the correct experts find your questions.
score: 0

http://stackoverflow.com/q/21468553
has answer: http://stackoverflow.com/a/21469157
tagged with: windows
score: 1
has body: For some reason the installation of the oracle JDK didn't work on the machine I am using. It was installed before I started using it so I figured I would uninstall it and install it properly. When I try to uninstall it in Windows I get the following error message: Error 1316: A network error occurred while attempting to read from the file C:\Installer\jdk1.7.0_51.msi This file doesn't exist on this machine, I think it was somehow deleted. Does anyone know how to get around this problem.
has comment: http://stackoverflow.com/comment/32401324
tagged with: uninstallation
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32401926
has comment: http://stackoverflow.com/comment/32401812
tagged with: java
type: UnansweredQuestion
has title: Uninstalling/Installing JDK
downvote count: 0
has comment: http://stackoverflow.com/comment/32401216
favorite count: 0
type: Question

http://stackoverflow.com/comment/32377691
type: QuestionComment
has text: Ok. just a second please...
comment on: http://stackoverflow.com/q/21455706
score: 0
type: Comment

http://stackoverflow.com/q/21354028
favorite count: 0
type: Question
tagged with: jframe
has body: I am in the making of a small Java program and I was wondering how, if at all, I could make it so that if I was to press the minimize button on my JPanel it would not minimize into the taskbar but into the system-tray. Could anyone please post the code for that? Thanks!
linked to: http://stackoverflow.com/q/7461477
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/32196545
tagged with: system-tray
has title: JPanel minimize to system-tray?
tagged with: jpanel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32196698
downvote count: 0
answer count: 0
score: 1

http://stackoverflow.com/comment/32391550
score: 1
has text: ... and use meaningful names.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21463614

http://stackoverflow.com/q/21460276
type: UnansweredQuestion
tagged with: multithreading
type: Question
score: 1
has comment: http://stackoverflow.com/comment/32385262
tagged with: java
has answer: http://stackoverflow.com/a/21462373
has comment: http://stackoverflow.com/comment/32385280
has title: Two methods (one synchronized the other not) and two threads
has answer: http://stackoverflow.com/a/38677046
answer count: 2
favorite count: 0
upvote count: 5
downvote count: 4
tagged with: synchronization
has body: If one method of an object is synchronized and the other isn't, can two different threads run them on the same time? I know that when a method is marked synchronized the intrinsic lock has to be acquired, but the second method isn't synchronized, does it matter? Or maybe if one thread acquired the lock, all of the methods cannot be entered?

http://stackoverflow.com/comment/32320336
has text: I suggest to add a new `insert_date` field of type `date`, and alter the `id` field to an a auto incremented primary key in your `classdost.xyz_media` table.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21423475
score: 0

http://stackoverflow.com/comment/32293869
type: AnswerComment
has text: Thanks for that Marc. My idea was to decode the data coming from devices sending messages in different formats , apply some business logic on the parsed data , write a reply back to the device or write to file or store in a message queue or store in a database etc. Now, the data written to file or DB could be used by a different application. I was planning to give the GPB protocol definition file to the other party to decipher the message sent from our system. Looks like i am going wrong in the basics itself
type: Comment
comment on: http://stackoverflow.com/a/21407942
score: 0

http://stackoverflow.com/comment/32386942
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21447573
has text: Hi Myth, it does not work. It check for the value, accepted it and at the end, does not matter what value you entered it tells its not a vialid number.
type: AnswerComment

http://stackoverflow.com/a/21419782
accepted answer of: http://stackoverflow.com/q/21419739
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: You are adding a new MouseListener each time results is called... This... DefaultListModel model = new DefaultListModel(); model.addElement(message); showOption.setModel(model); Shows that showOption is an existing instance of JList (which is good), but then you do... MouseListener mouseListener = new MouseAdapter() { //... }; showOption.addMouseListener(mouseListener); Which adds ANOTHER MouseListener to the JList, so the each time this method is called, there will another MouseListener added to the JList. Add a single MouseListener to the JList when you first create it.
type: Answer
answers question: http://stackoverflow.com/q/21419739

http://stackoverflow.com/q/21486546
tagged with: java
has comment: http://stackoverflow.com/comment/32432247
type: Question
upvote count: 0
answer count: 1
score: -7
favorite count: 0
has title: Looping through the keys of a hashMap
has comment: http://stackoverflow.com/comment/32431501
has body: I have a HashMap called AfricanPeople private HashMap&lt;Integer, Object&gt; AfricanPeople = new HashMap&lt;Integer, Object&gt;(); the key is the age and the value is a person object. I want to loop through the hashmaps keys and get all people that are between the age of 30 and 45. Is this possible?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32431648
has answer: http://stackoverflow.com/a/21486591
downvote count: 7
tagged with: hashmap

http://stackoverflow.com/comment/32240019
type: AnswerComment
type: Comment
has text: Ruchira, Base wil be extended by atleast 10 subclasses...
comment on: http://stackoverflow.com/a/21378127
score: 1

http://stackoverflow.com/a/21357333
type: Answer
answers question: http://stackoverflow.com/q/21351657
has body: If you use a security manager you also need to provide a .policy file that gives you the permissions you need. You don't need a security manager with RMI unless you're using the codebase feature. When this is used it it normally to supply classes to the client, not to the server, so it is the client who needs the security manager, not the server. You're probably installing it quite unnecessarily.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/73488920
answers question: http://stackoverflow.com/q/21478178
has body: For me the error occurred because I was passing wrong value in Pageable to backend. The cause was wrong name of the matSortActive property in an Angular .html file. <mat-table matSort matSortDisableClear matSortDirection="asc" matSortActive="name" [dataSource]="this.dataSource">
type: Answer
score: 0

http://stackoverflow.com/q/21501673
has title: Infinispan , How to assure read write lock on a key/cache
favorite count: 0
has answer: http://stackoverflow.com/a/21524481
has body: We are planning to use Infinispan in client server mode. The architecture has many clients (client 1, client 2 and so on ) and a distributed infinispan network. We need to update the data in the cache periodically, say every5 hours . All clients could be able to update the data. If one of them (say client 1) is updating we need to prevent others doing the same job. Once the updating is complete all clients wait another 5 hour and, any of them will do the the updating again. How to achieve this in infinispan 6? Thanks in advance.
type: UnansweredQuestion
tagged with: infinispan
score: 3
upvote count: 3
tagged with: java
tagged with: jboss-cache
tagged with: caching
type: Question
linked to: http://stackoverflow.com/q/21522203
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21351284
linked to: http://stackoverflow.com/q/1516144
favorite count: 0
has answer: http://stackoverflow.com/a/21351301
has comment: http://stackoverflow.com/comment/98064065
has answer: http://stackoverflow.com/a/21351345
tagged with: excel
duplicate of: http://stackoverflow.com/q/1516144
has title: Java Library to read Microsoft Excel files
type: AnsweredQuestion
has body: I want to write a program that compares two Microsoft Excel sheets using Java. Is there any existing library (and its documentation) that can help me get started with basic stuffs like reading all the rows and columns of the excel ?
tagged with: java
tagged with: comparison
possible better answer: http://stackoverflow.com/a/21351345
type: Question
score: 12
accepted answer: http://stackoverflow.com/a/21351301
answer count: 2
upvote count: 12
has comment: http://stackoverflow.com/comment/112664181
downvote count: 0

http://stackoverflow.com/comment/32203119
has text: @DavidWallace I know that it doesn't solve the toString() issue, but it does solve the problem he asked about.
type: Comment
comment on: http://stackoverflow.com/a/21357490
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32392860
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21463873
has text: I don't know Java well but, It might be you are using the wrong match function. See if there is a 'Matches' one. Some langs use auto-full line matches where it has to match the whole line. Some just match the substring.

http://stackoverflow.com/q/21390019
has answer: http://stackoverflow.com/a/21390450
upvote count: 1
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question
downvote count: 0
tagged with: jsp
has body: I am getting the following error when trying to access my pages using Spring MVC, addMinutes.jsp & hello.jsp. I can only access the root localhost, but if I navigate to a page, I get this error: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 11 in XML document from ServletContext resource [/WEB-INF/config/servlet-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'. I've searched online and I think my xml="" links are probably wrong, but I got this straight from the pluralsight.com tutorial. I'm new to JAVA MVC so this is foreign to me. Any help would be appreciated. Here is my servlet-config.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <mvc:annotation-driven/> <context:component-scan base-package="com.pluralsight.controller"></context:component-scan> <!-- <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/>--> </beans> Here is my web.xml <?xml version="1.0" encoding="UTF-8"?> fitTrackerServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/servlet-config.xml fitTrackerServlet *.html Archetype Created Web Application
has title: Spring MVC Servlet Error
has comment: http://stackoverflow.com/comment/32262250
answer count: 3
has answer: http://stackoverflow.com/a/21391498
score: 1
has answer: http://stackoverflow.com/a/21390087
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion

http://stackoverflow.com/comment/32325466
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21426124
has text: which version of spring security do you use?

http://stackoverflow.com/a/21417160
type: Answer
has body: It sounds like you are trying to implement a cache. There are many good concurrent cache implementations out there. I believe guava has a pretty decent implementation.
score: 0
answers question: http://stackoverflow.com/q/21416780

http://stackoverflow.com/q/21395834
has title: How do I append text to a JTextArea from another class?
has body: I'm trying to put a console-type thing on my GUI and for that I'm pretty sure that I have to append text to the JTextArea. For the console to actually be worthwhile I'll have to append text from a different class. For that I built a method to append a string to my console but it threw a NullPointerException and failed. What I'm wondering is how I can append text to my console (JTextArea) from other classes. Here is my code: package com.robot; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; public class GUI extends JFrame implements Runnable { static JTextArea console; //defines the line break static String newline = System.getProperty("line.separator"); //start of the constructor method for GUI public GUI() { //makes the program unable to be resized this.setResizable(false); //allows the user to close the program with the x button this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //sets the title of the program this.setTitle("ROBOT Alpha Alfred Version 3.0"); //creates panels to hold the elements of the GUI JPanel mainPanel = new JPanel(); JPanel buttonPanel = new JPanel(); JPanel consolePanel = new JPanel(); //creates buttons JButton runDemo = new JButton("Run Demo"); JButton runLive = new JButton("Run Live"); JButton scan = new JButton("Scan Market"); JButton findPatterns = new JButton("Find Patterns"); JButton cleanFolder = new JButton("Clean Up Folder"); JButton configureSettings = new JButton("Configure Settings"); //creates the console JTextArea console = new JTextArea(6, 40); //sets the default text of the console console.setText("----------------------- ROBOT Console -----------------------" + newline); //makes the console unable to be edited console.setEditable(false); //sets the line wrapping of the console console.setLineWrap(true); console.setWrapStyleWord(true); //creates scroll bars JScrollPane scrollBar = new JScro…
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21395863
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21395879
has answer: http://stackoverflow.com/a/21395879
tagged with: eclipse
type: Question
answer count: 2
tagged with: jtextarea
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/21395863

http://stackoverflow.com/a/21512327
has body: Implement the Iterable interface. That means you need to implement a method that returns an Iterator object that will iterate over the elements of a BookList. In this case, your iterator() method could just return the result of calling bList.iterator(). (That will cause for (Book b : somBookList) to iterate over the Book objects in the BookList.bList ... ) In other cases, you might need to write your own Iterator&lt;T&gt; implementation class, complete with T next(), boolean hasNext() and remove() methods. For instance, if you wanted to prevent external code from removing elements from the BookList via your iterator, you might implement it like this: public class BookList implements Iterable&lt;Book&gt; { private final List&lt;Book&gt; bList = new ArrayList&lt;Book&gt;(); //... @Override public Iterator&lt;Book&gt; iterator() { return new Iterator&lt;Book&gt; () { private final Iterator&lt;Book&gt; iter = bList.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public Book next() { return iter.next(); } @Override public void remove() { throw new UnsupportedOperationException("no changes allowed"); } }; } }
type: Answer
upvote count: 36
downvote count: 0
answers question: http://stackoverflow.com/q/21512250
has comment: http://stackoverflow.com/comment/59878444
score: 36

http://stackoverflow.com/q/21449458
type: Question
answer count: 2
upvote count: 0
has title: object references an unsaved transient instance - save the transient instance before flush
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/21449781
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/21449514
tagged with: java
tagged with: hibernate
has body: When I try to flush, I am getting below exception, org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.dao.Employee; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.dao.Employee Pls let me know what is the wrong while flusing. Code: .......... .......... while (i.hasNext()) { EmpAddressList p = (EmpAddressList ) i.next(); this.getHibernateTemplate().save(p); this.getHibernateTemplate().flush(); } ...... .....
downvote count: 1

http://stackoverflow.com/comment/32278470
comment on: http://stackoverflow.com/q/21399509
has text: Looks like you're running a 32-bit eclipse
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32274782
has text: I think it is present in the `StringBUffer`. How are you putting the data into it?
comment on: http://stackoverflow.com/q/21397090
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21371030
tagged with: java
tagged with: bigdata
type: Question
type: AnsweredQuestion
has body: I just setup my single node Hadoop cluster on my local machine using this tutorial - http://ac31004.blogspot.com/2013/10/installing-hadoop-2-on-mac_29.html In this tutorial I followed this following instructions : try a ls hadoop fs -ls if you get ls: `.': No such file or directory then there is no home directory in the hadoop file system. So hadoop fs -mkdir /user hadoop fs -mkdir /user/&lt;username&gt; where is the name you are logged onto the machine with. now change to $HADOOP_INSTALL directory and upload a file hadoop fs -put LICENSE.txt When I used this following command : hadoop jar ./hadoop-mapreduce-examples-2.2.0 wordcount LICENSE.txt out It worked but I am not able to find the output folder. So to debug I tried to use another output folder and used : hadoop jar ./hadoop-mapreduce-examples-2.2.0 wordcount LICENSE.txt /Applications/hadoop-2.2.0/out2 This worked fine, but the problem is I don`t seethe directory out2 in the application folder. Then I created a directory 'in' in the /Applications/hadoop-2.2.0 and put README.txt in it and tried to use following command : hadoop jar ./hadoop-mapreduce-examples-2.2.0.jar wordcount /Applications/hadoop-2.2.0/in/README.txt /Applications/hadoop-2.2.0/out3 Now I got an error: ERROR security.UserGroupInformation: PriviledgedActionException as:chinmay (auth:SIMPLE) cause:org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: hdfs://localhost:9000/Applications/hadoop-2.2.0/in/README.txt
tagged with: hadoop
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21371787
has title: How this input and output for Hadoop works?
has answer: http://stackoverflow.com/a/21371787

http://stackoverflow.com/a/62684046
answers question: http://stackoverflow.com/q/21444573
score: 0
has body: This problem can be solved by reorganizing the large list into two smaller lists, one with the even-indexed elements and one with the odd-indexed elements. Once these two sub-lists are created, merge them together and set front to the head of the merged list. In order to eventually merge the two lists, you'll need four variables. Two variables to point at the front of each sub-list, called evenFront and oddFront, and two variables to iterate through the sub-lists, called even and odd. Initialize even to front (since the list is zero-indexed, the first even-indexed element in the list is at index zero, also known as front) and initialize odd to front.next (for the same reason, the first odd-indexed element in the list is at index one, the next element after front). Here is my code. public void shift() { if (front != null &amp;&amp; front.next != null) { // iterators for the even and odd sub-lists ListNode even = front; ListNode odd = front.next; // pointers for the front of the even and odd sub-lists; these do not change ListNode evenFront = even; ListNode oddFront = odd; while (even.next != null &amp;&amp; odd.next != null) { even.next = even.next.next; even = even.next; odd.next = odd.next.next; odd = odd.next; } even.next = oddFront; front = evenFront; } }
type: Answer

http://stackoverflow.com/comment/32287903
has text: Bad JAR file in your local maven cache (it happens)? Did you try actually running the app with "mvn spring-boot:run"? If you have a bad JAR file it might show up that way.
score: 0
comment on: http://stackoverflow.com/q/21403987
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21507966
downvote count: 5
has comment: http://stackoverflow.com/comment/32470692
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21508432
has comment: http://stackoverflow.com/comment/32470560
favorite count: 0
has body: Trying to Place Order nothing shows up on screen but I want to show a textarea saying: Here's Sandwhich with the topping u provided Can you help me? import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.BorderLayout; import java.awt.Component; import java.awt.GridLayout; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.event.*; import java.util.ArrayList; import java.util.List; public void setCheese(String s) { cheese = s; } public String getCheese() { return cheese; }}
tagged with: swing
type: Question
has title: Trying to Place Order- nothing shows up on screen
type: AnsweredQuestion
score: -5
has answer: http://stackoverflow.com/a/21508432
tagged with: java

http://stackoverflow.com/comment/32207042
comment on: http://stackoverflow.com/q/21359473
has text: It sounds like there is a method to `add` something.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32329813
comment on: http://stackoverflow.com/a/21404064
has text: 01-29 11:56:25.156: E/AndroidRuntime(13717): FATAL EXCEPTION: main 01-29 11:56:25.156: E/AndroidRuntime(13717): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.MainActivity}: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21399289
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: Math.log(Math.pow(Math.exp(x), 3.5))
answers question: http://stackoverflow.com/q/21399001

http://stackoverflow.com/q/21469429
score: 0
has title: For loops wont stop
has answer: http://stackoverflow.com/a/21469940
tagged with: android
answer count: 1
has body: 2 part question here. I'm having some trouble here with my for loops. The basic idea of my code is that whenever checkX and checkY are called they compare the x of the touch and the x of the player then if the players x is less than the touchx then it increments the player x by 1 until the player x equals touch x. Its the exact same thing for checky. Everything works fine, the problem is that it never stops. The player just keeps moving on the exact same path. Heres the player class package com.gametest; import java.util.concurrent.CopyOnWriteArrayList; import com.gametest.GameSurfaceView.MyView; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; public class Player { int ID; static int x, y, width, height, widthEnd, currentFrame, boundsX, boundsY, dirTimer, dir, simx, simy; static Bitmap currentSprite, playerSprite, deathSprite; static MyView mv; public Player(MyView v, Bitmap orb, Bitmap explosion, int screenWidth, int screenHeight) { // TODO Auto-generated constructor stub playerSprite = orb; deathSprite = explosion; currentSprite = playerSprite; mv = v; height = playerSprite.getHeight(); width = playerSprite.getWidth() / 3; currentFrame = 1; } public static void sprite_draw(Canvas canvas, CopyOnWriteArrayList&lt;Sprite&gt; copy) { // TODO Auto-generated method stub x = (mv.getWidth() / 2) - 50; y = (mv.getHeight() / 2) - 50; currentFrame = currentFrame + 1; if (currentFrame &gt; 3) { currentFrame = 1; } widthEnd = (currentFrame * width) + width; boundsX = x + width; boundsY = y + height; Rect src = new Rect(currentFrame * width, 0, widthEnd, height); Rect dst = new Rect(x, y, boundsX, boundsY); canvas.drawBitmap(currentSprite, src, dst, null); for (Sprite s : copy) { if (s.x + 50 &gt; x &amp;&amp; s.x + 50 &lt; boundsX &amp;&amp; s.y + 50 &gt; y &amp;&amp; s.y + 50 &lt; boundsY) { GameSurfaceView.damagePlayer(); }; } } public void checkX(Integer touchx) { if (touchx &gt; x) { for (int newx = x; newx &lt; touchx; newx++)…
has comment: http://stackoverflow.com/comment/32402820
has comment: http://stackoverflow.com/comment/32403610
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32402849
tagged with: java
type: Question
tagged with: for-loop

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/21452053
type: Tag
tags question: http://stackoverflow.com/q/21490577

http://stackoverflow.com/comment/32663523
has text: Thanks for your comment. But I cannot resolve the issue still. If you don't mind can you please explain me in detail ?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21514978
type: AnswerComment

http://stackoverflow.com/a/21433447
has body: This is a JSTL. The c:forEach command will iterate the List (awardCriteria is your list), and hold each value of the list inside the criterion variable.
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21433288
type: Answer

http://stackoverflow.com/comment/32395623
score: 0
type: AnswerComment
has text: option 1: new panel, add button, add to frame
type: Comment
comment on: http://stackoverflow.com/a/21465489

http://stackoverflow.com/a/21376302
answers question: http://stackoverflow.com/q/21372559
upvote count: 1
downvote count: 0
has body: Card[] arr = new Card[2]; arr reference contains Array object with length 2. Also the above statement states that each object in the array is of class type Card. By default, no objects are created by the above statement and all the indexes in the array will have null references. arr[0] = null; arr[1] = null; arr[0] = new Card(); Card Object is created and its reference is arr[0] i.e. 1st index of array Base rule: Any array will be created with its default value in its index positions. A primitive array will have default value of that primitive type, for example int[] will have 0, boolean[] has false An Object array is created consisting references to null since Object default value is null. The number of references created is equal to the length provided in its initialization. arr[0] itself is not an object. arr[0] is a reference to an object which should be created explicitly in Java.
type: Answer
score: 1

http://stackoverflow.com/comment/32476352
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21511076
has text: @SiXoS You should not be using remarks such as "... so I know what I'm doing". Even accomplished cryptographers make implementation mistakes, and almost always these kind of sentences come back to haunt you. I would say that most accomplished cryptographers have learned not to make such claims (excepting Daniel Bernstein probably, but he's gained some bragging rights).
type: Comment

http://stackoverflow.com/q/21466716
answer count: 6
possible better answer: http://stackoverflow.com/a/22926074
has title: Unknown KieSession name in drools 6.0 (while trying to add drools to existing maven/eclipse project)
tagged with: eclipse
has answer: http://stackoverflow.com/a/22926074
has body: I am trying to adapt drools6.0 for an existing code base (it is maven project under eclipse). I didnt had need to learn drools or maven before (though they were part of my previous project), suffice to say I am lost in what I wanted to do. Based on my understanding (googling), java class files get hooked to rules based on the package name(?). That takes care of compile time issues. But I am seeing null pointer exception at run time. Inorder to adapt drools into my existing code base: I 1)created helloworld drools project, ran it successfully 2)copied the java file to my existing package, 3)created rule file in Eclipse with correct package: FIle->New->other->Rule Resource; 3)converted existing project into drools package by right clicking project and configure->convert to drools project This all takes care of compilation issues, but I get following run time error [main] ERROR org.drools.compiler.kie.builder.impl.KieContainerImpl - Unknown KieSession name: ksession-rules java.lang.NullPointerException at main.java.com.harmonia.cbm.afloat.dataaquisition.dql.DroolsTest.main(DroolsTest.java:23) This is because ksession that is returned from kcontainer is null and throws null pointer exception in last line KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("ksession-rules"); // above line is returning null Message message = new Message(); message.setMessage("Hello World"); message.setStatus(Message.HELLO); kSession.insert(message); Already spent more than a day trying to figure out how drools works and how above can be fixed. Pl suggest 1) am I taking the right approach to convert existing project into drools project. I want all existing functionality of my code base; but want to add rules based approach for future enhancements. Came across following link, but not clear if it helps my situation http://drools.46999.n3.nabble.com/Retrofitting-a-project-with-JBoss-Rules-td48656.h…
score: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/21692841
favorite count: 0
has answer: http://stackoverflow.com/a/37929975
type: AnsweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/21470592
type: Question
has answer: http://stackoverflow.com/a/47511818
has answer: http://stackoverflow.com/a/21692841
tagged with: drools
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/51835977

http://stackoverflow.com/comment/32358841
type: QuestionComment
comment on: http://stackoverflow.com/q/21444846
has text: @StéphaneBruckert It is probably a copy and paste error. The OP should fix it but the stack trace indicates their actual code is compilable.
type: Comment
score: 0

http://stackoverflow.com/comment/32392151
type: QuestionComment
comment on: http://stackoverflow.com/q/21463727
has text: no man they are getting displayed before this code but not after this one so what must be the case?
score: 0
type: Comment

http://stackoverflow.com/comment/32266648
type: AnswerComment
comment on: http://stackoverflow.com/a/21391362
type: Comment
has text: exceptions are not a problem here and server shouldn't process Actions it doesn't know. anyway, it's a best solution i've found(
score: 0

http://stackoverflow.com/q/21419558
has title: Altering specific bits of a 32-bit integer in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/32317523
linked to: http://stackoverflow.com/q/7619058
has comment: http://stackoverflow.com/comment/44552777
has comment: http://stackoverflow.com/comment/32314825
has body: Background: I have a 32-bit integer with a binary representation like so: 1111 1111 0000 0000 0000 0000 1111 1111 Note: This is the binary representation of the ARGB value of Color.BLUE. I'm using this for illustration purposes, but it is relevant to a situation I am attempting to solve. The Problem: I am attempting to alter the high order bits so that its binary representation looks like this: 1000 0000 0000 0000 0000 0000 1111 1111 Or more simply, the first eight high order bits should be changed like so: 1111 1111 -&gt; 1000 0000 Current Solution Attempt: Thus far, I've been successful by masking out the first eight high order bits, and then "adding" the desired value using bitwise "or", like so: int colourBlue = Color.BLUE.getRGB(); // equal to binary value at top of question int desiredAlpha = (0x80 &lt;&lt; 24); // equal to 1000 0000 0000 0000 0000 0000 0000 0000 // Mask out the eight high order bits, and add in the desired alpha value int alteredAlphaValue = (colourBlue &amp; 0x00FFFFFF) | desiredAlpha; While this does presently work, admittedly it has been some time since my computer architecture classes, and I have not had a lot of experience yet working with bitwise operators and lower level bit manipulation. My question: Is my solution the correct way to accomplish this task? If it is in some way improper (or just plain "dumb"), what is a better (or correct) way to achieve the goal of altering specific bits?
has comment: http://stackoverflow.com/comment/32313975
type: UnansweredQuestion
tagged with: bit-manipulation
tagged with: bit
has comment: http://stackoverflow.com/comment/32314622
has comment: http://stackoverflow.com/comment/32313941
has answer: http://stackoverflow.com/a/21419689
score: 3
has comment: http://stackoverflow.com/comment/32313961
upvote count: 3
has comment: http://stackoverflow.com/comment/32317354
tagged with: java
has comment: http://stackoverflow.com/comment/32313875
tagged with: bitwise-operators
type: Question
has comment: http://stackoverflow.com/comment/32313989
has comment: http://stackoverflow.com/comment/32314003
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32315244

http://stackoverflow.com/comment/32218151
score: 0
comment on: http://stackoverflow.com/a/21364012
type: Comment
has text: @nolan6000 if this is just for one or two specific classes it may indeed be simpler to write a little Java program that goes through these classes with the reflection API to extract the relevant details and build a `.csv` (or whatever) that your non-Java people can open in Excel.
type: AnswerComment

http://stackoverflow.com/comment/32285724
type: QuestionComment
has text: What is the problem you're facing?
score: 0
comment on: http://stackoverflow.com/q/21403859
type: Comment

http://stackoverflow.com/comment/32291473
comment on: http://stackoverflow.com/q/21406671
type: Comment
type: QuestionComment
has text: even I am aware of this, but since I am new to swing, I am not able to decide which part of code to be placed where. Since I am bound to run Presentation in a new Thread, I have to extend it with SwingWorker or is it incorrect ?
score: 0

http://stackoverflow.com/comment/32265484
comment on: http://stackoverflow.com/q/21391921
has text: The JRE is the Java Runtime Environment -- everything you need to _run_ Java programs. What you need is the JDK (Java Development Kit), which is for _compiling_ Java programs.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/32327209
comment on: http://stackoverflow.com/a/21423370
has text: @Sag You are making my job very tough, Please post the code where you have filled the `activityList`. Just specify the type of object in `activityList` during declaration like `List<ObjectClass>`. Please post `packMan.queryIntentActivities(mainIntent, 0);`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21366229
upvote count: 1
downvote count: 0
has body: So is this object actually in detached state? it is in detached state when it has been managed and you close the persistence context, or you explicitly call "em.detach". Anything else is likely in transient state. The log shows you what state objects are in. Clearly you could enable the persistence property datanucleus.allowAttachOfTransient as per the docs, but then you haven't enabled that by what you post. You also seem to be confused about which API you're using, quoting a JDO PMF specification, and then saying you're using JPA.
type: Answer
has comment: http://stackoverflow.com/comment/32218751
answers question: http://stackoverflow.com/q/21365686
has comment: http://stackoverflow.com/comment/32274970
score: 1
has comment: http://stackoverflow.com/comment/32219994

http://stackoverflow.com/q/21507278
has title: catching values from the SQLLite and displaying it in a list view - Android
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21507298
has body: i am trying to catch the values from the SQLLite database and display it in a list view. i have done the coding and i find no errors in my code, but after execution nothing is displayed in the list view. can any one help me to fix this please. here are my codes. Dbhandler.java file package lk.adspace.testing; import java.util.ArrayList; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class Dbhandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "jaffnatempletest"; // Temple table name private static final String TABLE_TEMPLE = "templ"; // Contacts Table Columns names private static final String KEY_ID = "id"; private static final String KEY_TMPNAME = "temple_name"; private static final String KEY_TMPTYPE = "temple_type"; private static final String KEY_LATITUDE = "latitude"; private static final String KEY_LONGITUDE = "longitude"; private static final String KEY_IMGNAME = "image_name"; private static final String KEY_YEARBUILD = "year_build"; private static final String KEY_ADDRESS = "address"; private static final String KEY_CITY = "city"; private static final String KEY_EMAIL = "email"; private static final String KEY_WEB = "website"; private static final String KEY_TEL1 = "telephone1"; private static final String KEY_TEL2 = "telephone2"; private static final String KEY_DESCRI = "Description"; private final ArrayList&lt;kovil&gt; temple_list = new ArrayList&lt;kovil&gt;(); public Dbhandler (Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String CREATE_TEMPLE_TABLE = "CREATE TABLE " + TABLE_TEMPLE + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + KEY_TMPNAME + " TEXT," + KEY_TMPTYPE + "…
answer count: 2
tagged with: sqlite
has comment: http://stackoverflow.com/comment/32469487
linked to: http://stackoverflow.com/q/21299175
has answer: http://stackoverflow.com/a/21507378
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/21412015
score: 0

http://stackoverflow.com/q/21463185
has comment: http://stackoverflow.com/comment/32390786
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21463214
has answer: http://stackoverflow.com/a/21464030
has answer: http://stackoverflow.com/a/21480292
score: 0
has body: I am testing a class called SetOfUsers and I am testing a method as followes: public void testAddUser() { System.out.println("addUser"); User aUser = new User("Bob","abc123","Manager"); SetOfUsers instance = new SetOfUsers(); instance.addUser(aUser); System.out.print(aUser); assertEquals("Bob,abc123,Manager", instance); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } However, this test fails the output message I am getting displays testAddUser Failed: expected: &lt;Bob, abc123,Manager&gt; but was: &lt;[Staff Name:Bob]&gt;
tagged with: junit
has title: JUnit test fail
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21463241
has answer: http://stackoverflow.com/a/21464164

http://stackoverflow.com/comment/32386302
type: QuestionComment
score: 8
has text: No, that has nothing to do with immutability. That is a `String` literal which is processed by the Java compiler. It's part of the language specification. You would have to implement your own compiler if you wanted similar behavior.
comment on: http://stackoverflow.com/q/21460819
type: Comment

http://stackoverflow.com/comment/32360431
score: 0
type: Comment
type: AnswerComment
has text: I mean because you had the condition results[i] != -1 && results[i] == minCount. The first condition wasn't necessary
comment on: http://stackoverflow.com/a/21445640

http://stackoverflow.com/comment/32204748
type: QuestionComment
comment on: http://stackoverflow.com/q/21358387
has text: Oh sorry I forgot to change that to explode(r,c). I am using explode2, which is a different method that does the same thing. This is how get around that error, by using a method with a different name with identical code, which then feeds it into explode3. When I try to use just explode(r,c) withing explode(), I get the following errors:`Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at mini.Cell.isMine(Cell.java:26) at mini.MineSweeperGame.explode(MineSweeperGame.java:92) at mini.MineSweeperGame.explode(MineSweeperGame.java:101)`
score: 0
type: Comment

http://stackoverflow.com/q/21428436
has body: I only want to read the script tag from the given xml file. testsuite.xml <?xml version="1.0" encoding="UTF-8" standalone="true"?> - 1.0. CETAF for Mobile <C.E.T.A.FType>testSuite</C.E.T.A.FType> <C.E.T.A.FName>CETAF</C.E.T.A.FName> <Init/> - - <Priority/> - <Priority/> - <Priority - <Priority/> - <Priority/> - <Priority/> - <Priority/> - <Priority/> - <Priority/> My Code in Java is the following : package xmlparse; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; import java.io.File; public class ReadXMLFile { public static void main(String argv[]) { try { File fXmlFile = new File("/Users/388033/Desktop/KeplerWorkSpace_20140102/ KeplerWorkSpace/cetaf/Engine/TestFiles/TestSuite/TestSuite.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); //optional, but recommended //read this - http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work doc.getDocumentElement().normalize(); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); NodeList nList = doc.getElementsByTagName("TestSuite"); System.out.println("----------------------------"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); System.out.println("\nCurrent Element :" + nNode.getNodeName()); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; //System.out.println("Script : " + eElement.getAttribute("Script")); System.out.println("Script : " + eElement.getElementsByTagName("Script").item(0).getTextContent()); System.out.println("Script : " + eElement.getElementsByTagName("Script").item(0).getTextContent()); //System.out.println("Last Name : " + eElement.getElementsByTagName("lastname").item(0).getTextCont…
downvote count: 1
has answer: http://stackoverflow.com/a/21429147
has answer: http://stackoverflow.com/a/21432198
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27037044
answer count: 6
has answer: http://stackoverflow.com/a/21428817
has answer: http://stackoverflow.com/a/21433092
has title: reading xml file using java
type: Question
has answer: http://stackoverflow.com/a/21428834
has comment: http://stackoverflow.com/comment/32329032
linked to: http://stackoverflow.com/q/13786607
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/21447671
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21447739
has answer: http://stackoverflow.com/a/21447775
tagged with: java
has body: I keep getting an IndexOutOfBoundsException when I run the executable. The first name and min_cost print before the error. I know that it is probably trying to access an index that can't be accessed. I can not figure out what is wrong. for(int j = 0; j &lt;= no_comps-1; j++){ String line2 = in.nextLine(); Scanner compline = new Scanner(line2); int k = j-1; String co_name = compline.next(); int x = compline.nextInt(); int y = compline.nextInt(); int val = compute(tot_boxes,my_boxes,x,y); List &lt;String&gt; names = new ArrayList &lt;String&gt;(500); names.add(j,co_name); List &lt;Integer&gt; min_cost = new ArrayList &lt;Integer&gt;(500); min_cost.add(j,val); while(j &gt; 1){ if(min_cost.get(j) &gt; min_cost.get(k)){ Collections.swap(names, j, k); Collections.swap(min_cost, j, k); } else{ } } System.out.println(names.get(j)+ " " +min_cost.get(j)); Thanks in advance for any help! Edit: DHL 46 Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.rangeCheckForAdd(ArrayList.java:612) at java.util.ArrayList.add(ArrayList.java:426)
tagged with: error-handling
has title: adding names/values in list
upvote count: 1
has comment: http://stackoverflow.com/comment/32364062
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/49303344
comment on: http://stackoverflow.com/a/21482673
has text: EntityUtils also deprecated ,now which one should I use...?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21360286
answer count: 4
possible better answer: http://stackoverflow.com/a/21360332
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21360437
type: Question
has answer: http://stackoverflow.com/a/21360332
tagged with: java
has title: How do you truncate extra decimals from BigDecimal
has answer: http://stackoverflow.com/a/21360379
upvote count: 2
has answer: http://stackoverflow.com/a/21360346
accepted answer: http://stackoverflow.com/a/21360346
downvote count: 0
favorite count: 0
has body: I'm building a service that uses a currency converter and forwards the BigDecimal amount to another service. Sometimes, the conversion rate makes it so that the converted amount has close to 34 decimal places, which the downstream service does not accept. Is there a way to simply truncate (not round) the BigDecimal. So, for example, if the converted amount is 1.23456789 I want neither 1.24, nor 1.3, nor 1.20, or anything of that sort. I simply want to get rid of the decimals that appear after 4. So what I want is 1.23. I saw a lot of questions on SO related to this, but they all rounded the BigDecimal in some way. Thanks!

http://stackoverflow.com/q/21383761
tagged with: for-loop
has title: Using nested for loops to print numbers (java)
upvote count: 0
answer count: 1
tagged with: printing
has comment: http://stackoverflow.com/comment/32250277
has comment: http://stackoverflow.com/comment/32251146
has comment: http://stackoverflow.com/comment/32253070
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/32251635
score: -2
has comment: http://stackoverflow.com/comment/32250978
has comment: http://stackoverflow.com/comment/32250264
has comment: http://stackoverflow.com/comment/32250799
has comment: http://stackoverflow.com/comment/32251622
has comment: http://stackoverflow.com/comment/32251863
has comment: http://stackoverflow.com/comment/32253444
tagged with: java
has answer: http://stackoverflow.com/a/21388396
tagged with: loops
has body: I am trying to use nested for loops (java) to print out the following: 331 330 322 311 300 222 111 and I am having some trouble. So far I have: for(int a = 3; a &gt;=0; a--) { for(int b = 3; b&gt;=0; b--) { for(int c = 2; c&gt;=0; c--) { System.out.println(a + " "+ b +" "+ c); } } } but that prints out something more like this: 3 3 2 3 3 1 3 3 0 3 2 2 3 2 1 3 2 0 3 1 2 3 1 1 3 1 0 3 0 2 3 0 1 3 0 0 2 3 2 2 3 1 2 3 0 2 2 2 2 2 1 2 2 0 2 1 2 What is wrong with my code? How can I get it to print out the first sequence, not the second? I'm pretty sure it has something to do with the middle loop, but I'm really not sure. Thanks!
type: Question
has comment: http://stackoverflow.com/comment/32251377
has comment: http://stackoverflow.com/comment/32289766
has comment: http://stackoverflow.com/comment/32250897

http://stackoverflow.com/q/21504256
possible better answer: http://stackoverflow.com/a/21504305
has answer: http://stackoverflow.com/a/21504305
favorite count: 0
downvote count: 2
accepted answer: http://stackoverflow.com/a/21504423
duplicate of: http://stackoverflow.com/q/7182996
has body: Using the Calendar API I want to store the date of object creation in its instance field. The object is then saved to a text file. Calendar cal = Calendar.getInstance(); Date todaysDate = cal.getTime(); Object obj = new Object(todaysDate); Later, I want to return the month the object was created. However, the date was stored as type 'Date'and AFAIK the Date API doesn't have a method to return the month. Is there a way to store the date in a variable that allows me to use Calendar methods?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7182996
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32464132
has comment: http://stackoverflow.com/comment/32463980
score: -2
has title: Calendar API How to get month from getTime(); saved as a variable
has answer: http://stackoverflow.com/a/21504423
answer count: 2
upvote count: 0

http://stackoverflow.com/q/21378942
has answer: http://stackoverflow.com/a/21379443
score: 1
upvote count: 1
type: Question
has body: How to access values stored in 2d array puzzle[][] in main class. i am not able print these values in generate() but not in main method. import java.util.Random; public class generator { static int puzzle[][] = new int[9][9]; public int[][] generate() { return puzzle; } public static void main(String args[]){ generator g = new generator (); g.generate(); } }
tagged with: java
accepted answer: http://stackoverflow.com/a/21379443
answer count: 2
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/21379497
has comment: http://stackoverflow.com/comment/32241522
favorite count: 0
has answer: http://stackoverflow.com/a/21379497
has comment: http://stackoverflow.com/comment/32241435
has comment: http://stackoverflow.com/comment/32241704
has comment: http://stackoverflow.com/comment/32241405
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32241407
has title: 2d array values aren't access in main method

http://stackoverflow.com/q/21439101
has answer: http://stackoverflow.com/a/21449157
has title: Spring web application healthchecks
type: UnansweredQuestion
tagged with: amazon-web-services
downvote count: 0
score: 7
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/21442082
has answer: http://stackoverflow.com/a/21441453
tagged with: spring
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/67106908
has body: I'm deploying Spring based web applications on Amazon's Beanstalk platform, and they give me the option of setting a "healthcheck" URL path for my application. The idea is that their platform will do a request against that URL, after the deployment, to see if the application is successfully started. So, if the request results in an HTTP 200, the application is probably fine. But if it results in an HTTP 500 or something else, the platform knows there's a problem with the application. So, I wish I could develop some kind of servlet that would check if the Spring Application Context was successfully initialised, or not, to give an appropriate HTTP response code to the platform. Has anybody attempted something like this? For similar purposes? I'm wondering if Spring already provides some elegant solution for this.
answer count: 4

http://stackoverflow.com/comment/32455495
comment on: http://stackoverflow.com/a/21499634
has text: This. I can't understand.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21370075
linked to: http://stackoverflow.com/q/9977236
tagged with: equals
has comment: http://stackoverflow.com/comment/32225759
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21370187
has body: I am a new Java programmer , im trying to implement a method to check the equality between two "features" array inside my object "FeatureVector" seems really basic but the method is not working for some reason ; it doesnt produce logical results ,and i cant seem to find a solution, please help public boolean equals (FeatureVector x ) { boolean result =false ; boolean size = false ; for (int i =0 ; (i &lt; this.features.length &amp;&amp; result == true );i ++ ) { if (this.features[i] == x.features[i] ) {result = true ;} else {result = false ; } } if (this.features.length == x.features.length ) {size = true ;} else {size =false; } return (result &amp;&amp; size) ; }
has answer: http://stackoverflow.com/a/21370164
tagged with: java
has title: Equals method not working
type: Question
tagged with: object
tagged with: arrays
has answer: http://stackoverflow.com/a/21370149
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32226127

http://stackoverflow.com/a/21503438
has comment: http://stackoverflow.com/comment/32462387
has comment: http://stackoverflow.com/comment/32462421
answers question: http://stackoverflow.com/q/21503414
score: 1
has body: Assuming miles is declared as double (if it's not, you should declare it as double so you can assign it a real number). This line miles = (miles+499)/500; is making a integer division (int/int = int). To get a double, you must cast it: miles = (double)(miles+499)/500; or, as @Vulcan suggested miles = (miles+499)/500.0; // here 500.0 is a double
has comment: http://stackoverflow.com/comment/32462923
has comment: http://stackoverflow.com/comment/32462963
downvote count: 0
has comment: http://stackoverflow.com/comment/32463027
has comment: http://stackoverflow.com/comment/32463837
type: Answer
has comment: http://stackoverflow.com/comment/32462767
has comment: http://stackoverflow.com/comment/32463807
has comment: http://stackoverflow.com/comment/32463611
has comment: http://stackoverflow.com/comment/32463685
has comment: http://stackoverflow.com/comment/32462555
has comment: http://stackoverflow.com/comment/32463193
upvote count: 1

http://stackoverflow.com/a/21556194
has comment: http://stackoverflow.com/comment/32848138
has comment: http://stackoverflow.com/comment/32821413
score: -1
has body: I've created a small testproject now to find out how I can get this to work. And I think it is worth sharing. We loop through the ClientLoginModule (which is provided by Wildfly) in the first stage (of the ApplicationRealm which is used to secure the remote- connection). This module stores the credentials (somewhere?) and they are available afterwards to my other login-module. <jaas name="AppRealmLoopThrough"/> Of course, this security-domain has to be defined afterwards: <module-option name="multi-threaded" value="true"/> In the CustomLoginModule (which extends UsernamePasswordLoginModule) I can do the following to retrieve username and password: final String[] usernameAndPassword = getUsernameAndPassword(); System.out.println("received username: " + usernameAndPassword[0] + " and password " + usernameAndPassword[1]); getUsernameAndPassword() is a method provided by the base class UsernamePasswordLoginModule. Of course, the secured EJBs have to be annoteded with @SecurityDomain("other") (or via deployment-descriptor) to get my CustomLoginModule invoked. Btw: I know that the security-domain other has some special meaning and should not be used for the application - this was just for testing... ;) I was not very successful when trying to find an explanation for this. For me it seems that the login-modules are invoked in two steps: first when the AppRealmLoopThrough is used for the ApplicationRealm which is the security-realm for the http-remoting-connector. In this "step" the username and password are available. The second "step" is the invocation of the CustomLoginModule when the container checks the EJB-permissions. In this phase by default there is no way to get the password (as tried initially). Does this sound reasonable?
answers question: http://stackoverflow.com/q/21475229
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/32461691
type: Comment
type: AnswerComment
has text: You are right, I'm doing hard coded coloring,but according to your code, I cannot access to my certain pixel to colour it.
score: 0
comment on: http://stackoverflow.com/a/21502082

http://stackoverflow.com/a/21408144
has comment: http://stackoverflow.com/comment/32293569
has comment: http://stackoverflow.com/comment/32297150
score: 5
has comment: http://stackoverflow.com/comment/32296862
upvote count: 5
answers question: http://stackoverflow.com/q/21407966
type: Answer
has body: I want the program to start in main, and call the method that sorts all of the floors and such. However, when I run the program it changes all of the values of the final array into 0's. The code you have shown us won't even compile. This line is invalid: floor_sorting.sorting_floors; We can't explain what a program does if you don't show us the real code. If you want to make it compile you need to convert your array of String into an array of int. The simple way is to: allocate an int[] of the right size (i.e. the same size as the String[] args array), loop over the range of the arrays, and use Integer.parseInt(String) to convert the values. Read the javadocs for the Integer class ... Finally, you need to pay a lot more attention to style: Your code's indentation is a mess. You are violating the style rules for identifiers. A class name should start with an uppercase letter, and should use "camel case" not underscores. Code like the above is hard to read, and will get you endless criticism / complaints from co-workers. (And it should lose you marks if this is a marked assignment.)
has comment: http://stackoverflow.com/comment/32296558
has comment: http://stackoverflow.com/comment/32294606
has comment: http://stackoverflow.com/comment/32296188
downvote count: 0
has comment: http://stackoverflow.com/comment/32296418
has comment: http://stackoverflow.com/comment/32294014

http://stackoverflow.com/comment/32479327
type: AnswerComment
comment on: http://stackoverflow.com/a/21512925
has text: Can you please advise also I have declared the string parameters outside the for loop is it the correct way.
type: Comment
score: 0

http://stackoverflow.com/q/21383649
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32250144
type: Question
answer count: 2
has title: Default initialisation as octal || int a = 0 -> Octal
downvote count: 0
has comment: http://stackoverflow.com/comment/32250696
has body: I wonder, why java has set the syntax for octals with a 0 before the number. Means: int a = 011; System.out.println("Output: " + a); //Output: 9 Because of this, it is logical, that this has to be handled as an octal too: int b = 0; System.out.println("Output: " + b); //Output: 0 Why does java work like this? The default initialisation for int is 0. This means, it's always calculated as octal by the system and not as a binary-value. Or am I one a false way?
has answer: http://stackoverflow.com/a/21383669
has answer: http://stackoverflow.com/a/21383699
favorite count: 0
possible better answer: http://stackoverflow.com/a/21383699
has comment: http://stackoverflow.com/comment/32250376
upvote count: 2
has comment: http://stackoverflow.com/comment/32250152
has comment: http://stackoverflow.com/comment/32250044
has comment: http://stackoverflow.com/comment/32250426
accepted answer: http://stackoverflow.com/a/21383669

http://stackoverflow.com/q/21381258
has body: I have a class which does the following class PersonDumper { // attributes public PersonDumper(PrintStream output, Set&lt;Person&gt; persons) { // do stuff } public dump() { for(Person p : persons) { output.print(p); output.print(","); } } } The thing is that I want to test that the formatting I am giving to the Person objects (in the example I want to print the toString() method), and so on is right. Then I would like to test the output with something like this: public class ListPrintStream extends PrintStream { private List&lt;List&lt;String&gt;&gt; output; // every time I call to print I do output.add(string) } Then, I can get that List> and read it in order to test if I am outputting what I want. But I have problems with the constructor used for PrintStream. Because, in my case, I don't want any argument for the constructor. Do you think that I am using a good approach? Shall I use the OutputStream class instead of PrintStream? Any hint? Edit to ask: Does anyone know a PrintStream that is used for testing?
score: 0
tagged with: java
type: Question
tagged with: testing
answer count: 1
tagged with: printstream
has answer: http://stackoverflow.com/a/21381677
has title: My Own Implementation Of PrintStream for Testing
accepted answer: http://stackoverflow.com/a/21381677
type: AnsweredQuestion

http://stackoverflow.com/comment/32395074
comment on: http://stackoverflow.com/a/21464955
score: 0
type: Comment
has text: How about you try something out and post a question when you have a specific problem? The pseudocode wouldn't really look much different from my last paragraph though.
type: AnswerComment

http://stackoverflow.com/comment/32414135
comment on: http://stackoverflow.com/a/21454294
type: AnswerComment
has text: Well in that case you have no problem. You can directly set your properties using `setStringProperty()`. For all available APIs see the docs link I gave in previous comment. It is not specific to ActiveMQ... it is in JMS specs. So you can do it with any JMS provider.
score: 0
type: Comment

http://stackoverflow.com/comment/32926233
comment on: http://stackoverflow.com/a/21463549
has text: Hey thanks alot man! That one minor detail was exactly what I was missing
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32209225
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21361042
has text: @JUBA My HDD is pretty big

http://stackoverflow.com/q/21418107
possible better answer: http://stackoverflow.com/a/21418442
has title: Neo4j 2.0, java - Failed to start Neo4j with an older data store version
downvote count: 0
tagged with: neo4j
has answer: http://stackoverflow.com/a/21418442
has answer: http://stackoverflow.com/a/21510883
favorite count: 0
has body: I used to use neo4j-community-1.9.4 with my java maven project. I switched to version 2.0 and made completly new db in 2.0. When I run the same java code, I get error: Exception in thread "main" org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException: Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true" at org.neo4j.kernel.impl.storemigration.ConfigMapUpgradeConfiguration.checkConfigurationAllowsAutomaticUpgrade(ConfigMapUpgradeConfiguration.java:39) at org.neo4j.kernel.impl.storemigration.StoreUpgrader.attemptUpgrade(StoreUpgrader.java:64) at org.neo4j.kernel.impl.nioneo.store.StoreFactory.tryToUpgradeStores(StoreFactory.java:104) at org.neo4j.kernel.impl.nioneo.store.StoreFactory.newNeoStore(StoreFactory.java:86) at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.&lt;init&gt;(NeoStoreXaDataSource.java:232) at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:423) at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:226) at org.neo4j.kernel.EmbeddedGraphDatabase.&lt;init&gt;(EmbeddedGraphDatabase.java:79) at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:70) at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:205) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:56) at tools.Import.main(Import.java:32) Any idea? Thank you.
tagged with: maven
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21510883
type: Question
score: 5
has answer: http://stackoverflow.com/a/37345997
upvote count: 5
answer count: 3

http://stackoverflow.com/comment/32407540
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21472034
score: 0
has text: The tools is probably based on cygwin. The path may be cygwin style. (See Jerry Jeremiah 's comment) See docs : http://mobaxterm.mobatek.net/support/documentation.html#2_1

http://stackoverflow.com/comment/32363985
type: AnswerComment
has text: @AndrewThompson Welcome aboard. It's always nice when the title doesn't match the question though :D
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21447111

http://stackoverflow.com/a/21378930
downvote count: 0
has body: Just use String.replace(CharSequence target, CharSequence replacement) if you are dealing with literal strings: s.replace("'", "\\'") It will replace all instances of ' in the string with \'. The String.replaceAll(String regex, String replacement) and String.replaceFirst(String regex, String replacement) functions works with Pattern (regex). Though there is no problem with "'" being the pattern, the replacement string "\\'" is the source of your problem. Since the replacement string can contain special sequences such as $1 to refer to text captured by capturing group, the syntax must allow plain $ to be specified by escaping \\$. This escaping will cause \' to be interpreted as ' in the replacement string syntax. This is why you need to double up the escaping "\\\\'" for the replacement string to work correctly. One layer of escaping to give \\' to the replaceAll/replaceFirst function, the next layer to make the replacement string being interpreted as \'. s.replaceAll("'", "\\\\'") In such case, Matcher.quoteReplacement(String s) can be used to quote the replacement string when you want to replace with fixed string: s.replaceAll("'", Matcher.quoteReplacement("\\'"))
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21378609
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21378609
type: Answer
score: 2

http://stackoverflow.com/comment/32353766
type: Comment
comment on: http://stackoverflow.com/a/21442126
type: AnswerComment
has text: worked like a charm. Thank you! I will mark is as the answer in 9 minutes when I can.
score: 0

http://stackoverflow.com/q/21406288
accepted answer: http://stackoverflow.com/a/21421089
has title: Passing Class Attribute like a factory Pattern in Android Activity
answer count: 1
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/32290184
has comment: http://stackoverflow.com/comment/32290207
tagged with: attributes
type: AnsweredQuestion
tagged with: factory
type: Question
tagged with: java
has body: I am working on this activity that I have a bunch of dynamic spinners. To set the items of each one of those I've set one List attribute for each SpinnerAdapter. To manage what spinner items i'll to update I've created a private method which is supposed to work like a factory pattern but only returning the List for a specific Spinner that I need to update. In my mind (at least thinking in objective-c) this code was supposed to work. package com.package.demo; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.SpinnerAdapter; public class SomeActivity extends Activity implements OnItemSelectedListener { private int activitySpinners[] = { R.id.spinner_a, R.id.spinner_b, R.id.spinner_c }; private List&lt;String&gt; spinnerAdapterItemsA; private List&lt;String&gt; spinnerAdapterItemsB; private List&lt;String&gt; spinnerAdapterItemsC; private List&lt;String&gt; teste ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_orders); for (int i = 0; i &lt; this.activitySpinners.length; i++) { int spinnerId = this.activitySpinners[i]; Spinner spinner = (Spinner) findViewById(spinnerId); this.clearArrayAdapterItemsWithPrompt(spinnerId); this.updateArrayAdapterItemsWithPrompt(spinnerId); spinner.setOnItemSelectedListener(this); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.spinner_item, this.adapterItemsForSpinnerId(spinnerId)); adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); spinner.setAdapter(adapter); } } private List&lt;String&gt; adapterItemsForSpinnerId(int spinnerId) { List&lt;String&gt; list = null; switch (spinnerId) { case R.id.spi…
score: 0
has answer: http://stackoverflow.com/a/21421089
has comment: http://stackoverflow.com/comment/32290171

http://stackoverflow.com/a/41352314
type: Answer
score: 0
has body: You can also use org.apache.derby.jdbc.ClientDriver for a "Network Server" connection as listed in the Apache Derby documentation linked here.
answers question: http://stackoverflow.com/q/21502124

http://stackoverflow.com/comment/32210000
has text: Is there any reference to "the heap in the JVM is not designed to run off disk." ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21361381

http://stackoverflow.com/comment/32241054
has text: Your `employee` field isn't marked with either a JAXB annotation nor a JPA annotation. You need to add a `@XmlElement` annotation to the `employee` field in your `Resource` class.
comment on: http://stackoverflow.com/q/21378375
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21363869
accepted answer: http://stackoverflow.com/a/21372674
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21364918
tagged with: multithreading
has comment: http://stackoverflow.com/comment/32214444
has title: java nested Map data structure read and write operations
has comment: http://stackoverflow.com/comment/32214211
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21364918
tagged with: java
has body: I have a data structure as:- Map&lt;String,Map&lt;String,List&lt;CustomPOJO&gt;&gt;&gt; The frequency of read operations on this data structure will be too high and write operations will also be there but not many. As far as read is concerned I guess there is no issue by using simple java.util.HashMap API. For write operations there can be two approaches:- Put entire data in ConcurrentHashMap and use it to write data into it. Perform all write operations in a synchronized block/method and use simple java.util.HashMap API. Please suggest which one would be better for write operation and also suggest whether there can be any loophole in read operation.
type: Question
tagged with: hashmap
linked to: http://stackoverflow.com/q/1291836
has answer: http://stackoverflow.com/a/21372674

http://stackoverflow.com/comment/32212046
has text: What is exactly what you want to do? I mean, what problem are you trying to solve? It may be simpler to answer that instead of what you are asking.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21362680
type: Comment

http://stackoverflow.com/comment/32436674
has text: Please very carefully explain what you are trying to do. Use a few examples. Without that, there's not much we can do...
type: Comment
comment on: http://stackoverflow.com/q/21488438
score: 0
type: QuestionComment

http://stackoverflow.com/q/21433374
upvote count: 1
has comment: http://stackoverflow.com/comment/32337355
type: Question
possible better answer: http://stackoverflow.com/a/21433500
has comment: http://stackoverflow.com/comment/32337859
accepted answer: http://stackoverflow.com/a/21433780
score: -1
has comment: http://stackoverflow.com/comment/32337271
has body: I have created a GUI in java, which holds a number of JButtons. I want to include some exception handling so that if a particular button is clicked twice or directly after each other, a message pops up to say that this command is not allowed. Which type of Exception would you suggest I use? Regards.
has comment: http://stackoverflow.com/comment/32337390
has comment: http://stackoverflow.com/comment/32337624
tagged with: user-interface
has answer: http://stackoverflow.com/a/21437933
has title: Exception Handling in GUI
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/21433780
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21436279
has comment: http://stackoverflow.com/comment/32342230
has answer: http://stackoverflow.com/a/21433500
tagged with: java
downvote count: 2

hudson
type: Tag
tags question: http://stackoverflow.com/q/21364184
tag name: hudson
tags question: http://stackoverflow.com/q/21474640

http://stackoverflow.com/a/21450816
has body: You're wrong and there's no reason why you should use the second form. There is 0 objects created, the only difference is the scope of the variable. The objects have already been created, they're in the map. You're just assigning a reference to an existing object. It's a good practice to declare variables in the smallest scope possible, so if you're not using s outside the loop (which wouldn't make sense, unless you wanted the last Student processed), it makes sense to declare it inside the loop.
score: 7
upvote count: 7
downvote count: 0
answers question: http://stackoverflow.com/q/21450788
type: Answer
has comment: http://stackoverflow.com/comment/32369427

http://stackoverflow.com/q/21360415
has comment: http://stackoverflow.com/comment/32208928
accepted answer: http://stackoverflow.com/a/21360446
type: AnsweredQuestion
has body: I've got a client and server coded in Java, once the server has received one message from the client, the server stops receiving all new messages. No errors are thrown when the client tries to sent more messages. I can't seem to find out why it doesn't allow or receive new connections! Please help. public class Server implements Runnable { @Override public void run() { ServerSocket echoServer = null; String line; DataInputStream is; PrintStream os; Socket clientSocket = null; boolean Listening = true; int sPort = 9999; // Try to open a server socket on port 9999 try { echoServer = new ServerSocket(sPort); } catch (IOException e) { System.out.println(e); } // Create a socket object from the ServerSocket to listen and accept // connections. // Open input and output streams while (Listening){ try { clientSocket = echoServer.accept(); is = new DataInputStream(clientSocket.getInputStream()); //os = new PrintStream(clientSocket.getOutputStream()); // As long as we receive data, echo that data back to the client. while (true) { line = is.readLine(); if(line != null){ //os.println(line); log(Level.SEVERE, "New connection to server {0}", line); } } } catch (IOException ex) { Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex); } } } }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32208153
score: -2
has answer: http://stackoverflow.com/a/21361094
has answer: http://stackoverflow.com/a/21360446
answer count: 3
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21360657
has title: Java Socket Server won't process second client
has answer: http://stackoverflow.com/a/21360657
tagged with: sockets
downvote count: 2

variables
tag name: variables
tags question: http://stackoverflow.com/q/21412815
tags question: http://stackoverflow.com/q/21453774
tags question: http://stackoverflow.com/q/21495847
tags question: http://stackoverflow.com/q/21401103
tags question: http://stackoverflow.com/q/21464780
type: Tag
tags question: http://stackoverflow.com/q/21507517
tags question: http://stackoverflow.com/q/21509622
tags question: http://stackoverflow.com/q/21500956
tags question: http://stackoverflow.com/q/21427866
tags question: http://stackoverflow.com/q/21395966
tags question: http://stackoverflow.com/q/21365098
tags question: http://stackoverflow.com/q/21409657
tags question: http://stackoverflow.com/q/21390830
tags question: http://stackoverflow.com/q/21492506
tags question: http://stackoverflow.com/q/21481345
tags question: http://stackoverflow.com/q/21367873

http://stackoverflow.com/comment/32318131
type: QuestionComment
has text: If I'm understanding you, that conflicts with the solution to my previous question, http://stackoverflow.com/q/21388479/2736496 , which this is a follow-up to. Using `TextLineValidator getObjectCopy()` results in the following compilation error, because the hierarchy is a diamond: `types LineGettable and ValidateValue<xbn.text.TextLine> are incompatible; both define getObjectCopy(), but with unrelated return types`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21421576

http://stackoverflow.com/comment/32351890
comment on: http://stackoverflow.com/a/21436630
score: 0
type: AnswerComment
has text: You'll need the +1 for the case when there are only 2 elements left to compare.
type: Comment

http://stackoverflow.com/comment/32354979
type: AnswerComment
has text: @Happy: It's calculating since 7 minutes now. Perhaps Matlab is the better choice. However even the linux command line calculator bc don't work for this problem: 2^(3^(4^(5^6))) Runtime error (func=(main), adr=18): exponent too large in raise
type: Comment
comment on: http://stackoverflow.com/a/21442694
score: 0

http://stackoverflow.com/a/21383232
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21383176
score: 1
has body: You will have to escape each of the \ symbols. Try: test = test.replaceAll("\\\\r", "\\r");
upvote count: 1

http://stackoverflow.com/comment/32205394
comment on: http://stackoverflow.com/q/21358791
type: Comment
has text: Please show us your code ;-) Its the only way we can debug it!
type: QuestionComment
score: 3

http://stackoverflow.com/comment/32324693
type: AnswerComment
comment on: http://stackoverflow.com/a/21425008
type: Comment
has text: Ok, you probably use that model in your controllers. If you throw exception on model, it will be cacthed with error page handler.
score: 0

http://stackoverflow.com/q/21382932
has comment: http://stackoverflow.com/comment/32248945
has title: Android Helper class -> null pointer exception
type: Question
has comment: http://stackoverflow.com/comment/32249013
has answer: http://stackoverflow.com/a/21393410
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32248869
has comment: http://stackoverflow.com/comment/32248586
favorite count: 0
score: 0
tagged with: nullpointerexception
tagged with: android
tagged with: helper
has comment: http://stackoverflow.com/comment/32248902
has comment: http://stackoverflow.com/comment/32250083
has body: i would like to ask: I have in my AppHelper class following method which check availability of internet connection. public boolean checkInternetConnection(Context ctx) { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); // test for connection if (cm.getActiveNetworkInfo() != null &amp;&amp; cm.getActiveNetworkInfo().isAvailable() &amp;&amp; cm.getActiveNetworkInfo().isConnected()) { return true; } else { Log.i(GlobalApplication.APP_LOG_NAMESPACE, "Internet Connection Not Present"); return false; } } Im trying to get Boolean value by using: // check internet connection and availability Boolean isConnectionAvailable = appHelper.checkInternetConnection(getBaseContext()); But unfortunately i get always null pointer exception. Is it matter of passed application context? And how should i solve that issue? Thanks for any advice.
has comment: http://stackoverflow.com/comment/32248693
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32250793
has comment: http://stackoverflow.com/comment/32248818
has comment: http://stackoverflow.com/comment/32248819
has comment: http://stackoverflow.com/comment/32248746
tagged with: java

http://stackoverflow.com/comment/32294814
type: AnswerComment
comment on: http://stackoverflow.com/a/21378138
type: Comment
has text: @AndrewThompson can you provide me link to understand it. Thnks for explanation
score: 0

http://stackoverflow.com/a/21466685
accepted answer of: http://stackoverflow.com/q/21466657
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21466657
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/32398894
score: 2
has body: You haven't overriden the doPost method. You've overloaded it. protected void doPost(HttpServletRequest request, HttpServletResponse response, String name, String pass) throws ServletException, IOException { And since nothing is calling your overloaded method, you get the default inherited HttpServlet#doPost() behavior which returns a 405.
has comment: http://stackoverflow.com/comment/32417413
has comment: http://stackoverflow.com/comment/32428738
has comment: http://stackoverflow.com/comment/32398842

http://stackoverflow.com/comment/32369921
comment on: http://stackoverflow.com/a/21450928
type: AnswerComment
score: 0
type: Comment
has text: Try to run `mvn` with `-X`; the exec plugin should then show you what it really does.

http://stackoverflow.com/a/47724287
answers question: http://stackoverflow.com/q/21460698
score: 0
type: Answer
has body: Struggled with this for most of day, finding a variety of out-of-date cookbooks and HowTo pages... In one of the eclipse forum posts, someone referenced this page, which worked for me. (Oxygen, pure E4 standalone RCP application) https://wiki.eclipse.org/Eclipse4/RCP/FAQ#How_to_use_Sleak_in_e4AP Even tho it seems odd, you have to have your Eclipse workbench application running with various flags set, before it pays any attention to your project settings when running your application in the debugger.

http://stackoverflow.com/comment/32229130
type: Comment
comment on: http://stackoverflow.com/q/21371849
type: QuestionComment
has text: @DavidSchwartz no connection is actually established at that connect. It's just meant to open up firewall exceptions to allow incoming traffic. Meaning i can't shutdown the sending side and no "close"s will ever be received.
score: 0

http://stackoverflow.com/q/21379865
upvote count: 6
favorite count: 0
tagged with: javafx-2
score: 6
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21381478
has title: How to hide the down arrow button on a combobox in javafx?
type: Question
possible better answer: http://stackoverflow.com/a/35152031
accepted answer: http://stackoverflow.com/a/21381478
has answer: http://stackoverflow.com/a/35152031
downvote count: 0
has body: I have an editable ComboBox and I wish to "hide" the down arrow button so that it looks like a normal textbox.
has answer: http://stackoverflow.com/a/21381029
answer count: 3

http://stackoverflow.com/comment/32362731
has text: tried making it public, that did not work. I'll try the getter
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21446923

http://stackoverflow.com/comment/32404808
comment on: http://stackoverflow.com/a/21468002
score: 0
type: AnswerComment
has text: Then I would have to do it for every question?
type: Comment

http://stackoverflow.com/q/21489624
has answer: http://stackoverflow.com/a/41536654
has comment: http://stackoverflow.com/comment/32438372
score: 1
tagged with: java
tagged with: jscrollbar
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has title: JScrollBar adjustment issue
has body: I am having an issue with my horizontal scroll bar demo. I am trying to move a custom message panel using the scroll bar. I used an anonymous listener and override the adjustmentValueChanged() method like so, public void adjustmentValueChanged(AdjustmentEvent e){ System.out.println(e.getAdjustmentType()); if( e.getAdjustmentType() == AdjustmentEvent.UNIT_INCREMENT ) { panel.moveLeft(); } } I am trying to get the AdjustmentEvent using e.getAdjustmentType() so I can properly handle the adjustment of the message panel. However, it is not working. I used System.out.println() method to print the adjustment type on my screen to see what the problem is but what I am not understanding is that no matter what part of the scroll bar I press (whether it is the unit increment, unit decrement, block increment, etc..) the value returned is 5? I am not sure what the issue is can someone please help. public class ScrollBarDemo extends JFrame { private JScrollBar scrollHort = new JScrollBar(JScrollBar.HORIZONTAL); private JScrollBar scrollVert = new JScrollBar(JScrollBar.VERTICAL); private MessagePanel panel = new MessagePanel("Welcom to Java bitch"); public static void main(String[] args) { ScrollBarDemo frame = new ScrollBarDemo(); frame.setTitle("ScrollBarDemo"); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public ScrollBarDemo() { setLayout(new BorderLayout()); add(panel, BorderLayout.CENTER); add(scrollHort, BorderLayout.SOUTH); add(scrollVert, BorderLayout.EAST); scrollHort.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { System.out.println(e.getAdjustmentType()); if (e.getAdjustmentType() == AdjustmentEvent.UNIT_INCREMENT) { panel.moveLeft(); } } }); } }
has comment: http://stackoverflow.com/comment/32449546
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32415921
has text: I meant to find the hash value for a pdf file, do we have any algorithms?
score: 0
comment on: http://stackoverflow.com/a/21476051
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32590433
type: QuestionComment
type: Comment
has text: @IraBaxter: I couldn't ask a question at softwarecs because I was not invited to join (maybe I missed some email invitation). In any case, I just flagged the question here at stackoverflow for moderator attention. As a matter of fact, I am not soliciting tool suggestions. One could have written a program or script that parses an entire Java codebase and builds the dependency graph pointing towards a given Java class. That person could share his/her solution in the answer. In any case, thanks a lot for your support on this.
comment on: http://stackoverflow.com/q/21482012
score: 0

http://stackoverflow.com/a/21371051
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Try this - More information here - Bug 340977
has comment: http://stackoverflow.com/comment/32235535
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21370467
answers question: http://stackoverflow.com/q/21370467

http://stackoverflow.com/a/21425904
score: 1
has body: If you use an IDE such as Eclipse, you can query the list of classes that implement Iterator. Just select the word Iterator in your code and press Ctrl-t. Other IDEs will have their own way of doing this. You'll see countless different iterators that are included in Oracle non-public code (and from other libraries you use). It is an instance of one of these classes that are returned when you request an iterator from a set. To find out which particular iterator is used with a certain object type, browse the source and see for yourself! Or print the name by calling .getClass().getName() on the iterator instance. For instance, a HashSet uses a private iterator class HashMap.KeyIterator, which extends a parent class HashMap.HashIterator.
upvote count: 1
answers question: http://stackoverflow.com/q/21425783
type: Answer
downvote count: 0

http://stackoverflow.com/comment/32375377
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21454490
has text: @zapl : You have defined your map as final, so, you have to clear it only. And, What are those multithreading issues?

http://stackoverflow.com/a/77973518
answers question: http://stackoverflow.com/q/21394537
downvote count: 0
type: Answer
score: 6
upvote count: 6
has body: After many years, this is still a big issue to many people who want to use Tess4j in MacOs. The issue is on Tess4j, not Tesseract. Tess4j is the Java wrapper for Tesseract. Apparently the Tess4j jar file is missing a c++ library (libtesseract.dylib) necessary for its operation in macos. I'll explain the steps I took to solve this for Mac users. Tools: Gradle 8.5, JDK 21, Tesseract 5.3.4 (from sourceforge), Tess4j 5.10.0, Intellij, Mac Os - Sonoma 14.2.1, Kotlin 1.9.22, Spring Boot 3.2.2 Install Tesseract using brew brew install tesseract. You can use brew list tesseract to check where brew installed tesseract. For me, brew installed it at /opt/homebrew/Cellar/tesseract/5.3.4 I used both the jar file and gradle dependency from this maven repo.. Here is my my setup (parts of my directory and gradle.build.kts dependencies). The libs directory and everything inside it are created by me. The libtesseract.dylib is a renamed version of libtesseract.5.dylib from brew's tesseract installation. In my case, it's located at /opt/homebrew/Cellar/tesseract/5.3.4/lib/libtesseract.5.dylib. The 5 in libtesseract.5.dylib seems to be the tesseract version, yours might be different depending on the time you'll be reading this. Side Note: The reason I used both the maven repo in the gradle build file as well as a jar file is that Tess4j has other dependencies which the gradle dependency brings in, such as Lept4J, which is a Java JNA wrapper for image processing. Also, I didn't want to patch the tess4j-5.10.0.jar file built by gradle because it's stored inside a hashed folder which could change when rebuilt or version updated. The last thing is to patch the jar file with the c++ library we copied. Open a terminal at the libs folder shown in the above image and run the following commands. i) jar uf tess4j-5.10.0.jar darwin - This will update the jar archive file with the darwin directory which you created. ii) jar uf tess4j-5.10.0.jar darwin/libtesseract.dylib this will update the jar fil…

http://stackoverflow.com/a/21439371
score: 0
type: AcceptedAnswer
has body: You wont be able to just exclude or ignore the time the server is waiting and only show the actual time that the server has been busy, but what you can do is ignore the transaction completely if you do not need to see those metrics. https://docs.newrelic.com/docs/java/java-agent-api This documentation talks about using New Relics API for ignoring transactions.
answers question: http://stackoverflow.com/q/21357855
type: Answer
accepted answer of: http://stackoverflow.com/q/21357855

http://stackoverflow.com/a/21363577
has body: You need to do a POST request to: https://graph.facebook.com/POST_ID/likes. Don't forget to include your token. For this you need to have extended permissions set up properly, to allow liking of posts.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33795660
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21363550
answers question: http://stackoverflow.com/q/21363550
has comment: http://stackoverflow.com/comment/37264942

http://stackoverflow.com/q/21467769
tagged with: arraylist
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21467847
favorite count: 0
accepted answer: http://stackoverflow.com/a/21467833
possible better answer: http://stackoverflow.com/a/21467847
has title: remove specific object does not work in Java ArrayList
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32399370
upvote count: 1
has body: I have an ArrayList of object containing a reference to their parent object. I am trying to remove every objects within a specific parent (so equals to the parent object). If I do: System.out.println(parent); my console output: ParentObject@1f8166e5 if I do: for(int i = 0; i &lt; array.size(); i++){ if(array.get(i).getParent().equals(parent)){ array.remove(i); } } And (test) for(int i = 0; i &lt; array.size(); i++){ if(array.get(i).getParent().equals(parent)){ System.out.println(parent + ":" + array.get(i).getParent()); } } My console output something like: ParentObject@1f8166e5:ParentObject@1f8166e5 What's wrong with the snippet above? Why array.remove(i) did not work?
type: Question
has answer: http://stackoverflow.com/a/21467833

http://stackoverflow.com/q/21511484
upvote count: 6
has answer: http://stackoverflow.com/a/21593152
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/41507468
downvote count: 0
has title: Excluding NullNode when serializing a Jackson JSON tree model
has answer: http://stackoverflow.com/a/21586999
tagged with: jackson
answer count: 3
possible better answer: http://stackoverflow.com/a/41507468
has body: I have a pojo type that needs to have specific numeric values set to a special string when it's serialized. These values will always be null, possibly pretty deep into a hierarchy. To accomplish this I first convert the pojo to a JsonNode with nulls intact to preserve property order, then I follow a path through the structure to set some strings and create nodes as necessary. Finally, I have the ObjectMapper serialize the JsonNode to a string. The logic looks something like this: ObjectMapper nonNullMapper = new ObjectMapper(); nonNullMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); ObjectMapper includeAllMapper = new ObjectMapper(); includeAllMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS); // NullNodes create stubs to maintain property order JsonNode node = includeAllMapper.valueToTree(pojoInstance); insertStrings(node); String json = nonNullMapper.writeValueAsString(node); // Halp, there's still nulls Note that I'm aware there's a @JsonInclude annotation so I don't actually need two mappers, but it turns out that I want to serialize the pojo instances without nulls elsewhere, so I can't use it to my knowledge. Anyway, how can I avoid having the NullNodes serialized into my string of json? I've found two approaches so far: Convert to a Map and then serialize to a String, with SerializationFeature.WRITE_NULL_MAP_VALUES disabled. This seems inefficient and hacky. Remove NullNode instances manually before serializing the JsonNode. Seems like it shouldn't be necessary given the support for excluding nulls for pojos and maps, and it adds (perhaps?) unneeded complexity. I tried registering a JsonSerializer for NullNode, but it doesn't appear to get used. I notice that NullNode itself implements JsonSerializable, which simply delegates to the SerializerProvider's null value serializer. I hesitate to attempt to overwrite this and I feel like the null filtering should be taking place before the values are serialized, but I didn't dig deep enough…
favorite count: 0
accepted answer: http://stackoverflow.com/a/21586999
score: 6

http://stackoverflow.com/q/21395148
has comment: http://stackoverflow.com/comment/32271409
type: UnansweredQuestion
downvote count: 2
tagged with: reset
tagged with: java
has comment: http://stackoverflow.com/comment/32271379
has answer: http://stackoverflow.com/a/21395333
tagged with: swing
has comment: http://stackoverflow.com/comment/32271288
type: Question
has title: Reset button not working
score: -2
has comment: http://stackoverflow.com/comment/32271299
upvote count: 0
has body: I would be greatfull if anyone could help me with my code. I have a project that involved an artificial lifeform( a bug ) that eats food and avoids obstacles. So far i have food randomly generated on the map. When i hit the reset button all the food dissapears and the bug goes back to the first square and is not randomised. Can anyone tell me why? Also how do i stop bugs and food being put onto the same panel sometimes. Any help would be great, thanks! package Javaproject; import java.lang.Math.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.Random; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.SpinnerNumberModel; import javax.swing.Timer; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @SuppressWarnings("serial") public class JumpinJackFlash extends JPanel implements ActionListener, ChangeListener { private JPanel gridPanel; //the panel containing the 2D grid private JPanel cells[][]; //the cells of the 2D grid private JToolBar toolBar; private JButton jb_start, jb_stop, jb_reset; private JTextField jtf_info; private Timer timer; private int speed; //cycles per second private int cycleNum; private JSpinner jspin_speed; private final static String RELPATHICONS = "icons" + File.separator; //relative path to icons folder private final static String RELPATHSOUNDS = "sounds" + File.separator; //relative path to sounds folder private static Random ran = new Random(); private static final int…
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/45541226
comment on: http://stackoverflow.com/a/28216983
has text: Thanks for the heads up. I ended up giving up on this since it seems static/dynamic/tomcat/vs boot was still an issue. This is way harder than it should be... Nginx reverse proxy FTW!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21493420
type: Answer
has body: So how can the values from 0 to 3 be returned? If search = "aaaa" the output will be 3, since that's the position (index) returned by the method binarySearch. Something similiar will happen if: search = "aaa", output will be 2 search = "aa", output will be 1 search = "a", output will be 0 To understand this, try printing the elements of the array sa: System.out.println(sa[0]); // index 0 System.out.println(sa[1]); // index 1 System.out.println(sa[2]); // index 2 System.out.println(sa[3]); // index 3 Output: a aa aaa aaaa
score: 3
accepted answer of: http://stackoverflow.com/q/21493394
answers question: http://stackoverflow.com/q/21493394
type: AcceptedAnswer
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/21365774
upvote count: 1
answers question: http://stackoverflow.com/q/21365643
downvote count: 0
has body: I assume that MailServiceImpl and MailBO are Spring Beans. Then just annotate MailServiceImpl constructor by @Autowired and Spring will automatically injects constructor dependency
type: Answer
score: 1

http://stackoverflow.com/comment/32472806
score: 0
type: AnswerComment
has text: thanks, I just wondering if it is possible to be column oriented?
comment on: http://stackoverflow.com/a/21509207
type: Comment

http://stackoverflow.com/comment/32486597
comment on: http://stackoverflow.com/a/21507748
has text: Last line: current.next = q; not current.next = p; I modified the code
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32246924
score: 0
type: QuestionComment
has text: articololink = (TextView)findViewById(R.id.content); add this into OnCreate() method
type: Comment
comment on: http://stackoverflow.com/q/21382068

http://stackoverflow.com/a/21374395
type: Answer
answers question: http://stackoverflow.com/q/21374305
has body: Try this: "\/p.*\/bugs[^"]*" it means: "/p" then: all chars, then: "/bugs", then: all chars except "
score: 0

http://stackoverflow.com/comment/32316533
type: QuestionComment
comment on: http://stackoverflow.com/q/21420997
score: 0
has text: @SotiriosDelimanolis I am using loopj's AsyncHttpClient and it uses the AsyncHttpResponseHandler. I just took a look at the ScheduledExecutorService, and it seems like a hacky solution. But maybe that is because I am a C# developer and we are just used to the async and await keywords that basically does all this for you.
type: Comment

http://stackoverflow.com/q/21462301
type: Question
score: 0
linked to: http://stackoverflow.com/q/3436118
answer count: 1
has body: I have the following output string to match using regex: person1 | Age 20 | M |Gender Male person2 | Age 11 | |Gender Female person3 | Age 23 | M |Gender Female person4 | Age 32 | |Gender Male person5 | Age 41 | M |Gender Male person11| Age 28 | M |Gender Female person12| Age 31 | M |Gender Male person10| Age 33 | |Gender Male person8 | Age 26 | |Gender Male In the java code, I am using the following exgex to match the above output: "person[^\n]*1Age 20[^\n]*M[^\n]*Gender Male[^\n]*" + "person3[^\n]*Age 23[^\n]*M[^\n]*Gender Female[^\n]*" + "person5[^\n]*Age 41[^\n]*M[^\n]*Gender Male[^\n]*" + "person11[^\n]*Age 28[^\n]*M[^\n]*Gender Female[^\n]*" + "person12[^\n]*Age 31[^\n]*M[^\n]*Gender Male[^\n]*" but the problem is the output string is not always in the same order every time, some times the look like: person1 | Age 20 | M |Gender Male person2 | Age 11 | |Gender Female person3 | Age 23 | M |Gender Female person4 | Age 32 | |Gender Male person11| Age 28 | M |Gender Female person12| Age 31 | M |Gender Male person5 | Age 41 | M |Gender Male person10| Age 33 | |Gender Male person8 | Age 26 | |Gender Male if I use the same regex to match the output string, it does not match. are there any ways this problem can be fixed?
has comment: http://stackoverflow.com/comment/32390247
has comment: http://stackoverflow.com/comment/32389873
type: UnansweredQuestion
tagged with: regex
has title: how to use regex to match output if the output format is changing
has answer: http://stackoverflow.com/a/21462924
tagged with: java

http://stackoverflow.com/comment/32298243
comment on: http://stackoverflow.com/q/21406934
score: 0
has text: Due to modern CPUs with multiple cores, today threads often truly run in parallel. So you might suddenly face concurrency issues that have always been in your code but have never shown up before.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32374263
comment on: http://stackoverflow.com/q/21453485
has text: But you can make a locking mechanism which locks some cells if they are accessed by a user. All other users see "access denied" on their screen for those cells until first user releases them.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/32287692
score: 0
type: Comment
type: QuestionComment
has text: Our problem is that the application does render a lot of images in a very short time (it's a psychological test, we're using Processing as graphical framework), so the VM seems not to be able to increase heap size fast enough to accomodate for this. With the -Xms parameter, it works, but the best setting for this parameter ist determined by the system environment. Setting it to 1500M, for example, fails on older machines.
comment on: http://stackoverflow.com/q/21400479

http://stackoverflow.com/comment/42826419
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21745229
has text: Thanks! I missed this update and have been installing the certs manually, but I'll take a look at the reference.
type: AnswerComment

http://stackoverflow.com/q/21401032
has body: I want to install/implement our product in a client machine, for that i have manual procedure, but i want to automate this process, i.e i want to prepare a installation shield for this process. I will keep all the required files in one place for example: war files Data base dump files. Required db scripts When i click on the .exe (if we created installation shield, we will get .exe) it has to ask the location about the above files, And do the installation process.i can do this by using swing , but i am searching for some readily available tools (open source) which contains more features. Expected things to be done by the installation shield: 1)Importing the dump files into already created DB user. 2)placing the above wars in to JBoss deployment folder / deployment procedure. 3)Creating the shortcuts to start &amp; stop the JBoss server in desktop. Please help me, from where i can get such tool which can do the above or similar activities.
type: UnansweredQuestion
tagged with: installshield
has answer: http://stackoverflow.com/a/21401092
tagged with: java
has answer: http://stackoverflow.com/a/21402939
type: Question
tagged with: jakarta-ee
has title: Installation Shield for JavaEE application
tagged with: webdeploy
score: 0
answer count: 2

http://stackoverflow.com/comment/32276961
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21397090
type: Comment
has text: That gives the data which is company proprietary. Can't post it here. But those are nothing but `String` and `int` data. In `String` some are Names and some are strictly alphanumeric codes.

http://stackoverflow.com/a/21433699
has body: They are the same functionality. The hamcrest provides a more English-like readable language and better error messages. In simple cases like this, I would probably just use the assertFalse
accepted answer of: http://stackoverflow.com/q/21433497
score: 11
answers question: http://stackoverflow.com/q/21433497
downvote count: 0
type: AcceptedAnswer
upvote count: 11
type: Answer

http://stackoverflow.com/q/21383786
favorite count: 0
has title: How to get init parameter of servlet at web.xml from welcome jsp page?
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: welcome-file
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21384104
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21384378
has body: I created index.jsp page and binded path /index to it in web.xml. It's also displayed when accessing the root of application as welcome page. It has three init parameters. The problem is I can access then from JSP code by config.getInitParameter() if the path is full [host:port]/[appName]/index, the parameters are accessed normally. If I try to navigate to application root [host:port]/[appName]/ welcome page is displayed but init parameters can't be accessed. config.getInitParameter() method returns null. How to configure welcome page properly in web.xml if I want to get servlet init parameters?

http://stackoverflow.com/a/21463117
has comment: http://stackoverflow.com/comment/32398079
type: Answer
has body: Is there a way to get only the latest revison of each doc? Couch always gives you the latest revision, unless you ask for a particular revision: GET http://localhost:5984/mydb/doc-123 Returns latest revision of doc-123 GET http://localhost:5984/mydb/doc-123?rev=946B7D1C Returns a specific revision of doc-123. (Revisions are kept by couch only for conflict resolution. They are removed during compaction and are not replicated, so you shouldn't necessarily count on them being there) And if possible only get only one doc by id from that view If you just want to get a document by id, there is no need to use a view. Looks like you want to do something like this with ektorp: Sofa sofa = db.get(Sofa.class, id, rev); Where Sofa is a java class which extends CouchDbDocument
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21453071
has comment: http://stackoverflow.com/comment/32394159

http://stackoverflow.com/a/21425055
answers question: http://stackoverflow.com/q/21424931
score: 0
has comment: http://stackoverflow.com/comment/32323111
has body: No matter which kind of error, you can always redirect to any other pages: &lt;% try { // do whatever you want (Connect to database ...) } catch(Exception ex) { // logging ... response.sendRedirect(..); return; } %&gt; UPDATE Sorry, But I'm a little bit confuse about your question. But: If an error happens at servlet init and your single tone class is in it, just leave this error because Application fail to start, and user should fix it anyway, you can generate log of whatever to help to user to figure out what is the problem! For utilities and some special cases Singleton is not bad, but for the web application you should avoid it as much as you can. You can make an instance and put it on session if it's for unique for each user, and if it's unique in entire system, you can put it on servlet Context. getServletContext().setAttribute("my", sample); Hope that it help I hope this may help you
type: Answer

http://stackoverflow.com/q/21359774
has comment: http://stackoverflow.com/comment/32207691
answer count: 1
tagged with: java-2d
has comment: http://stackoverflow.com/comment/32207679
has comment: http://stackoverflow.com/comment/32207236
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/32207187
has comment: http://stackoverflow.com/comment/32207455
tagged with: java
has comment: http://stackoverflow.com/comment/32207689
has answer: http://stackoverflow.com/a/21360655
type: Question
has comment: http://stackoverflow.com/comment/32207766
has comment: http://stackoverflow.com/comment/32208320
accepted answer: http://stackoverflow.com/a/21360655
has comment: http://stackoverflow.com/comment/32207264
has title: Java Tiled map is painting sideways
has body: Recently I've been trying to make a little game for my learning purpose but I got stuck. I was able to generate a map from a .txt file but then it seems to paint it sideways? this is my map loaded which reads from a text file and add them to an ArrayList. Width is 20 Height is 10. Same thing applies in my map 20 lines wide 10 down. public void loadMap(String name) { try { this.name = name; FileInputStream file_stream = new FileInputStream(name); DataInputStream in = new DataInputStream(file_stream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); map = new Tile[WIDTH][HEIGHT]; String line; int y = 0; while ((line = br.readLine()) != null) { String[] tokens = line.split(" "); for (int x = 0; x &lt; WIDTH; x++) { boolean f = false; if (Integer.parseInt(tokens[x]) == 1) f = true; Tile tile = new Tile(y, x, f, Integer.parseInt(tokens[x])); tiles.add(tile); map[x][y] = tile; System.out.println("adding tile (x: " + x + " y: " + y + ") " + f + " " + Integer.parseInt(tokens[x])); } y++; } in.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "The map: " + name + " was not found."); e.printStackTrace(); } } This is the draw method for the map public void paint(Graphics2D g) { for (Tile t : getTiles()) { t.draw(g); //g.draw(t.getBounds()); } } Here is an example map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 The way it paints the map is basically a vertical version of this instead of the correct way like it is above. I have tried messing with the numbers within the mapLoaded (width, height) and switching the x and y around but nothing seems to work. Please help
tagged with: arraylist

http://stackoverflow.com/q/21405730
has title: JTextPane DefaultStyledDocument and setEditorKit conflict
tagged with: defaultstyleddocument
has answer: http://stackoverflow.com/a/21412608
has body: I'm using JTextPane in a project where I'm supposed to display row numbers and color some keywords. For displaying row numbers, I'm using 'setEditorKit' and for coloring the text, I'm overriding insertString() and removeString() methods of DefaultStyledDocument and then using 'JTextPane.setDocument(DefaultStyledDocument_object)'. The problem I'm facing is that if I add EditorKit to my JTextPane, the coloring part doesn't work. And if I add the the DefaultStyledDocument after setting the EditorKit, the insertString method shifts the caret to the 'zero caret position', hence messing up the UI. Here's an image of the functionality I'm trying to achive. This is what I want to my JTextPane to look like. This is what it currently looks like How do I use both 'setEditorKit' and 'DefaultStyledDocument' in my application?
tagged with: jtextpane
tagged with: swing
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21412608
type: Question
answer count: 1
score: 0

http://stackoverflow.com/q/21354286
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32197899
has comment: http://stackoverflow.com/comment/32198647
downvote count: 1
upvote count: 6
has comment: http://stackoverflow.com/comment/32197684
has comment: http://stackoverflow.com/comment/32197808
tagged with: java
has comment: http://stackoverflow.com/comment/32198003
has body: Let me show my quick example: public class Main { public static abstract class Food { } public static abstract class Fruit extends Food { public String getJuice(){ return "juice"; } } public static abstract class Container&lt;T extends Food&gt; { private T food; public final T get(){ return food; } } public static abstract class Crate&lt;T extends Fruit&gt; extends Container&lt;T&gt; { } public static void Bar(Crate crate) { Food f = crate.get(); //compiles fine //Fruit f2 = crate.get(); //can't compile } } When given a raw type, crate.get() returns Food instead of Fruit note: Crate is declared as Crate&lt;T extends Fruit&gt; extends Container&lt;T&gt; so Crate&lt;Food&gt; is forbidden. I am just curious: why does the method T get() not return Fruit? Why is Crate&lt;Fruit&gt; required?
type: Question
has title: Wrong generic return type
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/32197974
has comment: http://stackoverflow.com/comment/32197268
has answer: http://stackoverflow.com/a/21355375
linked to: http://stackoverflow.com/q/2770321
tagged with: generics
favorite count: 0

http://stackoverflow.com/comment/32460353
score: 0
type: Comment
has text: Hi, thanks theodoros, this is a good way of doing it, it will make my code a lot short. I have one question though, do each component have there own unique name which I can refer to. e.g. if i want to use the value of field to, or disable textfield1, how would i do that?
type: AnswerComment
comment on: http://stackoverflow.com/a/21502204

http://stackoverflow.com/a/21402816
has comment: http://stackoverflow.com/comment/32297160
answers question: http://stackoverflow.com/q/21392674
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32296159
has body: It really seems that the missing commit is the cause of your problem in your third unit of work. Because your application opens the transaction, it is its duty to commit or roll-back it. The another scenario would be a container managed transaction (CMT) where the Java EE container (or Spring) deals with all transactions.
has comment: http://stackoverflow.com/comment/32301904
type: Answer

http://stackoverflow.com/q/21431497
type: AnsweredQuestion
tagged with: java
has body: Previously I used RAD 7.5 IDE and there i used Websphere Application Server(WAS) 7.0 to deploy my web projects. Now I am moving to Netbeans IDE 7.4. Could you please let me know how can I configure WAS 7.0 in Netbeans IDE?
type: Question
tagged with: websphere
has title: how to configure IBM websphere application server 7.0 with netbeans IDE 7.4
answer count: 1
tagged with: netbeans-7
score: 0
has answer: http://stackoverflow.com/a/21503830
accepted answer: http://stackoverflow.com/a/21503830

http://stackoverflow.com/comment/32278183
score: 0
has text: Prateek, i edited my question...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21399318

http://stackoverflow.com/comment/32417238
comment on: http://stackoverflow.com/a/21478248
score: 0
type: AnswerComment
has text: I agree with you, and regex might take more process times than expected. This is a more elegant solution. You can change it to single line if you prefer. str = str.substring(0,str.indexOf('+')+1) + str.substring(str.indexOf('@')+1,str.length);
type: Comment

http://stackoverflow.com/comment/32256848
type: Comment
has text: So what can I do ? Thanks for your reply
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21387061

http://stackoverflow.com/q/21388183
has comment: http://stackoverflow.com/comment/32258921
tagged with: jackson
has title: How do I call the default deserializer in a custom deserializer in Jackson?
answer count: 1
favorite count: 0
has body: I have a JSON object that has 3 different objects in use. { // Class A "name" : "Name", "list" : { "names" : { //Class B "scale1" : { //Class C "max" : 10, "min" : 0 }, "scale2" : { //Class C "max" : 20, "min" : 15 } } } } Class A contains a Map&lt; String,Class B>, and Class B contains a Map&lt; String,Class C>. The issue I am having is that I have a custom deserializer for class B but I want to use the default deserializer for class C. I want to have it something like this: public class BDeserializer extends JsonDeserializer&lt;B&gt; { @Override public B deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException, JsonProcessingException { B bObject = new B(); while(!arg0.isClosed()){ C cObject = CDeserializer.deserialize() bObject.names.add(cObject); } return bObject; } } But I am not sure what arguments to pass into the CDeserializer, or if there is a away for me to call a default deserializer for class C. The classes look roughly like: public class A { String name; Map&lt;String,B&gt; list = new HashMap&lt;String,B&gt;(); //getters &amp; setters } public class B { String name; Map&lt;String,C&gt; fields = new HashMap&lt;String,C&gt;(); //getters &amp; setters } public class C { String name; long min; long max; //getters &amp; setters }
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21409544
accepted answer: http://stackoverflow.com/a/21409544
downvote count: 0

http://stackoverflow.com/comment/32288888
has text: Ah, the scope was wrong. If you turn the comment into an answer, i'll happily accept it :-)
comment on: http://stackoverflow.com/q/21405426
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21594697
type: Answer
has comment: http://stackoverflow.com/comment/32624647
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21503188
downvote count: 0
has body: You're trying to re-invent the wheel here. You should just use a JOptionPane to create a modal dialog that returns some user entered input. See http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

http://stackoverflow.com/a/21390219
score: 10
has comment: http://stackoverflow.com/comment/32267038
has comment: http://stackoverflow.com/comment/32262123
answers question: http://stackoverflow.com/q/21390187
upvote count: 10
has comment: http://stackoverflow.com/comment/32262434
downvote count: 0
type: Answer
has body: Can Creatures, Buildings, and Magic all implement the same interface or extend the same class? Then you could have an ArrayList that contains that interface or class. Alternatively, just have a data structure that contains three ArrayLists and write code that picks fairly between them.
has comment: http://stackoverflow.com/comment/32262225

http://stackoverflow.com/a/21506121
type: Answer
has body: You could use a finally: @Test(expected = IllegalArgumentException.class) public void cdIntoNonExistantFolder() { try { cdTool.changeDirectory("nonexistant"); } finally { assertThat(cdTool.getStatusCode(), not(equalTo(0))); } }
score: 18
upvote count: 18
answers question: http://stackoverflow.com/q/21506079
downvote count: 0

http://stackoverflow.com/comment/32356168
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21443268
type: Comment
has text: Seriously though, does it really matter? Inserting the first document in a collection is a one-time thing so if you plan to add lots of documents into the same collection that initial cost will amortize out to practically nothing.

http://stackoverflow.com/comment/32229604
type: QuestionComment
has text: Then we need the *actual* where clause. Basically, the reason for joining `p` is to be able to select the employees who are associated with some project(s).
comment on: http://stackoverflow.com/q/21372116
score: 0
type: Comment

http://stackoverflow.com/q/21487276
answer count: 1
has title: java.util.MissingResourceException: Can't find bundle for base name com.sun.org.apache.xerces.internal.impl.msg.SAXMessages, locale en_US
favorite count: 0
has body: I'm receiving the following exception while trying to deploy my java app to tomcat7 using java7, hibernate, mysql. java.util.MissingResourceException: Can't find bundle for base name com.sun.org.apache.xerces.internal.impl.msg.SAXMessages, locale en_US I've spent a lot of time surfing around the web looking for an answer, but I have yet to come up with one. Does anybody know what this error means or how to correct it?
upvote count: 1
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/21487522
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21487522

http://stackoverflow.com/a/21408395
score: 0
type: Answer
has body: The first time you click you should use the OnFocusChangeListener to get the event. After foucus is on the View all extra clicks will invoke the OnClickListener event. You can also do this: setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { // call your onclick method } } });
answers question: http://stackoverflow.com/q/21408199

http://stackoverflow.com/a/21359000
has comment: http://stackoverflow.com/comment/32206226
has body: As in your question, Res1 and Res2 need to be type ResMsg, which suggests Res1, Res2 should have something in common. But from your class definition of Res1, Res2, they just have different fields and nothing in common. Whether to use interface or not is based on how you want the Response object to be used. In my opinion, there will be an interface ResMsg, which defines public api, Res1 and Res2 can directly implement the interface. And if Res1 and Res2 have some common logics, you can have an abstract class, such as AbstractResMsg, to implement the common logics. Res1, Res2 can extend the abstract class and implement the interface.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32206278
answers question: http://stackoverflow.com/q/21358828

http://stackoverflow.com/comment/32192136
has text: There's no need to make coorX and coorY private if you're allowing it to be read and wrote with getters and setters.
comment on: http://stackoverflow.com/q/21351395
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32435450
comment on: http://stackoverflow.com/q/21488419
type: Comment
score: 1
has text: [Apache POI](http://poi.apache.org/).
type: QuestionComment

http://stackoverflow.com/q/21459331
has title: Junit: NoSuchElement Exception while running test only in remotewebriver
tagged with: selenium-grid
score: 0
has answer: http://stackoverflow.com/a/21460152
answer count: 1
has body: I am running 10 tests in parallel with 2 nodes using selenium grid , got an NoSuchElementException only in Remotewebdriver , but the same is working fine in normal firefox driver , I have definded my own threadpool executor class which holds two threads at a time , each thread starts its own Junit tests using Junitcore api. below is the exception i recieved org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"login_element"} Command duration or timeout: 1.28 seconds Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01' System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_24' Session ID: 5c94133a-5586-449c-b7f6-018bbd79a6d7 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotata ble=false, locationContextEnabled=true, version=23.0.1, cssSelectorsEnabled=true, databaseEnabled=tr ue, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, ap plicationCacheEnabled=true, takesScreenshot=true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java: 39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm pl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307) at org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:356 ) at org.openqa.selenium.By$ByLinkText.findElement(By.java:241) at org.openqa.selen…
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: junit4
tagged with: java
tagged with: selenium
type: Question

http://stackoverflow.com/comment/32476978
comment on: http://stackoverflow.com/a/21510093
type: AnswerComment
type: Comment
score: 0
has text: Then read, understand and document the jadira code, or rewrite it by yourself. If Hibernate decides to release a new, backward-incompatible version, there's a much higher chance of the jadira code to be quickly updated than your own code to magically work with the new backward-incompatible version.

http://stackoverflow.com/comment/32214569
has text: @ᴍarounᴍaroun Yes, but he's asking why he gets "result may not be initialised", and that's why. And I added a note about string comparison
comment on: http://stackoverflow.com/a/21364144
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21387532
has comment: http://stackoverflow.com/comment/32294049
has comment: http://stackoverflow.com/comment/43175383
has comment: http://stackoverflow.com/comment/32283162
upvote count: 4
has body: The difference between SuperDevMode and compiling in draft mode is that SuperDevMode uses a resident compiler, so it doesn't start from scratch when it needs to recompile your app. SuperDevMode also only compiles one permutation (the one that your browser will use). That said, compilation is still monolithic. In the next version, GWT will introduce incremental compilation: modules will be pre-compiled on their own, so modules that don't change don't need to be recompiled and only need to be "linked" with the others to produce the final JS.
downvote count: 0
has comment: http://stackoverflow.com/comment/32292903
score: 4
has comment: http://stackoverflow.com/comment/32259447
has comment: http://stackoverflow.com/comment/32259390
type: Answer
answers question: http://stackoverflow.com/q/21387335
has comment: http://stackoverflow.com/comment/87676944
has comment: http://stackoverflow.com/comment/32259549

http://stackoverflow.com/q/21432493
tagged with: regex
type: AnsweredQuestion
has body: I have the following String: [{"index":1,"image":"1234a.jpg","thumbnail":"1234a_t.jpg","medium":"1234a.jpg"}, {"index":2,"image":"43215256b.png","thumbnail":"43215256b_t.jpg","medium":"43215256b.jpg"}] I would like to select only JPG name or the pngs like (1234a.jpg OR 43215256b.png) and ignore the rest of the String, How can I do that in Java?? I tried substring but it works not fine because the names of the JPGs are different. Here a piece of my Java code: for (int i = 0; i &lt; data.length(); i++) { JSONObject c = data.getJSONObject(i); map = new HashMap&lt;String, String&gt;(); map.put("imageID", c.getString("imageID")); map.put("image", c.getString("image")); MyArrList.add(map); } Where image is a database field that contains the String above, So I would like to select the JPGs names OR the PNGs names from the content of c.getString("image") I tried JSON but not worked, mabye have someone better Idea?? please help.
possible better answer: http://stackoverflow.com/a/21432668
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/21454500
has comment: http://stackoverflow.com/comment/32335707
has comment: http://stackoverflow.com/comment/32335740
has title: Iterate String Java and select specific word
answer count: 3
has answer: http://stackoverflow.com/a/21432554
upvote count: 0
tagged with: string
accepted answer: http://stackoverflow.com/a/21454500
favorite count: 0
has answer: http://stackoverflow.com/a/21432668
score: -3

http://stackoverflow.com/q/21421150
tagged with: awt
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21421243
linked to: http://stackoverflow.com/q/21322353
has title: Java: Using graphics component within an ActionListener
has answer: http://stackoverflow.com/a/21421254
type: Question
has answer: http://stackoverflow.com/a/21421343
accepted answer: http://stackoverflow.com/a/21421254
tagged with: paint
score: 0
tagged with: java
answer count: 3
tagged with: graphics
has body: I have two separate class and driver files, and in the class file I create the paint method: public void paint(Graphics g){ g.drawLine(...... .... //along with all of my other draw commands } Further down in the code, I create a JButton and within this button's action listener I don't know how to use a Graphics object to create more graphics in the JFrame. Should I be adding something to my driver to make this happen, or is there a way to use these graphics within my action listener? Thank you, and any help is appreciated.
has answer: http://stackoverflow.com/a/21421243

http://stackoverflow.com/q/21428303
tagged with: postgresql
score: 0
has title: ClassNotFoundException: org.postgresql.util.PSQLException
accepted answer: http://stackoverflow.com/a/21444004
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32329238
tagged with: java
has answer: http://stackoverflow.com/a/21444004
has body: I have a performance issue where the application cannot execute a DB query when a particular page is accessed and the page fails to load. The stack trace for the error is as follows: Caused by: java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:246) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148) at com.sun.proxy.$Proxy27.getCallSynthData(Unknown Source) at com.avaya.ces.gui.rmi.CallSynthDataServiceRmiClient.getCallSynthData(CallSynthDataServiceRmiClient.java:107) ... 98 more Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:393) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:185) at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637) at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264) at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:214) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990) at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:500) at java.lang.Throwable.readObject(Throwable.java:914) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Nat…
type: Question
answer count: 1

http://stackoverflow.com/q/21494991
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/32447683
type: Question
has body: Here is my login activity class where i want to do login after login it show the map but when i run the app it show unfortunately stopped login loginActivity.java package com.ivb.login; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class LoginActivity extends Activity{ EditText edtemail,edtPassword; Button btnLogin; String strUsername,strPassword; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.login); edtemail = (EditText)this.findViewById(R.id.edt_email); edtPassword = (EditText)this.findViewById(R.id.edt_passwrd); btnLogin = (Button)this.findViewById(R.id.btnLogin); btnLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub strUsername = edtemail.getText().toString().trim(); strPassword = edtPassword.getText().toString().trim(); if(strUsername.equals("needin@gmail.com") && strPassword.equals("needin123")) startActivity(new Intent(LoginActivity.this,LoginSuccess.class).putExtra("usr",(CharSequence)strUsername)); else Toast.makeText(LoginActivity.this,"Invalid UserName or Password", Toast.LENGTH_LONG).show(); } }); TextView registerScreen = (TextView) findViewById(R.id.link_to_register); // Listening to register new account link registerScreen.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Switching to Register screen Intent i = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(i); } }); } } loginsuccess.java package com.ivb.login; import javax.security.auth.PrivateCredentialPermission; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.m…
has comment: http://stackoverflow.com/comment/32447801
has comment: http://stackoverflow.com/comment/32447695
upvote count: 2
score: 0
has title: Unfortunately my app has stopped working
downvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/21495090
favorite count: 0
has comment: http://stackoverflow.com/comment/32447699
tagged with: android
has comment: http://stackoverflow.com/comment/32447802
has comment: http://stackoverflow.com/comment/32447706
has comment: http://stackoverflow.com/comment/32447650
tagged with: android-intent
has answer: http://stackoverflow.com/a/21495090
type: AnsweredQuestion

http://stackoverflow.com/a/21390164
upvote count: 1
answers question: http://stackoverflow.com/q/21390079
type: Answer
has body: zustand = (zustand == false); If zustand is true, then zustand == false is false and zustand is assigned to false. If zustand is false, then zustand == false is true and zustand is assigned to true. In other words, the line zustand = (zustand == false) flips the value of zustand (which is then returned). This explains your output.
downvote count: 0
score: 1

http://stackoverflow.com/comment/32239573
comment on: http://stackoverflow.com/a/21377554
score: 0
type: AnswerComment
has text: So check some criteria are there equal or not before creating. Its depends the equality logic of your class.
type: Comment

http://stackoverflow.com/comment/32202905
score: 0
type: Comment
type: QuestionComment
has text: Show us only the snippet that's obviously correct and we're just guessing too...?! Where's the interface and class declaration and the imports?
comment on: http://stackoverflow.com/q/21357375

http://stackoverflow.com/q/21445507
score: 0
has body: i have the following setup. server1: i am using spring security v3.1.4 in one application. this application is running on its own server (e.g. tomcat at server1.mydomain.com). server2: i have another 3rd party web application running on a different server (e.g. tomcat at server2.mydomain.com). this applicaton is pluggable in that it allows me to install jars to dynamically modify behavior at runtime. its purpose is to serve content. users and resource access are managed on server1. content is delivered by server2. on server2, if a resource request comes in, i need to ask server1 if the user is logged in. is this possible to do with spring security? i imagine i would pass in the username with the resource request (e.g. http://server2.mydomain.com?getFileId=1&amp;username=johndoe@gmail.com). i read a little bit on the spring security website and SSO seems to be the way to go (e.g. using Central Authentication Service). but that seems like an overkill. our architecture already has several servers running. integration (e.g. the webapp using spring security) media (e.g. the 3rd party webapp) elastic search (a cluster) mysql (a cluster) if possible we would like to have a minimalist system (but our system isn't small, given our investments and assumptions using rdbms/IR clusters). any help is appreciated.
tagged with: spring
answer count: 1
has comment: http://stackoverflow.com/comment/43627789
has answer: http://stackoverflow.com/a/21454061
tagged with: java
tagged with: tomcat
tagged with: spring-security
has title: how to check if a user is logged in from another webapp using spring security
accepted answer: http://stackoverflow.com/a/21454061
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/32424899
comment on: http://stackoverflow.com/a/21471274
has text: I think we are talking about entirely different things. I'm not interested in the use cases for worker threads. I'm interested in if it matters from where in my code my thread is started. I'm interested in this because it has been implied in other answers that "you should start a thread **in** a service". Contrast this with "you should start a service. Then create a new thread [from anywhere]".
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21350338
upvote count: 7
has body: If a library is ok for you, GSON would help about it. it converts JSON to object, so you can reach them such as yourclassinst.name refer this one
score: 7
answers question: http://stackoverflow.com/q/21350280
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32190858

http://stackoverflow.com/comment/32308938
type: Comment
has text: Thanks. What have worked for me is implementing PrivilegedAction on my classes and doing the AccessController.doPrivileged().
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21416480

http://stackoverflow.com/comment/32433605
type: Comment
comment on: http://stackoverflow.com/a/21487609
score: 0
has text: If you're accessing the variables from the enclosing class, they don't need to be public.
type: AnswerComment

http://stackoverflow.com/q/21403891
has comment: http://stackoverflow.com/comment/32286030
accepted answer: http://stackoverflow.com/a/21404027
has body: I have in my package two classes: Animal and AnimalTest. I have in a different package another class Animal. I want to have public class AnimalTest extends Animal where Animal is the class from the other package. But when I write that, Eclipse automatically selects the class Animal from my current package. I found to ways to get what I want: by deleting the file, creating a class with the wizard and indicating the path of the Superclass writing: public class AnimalTest extends com.the.other.package.Animal then writing: import com.the.other.package.Animal then changing the header back to: public class AnimalTest extends Animal and this time it is linked to the Animal class I want. This seems very cumbersome to me and I am sure there is a better and simpler way to do it?
has comment: http://stackoverflow.com/comment/32285873
tagged with: extends
tagged with: package
possible better answer: http://stackoverflow.com/a/21404023
has answer: http://stackoverflow.com/a/21404098
upvote count: 1
has answer: http://stackoverflow.com/a/21404023
has title: Fastest way to extend to a class in another package, with the same name as one in the current package
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21404027
answer count: 3
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/35092439
answers question: http://stackoverflow.com/q/21360480
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: Well, here is how I did this, but for byte[], for InputStream should be straightforward, but I do think you will need to keep the connection open (I don't know if this could be done with mybatis). Add the Oracle JDBC driver to your project, you will need mybatis dependencies too. If you are using Maven: com.oracle ojdbc14 10.2.0.3.0 org.mybatis mybatis-spring 1.2.1 org.mybatis mybatis 3.2.3 Add the custom BaseTypeHandler for reading byte[] from Oracle BLOB class: @MappedTypes(byte[].class) public class OracleBlobTypeHandler extends BaseTypeHandler<byte[]> { @Override public void setNonNullParameter(PreparedStatement preparedStatement, int i, byte[] bytes, JdbcType jdbcType) throws SQLException { // see setBlobAsBytes method from https://jira.spring.io/secure/attachment/11851/OracleLobHandler.java try { if (bytes != null) { //prepareLob BLOB blob = BLOB.createTemporary(preparedStatement.getConnection(), true, BLOB.DURATION_SESSION); //callback.populateLob OutputStream os = blob.getBinaryOutputStream(); try { os.write(bytes); } catch (Exception e) { throw new SQLException(e); } finally { try { os.close(); } catch (Exception e) { e.printStackTrace();//ignore } } preparedStatement.setBlob(i, blob); } else { preparedStatement.setBlob(i, (Blob) null); } } catch (Exception e) { throw new SQLException(e); } } /** see getBlobAsBytes method from https://jira.spring.io/secure/attachment/11851/OracleLobHandler.java */ private byte[] getBlobAsBytes(BLOB blob) throws SQLException { //initializeResourcesBeforeRead if(!blob.isTemporary()) { blob.open(BLOB.MODE_READONLY); } //read byte[] bytes = blob.getBytes(1L, (int)blob.length()); //releaseResourcesAfterRead if(blob.isTemporary()) { blob.freeTemporary(); } else if(blob.isOpen()) { blob.close(); } return bytes; } @Override public byte[] getNullableResult(ResultSet resultSet, String columnName) throws SQLException { try { //use a custom oracle.sql.BLOB BLOB blob = (BLOB) resultSet.getBlob(columnName); return getBlobAsBytes(blob); }…

http://stackoverflow.com/comment/32614637
score: 0
comment on: http://stackoverflow.com/a/21441634
type: Comment
has text: @AleksandrDubinsky: Why shouldn't it work for parallel streams? Take a look at the documentation: [Reduction Operations](http://download.java.net/jdk8/docs/api/java/util/stream/package-summary.html#Reduction).
type: AnswerComment

http://stackoverflow.com/comment/32379386
has text: I'd go for calculating a simple file hash then. For each file, calculate its MD5 hash, then maintain a Map where the key is the hash, and the value is the list of all files that have that hash. Then, when all files are processed, for every key in the map, create a directory and copy or move there all the related files.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21456734

http://stackoverflow.com/comment/32426368
comment on: http://stackoverflow.com/q/21483556
type: Comment
has text: Please post your logcat output with stacktrace.
type: QuestionComment
score: 0

http://stackoverflow.com/a/33625089
score: 4
type: Answer
has body: Accepted response from @sleske, didn't work for me out of the box as I'm using com.sun.jersey.api.client.Client and com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider. What actually worked for me is this , ClientConfig config = new DefaultClientConfig(); JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); config.getSingletons().add(jacksonJsonProvider); Client client = Client.create(config); Cheers!
upvote count: 4
answers question: http://stackoverflow.com/q/21462425
downvote count: 0

http://stackoverflow.com/comment/32277851
has text: LOL I didn't notice we can use `+`.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21399192
type: AnswerComment

http://stackoverflow.com/comment/32281652
type: Comment
comment on: http://stackoverflow.com/a/21401387
has text: What if he doesnt write sc.close(). Why dont we get an exception that the resource is open?. If we are not able to execute sc.close() ,why is it not the same as as not having sc.close() in the code ?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21355945
answer count: 3
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/21501640
linked to: http://stackoverflow.com/q/18647666
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43787624
tagged with: spring
has answer: http://stackoverflow.com/a/43193426
has comment: http://stackoverflow.com/comment/32200202
downvote count: 0
tagged with: java
score: 7
has title: NameNotFoundException: While trying to lookup 'jdbc' only when publishing from Eclipse Kepler but not Indigo
tagged with: eclipse
type: Question
tagged with: weblogic12c
has body: I'm able to publish my web-app to an Oracle Weblogic 12c (12.1.1) AdminServer from Eclipse Indigo 3.7.2 with oepe 12.1.1.1.1 However, the exact same web-app imported into Eclipse Kepler 4.3.1 with oepe 12.1.2.2 fails to publish with the following (fairly well trodden) exception and I'm trying to work out why?... NameNotFoundException: While trying to lookup 'jdbc.oraclexe' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/oraclexe']; Link Remaining Name: 'jdbc/oraclexe' The Weblogic 12c data source is definitely available and I have to assume its configured correctly as the application deploys and runs with no problems when published from Indigo. I'm also assuming the mappings in applicationContext.xml, web.xml and weblogic.xml are corrects as again there are no problems when published from Indigo. The mappings are as follows... src\main\webapp\WEB-INF\spring\applicationContext.xml <property name="jndiName" value="java:comp/env/jdbc/oraclexe" /> src\main\webapp\WEB-INF\web.xml Oracle Weblogic Connection Pool (oraclexe) jdbc/oraclexe javax.sql.DataSource Container jdbc/oraclexe build\weboutput\WEB-INF\weblogic.xml jdbc/oraclexe oraclexe I am wondering if the weblogic.xml isn't being made available during deployment (i.e its not being copied to the src\main\webapp\WEB-INF folder) rather than a problem with the mappings between jndiName/resource-ref/res-ref-name themselves? I've tried putting weblogic.xml directly in the src\main\webapp\WEB-INF folder but I get the same exception. My only other thought is that Indigo oepe 12.1.1.1.1 is happy publishing to Weblogic 12.1.1 but Kepler oepe 12.1.2 isn't and I should be publishing to a Weblogic 12.1.2 server?

http://stackoverflow.com/a/21436468
answers question: http://stackoverflow.com/q/21436212
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: Forcibly killing the application, i.e. not gracefully, so the JVM doesn't know that the application is exiting, therefore the shutdown hooks are not invoked. Unfortunately, there is no way (in Windows, at least) to provide a mechanism that ensures that the hook is always invoked. It's just something that may be invoked, but there is no guarantee.
type: Answer
accepted answer of: http://stackoverflow.com/q/21436212

http://stackoverflow.com/q/21351000
tagged with: java
has answer: http://stackoverflow.com/a/21351039
tagged with: database
type: UnansweredQuestion
tagged with: javabeans
has title: JDBC beans configuration
has body: I was following the tutorial from http://www.mkyong.com/spring/maven-spring-jdbc-example/ I have not worked with beans before and one thing from this tutorial puzzled me <property name="dataSource" ref="dataSource" /> This is a bean file which contains a bean which sets the dataSource variable from JDBCCustomerDao to be dataSource which is yet another bean contained in this file: <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/mkyongjava" /> <property name="username" value="root" /> <property name="password" value="password" /> I understand so far that the dataSource variable from JdbcCustomerDao is set to have the properties <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/mkyongjava" /> <property name="username" value="root" /> <property name="password" value="password" /> However I'm not sure what the url points to. Is is the url where my database can be found? Is it the directory which I can create dbs in? Probably this question has a pretty simple answer but I'm not that sure and google searches didn't really help. Thank you
tagged with: jdbc
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/21490844
score: 0
has comment: http://stackoverflow.com/comment/32469636
has body: You can specify an instance of ValidationEventHandler on the Unmarshaller and return false on the handleEvent method to make JAXB fail on the invalid value.
type: Answer
answers question: http://stackoverflow.com/q/21490230

http://stackoverflow.com/a/21428824
upvote count: 1
has comment: http://stackoverflow.com/comment/32331514
has body: I guess you are trying something like: File fil = new File("Example.xlsx"); fil.createNewFile(); Well, it this is your case you're creating a file with xlsx extension, but it's not truly a Excel file (it's empty). If you try to create a new file using Excel or File Explorer, you can see that a new fresh xlsx file weight about 10kb. If you need to create a Excel file you need to use Apache POI, or another library. You need to add a sheet at least: XSSFWorkbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet(); FileOutputStream fileOut = new FileOutputStream("Example.xlsx"); wb.write(fileOut); fileOut.close(); PS: I use poi-ooxml, since you use a xlsx file. Hope it helps.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21427588
score: 1

http://stackoverflow.com/q/21465110
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32394666
upvote count: 1
has body: I want to develop a software for a book rental store which is to have the following specifications: The store has a large collection of books. A person can become a member by depositing a certain amount and filling up his details. At any point, a member can cancel his membership and take back his deposit, if he has no dues out-standing against him. Whenever the store purchases a new item, its details such as date of procurement, price and daily rental charge are entered. After passage of a year, the daily rental charge is automatically halved. A member can rent at most 2 books at a time. The details are entered by a store clerk and a receipt indicating the daily rental charge is printed. Whenever a member returns his rented item, the amount to be paid is displayed. After the amount is paid, the items are marked returned. I am a beginner in Java and have no prior experience of such Database Management. What would be the best way to make such a software in Java? A detailed approach will be helpful. Edit: I am comfortable with working with IDEs such as Eclipse &amp; Netbeans and have reasonable experience in basic Java programming. However I have no clue regarding which API/plug-in/etc. to go after for the above mentioned application. So, what precisely I am looking after is how to get started with developing this software.
downvote count: 1
has comment: http://stackoverflow.com/comment/32395231
tagged with: java
has comment: http://stackoverflow.com/comment/32394696
type: Question
has answer: http://stackoverflow.com/a/21465720
tagged with: database
has title: Building Software for handling Database in Java
score: 0
answer count: 1

http://stackoverflow.com/a/21416480
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21415861
has comment: http://stackoverflow.com/comment/32311185
answers question: http://stackoverflow.com/q/21415861
has body: The behavior depends on java Version. Starting from java 7u51 both jws and applet need to be signed with a valid certificate (not self signed). http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html#newft There are only two security levels sandbox and all-permissions. The attribute permissions must be specified in the manifest and in the jnlp file. To perform http request sandbox is enough. Read this article http://docs.oracle.com/javase/tutorial/deployment/applet/security.html
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32308938

http://stackoverflow.com/q/21376891
tagged with: jsf
has comment: http://stackoverflow.com/comment/32238274
has comment: http://stackoverflow.com/comment/32239870
accepted answer: http://stackoverflow.com/a/21376998
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: jpa
has title: JPA entity persistent field not fetched when listing
has answer: http://stackoverflow.com/a/21376998
possible better answer: http://stackoverflow.com/a/21377029
has answer: http://stackoverflow.com/a/21377029
has body: I am building a JSF CRUD web application using JPA. I want to list all entities of typ Supplier I can fetch from the db. But one of the fields (articleList) in Supplier are not neccessary when creating a list view and will consume alot of time if it is fetched when listing all content of Supplier. Is there a way to supress this in this instance, but have that field information fetched when looking at the detail information of Supplier. This is Supplier: @Entity @Table(name = "supplier") @NamedQueries({ @NamedQuery(name = "Supplier.findAll", query = "SELECT s FROM Supplier s"), @NamedQuery(name = "Supplier.findBySid", query = "SELECT s FROM Supplier s WHERE s.sid = :sid")}) public class Supplier implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "SID") private Short sid; @Basic(optional = false) @NotNull @Size(min = 1, max = 255) @Column(name = "Supplier") private String supplier; @OneToMany(cascade = {CascadeType.MERGE,CascadeType.REMOVE,CascadeType.REFRESH}, mappedBy = "supplierSID") private List&lt;Article&gt; articleList; I don't wan't articleList to be filled in from the database when performing the findAll query. Can I control this somehow?
has comment: http://stackoverflow.com/comment/32240865

http://stackoverflow.com/a/21507347
has body: When talking about OOP, trying to discern what the concrete subclass actually is generally means you're doing something wrong. You could approach this issue by defining a default pullSled() in your Dog class, then overriding it: public class Dog { private final String breed; public Dog(String b) { breed = b; } public boolean pullSled() { System.out.println("Dude, I'm a " + breed + ", not a Siberian Husky!"); return false; } //More Dog methods (bark, eat, etc.) } public class SledDog extends Dog { public SledDog(String b) { super(b); } @Override public boolean pullSled() { System.out.println("pulling the sled"); return true; } } Another option over this simple example, you could also define a field and boolean canPullSled(): public class Dog { private final String breed; protected boolean canPullSled; public Dog(String b) { breed = b; } public boolean canPullSled() { return canPullSled; } public boolean pullSled() { if (canPullSled) { System.out.println("pulling the sled"); return true; } else { System.out.println("Dude, I'm a " + breed + ", not a Siberian Husky!"); return false; } } // other stuff } public class SledDog extends Dog { public SledDog(String b) { super(b); this.canPullSled = true; } } Or use a Builder ... or a fluent interface ... or ... In the end, instanceof is really a last resort, used only when nothing else will do.
answers question: http://stackoverflow.com/q/21507247
score: 2
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/q/21412838
favorite count: 0
has answer: http://stackoverflow.com/a/21412988
possible better answer: http://stackoverflow.com/a/21412951
has title: My JButtons don't work when pressed
has answer: http://stackoverflow.com/a/21412951
has body: I have some JButtons that I set up action listeners for but they still don't work when they are pressed. I want them to call methods when pressed. Some of them are unimplemented (aren't supposed to do anything when pressed) but I'm talking about the ones that are in the if statement not working. Please help! Here is my code: package com.robot; import java.awt.AWTException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; public class GUI extends JFrame implements Runnable { //defines the panels JPanel mainPanel; JPanel labelPanel; JPanel buttonPanel1; JPanel buttonPanel2; JPanel consolePanel; //defines the label JLabel title; //defines the buttons JButton runDemo; JButton runLive; JButton scan; JButton findPatterns; JButton cleanFolder; JButton configureSettings; //defines the console JTextArea console; //defines the line break String newline = System.getProperty("line.separator"); //start of the constructor method for GUI public GUI() { //makes the program unable to be resized this.setResizable(false); //allows the user to close the program with the x button this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //sets the title of the program this.setTitle("ROBOT Alpha Alfred Version 3.0"); //creates panels to hold the elements of the GUI mainPanel = new JPanel(); labelPanel = new JPanel(); buttonPanel1 = new JPanel(); buttonPanel2 = new JPanel(); consolePanel = new JPanel(); //creates label title = new JLabel("Robotically Operated Binary Options Trader"); //creates buttons runDemo = new JButton("Run Demo"); runLive = new JButton("Run Live"); scan = new JButton("Scan Market"); findPatterns = new JButton("Find Patterns"); cleanFolder = new JButton("Clean Up Folder"); configureSettings = new JButton("Configure…
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21413961
tagged with: java
upvote count: 1
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/21412959
tagged with: user-interface
downvote count: 0
tagged with: button
score: 1
accepted answer: http://stackoverflow.com/a/21412959

http://stackoverflow.com/comment/32371598
type: Comment
has text: How do you experience the fact that it isn't `@Transactional`?
score: 2
comment on: http://stackoverflow.com/q/21452039
type: QuestionComment

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/21413978
tag name: csv
tags question: http://stackoverflow.com/q/21420717
tags question: http://stackoverflow.com/q/21378773
tags question: http://stackoverflow.com/q/21450329
tags question: http://stackoverflow.com/q/21397090
tags question: http://stackoverflow.com/q/21359403
tags question: http://stackoverflow.com/q/21506408
tags question: http://stackoverflow.com/q/21483563
tags question: http://stackoverflow.com/q/21509165

http://stackoverflow.com/q/21495604
downvote count: 3
upvote count: 1
type: Question
score: -2
accepted answer: http://stackoverflow.com/a/21496162
has body: I'm using this code into a switch case. When I start the new activity I want to see a transition animation case 0: intent = new Intent(getApplicationContext(), MyActivity.class); startActivity(intent); overridePendingTransition(R.anim.animation, R.anim.yea); break; Don't work. I don't see animation. With this code works (not in switch case) startActivity(intent); overridePendingTransition(R.anim.animation, R.anim.yea);
has comment: http://stackoverflow.com/comment/32448703
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: android
has title: overridePendingTransition does not work in switch case
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21496162
tagged with: java

atomicinteger
tag name: atomicinteger
tags question: http://stackoverflow.com/q/21354409
type: Tag

http://stackoverflow.com/comment/32303650
type: QuestionComment
has text: Read the documentation on ByteBuffer. Your crash is likely something trivial and unrelated to this functional challenge, such as a naming problem or even a build problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21413158

http://stackoverflow.com/q/21396694
tagged with: google-plus
tagged with: android-activity
favorite count: 0
tagged with: sdk
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35770244
has title: How Can I Let Users +1 a Google Plus Page and log them out immediately?
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35728223
has body: I am attempting to integrate Google+ in my android app but I am stuck. Here is what I have so far: public class GooglePlusActivity extends Activity implements View.OnClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, PlusOneButton.OnPlusOneClickListener { private static final String TAG = "GooglePlusActivity"; private static final int REQUEST_CODE_RESOLVE_ERR = 9000; private ProgressDialog mConnectionProgressDialog; private PlusClient mPlusClient; private PlusOneButton mPlusOneButton; public ConnectionResult mConnectionResult; private static final int PLUS_ONE_REQUEST_CODE = 0; public static String accessToken; public static String email; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.google_plus); Log.d(TAG, "Access token retrieved:" + accessToken); mPlusClient = new PlusClient.Builder(this, this, this) .setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity") .setScopes(Scopes.PLUS_LOGIN) // recommended login scope for social features // .setScopes("profile") // alternative basic login scope .build(); // Progress bar to be displayed if the connection failure is not resolved. mConnectionProgressDialog = new ProgressDialog(this); mConnectionProgressDialog.setMessage("Signing in..."); TextView gplus_header = (TextView)findViewById(R.id.ft_header); gplus_header.setText(Html.fromHtml(getString(R.string.ft_main_header))); mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button); mPlusOneButton.setOnClickListener(this); mPlusOneButton.setSize(600); WebView gplus = (WebView)findViewById(R.id.gplus_zoom); gplus.getSettings().setDisplayZoomControls(true); gplus.setInitialScale(500); gplus.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE); gplus.zoomIn(); gplus.getSettings().setUseWideViewPort(true); } @Override public void onPlusOneClick(Intent intent){ if(!mPlusClient.isConnected()) { mPlusClient.c…
has comment: http://stackoverflow.com/comment/35746956
has comment: http://stackoverflow.com/comment/35792460
downvote count: 0

http://stackoverflow.com/q/21446445
has answer: http://stackoverflow.com/a/21446715
score: -1
has body: I am working on a game which has multiplayer(on same device) and I need to have a split screen for player 1 and 2. Player one will be on bottom while player 2 is on top. And player 2's side should be flipped so that both players and screens are facing each other. I have both layouts set but I don't know how to get the top side flipped. I used two LinearLayouts which are are wrapped with a RelativeLayout.
accepted answer: http://stackoverflow.com/a/21446715
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32361693
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32361733
tagged with: java
downvote count: 1
type: Question
has title: how to make a split screen in android application?
upvote count: 0
tagged with: layout

http://stackoverflow.com/comment/63923936
score: 0
type: Comment
has text: I tried your code but it does not work for me. How do you do the ajax-call? I just did `$.get( "SERVLETNAME", { parameters }, function( ) {});`
type: AnswerComment
comment on: http://stackoverflow.com/a/21400955

http://stackoverflow.com/a/21392936
has body: The only return you have is right after the recursive call. That means your current program will never break out of the recursion. You need to check for a "done" condition and return if "done" is true. Or, have recursiveLoop(i, j, k, l); be under the if statement.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21392829

http://stackoverflow.com/comment/71284397
type: AnswerComment
has text: This will help you https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
type: Comment
comment on: http://stackoverflow.com/a/21887612
score: 0

http://stackoverflow.com/q/21436517
has answer: http://stackoverflow.com/a/21436594
has answer: http://stackoverflow.com/a/21436643
type: Question
has body: I'm trying to replace all special characters with a "%", like: "123.456/789" -&gt; "123%465%798" my regular expression is: [^a-zA-Z0-9]+ In online tools* it works perfecly, but in java s.replaceAll("[^a-zA-Z0-9]+", "%"); strings remain untouched. *I tried: http://www.regexplanet.com/ http://regex101.com/ and others
linked to: http://stackoverflow.com/q/12734721
tagged with: special-characters
has answer: http://stackoverflow.com/a/21436614
has title: Java replaceAll() regex does not work
upvote count: 3
has comment: http://stackoverflow.com/comment/32343163
favorite count: 0
has answer: http://stackoverflow.com/a/21436573
accepted answer: http://stackoverflow.com/a/21436573
tagged with: regex
answer count: 4
possible better answer: http://stackoverflow.com/a/21436614
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32343046
score: 3
duplicate of: http://stackoverflow.com/q/12734721
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/32435948
comment on: http://stackoverflow.com/a/21487903
type: AnswerComment
has text: @skiwi what did you put as a comparator function to the priority queue?
score: 0
type: Comment

http://stackoverflow.com/q/21487575
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32433826
has answer: http://stackoverflow.com/a/21487891
tagged with: java
has comment: http://stackoverflow.com/comment/32434367
has body: I am working on a project in which I will be having a Map of String and Object coming to my below method. And suppose if this data Map contains like this - a = p b = q c = r d = s e = t f = u g = v h = w i = x where a, b, c, d, e, f, g is the key and p, q, r, s, t, u, v are there corresponding values in the above map. Below is my method - private void dataCheck(Map&lt;String, Object&gt; data) { } Now I have another static mapping like this in an another map which is of String and String - public static final Map&lt;String, String&gt; STATIC_MAPPING = Collections.unmodifiableMap(new LinkedHashMap&lt;String, String&gt;() {{ put("a","hello"); put("b","world"); put("c","titan"); put("d","david"); put("e","elephant"); put("f","fire"); put("g","gel"); }}); here value of key a is hello, value of key b is world, value of key c is titan and same thing with other key value pairs. Now in the below method as I have mentioned above, I will be getting values in the Map which will contain the data as shown above - private void dataCheck(Map&lt;String, Object&gt; data) { // how to get extract the value of the key from the // STATIC_MAPPING map corresponding to data map key. // print out a new map here with latest mappings } Now as data map will have a = p, it will get replace with hello = p because a is mapped to hello as shown in the STATIC_MAPPING and same with other fields as well. How can I do this efficiently? And suppose if we don't have any mapping for the key in data map, then we will keep that as it is. UPDATE:- So my new map should have data like this - hello = p world = q titan = r david = s elephant = t fire = u gel = v h = w i = x As there was no mapping for key h and i so I will keep that as it is..
has comment: http://stackoverflow.com/comment/32433890
has comment: http://stackoverflow.com/comment/32434803
type: Question
has title: How to change the key of one map corresponding to a value in another map?
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/32433612
has comment: http://stackoverflow.com/comment/32433736
accepted answer: http://stackoverflow.com/a/21487891
tagged with: dictionary

http://stackoverflow.com/comment/32475410
score: 0
type: Comment
has text: Well I did find the need to address your comments, so that's why I did it. If you hadn't responded in a way that suggested that you didn't "get it", then I wouldn't have felt the need to explain it ... again.
comment on: http://stackoverflow.com/a/21510457
type: AnswerComment

http://stackoverflow.com/comment/32263461
has text: Thanks for your answer. Is there any other way? My professor hasn't been over BigDecimal yet. This project should not cover BigDecimal, any other suggestion.
comment on: http://stackoverflow.com/a/21390873
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32396219
type: Comment
comment on: http://stackoverflow.com/a/21465953
type: AnswerComment
has text: Thx for the reply.. The problem I'm getting with this is that when you have no elements then: first == null. Hence node == null. In the while loop when executing isHealthy without any elements the node.next statement brings upp the java.lang.NullPointerException: null error
score: 0

http://stackoverflow.com/comment/32366116
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21448781
has text: yes sir its working when i change Security levels in the Java Control Panel but i don't want to change my Security manually
type: Comment

http://stackoverflow.com/q/21375118
has title: Cassandra : How to send multiple write/read requests in a single client request?
tagged with: java
type: Question
tagged with: pipeline
has body: I am working on an application, where I need to send multiple requests to the cassandra server. The individual requests are kind of a write/read requests, with short interval of execution. I am observing a major bottleneck in round trip time. Can I pipeline the requests to the cassandra to avoid RTT, just like pipelining in Redis.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cassandra
score: 2
has answer: http://stackoverflow.com/a/21386230
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/21436068
downvote count: 3
has title: Arrays shown in output after user input
type: AnsweredQuestion
tagged with: project
accepted answer: http://stackoverflow.com/a/21436233
tagged with: java
has body: I can't seem to have my array to appear in the output here is my coding. Is there a problem? I want my 'Jan' array to appear in my menu for example: "Jan Expenditure" however only "expenditure is appearing. And now i have a syntax error on String monthChoice. Please help me out. Thank you! import java.util.Scanner; public class Project { static String[] itemList = new String[10]; static int[] amountList = new int[10]; static int choice; public static void main(String[] args) { { Scanner input = new Scanner(System.in); System.out.println("***************Expenditure***************"); System.out.println("1)Enter monthly expenses"); System.out.println("2)Display detailed expenditure by month"); System.out.println("3)Quick glance at monthly expenses"); System.out.println("4)Exit"); System.out.println("Please select your choice &lt;1-3&gt;:"); choice = input.nextInt(); switch (choice) { case 1: int count = 0; String[] monthsArray = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }; System.out.println("*******************************************"); System.out.println("\t\t\t\t"); System.out.print("Enter month &lt;1 for Jan - 12 for Dec&gt;:"); int month = input.nextInt(); for (int i=0; i &lt; monthsArray.length; i++) String monthChoice = monthsArray[month - 1]; System.out.println("-------------------------------------"); System.out.println(monthChoice + "expenditure (max 10 items)");
score: -3
has comment: http://stackoverflow.com/comment/32342517
type: Question
upvote count: 0
answer count: 1
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/32342361
favorite count: 0
linked to: http://stackoverflow.com/q/21434924
has answer: http://stackoverflow.com/a/21436233
duplicate of: http://stackoverflow.com/q/21434924

http://stackoverflow.com/q/21413442
has answer: http://stackoverflow.com/a/21413507
type: AnsweredQuestion
tagged with: linked-list
type: Question
possible better answer: http://stackoverflow.com/a/21413648
has body: I see 2 youtube videos showing an add at end method as such public void insertFirstLink(String bookName, int millionsSold) { Link newLink = new Link(bookName, millionsSold); newLink.next = firstLink; firstLink = newLink; } This looks nice and clean, but I went through another tutorial that does this public void insert(int x) { if (head == null) { head = new Node(x, head); } else { Node current = head; while (current.getNext() != null) { current = current.getNext(); } Node newNode = new Node(x, null); current.setNext(newNode); } } why would I ever use the 2nd one since its longer and traverses the list just to add to the end. I am new to linked lists and am confused as to why so many people write it differently, every tutorial I saw was using a different technique. I am mainly studying this to be able to answer interview questions so I need to understand all possibilities. I am also unclear on what the 'head/current/first' node is. In a tutorial he mentioned that head is the first node added, and becomes the next added node, so eventually the 'head' node is the last node right? when he printed his list it was in reverse.
tagged with: java
has answer: http://stackoverflow.com/a/21413648
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21413507
has comment: http://stackoverflow.com/comment/32302848
has title: which way is better to write add method on a singly linked list

http://stackoverflow.com/q/21486131
tagged with: interface
type: UnansweredQuestion
downvote count: 1
has title: Interfaces: Java Language Specification
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21486282
tagged with: java
score: -1
has body: Please explain: 3rd bullet point 5th line (in bold) 2nd last line
tagged with: class
upvote count: 0
answer count: 1
favorite count: 0
tagged with: abstract

http://stackoverflow.com/comment/32371795
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21398383
has text: Do you have `Caused by: java.lang.NoSuchMethodException` in full stack trace?

http://stackoverflow.com/a/21487023
type: Answer
answers question: http://stackoverflow.com/q/21486707
score: 1
has body: We have this same problem.... 72 projects in our workspace normally makes using m2e impossible. We're trying to not use m2e and start maven executable as an external tool with some configurations. And you can make maven generate your .project and .classpath to change the eclipse configurations: mvn eclipse:eclipse Not the best option, but is what we have now.
upvote count: 1
has comment: http://stackoverflow.com/comment/32511190
has comment: http://stackoverflow.com/comment/49843947
has comment: http://stackoverflow.com/comment/34014375
downvote count: 0
has comment: http://stackoverflow.com/comment/32433198

http://stackoverflow.com/a/21464259
score: 0
answers question: http://stackoverflow.com/q/21463867
has body: There can be two things: ammount variable that you used either it could be a string array that you are maintaining strings inside it, if this is the case than you have to loop first through array of strings and then maintain one nested loop to check that strings inside it are palindrom or not or second case is that you have used the variable incorrect it may be text instead of ammount
type: Answer

http://stackoverflow.com/comment/32228582
type: Comment
has text: Unless you want to put this Set into another HasSet or HashMap, you won't need to override hashCode.
comment on: http://stackoverflow.com/q/21371626
type: QuestionComment
score: 0

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/21372111

http://stackoverflow.com/comment/32428689
type: Comment
score: 0
type: AnswerComment
has text: @Pshemo That is why you are not a real programmer in your professors eyes, that's all. Using a library for this is definitely the sanest suggestion.
comment on: http://stackoverflow.com/a/21484482

http://stackoverflow.com/comment/32200845
comment on: http://stackoverflow.com/a/21355680
type: AnswerComment
has text: Ok great. But I want to reset listView by executing listView.clearChoices() however I'm doing it from another Fragment. If the one with listView is not visible then (or more previsely View hierarchy doesn't exist) then clearChoices seems not to work. Thus I have to check if my Fragment has the Viev hierarchy attached or no? How to do that please?
score: 0
type: Comment

http://stackoverflow.com/q/21443191
type: AnsweredQuestion
score: 3
tagged with: pointcut
has title: Binding annotation objects to advice body
upvote count: 3
tagged with: java
type: Question
has body: I was able to get the @annotation pointcut work for my basic needs. @Pointcut ("@annotation(path.to.my.CustomAnnotation)") public void actionAnnotatedPointCut() {} But when I try to bind it to the advice body like below, I get the IllegalArgumentException. @Pointcut ("@annotation(customAnnotation)") public void actionAnnotatedPointCut(CustomAnnotation customAnnotation) {} Exception: Caused by: java.lang.IllegalArgumentException: error at ::0 incompatible number of arguments to pointcut, expected 1 found 0 Full trace: Jan 29, 2014 9:45:29 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Jan 29, 2014 9:45:29 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 incompatible number of arguments to pointcut, expected 1 found 0 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSin…
accepted answer: http://stackoverflow.com/a/21444172
tagged with: spring-aop
tagged with: aspectj
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32356225
tagged with: spring
has answer: http://stackoverflow.com/a/21444172

http://stackoverflow.com/comment/32206226
type: Comment
comment on: http://stackoverflow.com/a/21359000
type: AnswerComment
has text: They don't have anything in common. I added more information to my question.
score: 0

http://stackoverflow.com/q/21433706
accepted answer: http://stackoverflow.com/a/21433752
score: 0
tagged with: oracle-database
has title: Run Oracle import Command from Java and see Console output
tagged with: imp
has answer: http://stackoverflow.com/a/21433752
possible better answer: http://stackoverflow.com/a/21433785
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21433785
tagged with: java
has body: I am running an Oracle database Command for a .dmp file like this: String impcmd = "imp askul/askul@askdb file=mydumpfile.dmp log=mylogfile.log fromuser=askul touser=askul full=N ignore=Y grants=Y indexes=Y"; Process p = Runtime.getRuntime().exec(impcmd); p.waitFor(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = br.readLine(); while(line != null){ System.out.println(line); line = br.readLine(); } The database import is Happening Fine on the Background, but I want to be Able to see the console output as the Import goes on as I now have to guess whether it is complete or not. What Am I missing here?
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/882772

http://stackoverflow.com/a/21500450
accepted answer of: http://stackoverflow.com/q/21496278
type: Answer
has body: I repeated here the comment so you can mark your question as solved by this answer :D If you are talking about your jsp getting parameter "name"... it's simply because you have put the request directly in the url (NewFile.jsp?name=xuser). If not, I didn't understand your question, please try to be clearer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21496278
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32294724
type: Comment
comment on: http://stackoverflow.com/a/21378138
has text: No, there isn't. The developer should digitally sign the code using a valid certificate. And spell out all 5 letters of words like 'there', typing 'thr' makes you sound like a *lazy* teenager.
score: 5
type: AnswerComment

http://stackoverflow.com/comment/32450930
comment on: http://stackoverflow.com/q/21496836
type: QuestionComment
score: 0
has text: The user might be null. The user name might be null. The user name might be an empty or blank string. Check its value in the controller.
type: Comment

http://stackoverflow.com/comment/32334035
score: 0
comment on: http://stackoverflow.com/q/21431300
type: Comment
has text: What exactly you want to do in the back end with the passed list? Can you be clear in your question. Apart from that you can use binding attribute of the datatable binded to a backend bean property
type: QuestionComment

http://stackoverflow.com/comment/32351781
has text: That corresponds with my question assuming JIT choosing between branch and conditional move based on profiling (which is very good) but grossly underestimating the cost of branching (which is pretty bad). In the comment you kindly pointed me to, `-O3` leads to conditional move, while `-O2` leads to branching. Not sure if such an behavior makes sense.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21434257
type: AnswerComment

http://stackoverflow.com/q/21452065
tagged with: hashmap
upvote count: 0
score: -1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32371520
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21452265
has title: HashMap<String, Set<String>> cant find its key even though it exists
tagged with: java
has body: I have a HashMap of this type Map&lt;String, Set&lt;String&gt;&gt; list_names = new HashMap&lt;String,Set&lt;String&gt;&gt;(); that I have constructed and added its elements from a txt file that has a list's name and a set of names in it. 98298XSD98 N9823923 N123781 N723872 .... 13214FS923 N9818324 N982389 ... ... I made another HashMap, called names_list that pretty much replaces the order of the list_names HashMap such that I can get all the lists that a given name is in. now the HashMap I have is pretty big, and there are over 400k items and 60k lists. somewhere in my code im trying to get the Set of different lists many many times and then getting the intersection of these two lists for computational purposes, a_list = this.names_lists.get(a); b_list = this.names_lists.get(b); // printing lists //intersection stuff but whats weird is the HashMap didn't recognizance one of its keys(or maybe many of its keys) and treated it as null after one retrieval or sometimes 0 retrievals. a:0122211029:[R3DDZP35ERRSA] b:1159829805:[R3ALX1GRMY5IMX, R1204YEYK4MBCA] a:0122211029:[] b:1593072570:[R222JSDL42MS64] here, im just printing the name and names_list.get(key).toString(); and yes i'm printing these before doing any intersection stuff. any idea why is it doing that?
downvote count: 1
type: Question

http://stackoverflow.com/comment/32342957
comment on: http://stackoverflow.com/q/21435879
score: 1
type: Comment
type: QuestionComment
has text: your custom ViewGroup has two children: two FrameLayouts, you can posirion them in onLayout method by calling layout(l, t, r, b)

http://stackoverflow.com/comment/32340438
type: QuestionComment
has text: @Teeg I already started on this project there are just some parts i cant seem to figured out. Look I just started learning programming & could really use some help. if you don't wanna help thats alright. Thanks.
score: 0
comment on: http://stackoverflow.com/q/21434924
type: Comment

http://stackoverflow.com/a/21595344
score: 0
type: Answer
has body: It is a race condition between initialized process by Jboss messaging and process by Web application. This program is getting executed during service startup. It is working fine now after thread sleep of 1sec. Before Change TopicConnectionFactory _factory = (TopicConnectionFactory)context.lookup("java:JmsXA"); TopicConnection _connection = _factory.createTopicConnection(); TopicSession _session = _connection.createTopicSession(false, 1); //This is the place where it hanged. Topic _topic = (Topic)context.lookup(s); TopicPublisher _publisher = _session.createPublisher(_topic); _connection.start(); After Change TopicConnectionFactory _factory = (TopicConnectionFactory)context.lookup("java:JmsXA"); TopicConnection _connection = _factory.createTopicConnection(); Thread.sleep(1000); //After introducing this line, it is working fine. TopicSession _session = _connection.createTopicSession(false, 1); Topic _topic = (Topic)context.lookup(s); TopicPublisher _publisher = _session.createPublisher(_topic); _connection.start();
accepted answer of: http://stackoverflow.com/q/21477139
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21477139

http://stackoverflow.com/comment/32199115
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21355422
score: 1
has text: Your code doesn't make much sense. Why do you have a do/while loop when you can just set `paddleLocation = 20`? It does the same thing. Same with the one below it. What is `edgeCheck()` supposed to do? It only returns true if it's on the right edge...

http://stackoverflow.com/q/21353806
type: UnansweredQuestion
tagged with: overlay
has title: Draw rectangle on google map
tagged with: java
type: Question
tagged with: touch
linked to: http://stackoverflow.com/q/13722869
has body: I am extend a SupportMapFragment which contain google map here, I lay my google map on a frameLayout according to How to handle onTouch event for map in Google Map API v2?. Ondraw()method is called , but the problem is rectangle is never been showed, even when I use setWillNotDraw(false); here. I already got the right position of the rectangle, the only problem is it is not showed. Following is my most part of code: Add-on:When I remove the google map it works as I expect, actually the rectangle drawed on the background frameLayout, so it will be covered by the map, now the way I solve the question is add a image view as a rectangle and dynamic change its size when touch moving. I have no idea how to draw directly on the top of this viewgroup(framelayout) at the moment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); //stash reference to google map mGoogleMap = getMap(); //show the location mGoogleMap.setMyLocationEnabled(true); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(view); return mTouchView; } private class TouchableWrapper extends FrameLayout { //box is used to illustrate the drawing box, the painter is used to set the color of the box. private Box mCurrentBox = null; private Paint mBoxPaint; public TouchableWrapper(Context context) { super(context); mBoxPaint = new Paint(); mBoxPaint.setColor(0xffff0000); // mBoxPaint.setStrokeMiter(20); mBoxPaint.setStrokeWidth(8); this.setWillNotDraw(false); setWillNotDraw(false); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { // decide when the child should hold the motion event. return true; //always let the relative layout to hold the motion event. } @Override public boolean onTouchEvent(MotionEvent event) { PointF curr = new PointF(event.getX(), event.getY()); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mMapIsTouched = true; mCu…
has comment: http://stackoverflow.com/comment/32196156
score: 0
has answer: http://stackoverflow.com/a/21353912
tagged with: android
answer count: 1
tagged with: android-framelayout

http://stackoverflow.com/comment/32218016
type: Comment
type: QuestionComment
has text: @JBNizet so he should just put the file wherever the result of `new File(".").getAbsolutePath()` indicates, I guess?
comment on: http://stackoverflow.com/q/21365927
score: 0

http://stackoverflow.com/q/21510905
score: 0
has answer: http://stackoverflow.com/a/21510962
accepted answer: http://stackoverflow.com/a/21510962
has body: Using the MongoDB java driver I would like to get all unique values of a field called "category" where the field called "companyKey" has the value "XYZ". First question, is this possible? Second question, do you have any idea what the syntax would look like? I can't find any relevant docs ... pointers to docs would be equally helpful.
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: mongodb
answer count: 1
has title: MongoDB java driver: get all unique value of a field restricted by another field

http://stackoverflow.com/q/21491887
upvote count: 1
tagged with: android-intent
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32443251
has body: I have a FragmentActivity defined in my searchable.xml and AndroidManifest.xml as the go-to handler for any search queries. Here's what works: 1) The user clicks the search button, enters some text, and executes the search 2) My searchable Activity's onCreate(Bundle savedInstanceState) method is called (its launchMode is singleTop) 3) Calling getIntent() in the onCreate() method gives me a proper android.intent.action.SEARCH action, with the query! Here's what doesn't work: At the end of onCreate(), I want to update all my child fragment activities - the main searchable has 4 swipeable tabs at the top, to switch between 4 different ListView views based on category. The problem, is that onCreateView() is not called on my child Fragment views until after the onCreate() in my main activity is finished. So my ListView objects don't even exist yet! So, I need to either: 1) Cache the results of my handleIntent() method that does the querying and result-gathering, and access them in the Fragment when it finally loads, or: 2) Find some way to trigger these Fragment views to load in the parent Activity's onCreate() method so that I can actually provide them the data they should be displaying. Was I incorrect in assuming that these child Fragments would be ready to go at the end of the parent Activity's onCreate() method? Relevant code: public static class DummySectionFragment extends Fragment { ... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(LOG_TAG, "Creating view with section number: " + getArguments().getInt(ARG_SECTION_NUMBER)); ... } } And in my SearchActivity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); setTitle("Search Items"); // Here the pager and adapter are created - this is // boilerplate code created by the Android Eclipse plugin ... handleIntent(getIntent()); } Finally, the handleIntent() method…
downvote count: 0
favorite count: 0
has title: Android Intent provided to searchable Activity before Fragments are created?
tagged with: android
has comment: http://stackoverflow.com/comment/34646481
tagged with: android-activity
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32247765
score: 0
type: Comment
has text: No ... he is saying that packaging the images as part of your application (i.e. putting them in the JAR file!) is a bad idea. The problem is that your English is .... umm ... difficult to understand.
comment on: http://stackoverflow.com/a/21382293
type: AnswerComment

http://stackoverflow.com/comment/32479722
has text: Ok, I have about 4 JButtons in my GUI, to perform different commands. I want to create a case where if one of those four is clicked consecutively, an error pops up.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21513099

http://stackoverflow.com/q/21439776
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21439931
tagged with: java
tagged with: duplicates
type: Question
has body: I have an Entity user, and another Entity book, the user can have many books and the book can have many owner, so it is a manytomany relationship. and a middle table user_book was created with user_id, and book_id but now comes the problem, what happened if a user have 2 exactly same books, for example he bought the same book twice. then the primary key constraint was triggered and I can't persist the user any more. so what can I do with it? How can a user have 2 same books?
has answer: http://stackoverflow.com/a/21440197
tagged with: jpa
downvote count: 0
favorite count: 0
has title: jpa manytomany how to add duplicate item
answer count: 3
has answer: http://stackoverflow.com/a/21440130
score: 2

http://stackoverflow.com/comment/32336871
comment on: http://stackoverflow.com/q/21433143
score: 1
type: Comment
type: QuestionComment
has text: When talking about Java, we usually say *method*.

http://stackoverflow.com/a/21524217
has comment: http://stackoverflow.com/comment/32499834
type: Answer
accepted answer of: http://stackoverflow.com/q/21398631
has body: While I am not certain that this is the primary problem, I do find quite a bit of inefficiency in your code: you are creating a lot of transient objects with this for (byte i = 0; i &lt; demoRxMsg.dataLength; i++) { data = data + Integer.toHexString(demoRxMsg.data[i]) + " "; } For each byte you are creating at least two objects: one StringBuilder and one String object (ref here). If you want to get a String, at least make it like below: StringBuilder sb=new StringBuilder(); for (byte i = 0; i &lt; demoRxMsg.dataLength; i++) { sb.append(demoRxMsg.data[i]); } data=sb.toString(); Instead of comparing strings, it'll be much faster to compare raw bytes, this way you can skip any object creation altogether. I assuming between the first and last few blocks of data, there are quite a bit of data in between, but in your current implementation those data that do not affect UI will still be checked on the UI thread, instead only run mProgressBar.setProgress(progress); when you have determined that UI needs to be updated. Untested code: class RxThread extends Thread { private static final String TEST = "0 0 0 0 0 40 0 0 "; private static final String TEST2 = "0 1 0 0 0 41 0 0 "; private static final String TEST3 = "2 bb 0 0 2 fb 0 0 "; private static final String TEST4 = "2 bd 0 0 2 fd 0 0 "; private static final String TEST5 = "2 be 0 0 2 fe 0 0 "; Handler myHandler = new Handler(); public void run() { while (true) { try { Thread.sleep(60); demoRxMsg = new MessageStructure(); int progress = -1; while (rxChannel.receiveMessage(demoRxMsg) == ReturnCode.SUCCESS) { String data = ""; String format = ""; rxChannel.receiveMessage(demoRxMsg); if (demoRxMsg.frameFormat == API_ADK.STANDARD_FRAME) { format = "SFF"; } else { format = "EFF"; } for (byte i = 0; i &lt; demoRxMsg.dataLength; i++) { data = data + Integer.toHexString(demoRxMsg.data[i]) + " "; } if (data.equalsIgnoreCase(TEST)) { progress = 0; } else if (data.equalsIgnoreCase(TEST2)) { progress = 1; } else if (data.equalsIgnoreC…
has comment: http://stackoverflow.com/comment/32510093
has comment: http://stackoverflow.com/comment/32499918
answers question: http://stackoverflow.com/q/21398631
has comment: http://stackoverflow.com/comment/32500688
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32506835
has comment: http://stackoverflow.com/comment/32501538
has comment: http://stackoverflow.com/comment/32501240
has comment: http://stackoverflow.com/comment/32500044
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32507949
has comment: http://stackoverflow.com/comment/32500203

http://stackoverflow.com/q/21395520
has comment: http://stackoverflow.com/comment/32413260
type: Question
has comment: http://stackoverflow.com/comment/32272695
score: 0
has comment: http://stackoverflow.com/comment/32277235
answer count: 1
has body: When I load a texture using slick-util and render it using lwjgl's opengl, it is highly distorted unless the length and width of the texture are both powers of 2. Why is this?
has answer: http://stackoverflow.com/a/21398836
has title: Why does opengl only render correctly if texture sizes are powers of 2?
has comment: http://stackoverflow.com/comment/32273304
type: UnansweredQuestion
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/32272275
has comment: http://stackoverflow.com/comment/32272127
tagged with: opengl
tagged with: java
tagged with: slick2d

http://stackoverflow.com/a/21412732
has body: Do it in a static block in class Database static { } But this implies that Connections and Statement will be static and then shared by all instances of Database. Just as an example from another SO post: public static final Map&lt;String, String&gt; initials = new HashMap&lt;String, String&gt;(); static { initials.put("AEN", "Alfred E. Newman"); // etc. }
answers question: http://stackoverflow.com/q/21412438
type: Answer
score: 0

http://stackoverflow.com/comment/32200899
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21356410
score: 1
has text: The aim of a hash function is to uniformly distribute values between 0 and 2^32 - 1. Does your function do that?

http://stackoverflow.com/q/21487219
tagged with: scala
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58197933
has body: Using IntelliJ's 12 Ultimate, I'm running the following code in the Debugger: Java import play.api.libs.json.JsValue; public class Foo { ... public JsValue toJson() { ... } public class FooExample { ... Foo foo = new Foo(); System.out.println("...); //&lt;-- breakpoint At the breakpoint, I right-clicked my source code and picked "Evaluate Expression," typing in: foo.toJson(). But the following error showed up: No such instance method: play.api.libs.json.JsValue$class.com.foo.Foo.toJson () Am I doing something wrong? Foo#toJson calls Scala code, if that matters. EDIT I actually had the breakpoint after the instantiation of Foo. To those who downvoted it, I deserved it.
tagged with: java
has answer: http://stackoverflow.com/a/47943016
has answer: http://stackoverflow.com/a/21487275
type: Question
tagged with: intellij-idea
has title: IntelliJ - No such instance method
score: 4
answer count: 3
downvote count: 3
upvote count: 7
favorite count: 0

http://stackoverflow.com/a/21509718
upvote count: 1
has comment: http://stackoverflow.com/comment/32473643
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32473573
accepted answer of: http://stackoverflow.com/q/21509622
has body: You can't have dynamic variable names in Java. What you can do is use a Map, to associate a key (the player's name, for example), with a value (the player's password, for example): Map&lt;String, String&gt; passwordsByPlayer = new HashMap&lt;&gt;(); ... passwordsByPlayer.put(playerName, passwordField.getText());
answers question: http://stackoverflow.com/q/21509622
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/21456593
has answer: http://stackoverflow.com/a/21456869
accepted answer: http://stackoverflow.com/a/21456869
type: AnsweredQuestion
tagged with: java
type: Question
has title: 404 on 'j_spring_security_check'
score: 0
answer count: 1
tagged with: spring-security
has body: I think the best way to explain my problem is with a screenshot: imgbin.org/index.php?page=image&amp;id=16564 Basically I'm trying to follow this mkyong tutorial (http://www.mkyong.com/spring-security/spring-security-form-login-example/) for a school project. I get redirected to the login page, but when i try to login with any credentials, i get the action value printed on the url. Could it be a encoding related problem? Any idea how to solve it? Here's my controller, security.xml and web.xml. Thanks! spring-security.xml: pastebin.com/MS7VYSfs web.xml: pastebin.com/EpGPc40Q login.jsp: pastebin.com/8Q4hxdVs
tagged with: spring

http://stackoverflow.com/a/21370413
type: Answer
answers question: http://stackoverflow.com/q/21368244
has body: Consider using a JTable. It's designed to provide tabular data Picture from How to use Tables
score: 0

http://stackoverflow.com/comment/32229172
comment on: http://stackoverflow.com/q/21368895
score: 0
has text: 1) Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32298957
type: Comment
comment on: http://stackoverflow.com/a/21411245
type: AnswerComment
score: 0
has text: @RichardTingle That is good and is typically how you would do things. It saves time by not needing to allocate new stack space for each thread each time you need a new thread. However, the issue at this point isn't that. It's mostly because you're overly parallelizing a task which is fast on its own. Your data copy to prepare for concurrent processing may even be more expensive than just executing the task on a single thread, depending on the allocated size of your collection.

http://stackoverflow.com/a/21496467
has comment: http://stackoverflow.com/comment/32450957
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21495944
has body: Here i added the sample code for you. Please try and let me know. import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import android.util.Base64; public class EncodeDecodeAES { private final static String HEX = "0123456789ABCDEF"; private final static String key = "encryptionKey" private final static int JELLY_BEAN_4_2 = 17; private final static byte[] key = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; public static String encrypt(String cleartext) throws Exception { return encrypt(key,cleartext); } public static String decrypt(String cleartext) throws Exception { return decrypt(key,cleartext); } public static String encrypt(String seed, String cleartext) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = encrypt(rawKey, cleartext.getBytes()); String fromHex = toHex(result); String base64 = new String(Base64.encodeToString(fromHex.getBytes(), 0)); return base64; } public static String decrypt(String seed, String encrypted) throws Exception { byte[] seedByte = seed.getBytes(); System.arraycopy(seedByte, 0, key, 0, ((seedByte.length &lt; 16) ? seedByte.length : 16)); String base64 = new String(Base64.decode(encrypted, 0)); byte[] rawKey = getRawKey(seedByte); byte[] enc = toByte(base64); byte[] result = decrypt(rawKey, enc); return new String(result); } public static byte[] encryptBytes(String seed, byte[] cleartext) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = encrypt(rawKey, cleartext); return result; } public static byte[] decryptBytes(String seed, byte[] encrypted) throws Exception { byte[] rawKey = getRawKey(seed.getBytes()); byte[] result = decrypt(rawKey, encrypted); return result; } private static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); // , "SC"); SecureRandom sr = null; if (android.os.Build.VERSION.SDK_INT &gt;= JEL…
answers question: http://stackoverflow.com/q/21495944
type: Answer
has comment: http://stackoverflow.com/comment/32451115
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/32451019
has comment: http://stackoverflow.com/comment/32452646
has comment: http://stackoverflow.com/comment/32451814
score: -1
has comment: http://stackoverflow.com/comment/32451888

http://stackoverflow.com/comment/32358992
type: AnswerComment
score: 0
type: Comment
has text: I know, but right now, I'm the one who edited your post. You could have been the only author.
comment on: http://stackoverflow.com/a/21444893

http://stackoverflow.com/a/21537995
score: 1
has comment: http://stackoverflow.com/comment/32524113
type: Answer
accepted answer of: http://stackoverflow.com/q/21458965
answers question: http://stackoverflow.com/q/21458965
has body: here is the first prototype of the minimap, it will be enough for the first step of the game dev. public class Main { public static void main(String[] args) { LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "my-op0-game"; cfg.useGL20 = false; cfg.width = MyOp0Game.MY_APP_WINDOW_WIDTH; cfg.height = MyOp0Game.MY_APP_WINDOW_HEIGHT; new LwjglApplication(new MyOp0Game(), cfg); } } public class MyOp0Game extends Game { public static int MY_APP_WINDOW_WIDTH = 512; public static int MY_APP_WINDOW_HEIGHT = 512; public static int MY_WORLD_WIDTH = 2048; public static int MY_WORLD_HEIGHT = 2048; public static int MY_MINIMAP_WIDTH = 256; public static int MY_MINIMAP_HEIGHT = 256; public static int MY_MINIMAP_SCALE_FACTOR = MY_WORLD_WIDTH / MY_MINIMAP_WIDTH; public static int MY_ORIGINAL_CAMERA_POSITION_X = MY_APP_WINDOW_WIDTH/2; public static int MY_ORIGINAL_CAMERA_POSITION_Y = MY_APP_WINDOW_HEIGHT/2; public static final String LOG = "MyOp0Game"; MyScreen0 my_screen_0; @Override public void create() { // allocate screen my_screen_0 = new MyScreen0(this); // set current screen setScreen(my_screen_0); } @Override public void render() { super.render(); } } public class MyScreen0 implements Screen{ protected final Stage stage0; protected final MyOp0Game game; protected final MyActor0 actor0_0; protected final MyActor0 actor0_1; protected final MyActor1 actor1_0; public MyScreen0(MyOp0Game game) { // link screen to game this.game = game; // allocate stage; viewport size maps game window size this.stage0 = new Stage( Gdx.graphics.getWidth(),Gdx.graphics.getHeight(), true ); // allocate actor0_0 and add to stage this.actor0_0 = new MyActor0(); this.actor0_0.setPosition(0, 0); this.stage0.addActor(this.actor0_0); // allocate actor0_1 and add to stage, actor1 is placed next to actor0 this.actor0_1 = new MyActor0(); this.actor0_1.setPosition(512, 256); this.stage0.addActor(this.actor0_1); // allocate actor1_0 and add to stage this.actor1_0 = new MyActo…
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32365356
comment on: http://stackoverflow.com/a/21448381
type: AnswerComment
score: 0
type: Comment
has text: How would I go about rolling, then?

http://stackoverflow.com/comment/32417308
type: Comment
comment on: http://stackoverflow.com/a/21478166
has text: In my other tables in MySQL, its `TaskId`. We should map that right? And also it is working fine for me. Problem is with large volume of data only. If that's small t, I would get error for all requets
type: AnswerComment
score: 0

http://stackoverflow.com/a/21508107
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/32474323
downvote count: 0
answers question: http://stackoverflow.com/q/21508058
has comment: http://stackoverflow.com/comment/32474386
has body: ConcurrentModificationException basically means that you're iterating over a Collection with one iterator (albeit implicitly defined by your enhanced for loop) and invalidating it on the fly by changing the Collection itself. You can avoid this by doing the modifications via the sameiterator: List&lt;Integer&gt; collection = new ArrayList&lt;&gt;(); ListIterator&lt;Integer&gt; iter = collection.listIterator(); while (iter.hasNext()) { Integer currVal = iter.next(); if (someCondition) { iter.add(something); // Note the addition is done on iter break; } }
upvote count: 2

http://stackoverflow.com/a/21352705
downvote count: 0
upvote count: 2
has body: The URL scheme depends largely on what you need to do with your data model, e.g. how you want to query those ratings: if you only ever want to display a single user's ratings, put them under /users/:id/ratings if you want something like "10 top-rated users", consider something like GET /users?toprated -- here you're looking for users, so the URL should signify that by being /users if you want to get ratings across several users, e.g. to find all ratings containing the word "outstanding", /ratings/ makes more sense: The search is then naturally expressed as GET /ratings?q=outstanding -- here you want ratings so the URL should be /ratings plus a request parameter to restrict what kind of ratings you want In either case, unless you're building a huge, public API and expect lots of clients right on launch day, go with what works and change the URL scheme if you need to. As for the singular/plural debate: Use plural for path segments, i.e. /users, /ratings because it follows naturally from REST's building blocks of a "resource" and "collections of resources": There's the collection of users at /users (accepting GET, POST) and there's a single user at /users/:id (accepting GET, PUT, DELETE).
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21352392
has comment: http://stackoverflow.com/comment/32200625
answers question: http://stackoverflow.com/q/21352392
type: Answer
score: 2

http://stackoverflow.com/comment/32272742
comment on: http://stackoverflow.com/q/21374157
type: Comment
type: QuestionComment
has text: @AndrewThompson yes I understand. However any java based library you could suggest which could support playing and more importantly allow me to easily apply some framewise enhancement techniques to most known formats?
score: 0

http://stackoverflow.com/comment/32202418
has text: The instance, not really, but I can tell you it was a JTabbedPane
comment on: http://stackoverflow.com/q/21356691
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21460491
type: Question
accepted answer: http://stackoverflow.com/a/21460554
answer count: 1
downvote count: 0
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/21460554
has title: How field values are taken during deserialization in java?
has body: I tried to understand how de-serialization is done with the example: class A implements Serializable{ int x=3; long y=4; short z=5; } public class B extends A{ public B(){ x=7; } public String toString(){ return ""+x+""+y+""+z; } public static void main(String[] args) { B b=new B(); try{ FileOutputStream fos=new FileOutputStream("ser.ser"); ObjectOutputStream oos=new ObjectOutputStream(fos); oos.writeObject(b); oos.close(); System.out.println(b); FileInputStream fis=new FileInputStream("ser.ser"); ObjectInputStream ois=new ObjectInputStream(fis); b=(B)ois.readObject(); ois.close(); System.out.println(b); } catch(Exception e){ e.printStackTrace(); } } } It's produces 745 But when i implement serializable in B class the result is 345 i am not able to understand the difference serialization of of class B is making...
has comment: http://stackoverflow.com/comment/32385880
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32355607
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21443140
has text: You have to have access to your keystore file. See the answer that I've given before. And you should always use a proper keystore file that you generate for yourself, not the auto-generated one.

http://stackoverflow.com/comment/32284713
type: Comment
has text: A switch statement is like to be more efficient.
comment on: http://stackoverflow.com/a/21403141
type: AnswerComment
score: 0

http://stackoverflow.com/q/21495778
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/38014809
tagged with: java
has title: Use Fragments (ActionTabs) and Webview
type: Question
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/32448889
favorite count: 0
has body: I want to have my app so that you have tabs at the top of the screen (got this working) and in the xml file you have a webview. I cannot get the webview and the fragment code to work as I get 'Unreachable Statement'. import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.app.Activity; import android.webkit.WebView; public class TopRatedFragment extends Activity { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false); return rootView; //Unreachable Statement WebView engine = (WebView) findViewById(R.id.web_engine); engine.loadUrl("http://www.google.com/"); } } Does anyone have any suggestions?
accepted answer: http://stackoverflow.com/a/21496153
upvote count: 3
answer count: 3
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/21496153
possible better answer: http://stackoverflow.com/a/21495868
has comment: http://stackoverflow.com/comment/32448876
has answer: http://stackoverflow.com/a/21495868

http://stackoverflow.com/comment/32332611
comment on: http://stackoverflow.com/q/21412935
score: 0
has text: possible duplicate of [How to use log4j in eclipse rcp](http://stackoverflow.com/questions/7994883/how-to-use-log4j-in-eclipse-rcp)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21493125
favorite count: 0
type: Question
tagged with: jetty
has body: When I was trying out JMinix servlet with an embedded Jetty 6.x server, I get the following NullPointerException: [ERROR ]:[2014-01-31 14:31:19,194]:[684929885@qtp-1937268239-2 - /jmx]:[mortbay.log]:/jmx java.lang.NullPointerException at org.mortbay.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:414) at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:458) at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:322) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Initially I suspected JMinix, however it deploys fine with other containers. A simple servlet within the project works. Is this a Jetty problem?
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21493126
tagged with: nullpointerexception
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21493126
score: 1
has title: NullPointerException in Jetty 6.x while deploying servlet from an external jar

http://stackoverflow.com/q/21398571
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21402297
has answer: http://stackoverflow.com/a/21398725
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/21398825
type: Question
has body: I have 2 tasks to run in parallel. Another, 3rd task, has to be launched after the other 2 have been completed. To kick off the 3rd task I use a counter variable = 2, which I decrement when each of the first 2 tasks complete. After each decrement there is a check whether counter == 0 and if it does - the 3rd task starts. The check is carried out on UI thread in a callback like this: @Override protected void onSuccess(Object data) { // decrement the counter // decide whether to kick off the 3rd task } I can't use join here - even if I could - it would stall the UI thread. So I use this counter. I just wanted to ask whether there's a native component/pattern for that technique in java. Thanks.
has title: Pattern for parallel task execution
tagged with: java
has comment: http://stackoverflow.com/comment/32277225
downvote count: 0
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/32303381
has text: Also, thanks @DataNucleus, for pointing out that this `JPA` API used here is actually Hibernate's, not the actual `JPA` API.
score: 0
comment on: http://stackoverflow.com/q/21392674
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21362682
answers question: http://stackoverflow.com/q/21360084
type: Answer
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32239389
upvote count: 2
has body: I know the correct visual solution to remove tabs' border: tabbedPane.setFocusable(false); But you lost posibility to use keys for tabbed pane.

http://stackoverflow.com/a/21386491
upvote count: 1
answers question: http://stackoverflow.com/q/21384375
downvote count: 0
score: 1
has body: One alternative, depending on what you're doing with the document, might be to switch from DOM-based processing to SAX-based processing (or other event-driven serializer interface). That would let you use an internal memory model which was tuned to your needs and thus more efficient than the general DOM, and perhaps avoid building an in-memory model at all if you can serialize from existing data models or are generating content on the fly. The Xalan XSLT processor, for example, uses a SAX parser to build a custom data model internally rather than the DOM (XSLT, in general, requires random access to the document's contents so some in-memory model is required), and produces output directly to a SAX serializer whenever possible. Taking that further, you could set up a data model which explicitly pages portions of the document in and out rather than counting on the operating system's swapper. I'm not sure it would be a net win, though. The DOM's a fine thing, mind you (he says, as one of its authors) -- but as a general-purpose tool it's not the ideal answer for all tasks. BTW, when debugging Xalan on some of the more complex problems I fairly often set -Xmx higher than 1024m. Whether Java will let you use higher values depends on the JVM and your operating system configuration, but I'd say it's worth double-checking whether you can push that up a bit.
type: Answer

http://stackoverflow.com/comment/32244914
type: AnswerComment
comment on: http://stackoverflow.com/a/21380977
type: Comment
has text: Thanks, at least this is one valid question. I don't want you to made it for me, just wanted to get some instructions.
score: 0

http://stackoverflow.com/comment/32307826
type: Comment
type: QuestionComment
has text: Here's some interesting info for you : http://amitstechblog.wordpress.com/2011/05/31/supporting-custom-isolation-levels-with-jpa/
comment on: http://stackoverflow.com/q/21415177
score: 0

java-web-start
tags question: http://stackoverflow.com/q/21412457
tags question: http://stackoverflow.com/q/21387722
tags question: http://stackoverflow.com/q/21440563
type: Tag
tags question: http://stackoverflow.com/q/21404830
tags question: http://stackoverflow.com/q/21479658
tag name: java-web-start
tags question: http://stackoverflow.com/q/21499142

http://stackoverflow.com/comment/32227759
type: QuestionComment
type: Comment
has text: You need to add the ints at locations [0][0], then [1][1], then [2][2]... see the pattern? Second part is [0][9], [1][8], [2][7]... also a simple pattern.
comment on: http://stackoverflow.com/q/21371204
score: 0

http://stackoverflow.com/a/21360285
has comment: http://stackoverflow.com/comment/32207990
has body: The bankParser method header says it should return a Bank class object, but it is set to return null Trying to call that and save the result will always give you a null there. Based on this line in BankParser, it looks like it is used to print itself System.out.println(bankInfoArray[0]);
score: 0
has comment: http://stackoverflow.com/comment/32207939
has comment: http://stackoverflow.com/comment/32208025
type: Answer
answers question: http://stackoverflow.com/q/21360244
has comment: http://stackoverflow.com/comment/32208096

http://stackoverflow.com/a/21536244
has body: Ok, cheating mode on: How about you overwrite de public setter and change the map implementation to a inner class of MyBaseClass. This implementation could throw a exception on all methods of map you dont want your children to access and your MyBaseClass could expose the methods they should use by using an internal method your map implementation... Still has to solve how the ThirdPartyMethod will access those properties, but you could force your code to call a finalizationMethod on your MyBaseClass before use it... I'm just divagating here EDIT Like This: public abstract class MyBaseClass extends ThirdPartyClass{ private class InnerMapImpl implements Map{ ... Throw exception for all Map methods you dont want children to use private Object internalGet(K key){ return delegate.get(key); } } public void setPropertyMap(Map propertyMap){ this.propertyMap= new InnerMapImpl(propertyMap); } public Object getFoo(){ return ((InnerMapImpl) propertyMap).internalGet("Foo"); } }
has comment: http://stackoverflow.com/comment/32522082
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/32522115
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32523322
answers question: http://stackoverflow.com/q/21482682

http://stackoverflow.com/comment/32284101
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21382090
has text: You have define your method as public void Searchstart(View v){}

http://stackoverflow.com/q/21401780
type: Question
tagged with: matlab
has body: I want to connect to Matlab from netbeans and read some image files and do image processing. It works fine in last month,i did all the testing for my final reaserch and it worked fine. This is my cording to connect with Matlab, MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder().setUsePreviouslyControlledSession(true).build(); MatlabProxyFactory factory = new MatlabProxyFactory(options); MatlabProxy proxy=factory.getProxy(); // call builtin function String curr=""; for (int i = 0; i &lt; r.fileread(path).length; i++) { curr=r.fileread(path)[i]+"\\*.bmp"; String out=r.fileread(path)[i]+".txt"; String newfile=r.fileread(path)[i]+"_new.txt"; //execute the addapth path command in matlab proxy.eval("addpath('D:\\finalwk')"); //execute user defined functions proxy.feval("Untitled",r.fileread(path)[i],curr,out); proxy.feval("uni",out,newfile); } Now it dose not run from MatlabProxy proxy=factory.getProxy(); statement it opens Matlab and and gives a huge error, Reconnecting to this session of MATLAB will not be possible matlabcontrol.MatlabConnectionException: Could not register this session of MATLAB at matlabcontrol.MatlabBroadcaster.bindSession(MatlabBroadcaster.java:144) at matlabcontrol.MatlabBroadcaster.broadcast(MatlabBroadcaster.java:92) at matlabcontrol.MatlabConnector$EstablishConnectionRunnable.run(MatlabConnector.java:209) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection timed out: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)... Can Some one give an idea as so…
upvote count: 3
tagged with: java
answer count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
favorite count: 0
tagged with: netbeans
has title: Connecting with Matlab From netbeans

http://stackoverflow.com/comment/32302820
score: 0
has text: Thanks, I found a solution that is similar to yours. I have answered the question here with it
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21412242

http://stackoverflow.com/q/21415391
tagged with: asynchronous
favorite count: 0
tagged with: promise
upvote count: 1
type: AnsweredQuestion
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/32306803
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21432026
type: Question
has body: I am new to play framework 2. I have seen a lot of examples regarding async calls like: JavaAsync. However, all of them happen the "controller" layer. Meaning that the result of the functional composition is always a "Result" object in these examples, and I have not seen any other examples that return anything other than "Result". Having said this, due to a different setup i need to return a Boolean. Here is my setup: I have a service layer. So my controller gets the request from the user, it passes it to my service layer, my service layer talks to an external service (in my case elasticsearch), the external service sends it result, my service layer gets it and passes it to the controller,... . My problem is that my async call happens in the service layer (btw, I am using play2-elasticsearch plugin just in case): @Override public Boolean saveTask(TaskInfo taskInfo){ final TaskEntity taskEntity = EntityTransformer.createNewTaskEntity(taskInfo); // save to es F.Promise indexResponsePromise = taskEntity.indexAsync(); return indexResponsePromise.map(new F.Function() { @Override public Boolean apply(IndexResponse indexResponse) throws Throwable { if (indexResponse.getId().equals(taskEntity.id.toString())) { return Boolean.TRUE; } else { return Boolean.FALSE; } } }); } Having, the code above, I get an error telling me that saveTask method should return a 'F.Promise'. Now the questions: how can I only return a "Boolean" instead of 'F.Promise'? If return 'F.Promise', how can I get the value out of it? Thanks!
answer count: 2
has title: How to do async calls in PlayFramework 2 in service layer?
possible better answer: http://stackoverflow.com/a/21432026
downvote count: 0
has answer: http://stackoverflow.com/a/21425230
accepted answer: http://stackoverflow.com/a/21425230

http://stackoverflow.com/comment/32260236
comment on: http://stackoverflow.com/a/21389193
type: Comment
has text: @user3187463 I accept dear.You need to read the file line by line and put the FS PS in MAP.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21364925
has comment: http://stackoverflow.com/comment/32215964
has comment: http://stackoverflow.com/comment/32216038
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/21364972
has body: I want to open an UDP channel between the Client and the server with UDP. I have two questions. When i write DatagramSocket serverSocket = new DatagramSocket(port);; is the channel opened or it will be open when I start sending ? and How can I specify the IP adress of the server ?
favorite count: 0
has answer: http://stackoverflow.com/a/21364989
tagged with: sockets
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21364965
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/21364989
possible better answer: http://stackoverflow.com/a/21364965
type: Question
tagged with: datagram
has title: Open an UDP channel in java
score: -1

http://stackoverflow.com/comment/32393294
has text: You can us Use `Scanner.hasNextInt()` `while (!scan.hasNextInt()) scan.next(); int age = scan.nextInt();`
comment on: http://stackoverflow.com/a/21464525
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21427859
upvote count: 6
has answer: http://stackoverflow.com/a/21428507
type: UnansweredQuestion
tagged with: java
score: 6
tagged with: gmail-imap
has comment: http://stackoverflow.com/comment/32347381
has answer: http://stackoverflow.com/a/21447763
type: Question
has title: IMAP List extension JAVA
has body: I'm building a tool that need access to mail specific folders (e.g. '[Gmail]/Trash', '[Gmail]/Sent'). It seems that the names are localized with respect to the user localization settings, so '[Gmail]/Trash' show as '[Gmail]/Papelera' to Spanish users for example. I read about XLIST command but now is deprecated in favor of the IMAP LIST Extension (https://developers.google.com/gmail/imap_extensions#special-use_extension_of_the_list_command). I tried to do it that way javax.mail.Folder.list("\Trash") but nothing is returned. How can I use the IMAP List extension in JAVA? PS: Using several email providers, not just Gmail.
has answer: http://stackoverflow.com/a/21431040
tagged with: imap
tagged with: jakarta-mail
tagged with: email
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21431235
has answer: http://stackoverflow.com/a/26591696
answer count: 5

http://stackoverflow.com/comment/48765064
score: 0
type: Comment
has text: @Abhinav I'll help you with your [question](http://stackoverflow.com/questions/30051201), no need to double post :)
comment on: http://stackoverflow.com/a/21483097
type: AnswerComment

http://stackoverflow.com/q/21482969
has answer: http://stackoverflow.com/a/21483108
has comment: http://stackoverflow.com/comment/32426723
favorite count: 0
has body: I am having milliseconds value and want to display the time subtracting 5 minutes from current milliseconds value in hh:mm:ss format. Code String str = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours((cal.getTimeInMillis()-300000)), TimeUnit.MILLISECONDS.toMinutes(cal.getTimeInMillis()-300000) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(cal.getTimeInMillis()-300000)), TimeUnit.MILLISECONDS.toSeconds(cal.getTimeInMillis()-300000) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(cal.getTimeInMillis()-300000))); Toast.makeText(getApplicationContext(), "Alarm Set."+str, Toast.LENGTH_LONG).show() Output now Alarm Set. 386467:25:00 Output Required Alarm Set. 07:25:00 As you see minutes and seconds are getting retrieved quiet right but there's some problem with hours. P.S 1.I referred this post.They say it works fine.But don't know why not in my case. 2.I am sure about what i want to get as hours value i.e 07 as i have set the value using Calendar.HOUR and its getting displayed too if i use cal.get(Calendar.HOUR).cal is of course object of Calendar class. Alternative Solution SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); String str1 = sdf.format(new Date(cal.getTimeInMillis()-300000)); Toast.makeText(getApplicationContext(), "Alarm Set."+str1, Toast.LENGTH_LONG).show();
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/32425556
tagged with: timeunit
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21484155
has title: Formatting milliseconds to hh:mm:ss format
tagged with: java
has comment: http://stackoverflow.com/comment/32472836
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/32437232
linked to: http://stackoverflow.com/q/9027317
has answer: http://stackoverflow.com/a/21519775
tagged with: date
has comment: http://stackoverflow.com/comment/32434190
accepted answer: http://stackoverflow.com/a/21484155
linked to: http://stackoverflow.com/q/21508611
answer count: 3
has comment: http://stackoverflow.com/comment/32433708
has comment: http://stackoverflow.com/comment/32436363
possible better answer: http://stackoverflow.com/a/21483108
linked to: http://stackoverflow.com/q/21488830
downvote count: 0

http://stackoverflow.com/comment/32473657
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21501207
has text: that means you are doing it wrong. debug your code with break points. the code in the link i posted works absolutely fine.
score: 0

http://stackoverflow.com/a/43641750
answers question: http://stackoverflow.com/q/21394643
has body: I think you should use something like this: The path where you can find wsimport(Usually in java_home\bin)
score: 0
type: Answer

http://stackoverflow.com/q/21462677
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21462881
tagged with: jaxb
has answer: http://stackoverflow.com/a/21462881
has body: I already have a working JAXB setup for Schema A a working JAXB setup for Schema B an XSLT transformation from instances of A to instances of B (and vice versa) If I have an XML instance of type A, I can use XSLT and Jettsion to produce a reasonable JSON representation of B. But what I really want to do is take a Java object of type A, a JAXB marshaller, my existing A->B XSLT, and a Jettsion XMLStreamWriter to produce JSON of type B, without having to produce an instance of B (XML or Java) in between. Java Object A --&gt; JAXB Marshaller --&gt; ? --&gt; XSLT A to B transfrom --&gt; JSON B I have an idea that I should be able to this by marshalling to a SAXResult that in turn act as an XMLReader that can feed the XSLT translation. I need a kind of ContentHandlerAdapter that can coordinate the marshalling with the transformation. But here my head starts spinning. Has anybody seen or written a setup like this, and hopefully point me to an example?
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21463390
accepted answer: http://stackoverflow.com/a/21463390
has title: Transforming Java object to JSON via XSLT
answer count: 2
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xslt
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/21350052
has body: Does anyone know if there is way (maybe through an external API) to pipe Graphics drawings / transforms into multiple Graphics? The idea would be to save PNG and PDF at same time (using Java IText library).
score: 0
answer count: 2
tagged with: java-2d
has title: Pipe Java2D Graphics drawings into multiple Graphics contexts
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21411584
tagged with: java
tagged with: itext
type: Question
has answer: http://stackoverflow.com/a/21407138

http://stackoverflow.com/comment/32228322
has text: but one more problem , the character keeps walking when i release the key ... doesnt it set the false the right way !! here : `keys[ke.getKeyCode()] = false;`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21371362
type: AnswerComment

http://stackoverflow.com/a/21370305
has comment: http://stackoverflow.com/comment/32226343
upvote count: 1
has comment: http://stackoverflow.com/comment/32226382
has comment: http://stackoverflow.com/comment/32226307
type: Answer
has comment: http://stackoverflow.com/comment/32226234
has comment: http://stackoverflow.com/comment/32226267
has comment: http://stackoverflow.com/comment/32226325
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21370179
has body: Thing is, all Java knows at compile-time is that you've declared your item as a Node. At runtime, however, the JVM knows the actual class of your object. From that moment on, from the Java perspective, casting is only legal along the inheritance chain. Even that one might fail if you don't pay enough attention (an object built as a Node cannot be cast as a DeletedNode for example). Since your inherited Node types are sibling classes, the cast along the inheritance chain will fail and will throw the well known ClassCastException.

http://stackoverflow.com/q/21491470
has comment: http://stackoverflow.com/comment/32441692
has comment: http://stackoverflow.com/comment/32442015
tagged with: checksum
type: Question
has title: How do I know a Longitudinal redundancy check is correctly calculated and how is it used to ensure that data before is not corrupt?
has comment: http://stackoverflow.com/comment/32441406
score: 0
answer count: 1
tagged with: protocols
has comment: http://stackoverflow.com/comment/32441750
tagged with: byte
type: UnansweredQuestion
tagged with: redundancy
has comment: http://stackoverflow.com/comment/32441804
has answer: http://stackoverflow.com/a/43881951
tagged with: java
has body: How do I know a Longitudinal redundancy check is correctly calculated and how is it used to ensure that data before is not corrupt? This is how I'm calculating it right now in Java but how do I know I am calculating it correctly given the data? byte[] testMessage1 = {0x02, // STX 0x10,0x2,0xA,0x10,0x10,0x7,0x8, // Data 02, A, 10, 7, 8 0x03, // ETX 0x2^0xA^0x10^0x7^0x8^0x03}; // LRC calculated from the data (with the DLE removed) plus the ETX public static byte calculateLRC2(byte[] bytes) { byte checksum = 0; for (int i = 1; i &lt; bytes.length - 1; i++) { checksum ^= (bytes[i] &amp; 0xFF); } return checksum; }

http://stackoverflow.com/comment/32405442
type: Comment
type: QuestionComment
has text: You can decalre new types without parameters extending the complex one with a meaningful names. Unfortunately this has nasty side-effects.
comment on: http://stackoverflow.com/q/21470984
score: 0

http://stackoverflow.com/a/21365308
score: 2
accepted answer of: http://stackoverflow.com/q/21365234
downvote count: 0
answers question: http://stackoverflow.com/q/21365234
upvote count: 2
type: AcceptedAnswer
has body: Ok, one thing at a time. First off, you're printing _players.get(2).getNumberHits() and getting a NPE. Either _players.get(2) returns null, or getNumberHits() does something that throws an NPE. What cannot be the case is that _players2 is null since you already said that worked. So, you need to look into what's wrong with the object _players you are being passed. I would suggest you try setting a breakpoint and analysing the object with your IDE (e.g. Eclipse or Netbeans)
type: Answer

http://stackoverflow.com/q/21489226
tagged with: jmstemplate
tagged with: jdbctemplate
type: Question
has body: I'm new to Java. I've only been programming it for about a year. What does Spring mean by the use of templates? In Spring, there is jdbc-templates, jms-templates etc.. What are template classes in java? Are they a special kind of design pattern or what? Thank you in advance.
has answer: http://stackoverflow.com/a/21489446
score: 21
has answer: http://stackoverflow.com/a/21491939
accepted answer: http://stackoverflow.com/a/21494888
possible better answer: http://stackoverflow.com/a/21491939
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32441162
tagged with: spring
has answer: http://stackoverflow.com/a/21494888
type: AnsweredQuestion
has title: What are template classes in Spring Java? Why are they called templates? For example jdbc-template, jms-template etc
tagged with: java
has comment: http://stackoverflow.com/comment/115312873
linked to: http://stackoverflow.com/q/33153252
upvote count: 21

http://stackoverflow.com/q/21405897
has comment: http://stackoverflow.com/comment/32611314
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/32505692
has answer: http://stackoverflow.com/a/21645174
accepted answer: http://stackoverflow.com/a/21645174
upvote count: 3
tagged with: querydsl
has body: I was unable to find any way of implementing fetch plans in QueryDSL, and I tried a lot. Can you provide me any hints? Also, do you know any better way of chosing which fields to fetch and which load lazily in different situations? I use batch fetching, therefore I can't use JOIN FETCH.
answer count: 1
has comment: http://stackoverflow.com/comment/32515102
favorite count: 0
has comment: http://stackoverflow.com/comment/32560078
has title: Fetch plan aka. fetch group aka. entity graph in QueryDSL
has comment: http://stackoverflow.com/comment/32543050
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32476129
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32585567

http://stackoverflow.com/comment/32246611
type: Comment
has text: @user2068662 Please refer to my answer below as it may address your issues. :)
type: QuestionComment
comment on: http://stackoverflow.com/q/21381364
score: 0

http://stackoverflow.com/q/21444425
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/22812527
has body: I have some TextViews on my app, I don't know why but the android:gravity attribute is not centering the text content where it should be on devices running the API 18+ (4.3+). There is the code I use on my custom TextView, this is a child of RelativeLayout: &lt;com.package.custom.CustomTextFont android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@+id/seekbar" android:layout_alignParentLeft="true" android:layout_alignTop="@+id/seekbar" android:layout_marginLeft="@dimen/margin_tiny_double" android:layout_toLeftOf="@+id/seekbar" android:gravity="center_vertical|left" android:paddingRight="@dimen/margin_tiny" android:text="@string/text1" android:textColor="@color/black" android:textSize="@dimen/size_text_normal" /&gt; This code should take the edges of this TextView and align it to the top and bottom and put it to the Left of the SeekBar, this is working, but the TextView gets big, so with android:gravity I center the text to the center and left from it self. It works, but I don't know why, the text is not centered at center|left on devices running android 4.3 and 4.4. This issue can be reproduced on real devices and as well on the layout preview (Graphic layout) of Eclipse. There is any changes made on API 18+ or on android:gravity that I'm missing? PS: I'm targetting the API 19 on the project and on AndroidManifest.xml PS2: My TextView is custom just to set an external font.tff This is how it looks like on API 17- This is how it looks like on API 18+ Thanks in advance! = UPTADATE = On my Manifest, I changed the android:targetSdkVersion to 17 instead of 19 and the problem disappeared, but this is a "trick", not a solution, what can I do since it could be an issue from the API ? And yes, I have the latest version of the API 18 and 19 (today, 01/30/2014).
has comment: http://stackoverflow.com/comment/32367004
tagged with: gravity
has comment: http://stackoverflow.com/comment/32495732
has title: android:gravity fails on API 18+
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/21460697
has comment: http://stackoverflow.com/comment/32395232
linked to: http://stackoverflow.com/q/20239547
has comment: http://stackoverflow.com/comment/32359845
has comment: http://stackoverflow.com/comment/32359033
accepted answer: http://stackoverflow.com/a/22812527
possible better answer: http://stackoverflow.com/a/21460697
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/32359790
has comment: http://stackoverflow.com/comment/32395318
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32387031
tagged with: layout
has comment: http://stackoverflow.com/comment/32359148
downvote count: 0
has comment: http://stackoverflow.com/comment/32493330

http://stackoverflow.com/q/21362370
tagged with: web-services
has body: I am trying to call a web service dynamically, I don't have any problem in calling a method with input parameters , but when I use a method without arguments, I got nosuchelementexception error ,My source code is described below: I have an interface : public interface SmsParam extends java.rmi.Remote { public String getSmsIncomePackServices() throws java.rmi.RemoteException; public String getCustMobileNo(Integer intCustId) throws java.rmi.RemoteException; } and I use below code for calling getSmsIncomePackServices method: String UrlString = " ?wsdl"; String nameSpaceUri = " "; String serviceName = " "; String portName = "coreBankingSMSWebServiceHttpSoap11Endpoint";//"inactiveMobileSMSHttpSoap11Endpoint"; ServiceFactory serviceFactory = ServiceFactory.newInstance(); Service helloService = serviceFactory.createService(helloWsdlUrl, new QName(nameSpaceUri, serviceName)); SmsParam myProxy = (SmsParam)helloService.getPort( new QName(nameSpaceUri, portName), SmsParam.class); myProxy.getCustMobileNo(12); //Runs successfuly myProxy.getSmsFreePackServices();//I got nosuchelementexception error Is there any way to solve my problem?
has answer: http://stackoverflow.com/a/21521160
score: 1
tagged with: java
tagged with: apache-axis
upvote count: 1
type: Question
has title: nosuchelementexception in calling a dynamic web service
tagged with: axis
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21364992
has title: double comparison. explanation of different results
score: 0
tagged with: java
type: Question
has body: I try to train for scjp. I have this code: System.out.println(0.8==0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1);//false System.out.println(0.8==((0.1+0.1)+(0.1+0.1))+((0.1+0.1)+(0.1+0.1))); // true output: true false I know that right comparison something like this: abs(a1-a2)&lt;epsilon But this results is strange for me. Who can explain their for me? Are valid similar questions for scjp?
has answer: http://stackoverflow.com/a/21365091
answer count: 1
type: UnansweredQuestion

frame
tags question: http://stackoverflow.com/q/21384655
tags question: http://stackoverflow.com/q/21360831
type: Tag
tags question: http://stackoverflow.com/q/21465462
tags question: http://stackoverflow.com/q/21417112
tag name: frame
tags question: http://stackoverflow.com/q/21457615

http://stackoverflow.com/comment/32475982
has text: You call `a.split()` but `a` is not a string. What is the split implementation in `a`?
type: Comment
comment on: http://stackoverflow.com/q/21511133
type: QuestionComment
score: 2

http://stackoverflow.com/q/21478778
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21480161
tagged with: java
tagged with: http
has comment: http://stackoverflow.com/comment/32418252
accepted answer: http://stackoverflow.com/a/21480161
type: Question
has comment: http://stackoverflow.com/comment/32419501
has body: I am working with Apache Tomcat and I want to send a data to a the http server and get response from HTTP server (from a servlet). Problem: When I use the HTTP client to send the data, it seems the data are not delivered (the parameters sent are not displayed by the servlet). When I simulate the same by a HTTP browser (Chrome), everything seems to be OK. Bellow are examples of my servlet and my http client. My HTTP Servlet: public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); out.println("This ervlet requires POST but received GET"); out.close(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); for (String name : request.getParameterMap().keySet()) { out.write("PARAMETER :" + name); out.write("\n"); } for (Part name : request.getParts()) { out.write("MULTIPART PARAMETER :" + name.getName()); out.write("\n"); } String p1 = request.getParameter("input1"); out.write("RECEIVED PARAMETER:" + p1); out.write("\n"); out.close(); } } My HTTP client /** * Example how to use multipart/form encoded POST request. */ public class ClientMultipartFormPost { public static void main(String[] args) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpPost httppost = new HttpPost("http://example.com:8080" + "/myservlet"); FileBody bin = new FileBody(new File("file1.txt")); StringBody comment = new StringBody("A binary file of some kind", ContentType.TEXT_PLAIN); HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("bin", bin) .addPart("input1", comment) .build(); httppost.setEntity(reqEntity); System.out.println("executing request " + httppost.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httppost); try { System.out.println("----------…
tagged with: servlets
has title: JAVA HTTP Client and Serlvlet
score: 0
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32418165
tagged with: client
has comment: http://stackoverflow.com/comment/32418041

http://stackoverflow.com/a/21432026
score: 1
upvote count: 1
has body: Here is a response from the Play Framework google group: I think in order to better understand the situation, we need to take a step back. When you operate asynchronously, you're faced with a choice. You can either be asynchronous from end-to-end, or you can block at some point and escape asynchronicity (but at a cost!). So to take your question, ideally saveTake would return an F.Promise&lt;Boolean&gt;, not a Boolean. Then whatever calls saveTask would operate on that boolean asynchronously as well and so on until you get to the controller. The controller would then take a Future&lt;Result&gt; rather than a simple Result. At that point, that code path is asynchronous from beginning to end. (Well, ignoring whatever else is going on in your code base) Once you have an F.Promise&lt;Boolean&gt;, you can use various higher-order functions on F.Promise in order to operate asynchronously. For instance, if you look at the API for F.Promise, you'll see the map function. You would create an F.Function which takes a Boolean as its sole input parameter and returns a B (for whatever B is since F.Function is generic). This is called mapping. Instead of operating directly on your boolean, you would chain these functions onto your promise as you go, only executing each function as the preceding result is available and all of this would be done asynchronously.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21415391

http://stackoverflow.com/comment/32386448
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21416097
has text: I didn't end up using the list object, but the `TypeToken` part of your answer is what I was looking for.

http://stackoverflow.com/comment/32190006
comment on: http://stackoverflow.com/q/21350098
has text: Did you override equals and hashCode?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21441149
tagged with: log4j
type: UnansweredQuestion
has title: What is missing from my log4j configuration that org.hibernate.cfg.annotations.Version requires?
tagged with: logging
has comment: http://stackoverflow.com/comment/32352680
has answer: http://stackoverflow.com/a/25155270
has answer: http://stackoverflow.com/a/21442193
tagged with: java
tagged with: hibernate
type: Question
has body: I'm trying to figure out why our Hibernate code is not logging anything to log4j. I put together a simple project that calls one Hibernate service method that logs a log4j message as the first line. Both the project and the Hibernate service have the following log4j specific code: private static Logger NTEVENT_LOG = Logger.getLogger("NTEVENT"); NTEVENT_LOG.debug("==== LOG4J logging"); When I run the project (Eclipse->run) I get the following messages in red: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. But immediately after I see the logging from the application itself so some part of log4j did get correctly initialized. However, nothing is being logged by the Hibernate service. [main] DEBUG NTEVENT - ==== LOG4J logging This is my log4j.xml &lt;appender name="NTEVENT" class="org.apache.log4j.ConsoleAppender"&gt; &lt;layout class="org.apache.log4j.PatternLayout"&gt; &lt;param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;root&gt; &lt;priority value ="debug" /&gt; &lt;appender-ref ref="NTEVENT" /&gt; &lt;/root&gt; I must be missing something that Hibernate is expecting but I have no idea what.
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21584688

http://stackoverflow.com/q/21417256
tagged with: java
tagged with: authentication
type: Question
has answer: http://stackoverflow.com/a/21419711
score: 0
linked to: http://stackoverflow.com/q/17811385
answer count: 1
accepted answer: http://stackoverflow.com/a/21419711
has title: Spring 4 API Request Authentication
tagged with: spring
has body: I am using Spring 4 to create an API and I need to have authentication for the API requests. Currently, I have created a HandlerInterceptorAdapter to pick out authentication related headers and perform some validation on those values. If everything is OK, I set the SecurityContext to a custom implementation of Authentication then in the postHandle I set the authentication to null. Everything works great, except I keep getting warnings in Tomcat7 about ThreadLocal variables not being removed when the application shuts down. SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@6c3e4fdb]) and a value of type [org.springframework.security.core.context.SecurityContextImpl] (value [org.springframework.security.core.context.SecurityContextImpl@ffffffff: Null authentication]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. I get that I may be doing this totally wrong, if so I would love some direction. :D Here is my interceptor: /** * Intercepts Requests to set the Authentication in the SecurityContext. * Sets the response to 401 - Unauthorized, if the header is missing */ @Component public class AuthenticationHandlerInterceptor extends HandlerInterceptorAdapter { private HandlerMediator mediator; Logger log = LoggerFactory.getLogger(AuthenticationHandlerInterceptor.class); @Autowired public AuthenticationHandlerInterceptor(HandlerMediator mediator) { this.mediator = mediator; } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String username = request.getHeader("authentication-username"); String token = request.getHeader("authentication-token"); // if the remote host is local, then override the authentication if (request.getRemoteHost().equals("0:0:0:0:0:0:0:1") || request.getRemoteHost().equals("127.0.0.1")) { log.info("On localh…
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/q/21382342
tagged with: java
has body: I would like to implement a database which consists of 2 tables, number and receivernumber. In fact, I have 2 xml files, one using number table, another using receivernumber. However, the code below only allows the first table to be used for both of the xmls. Previously, I have tried implementing 2 different sets of class files, as stated below. But it crashes the entire app instead. So I tried changing to using the same class file with the receivernumber table being number2 instead. Now, both of the activity/xml file uses the first database but not the second. Please advice. Thanks in advance. Note: there are no error logs available as it is working. Just that the table used for both activities are the same, but it's supposed to be different. Set_numbers_to_forward.java import java.util.ArrayList; import java.util.List; import com.example.awkwardpanda_redirectcall.DBAdapter; import com.example.awkwardpanda_redirectcall.CallAdapter; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; public class Set_numbers_to_forward extends Activity { Context mContext; ArrayAdapter&lt;String&gt; adapter; List&lt;String&gt; adapterData; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.set_numbers_to_forward); mContext = this; ListView list = (ListView) findViewById(R.id.number_list); adapterData = new ArrayList&lt;String&gt;(); DBAdapter db = new DBAdapter(this); // ---get all contacts--- db.open(); Cursor c = db.getAllContacts(); if (c.moveToFirst()) { do { adapterData.add(c.getString(1)); } while (c.moveToNext()); } db.close(); adapter…
type: Question
tagged with: database
has title: Using same class for 2 xml files that uses database
has answer: http://stackoverflow.com/a/21382617
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32247675
has answer: http://stackoverflow.com/a/21382514
tagged with: android
accepted answer: http://stackoverflow.com/a/21382617
possible better answer: http://stackoverflow.com/a/21382514
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32247647

http://stackoverflow.com/a/21356954
has comment: http://stackoverflow.com/comment/32201958
has body: What I would do is create a JPanel with a background image, and add it to the JFrame. I already have a BackgroundPanel class right in one of my projects, and this is the setup I have for it. public class MyFrame extends JFrame { private BackgroundPanel bgPanel; public MyFrame() { bgPanel = new BackgroundPanel("Chrysanthemum.jpg"); setTitle("MyFrame"); setResizable(false); setContentPane(bgPanel); pack(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); } public static void main(String[] args) { new MyFrame(); } } // -- BackgroundPanel class public class BackgroundPanel extends JPanel { private static final long serialVersionUID = 1L; private Image bg; public BackgroundPanel(String path) { this(Images.load(path).getImage()); } public BackgroundPanel(Image img) { this.bg = img; setPreferredSize(new Dimension(bg.getWidth(null), bg.getHeight(null))); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (bg != null) g.drawImage(bg, 0, 0, getWidth(), getHeight(), null); } }
type: Answer
answers question: http://stackoverflow.com/q/21356609
score: 0

http://stackoverflow.com/q/21511768
favorite count: 0
has title: MalformedURLException in java application
has answer: http://stackoverflow.com/a/21511787
has answer: http://stackoverflow.com/a/21511798
tagged with: swing
has answer: http://stackoverflow.com/a/40509753
accepted answer: http://stackoverflow.com/a/40509753
score: 2
tagged with: joptionpane
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: i wrote a simple program which is in my book. but i'm getting the MalformedURLException exception.This is my code import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JOptionPane; public class ImageGreet{ public static void main(String []args){ URL imageLocation = new URL("http://horstmann.com/java4everyone/duke.gif"); JOptionPane.showMessageDialog(null,"Hello","Title",JOptionPane.PLAIN_MESSAGE,new ImageIcon(imageLocation)); } } but my friend said he got it right with the same code. what's wr9ong with my code? Is it because of the internet connection(I'm using a dial-up connection) I
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/21511798
has comment: http://stackoverflow.com/comment/32477189
tagged with: imageicon
has answer: http://stackoverflow.com/a/21511802
answer count: 4

http://stackoverflow.com/comment/32209932
comment on: http://stackoverflow.com/q/21361492
score: 1
has text: Why you have two `{` after the `while`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32352254
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21437918
type: AnswerComment
has text: for now, I can use the jboss repo :).

http://stackoverflow.com/comment/32271281
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21395110
has text: There should be atleast one digit within the string

http://stackoverflow.com/comment/32314622
comment on: http://stackoverflow.com/q/21419558
has text: Why are you actually trying to twiddle the bits? what problem are you trying to actually solve with this?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32428721
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21475278
has text: Before using this driver.switchTo().window((String) childParentHandles.toArray()[0]); I've remove main window handle from the set using childParentHandles.remove(mainWindowHanhle);. So It will return child window handle only.

http://stackoverflow.com/q/21404830
has comment: http://stackoverflow.com/comment/54749246
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/19449738
upvote count: 32
downvote count: 0
tagged with: java-web-start
favorite count: 0
has answer: http://stackoverflow.com/a/21427782
accepted answer: http://stackoverflow.com/a/21427782
has comment: http://stackoverflow.com/comment/32315640
linked to: http://stackoverflow.com/q/38356087
tagged with: jnlp
possible better answer: http://stackoverflow.com/a/22714168
has comment: http://stackoverflow.com/comment/32329417
has body: OS: Windows 7 64 bit Java: jdk1.7.0_51 I have a jnlp file. When I double click on this, exception is occurred as below: Application Error: Unable to launch the application Exception: java.lang.SecurityException: Missing required Permissions manifest attribute in main jar
score: 32
has comment: http://stackoverflow.com/comment/54749192
has title: SecurityException during executing jnlp file (Missing required Permissions manifest attribute in main jar)
has comment: http://stackoverflow.com/comment/32287480
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4947458
has answer: http://stackoverflow.com/a/22714168
tagged with: java

http://stackoverflow.com/comment/32293310
score: 1
has text: @MadProgrammer *"interrupted the question correctly."* Sloppy socks? ITYM *"**interpreted** the question correctly."* ;)
comment on: http://stackoverflow.com/q/21404797
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32407245
score: 0
type: Comment
has text: ... and if you don't care what class of grammar you get, you should change your question title to something more like "Any working L(AL)R grammar for Java?".
type: QuestionComment
comment on: http://stackoverflow.com/q/21471465

http://stackoverflow.com/a/26257886
type: Answer
has body: I got the same error and I was able to build after several steps. Here they are. Basically, your project is way too big for eclipse/android to handle so you have to A) increase the memory sizes and B) reduce the number of methods you have. Increase Heap Size in eclipse.ini file. How to find eclipse.ini file. How do I increase the size of heap by editing eclipse.ini I used the following values: -Xms2048m -Xmx2048m That didn't really solve the problem so I followed the instructions in this link. Specifically: Add the following dex.force.jumbo=true in the first line of project.properties I then got this error: Unable to execute dex: method ID not in [0, 0xffff]: 65536 Which led me to another stack overflow answer here. I ended up deleting some .jars I didn't use anymore to reduce the number of methods my app uses. I hope that helps!
upvote count: 1
answers question: http://stackoverflow.com/q/21446519
score: 1
downvote count: 0

http://stackoverflow.com/q/21495326
has body: I want to create interface for different databases XML, Sql and implementations. I have one interface but it is good for xml, but for other ? I want to create jar libary from this interface. Also I have a POJO class Book which represent object from database. I will have two implementations, one for XML, one for sql, how should I do to set one from propeties file without compilation ? interface DataInterface { public void setBook(ArrayList&lt;Book&gt; book); public ArrayList&lt;Book&gt; getBook(); public void update(ArrayList&lt;Book&gt; book, int row, int col); public void read(); public void add(Book book); }
has comment: http://stackoverflow.com/comment/32449091
type: AnsweredQuestion
has title: create interface for different databases, propeties for choice implementation
tagged with: java
accepted answer: http://stackoverflow.com/a/21495526
type: Question
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/32448476
tagged with: interface
has answer: http://stackoverflow.com/a/21495526
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/21432685
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21432365
has body: I think you're basing your "pattern" on some misunderstandings. The logic for generateHashCode(), testHashCodeAgainst(Path), and determineFileType() don't have to be included in this FileWrapperClass, and probably shouldn't be if there are going to be potentially millions of these FileWrapperClass objects. Do you think that the code is included in each of those millions of instances? If yes, then you're wrong, the code is shared and there is no advantage in creating separate static methods to handle them. In fact, wouldn't it produce better performance to nix the whole getter/setter dynamic in favor of a direct access protected variable (despite breaking OO principles.. is it worth it for a performance gain?), like: No, there is no performance gain involved here. This is micro-optimization that will be rendered unnecessary by JIT anyways. So as a conclusion, sorry, but you're not "on to something" here, but I hope that you're "on the correct path" now.
type: Answer

http://stackoverflow.com/a/34571316
score: 0
downvote count: 1
type: Answer
has body: The answer is I2CFactory.getInstance(I2CBus.BUS_0); in some cases, the BUS is inverted so try this, i hope it helps :)
has comment: http://stackoverflow.com/comment/56889074
has comment: http://stackoverflow.com/comment/56888281
answers question: http://stackoverflow.com/q/21359186
upvote count: 1

http://stackoverflow.com/comment/32208928
has text: There is no crash here, just an infinite loop.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21360415
type: QuestionComment

http://stackoverflow.com/comment/32235137
has text: post what you already tried
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21374872
score: 0

http://stackoverflow.com/a/21461637
has comment: http://stackoverflow.com/comment/32413035
type: Answer
has comment: http://stackoverflow.com/comment/32388162
score: 2
has comment: http://stackoverflow.com/comment/32388993
upvote count: 3
downvote count: 1
has body: Have you tried using the getLocation() method of WebElement? Seems to do what you need... Here's the API doc for that: http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html However, depending on how your site is built, an elements position could depend on the size of the window (check for style="position:fixed"), so be careful when trying to validate position...
has comment: http://stackoverflow.com/comment/32389165
has comment: http://stackoverflow.com/comment/32389117
has comment: http://stackoverflow.com/comment/32413172
has comment: http://stackoverflow.com/comment/32389337
answers question: http://stackoverflow.com/q/21461347

http://stackoverflow.com/q/21352310
has comment: http://stackoverflow.com/comment/32194084
tagged with: struct
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32290372
has comment: http://stackoverflow.com/comment/32193588
has comment: http://stackoverflow.com/comment/32194007
favorite count: 0
has body: These days I am working on a new application that will be written in java and it will call native dll's functions via JNI. The main purpose of the application is to receive data from the internet and save it to temporary class objects. Later, when the number of created objects reaches 200, it should convert the data to c structs and pass an array of struct pointers to native dll function. Native function will perform some calculation and return a new array of structs (results). These structs will have to be converted to java objects and passed to java side. I have to note that rewriting native code functionality in java is not an option. Performance is very important and that is the reason why I chose to use JNI. I have read many posts and came to the conclusion that in order to get a good performance, I will have to minimize the number of calls to JNI layer, and a preferable way will be to pass the data in one batch. What do you think is the best way to perform this task? Should I serialize the data to byte array, pass it to the native side and deserialize it to c structs? Are there any other efficient solutions? Thank you very much for your help.
tagged with: c++
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32193920
has comment: http://stackoverflow.com/comment/32193674
tagged with: java-native-interface
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has title: Send a collection of java object to native function via JNI and get results back to java
type: Question

http://stackoverflow.com/q/21470074
has answer: http://stackoverflow.com/a/21470130
has answer: http://stackoverflow.com/a/21470613
tagged with: button
downvote count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/32403691
type: UnansweredQuestion
tagged with: android
has body: Hello everyone i am completely new to Android programming and one of the things i would like to learn is how to trigger events based on button presses. so far i have only managed to create a button but i don't know how to create the events and more importantly what files do i have to modify? activity_main.xml: &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_id" android:text="@string/font_color" android:onClick="toggleChange"/&gt; i am mostly familiar with the files activity_main.xml and mainActivity.java and have made a function in main activity.java: public void toggleChange(){ //not sure what goes here } i am not sure what to place inside the function and i also not entirely sure that java alone is whats needed. Do i need to change some other XML file i don't know about? thanks for any help. public boolean onCreateOptionsMenu(Menu menu) { final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click // Use attributes of View or cast to Button // to change background / text //v.setText ("Hello Blu"); } }); // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }
upvote count: 0
tagged with: fonts
has comment: http://stackoverflow.com/comment/32403769
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32403826
type: Question
answer count: 2
has title: How can i create a button that changes background and font text?

http://stackoverflow.com/comment/32356645
type: Comment
comment on: http://stackoverflow.com/a/21442494
score: 0
type: AnswerComment
has text: Thanks a lot for this advice finally got me moving in the right direction again!! Really appreciate it.

http://stackoverflow.com/q/21513695
type: Question
tagged with: jpa
accepted answer: http://stackoverflow.com/a/21513785
score: 0
answer count: 2
tagged with: eclipselink
tagged with: sql
has title: Criteria API ignores JOIN
favorite count: 0
has body: I have a simple criteria api query with a (inner) join public void find(Category category) { CriteriaBuilder b = getQueryBuilder(); CriteriaQuery&lt;Product&gt; q = createQuery(); Root&lt;Product&gt; root = q.from(Product.class); Join&lt;Product, Category&gt; myCategory= root.join("category"); q.where(b.equal(myCategory, category)); entityManager.createQuery(q).getResultList(); } The query works, but if I enable in persistence.xml the sql logging I can see that the query is a SELECT * FROM product, category WHERE ... and no SELECT * FROM product join category on category.id = product.category ... Any idea what the reason for this is? The where statement is very slow, so a real join would be really better. I'm using eclipselink 2.5.1, Java EE7 and postgres I also have a superclass from Product @Entity @Audit public class SuperClass {} @Entity @Inheritance(strategy = InheritanceType.JOINED) public class Product extends SuperClass {} But this should be no problem?
has answer: http://stackoverflow.com/a/21513785
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/40808614
upvote count: 1
has answer: http://stackoverflow.com/a/40808614
tagged with: inner-join
downvote count: 1

http://stackoverflow.com/q/21465637
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: encryption
type: Question
score: 3
has comment: http://stackoverflow.com/comment/32395709
upvote count: 3
tagged with: .net
answer count: 1
favorite count: 0
has body: I have a file which is encrypted in .Net. I have to decrypt that file in java. I have key and IV in text file. This file in encrypted using AES, CBC and PKCS7. I was trying to do that using following code. Can any one please help me ? File file = new File("myFile.txt"); String key = readFile(new File("AESKey.bin")); String iv = readFile(new File("AESIV.bin")); final byte[] secretKey = key.getBytes(); final byte[] initVector = iv.getBytes(); InputStream cipherInputStream = null; final StringBuilder output = new StringBuilder(); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secretKey, "AES"), new IvParameterSpec(initVector, 0, cipher.getBlockSize())); cipherInputStream = new CipherInputStream(new FileInputStream(file), cipher); final byte[] buffer = new byte[8192]; int read = cipherInputStream.read(buffer); final String charsetName = "UTF-8"; while (read &gt; -1) { output.append(new String(buffer, 0, read, charsetName)); read = cipherInputStream.read(buffer); } System.out.println(output);* It is giving exception - Exception in thread "main" java.security.NoSuchAlgorithmException: Cannot find any provider supporting AES/CBC/PKCS7Padding. Can any one help me please ?
has answer: http://stackoverflow.com/a/21465931
accepted answer: http://stackoverflow.com/a/21465931
has comment: http://stackoverflow.com/comment/32395563
has title: How to decrypt file in java which is encrypted in .net

http://stackoverflow.com/q/21451454
accepted answer: http://stackoverflow.com/a/21451614
has title: connect sql server JAR file
type: AnsweredQuestion
tagged with: java
has body: I want to connect with SQLServer2012. I got JRE 7 and sqljdbc4.jar. Connection is ok when I start program using eclipse but when I create JAR file connection cannot be done. What should I change? sqljdbc4.jar is added to referenced libraries and jre7\lib. Here is code: String host = textFieldHost.getText(); String instantion = textFieldInstation.getText(); String url = "jdbc:sqlserver://" + host + "\\" + instantion + ":1433;databaseName=db"; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); conn = DriverManager.getConnection(url, textField.getText(), String.valueOf(passwordField.getPassword())); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/32370420
type: Question
has answer: http://stackoverflow.com/a/21451614
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/32370372
tagged with: sql-server
score: 0

http://stackoverflow.com/q/21420888
upvote count: 1
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32316771
has answer: http://stackoverflow.com/a/21420955
has comment: http://stackoverflow.com/comment/32316226
type: Question
has comment: http://stackoverflow.com/comment/32316456
has title: Efficiency of ArrayList
downvote count: 0
has comment: http://stackoverflow.com/comment/32336163
has comment: http://stackoverflow.com/comment/32316095
has body: I am making a program in Java in which a ball bounces around on the screen. The user can add other balls, and they all bounce off of each other. My question lies in the storage of the added balls. At the moment, I am using an ArrayList to store them, and every time the space bar is pressed, a new ball class is created and added to an Array List. Is this the most efficient way of doing things? I don't specify the size of the Array List at the beginning, so is it inefficient to have to allocate a new space on the array every time the user wants a new ball, even if the ball count will get up in the hundreds? Is there another class I could use to handle this in a more efficient manner? Thanks! EDIT: Sorry, I should have been more clear. I iterate through the balls every 30 milliseconds, using nested for loops to see if they are intersecting with each other. I do access one ball the most often (the ball which the user can control with the arrow keys, another feature of the game), but the user can choose to switch control balls. Balls are never removed. So, I am performing some fairly complex calculations (I use my own vector class to move them off of each other every time there is a collision) on the balls very often.
has comment: http://stackoverflow.com/comment/32316107
tagged with: arraylist
has comment: http://stackoverflow.com/comment/32316130
has answer: http://stackoverflow.com/a/21420961
accepted answer: http://stackoverflow.com/a/21420955
has answer: http://stackoverflow.com/a/21420969
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/21420961
has answer: http://stackoverflow.com/a/21420979

http://stackoverflow.com/a/21463490
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32391302
has comment: http://stackoverflow.com/comment/32391917
has body: AppEngine translates your GQL query into a low level Datastore API query. According to the Restrictions on queries Java docs, "Inequality filters are limited to at most one property". This is usually because of index selection. The LIKE operator becomes an inequality filter and cannot apply to both .user and .nameBord properties in the same query.
answers question: http://stackoverflow.com/q/21462633
accepted answer of: http://stackoverflow.com/q/21462633
score: 4
upvote count: 4
type: AcceptedAnswer

jquery
tags question: http://stackoverflow.com/q/21365248
tags question: http://stackoverflow.com/q/21356736
tags question: http://stackoverflow.com/q/21392041
type: Tag
tags question: http://stackoverflow.com/q/21422548
tags question: http://stackoverflow.com/q/21484735
tags question: http://stackoverflow.com/q/21462385
tags question: http://stackoverflow.com/q/21476576
tags question: http://stackoverflow.com/q/21487548
tags question: http://stackoverflow.com/q/21354429
tags question: http://stackoverflow.com/q/21372215
tags question: http://stackoverflow.com/q/21456076
tags question: http://stackoverflow.com/q/21465767
tags question: http://stackoverflow.com/q/21398476
tags question: http://stackoverflow.com/q/21456494
tag name: jquery
tags question: http://stackoverflow.com/q/21432718
tags question: http://stackoverflow.com/q/21420887
tags question: http://stackoverflow.com/q/21480404
tags question: http://stackoverflow.com/q/21378837
tags question: http://stackoverflow.com/q/21449147
tags question: http://stackoverflow.com/q/21437985

http://stackoverflow.com/a/21384167
has body: According to section 8.1.1.3 of RFC 3261, the From header MUST have a tag parameter. This is one of the pieces of data used to identify the dialog. (The others are Call-ID and the tag on the To header, generated by the UAS.) One the examples shown in the RFC is: From: sip:+12125551212@phone2net.com;tag=887s When looking at the SIP message received by the Mobicents container, is there a tag parameter on the From header?
score: 1
has comment: http://stackoverflow.com/comment/32282023
has comment: http://stackoverflow.com/comment/32254508
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21383399
has comment: http://stackoverflow.com/comment/32335632
answers question: http://stackoverflow.com/q/21383399
upvote count: 1

http://stackoverflow.com/comment/32356382
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21443268
score: 0
has text: @AdamGent I'm only timing what is happening within the server code. Yes, the junit start up stuff is slow but I'm not measuring that. Just the time before and after the inserts.

http://stackoverflow.com/a/21511345
score: 0
has comment: http://stackoverflow.com/comment/32477760
has comment: http://stackoverflow.com/comment/32476379
has comment: http://stackoverflow.com/comment/32482300
type: Answer
has comment: http://stackoverflow.com/comment/32484178
has comment: http://stackoverflow.com/comment/32476412
has body: In your code there isn't no method named split , also your didn"t call your method getword inside System.out.println() .... First Class : public class A { public String returnedWord =""; public String getWord(String word , String horizontal) { returnedWord = word +"\n" + horizontal; return returnedWord ; } } the Second Class : public class B { public String word = "Hello"; public String horizontal = "World"; public static void main (String [] args ) { A a = new A(); System.out.println(a.getword(word,horizontal)); } } you will get the output below : Hello World
answers question: http://stackoverflow.com/q/21511133

http://stackoverflow.com/comment/37039814
comment on: http://stackoverflow.com/a/23925730
score: 1
has text: Update: Android 4.4.3 versions: start_Sticky is working. I tested a couple of times it is working on my Nexus 5. I guess the bug has been fixed.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32436466
comment on: http://stackoverflow.com/a/21488929
type: AnswerComment
score: 0
type: Comment
has text: Thank you.. Ranjit pati.

http://stackoverflow.com/q/21490595
answer count: 3
has title: How do I create a method passing an object implements an interface?
favorite count: 0
has answer: http://stackoverflow.com/a/21490631
has body: I have defined an interface like this: public interface InterfaceA { String getMyString(); } And I have two classes that implement the interface: public class MyClassA implements InterfaceA { @Override public String getMyString(){ return "A"; } } public class MyClassB implements InterfaceA { @Override public String getMyString(){ return "B"; } } What I am trying to do is to create a method that accepts an object that implements InterfaceA as an argument and call its getMyString method. Here is some pseudo code that illustrates what I'm trying to accomplish: public String getStringTest(T implements InterfaceA){ return T.getMyString; }
type: UnansweredQuestion
tagged with: interface
upvote count: 1
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21490754
has answer: http://stackoverflow.com/a/21490642
score: 0

http://stackoverflow.com/a/21356159
score: 0
type: Answer
has body: If this is in Eclipse, copy Jsoup.jar in your libs directory, if libs directory doesn't exist, make it yourself. Right click your project -> build path -> configure build path -> Library tab -> add jar -> (find it in your libs) and add away
answers question: http://stackoverflow.com/q/21356059

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/21390830

http://stackoverflow.com/comment/32423914
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21482064
has text: Good catch! Removed them.

http://stackoverflow.com/comment/32273302
has text: Where are your braces? This isn't Python, you know. :P As written, you'll roll one die 36000 times, and then roll the other one once and record that one roll.
score: 3
comment on: http://stackoverflow.com/q/21396226
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32391051
type: QuestionComment
comment on: http://stackoverflow.com/q/21461084
score: 0
has text: if your answer demands you to write too many lines of code, than you`re on the wrong path
type: Comment

http://stackoverflow.com/q/21381355
has comment: http://stackoverflow.com/comment/32275591
has comment: http://stackoverflow.com/comment/32245890
tagged with: eclipse-plugin
favorite count: 0
has title: Add fast view in application workbench and add view in it
tagged with: eclipse-rcp
type: Question
score: 1
has comment: http://stackoverflow.com/comment/32246240
has body: I have rcp application which have several views. I want to add a fast view option as eclipse ide has so that i can poulate all my views in it. I have tried all possible ways which are as follows: add entry in plugin.xml and done changes in applicationworkbenchadvisor @Override public void preWindowOpen(IWorkbenchWindowConfigurer configurer) { configurer.setInitialSize(new Point(1024, 800)); configurer.setShowStatusLine(true); configurer.setTitle("My application"); configurer.setShowFastViewBars(true); } but its not showing not even any exception is throwing. please count what i doing wrong ASAP.
upvote count: 1
tagged with: java
type: UnansweredQuestion
tagged with: perspective
downvote count: 0
answer count: 0

http://stackoverflow.com/comment/32338231
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21432612
has text: It may be helpful to run just the one test in question from the command line with Maven--i.e., mvn -Dtest=TimeScaleUpdTest test
score: 0

http://stackoverflow.com/comment/32335135
has text: `SELECT q FROM Question AS q ORDER BY RANDOM()` but it would return all the rows with random order.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21432078

http://stackoverflow.com/comment/32452190
comment on: http://stackoverflow.com/a/21467021
type: AnswerComment
type: Comment
has text: As simple as: it returns false in all cases.
score: 0

meta-inf
tag name: meta-inf
type: Tag
tags question: http://stackoverflow.com/q/21501621

http://stackoverflow.com/comment/32499415
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21512988
has text: I understand, but you don't have to share any of your work code. Just a simple example with 2-3 form fields is all i need to get an idea..

http://stackoverflow.com/comment/32482189
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21514425
type: AnswerComment
has text: I wanted to use `ImageButton` because it is simple to add an image to it. I am creating a `Class` that extends `RelativeLayout` and inflate the row in its constructor.

http://stackoverflow.com/q/21442295
type: Question
has body: I read on some sites that getting a client's mac address is possible only if he's using explorer browser, or if he's on my the same LAN as me. On other sites I read it's always possible... What are the restrictions of getting a client's mac address through a java applet? (except for signed applet, user's confirmation and setting the manifest to permissions: all-permissions )
has comment: http://stackoverflow.com/comment/32357477
tagged with: applet
has title: getting mac address with java applet
tagged with: mac-address
score: 0
has comment: http://stackoverflow.com/comment/32368450
type: UnansweredQuestion
answer count: 0
tagged with: java

http://stackoverflow.com/q/21403859
upvote count: 1
has answer: http://stackoverflow.com/a/21435266
tagged with: excel
linked to: http://stackoverflow.com/q/3677925
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
has title: Apache Poi Android
type: Question
has answer: http://stackoverflow.com/a/21404046
accepted answer: http://stackoverflow.com/a/21404064
downvote count: 0
has body: I am using Apache Poi in an Android application, but I have a problem with the HSSFWorkbook. I just want to read an Excel file found in the internal memory of the Android tablet. (To display data in Android application) my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { AssetManager assetManager = this.getAssets(); InputStream input = assetManager.open("test42.XLS"); HSSFWorkbook classeur = new HSSFWorkbook(input); //HSSFSheet feuille = classeur.getSheetAt(0); //Cell cell = feuille.getRow(1).getCell(1); //String value = cell.getStringCellValue(); TextView tv = new TextView(this); tv.setText("Test"); setContentView(tv); } catch (IOException e) { e.printStackTrace(); System.out.println("prob"); } } The log : 01-28 14:09:55.036: E/dalvikvm(6919): Could not find class 'org.apache.xmlbeans.XmlOptions', referenced from method org.apache.poi.POIXMLDocumentPart.&lt;clinit&gt; 01-28 14:09:55.036: W/dalvikvm(6919): VFY: unable to resolve new-instance 2751 (Lorg/apache/xmlbeans/XmlOptions;) in Lorg/apache/poi/POIXMLDocumentPart; 01-28 14:09:55.036: D/dalvikvm(6919): VFY: replacing opcode 0x22 at 0x0008 01-28 14:09:55.056: E/AndroidRuntime(6919): FATAL EXCEPTION: main 01-28 14:09:55.056: E/AndroidRuntime(6919): java.lang.ExceptionInInitializerError 01-28 14:09:55.056: E/AndroidRuntime(6919): at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:72) 01-28 14:09:55.056: E/AndroidRuntime(6919): at android.app.Activity.performCreate(Activity.java:5267) 01-28 14:09:55.056: E/AndroidRuntime(6919): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097) 01-28 14:09:55.056: E/AndroidRuntime(6919): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209) 01-28 14:09:55.056: E/AndroidRuntime(6919): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295) 01-28 14:09:55.056: E/AndroidRuntime(6919): at android.app.ActivityThread$H.handleMessage…
possible better answer: http://stackoverflow.com/a/21404046
answer count: 3
has comment: http://stackoverflow.com/comment/32285724
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32285745
tagged with: android
has answer: http://stackoverflow.com/a/21404064

http://stackoverflow.com/comment/32276317
type: AnswerComment
has text: @progricebowl Then use this answer in conjunction with the other: Use instanceof to check what type was returned and cast the number to Float or Integer respectively.
comment on: http://stackoverflow.com/a/21397919
type: Comment
score: 0

http://stackoverflow.com/q/21450456
has comment: http://stackoverflow.com/comment/32369126
linked to: http://stackoverflow.com/q/3231797
answer count: 1
has comment: http://stackoverflow.com/comment/32368813
favorite count: 0
has comment: http://stackoverflow.com/comment/32369488
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10108374
tagged with: maven
has comment: http://stackoverflow.com/comment/32369711
duplicate of: http://stackoverflow.com/q/10108374
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/21450928
downvote count: 1
has body: Creating a test project in Maven. With information from forums/tutorials, i have been able to create the below pom. My requirement is to read command line arguments in a Java method. I found info on the "exec-maven-plugin", but could not get info on how to access these arguments in the Java code? pom.xml 4.0.0 com.test TestProject jar 1.0-SNAPSHOT TestProject http://maven.apache.org org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.codehaus.mojo exec-maven-plugin 1.2.1 java com.test.driver.TestDriver timestamp=023012 currentdate=01292014 net.sourceforge.jexcelapi jxl 2.6.12 com.oracle ojdbc14 10.2.0.2.0 org.testng testng 6.8 org.seleniumhq.selenium.server selenium-server 1.0.3-standalone
type: Question
has title: How to access the command line args passed from Maven in the Java program
upvote count: 0
has comment: http://stackoverflow.com/comment/32369854
score: -1
has comment: http://stackoverflow.com/comment/32368840
has comment: http://stackoverflow.com/comment/32369314

http://stackoverflow.com/comment/32403051
comment on: http://stackoverflow.com/q/21469600
score: 0
type: Comment
has text: There are probably a dozen different ways to do this. Fundamentally you need a list, and probably some concept of error severity, so you know when to simply quit. Lots of choices as to how you structure it, and no real "standards" in that regard.
type: QuestionComment

http://stackoverflow.com/comment/32276372
type: Comment
type: QuestionComment
score: 0
has text: sorry i cant post logcat because its show error on the line not the run time
comment on: http://stackoverflow.com/q/21398021

http://stackoverflow.com/comment/32340090
type: Comment
comment on: http://stackoverflow.com/a/21434609
has text: I heard about ArrayLists, it would eliminate all the null values.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21462133
answers question: http://stackoverflow.com/q/21462094
downvote count: 1
upvote count: 0
score: -1
type: Answer
has comment: http://stackoverflow.com/comment/32477175
has body: A WAR works only when deployed. Deployment occurs by expanding the archive. Probably your server does not perform auto-deploy. If it did, you would see files loaded not from the WAR, but from the expanded directory

http://stackoverflow.com/a/21510685
has comment: http://stackoverflow.com/comment/32475281
answers question: http://stackoverflow.com/q/21510573
score: 31
accepted answer of: http://stackoverflow.com/q/21510573
has comment: http://stackoverflow.com/comment/32475269
type: AcceptedAnswer
downvote count: 0
has body: Firstly, as noted by JB Nizet, don't do this. Very occasionally I'll use a postfix increment within another expression, for thing likes array[index++] = value; but very often I'll pull it out into two statements for clarity. I wasn't going to answer this question, but all the answers (at the time of posting) make the same mistake: this isn't a matter of timing at all; it's a matter of the value of the expression k++. The assignment to i happens after the increment of k - but the value of the expression k++ is the original value of k, not the incremented value. So this code: i = k++; Is equivalent to: int tmp = k; k++; i = tmp; From section 15.14.2 of the JLS (emphasis mine): [...] Otherwise, the value 1 is added to the value of the variable and the sum is stored back into the variable. Before the addition, binary numeric promotion (§5.6.2) is performed on the value 1 and the value of the variable. If necessary, the sum is narrowed by a narrowing primitive conversion (§5.1.3) and/or subjected to boxing conversion (§5.1.7) to the type of the variable before it is stored. The value of the postfix increment expression is the value of the variable before the new value is stored. This difference is very important, and can easily be seen if instead of using the postfix expression for an assignment, you call a method: public class Test { private static int k = 0; public static void main(String[] args) throws Exception { foo(k++); } private static void foo(int x) { System.out.println("Value of parameter: " + x); System.out.println("Value of k: " + k); } } The result is: Value of parameter: 0 Value of k: 1 As you can see, k has already been incremented by the time we call the method, but the value passed into the method is still the original value.
type: Answer
upvote count: 31

http://stackoverflow.com/q/21376281
has comment: http://stackoverflow.com/comment/32236824
score: 0
answer count: 2
has body: I basically have a program that reads grocery items from a file &amp; stores them in a array. It allows for adding of items by the user (name of item, number of items) and deleting of items from the array. However, I'm having issues trying to edit an item in the array? So changing its name and number of items. Here's three of my method codes for add, edit(need help) and delete: /** * ADDS a grocery item to an array */ public static Integer add(String [] list, Integer listSize){ //get item from user Scanner keyboard = new Scanner(System.in); System.out.print("Enter name of item: "); String name = keyboard.nextLine(); System.out.print("Enter number of items: "); String number = keyboard.nextLine(); //add to the end of the array list[listSize] = name + ", " + number; //add one to the size (one item to end of list) return listSize + 1; } /** * EDITS a grocery item to an array * * My steps to take *1: Prompt user for row number to be replaced *2: name of new item *3: number of new items *4: error checking: If the user enters a row number * that does not exist in the list- display error message */ public static Integer edit(String [] list, Integer listSize){ Scanner userInput = new Scanner(System.in); System.out.print("Enter the row number of the item you would like to edit: "); try{ Integer row = userInput.nextInt(); if(row &lt;= 0){ System.out.println("ERROR: The number can't be negative or zero!"); } //check if int is too large else if(row &gt; listSize-1){ System.out.println("ERROR: The number is too big for the list."); } else{ for(int i=row; i&lt;listSize; i++){ list[i] = list[i+1]; } } System.out.print("Enter name of item: "); String name = userInput.nextLine(); System.out.print("Enter number of items: "); String number = userInput.nextLine(); list[listSize] = name + ", " + number; } catch(InputMismatchException exception){ System.out.println("ERROR: You must enter a number to edit an item."); } return listSize ; } /** * DELETES a grocery item from an array */ publ…
has comment: http://stackoverflow.com/comment/32236877
has answer: http://stackoverflow.com/a/21376541
tagged with: arrays
has title: How do I edit a item in an array?
has comment: http://stackoverflow.com/comment/32236951
tagged with: java
has comment: http://stackoverflow.com/comment/32237081
tagged with: printwriter
possible better answer: http://stackoverflow.com/a/21376395
has answer: http://stackoverflow.com/a/21376395
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32236884
tagged with: edit
accepted answer: http://stackoverflow.com/a/21376541

http://stackoverflow.com/comment/32479302
comment on: http://stackoverflow.com/a/21512925
score: 0
type: AnswerComment
type: Comment
has text: thanks I have done that..String t, k;for (Map.Entry<Integer, Integer> entry : result1.entrySet()) {t= entry.getKey().toString() ;k=entry.getValue().toString();abc .callanothermethod(string p1,stringp2, stringj, string t) }

http://stackoverflow.com/a/21400227
downvote count: 0
has body: In unicode, it's CIRCLED LATIN SMALL LETTER I &#9432;, XML &amp;#9432;.
answers question: http://stackoverflow.com/q/21400142
type: Answer
accepted answer of: http://stackoverflow.com/q/21400142
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32283383
type: AcceptedAnswer

http://stackoverflow.com/comment/32404919
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21470539
has text: btw: instead of using substring(i, i+1) in the loop, you can simply use phrase.charAt(i) to iterate over all characters within the string. This approach increases efficiency and readability.
type: Comment

http://stackoverflow.com/comment/32445705
has text: You should profile your code to see where the slowdown is.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21490577

http://stackoverflow.com/comment/32426067
comment on: http://stackoverflow.com/q/21483272
score: 0
type: QuestionComment
type: Comment
has text: I know but the thing I'm sending to uses it I need too

http://stackoverflow.com/comment/32444899
type: Comment
score: 0
has text: With auto boxing, you shouldn't even need to make a new integer object
type: AnswerComment
comment on: http://stackoverflow.com/a/21493314

http://stackoverflow.com/a/21504798
accepted answer of: http://stackoverflow.com/q/21504760
type: Answer
has comment: http://stackoverflow.com/comment/32465156
has comment: http://stackoverflow.com/comment/32465376
has comment: http://stackoverflow.com/comment/32465126
score: 0
has comment: http://stackoverflow.com/comment/32467849
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21504760
has body: For taking input look at the Scanner class. Scanner For adding the values to your arrays just do this: computerBrand[i] = &lt;value_brand&gt;; computerSpeed[i] = &lt;value_speed&gt;; computerPrice[i] = &lt;value_price&gt;; i++; where these 3 values are the one read by the Scanner, and i is some index/counter integer variable. But first make sure you initialize your arrays e.g.: computerBrand = new String[100]; computerSpeed = new double[100]; computerPrice = new double[100];
has comment: http://stackoverflow.com/comment/32465261

http://stackoverflow.com/q/21364904
tagged with: java
has title: Select an Android xml layout element
type: Question
has body: I am trying to make a simple "whack a mole" style game. I am stuck on the first hurdle: I want to (randomly) select, and then change the color of, a button on my layout. I have three buttons on my xml layout: &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="3" &gt; &lt;Button android:id="@+id/button1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="1" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="2" /&gt; &lt;Button android:id="@+id/button3" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="3" /&gt; &lt;/LinearLayout&gt; And, on another (start) button being pressed, I do the following in my java class: protected void pickRandomButton() { // TODO Auto-generated method stub randomButtonId = ""; Random randomGenerator = new Random(); // construct a new random number generator int randomNumber = randomGenerator.nextInt(3); randomButtonId = "button" + (randomNumber +1); Log.d(TAG, randomButtonId, null); Button activeMole = (Button) findViewById(R.id.+"randomButtonId"); activeMole.setBackgroundResource(color.red); } This randomly generates a value between 0 and 2, then I increment by 1 and concatenate it to a string (randomButtonId) in order to create a string which is a randomly selected Id of one of the three buttons. Obviously, the 2nd to last line is not correct, but how do I then select the actual layout element, as I now want to change it's color (the last line)? Any advice greatly received!
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21365035
possible better answer: http://stackoverflow.com/a/21365100
has answer: http://stackoverflow.com/a/21365100
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21365035

http://stackoverflow.com/comment/32401554
has text: @PatGreens In my examples, the call `r.nextInt(26)` is what controls this. The maximum number the `nextInt()` method will return is 25. Then adding 97 yeilds 122. No higher value is possible. In the second code block, it is the array length which controls this. Provided the array is no longer than 26 it won't go past 122
type: AnswerComment
comment on: http://stackoverflow.com/a/21468236
score: 0
type: Comment

http://stackoverflow.com/comment/32474969
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21509969
has text: i'd hope there is the operation like String.format or some RegEX for easily convertion operations[*,+,-].

opencv
type: Tag
tags question: http://stackoverflow.com/q/21416611
tags question: http://stackoverflow.com/q/21484143
tags question: http://stackoverflow.com/q/21417112
tags question: http://stackoverflow.com/q/21405971
tags question: http://stackoverflow.com/q/21465556
tags question: http://stackoverflow.com/q/21364218
tags question: http://stackoverflow.com/q/21511135
tag name: opencv
tags question: http://stackoverflow.com/q/21452206
tags question: http://stackoverflow.com/q/21428793
tags question: http://stackoverflow.com/q/21429455
tags question: http://stackoverflow.com/q/21458255

http://stackoverflow.com/comment/32331027
comment on: http://stackoverflow.com/q/21429621
has text: What is your problem? It works right here. Can you give us the code of `MyCustomObj`? And please display the stack trace.
type: Comment
type: QuestionComment
score: 2

if-statement
tags question: http://stackoverflow.com/q/21370661
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/21356277
tags question: http://stackoverflow.com/q/21442302
tags question: http://stackoverflow.com/q/21417360
tags question: http://stackoverflow.com/q/21391367
tags question: http://stackoverflow.com/q/21491700
tags question: http://stackoverflow.com/q/21461732
tags question: http://stackoverflow.com/q/21416886
tags question: http://stackoverflow.com/q/21447350
tags question: http://stackoverflow.com/q/21473142
tags question: http://stackoverflow.com/q/21403084
tags question: http://stackoverflow.com/q/21510752
tags question: http://stackoverflow.com/q/21474140
tags question: http://stackoverflow.com/q/21434078
tags question: http://stackoverflow.com/q/21489908

http://stackoverflow.com/q/21402268
has body: I am trying to print the non repeated values when user enter some numbers it should display the numbers which are not duplicate. i am getting all the values and my program is as below public class Compare { public static void main(String[] args){ Scanner sc= new Scanner(System.in); System.out.println("enter the string:"); int[] array = new int[7]; for (int i=0; i&lt;array.length;i++) { array[i] = Integer.parseInt(sc.nextLine()); } for (int i = 0; i &lt; array.length; i++) { boolean found = false; for (int j = i+1; j &lt; array.length; j++) if (array[i] == array[j]) { found = true; break; } if(!found) System.out.println(array[i]); } } }
accepted answer: http://stackoverflow.com/a/21402575
type: Question
has answer: http://stackoverflow.com/a/21402422
has title: Trying to Identify the non repeating values from the console and print the non-repeating values to output
has answer: http://stackoverflow.com/a/21402576
has answer: http://stackoverflow.com/a/21402575
has answer: http://stackoverflow.com/a/21402370
score: 0
possible better answer: http://stackoverflow.com/a/21402370
answer count: 4
has comment: http://stackoverflow.com/comment/32283142
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21423359
has comment: http://stackoverflow.com/comment/32320390
type: Question
linked to: http://stackoverflow.com/q/20683098
tagged with: javascript
has body: How to get more than 64 result using google map api var restName="Pizza hut"; function initialize() { var pyrmont = new google.maps.LatLng(19.125362 , 72.866467);//var pyrmont = new google.maps.LatLng(-33.8665433, 151.1956316); map = new google.maps.Map(document.getElementById('map-canvas'), { mapTypeId: google.maps.MapTypeId.ROADMAP, center: pyrmont, zoom: 0 }); var request = { location: pyrmont, radius: 50000, types: ['restaurant'], input: [restName] }; placesList = document.getElementById('places'); var service = new google.maps.places.PlacesService(map); service.textSearch(request, callback); But it gives me only 64 result using pagination. how to get all country result?
tagged with: google-maps-api-3
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 1
upvote count: 0
has title: How to get more than 64 result from google map api
has answer: http://stackoverflow.com/a/21423865
tagged with: java
score: -1

http://stackoverflow.com/comment/32349416
type: Comment
comment on: http://stackoverflow.com/a/21439764
has text: That's the fact of the *what* - but the question asks *why*. I agree it's hard to find a reason here - but that just means we don't know the answer to the question that was asked...
score: 0
type: AnswerComment

http://stackoverflow.com/a/21503257
has body: Well since you're using List interface Its probably has assigned an ArrayList to it. So first of all you gotta convert it to String. String unSort = getDataList.toString(); String Sort[] = unSort.split(","); String noComma = Sort.toString(); This will solve your comma seperation problem, you can further split the sorted text by using some other regexes like ":" or any other. String noColon[] = noComma.split(":");
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21503160
downvote count: 0

http://stackoverflow.com/comment/32351419
type: Comment
has text: I got lost when the bitwise OR operation begins. I am having difficulty following after that.why do you set s = s1 | s2. and I guess the runtime is still O(n)
comment on: http://stackoverflow.com/a/21440781
score: 0
type: AnswerComment

http://stackoverflow.com/a/21455557
type: Answer
has body: Create your own com.google.api.client.auth.oauth2.BearerToken class and ensure the JAR/WAR/folder where it is located is in the ClassPath before the original library. Thus you may slip it under. I believe even the original library might use it. (Please check it out.) Note: you may create a class in the same package but in another physical folder/directory. Thus you may e.g. access package private (default access) fields in someone else's packages. When JVM searches during runtime for the classes to be loaded, it searches the class path in the given order. The first occurrence of the class is used.
answers question: http://stackoverflow.com/q/21412090
score: 0

http://stackoverflow.com/a/21438755
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32349306
accepted answer of: http://stackoverflow.com/q/21435990
has comment: http://stackoverflow.com/comment/32348178
answers question: http://stackoverflow.com/q/21435990
score: 15
has body: I found a solution to the problem. It turns out that the Log4j 2 Configuration doesn't document all the required dependencies: The JSON support uses the Jackson Data Processor to parse the JSON files. These dependencies must be added to a project that wants to use JSON for configuration: com.fasterxml.jackson.core jackson-core 2.8.7 com.fasterxml.jackson.core jackson-databind 2.8.7 com.fasterxml.jackson.core jackson-annotations 2.8.7
upvote count: 15
has comment: http://stackoverflow.com/comment/103118660

ide
tags question: http://stackoverflow.com/q/21445570
tags question: http://stackoverflow.com/q/21401438
tags question: http://stackoverflow.com/q/21485683
tag name: ide
tags question: http://stackoverflow.com/q/21419367
type: Tag
tags question: http://stackoverflow.com/q/21446481

http://stackoverflow.com/a/21710991
upvote count: 4
downvote count: 0
score: 4
has body: Ok we learned a couple of things. First, we switched to using an external instance of ActiveMQ, instead of relying on the embedded one inside TomEE. You must start the broker first, before start TomEE, or TomEE will create an internal broker on startup and you'll be scratching your head going gee why aren't any messages processing. You then connect TomEE to the broker by setting BrokerXmlConfig = and ServerUrl = tcp://localhost. Next, we switched to using the activemq http transport. This completely negates any network disconnect problems, since http is stateless. It is VERY slow however relative to tcp/ssl, but the message transport is not the slowest point in our system so it doesn't matter anyway. You MUST have the external broker listen on both http and tcp since TomEE connects via TCP and the remote broker connects via http. These two things fixed our problems and we have a completely solid system running now. I hope this helps someone!!
accepted answer of: http://stackoverflow.com/q/21470045
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21470045
has comment: http://stackoverflow.com/comment/106879546
type: Answer

http://stackoverflow.com/a/21418541
answers question: http://stackoverflow.com/q/21418275
has comment: http://stackoverflow.com/comment/32311970
type: Answer
score: 2
upvote count: 2
has body: According to Oracle, this is a bug (BUG-6362104): JDBC driver throws MalformedObjectException or InstanceAlreadyExistsException when loading. . Try to download again the drivers from OTN. If you want to know whether you have the patched jar or not run: java -jar ojdbc6.jar The unpatched jar prints Oracle 11.1.0.6.0-Production JDBC 5.0 complied with JDK1.6 and the patched jar prints Oracle 11.1.0.6.0-Production+ JDBC 5.0 complied with JDK1.6 Just be sure that you have the latest JDBC driver available for your Oracle DB version.
downvote count: 0

http://stackoverflow.com/comment/32463239
type: QuestionComment
has text: maybe I am doing something wrong, where should i be placing the array list? I know it should be outside my method, so is there a particular place where it needs to be or is anywhere fine? @mikeyaworski
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21502742

http://stackoverflow.com/comment/32302994
comment on: http://stackoverflow.com/a/21413428
score: 0
type: Comment
type: AnswerComment
has text: Thanks for your input, will test it right now, since it still returning `true`, while it is not.

http://stackoverflow.com/comment/61253643
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21427956
has text: sessions are suitable only for requests within the same controller class.

http://stackoverflow.com/q/21407190
tagged with: java-8
type: AnsweredQuestion
score: 2
downvote count: 0
has body: I have the following code: List&lt;Person&gt; personList = getPersons(); List&lt;Function&lt;List&lt;Person&gt;, Stream&lt;Person&gt;&gt;&gt; streams = new ArrayList&lt;&gt;(); streams.add(p -&gt; p.stream()); streams.add(p -&gt; p.parallelStream()); Intellij Idea suggests I should replace the lambda expressions to method references. I'd like to do so, only I'm not sure what should be the new generic type of the streams list. I tried to evaluate the expression personList::stream but I get "No such instance field: 'stream'". If I try List::stream or ArrayList::stream (The concrete type of the person list) I get: "No such static field: 'stream'". Is there a way to add method references to a list? if so what should be the list's generic type? Thanks As assylias pointed out, IDEA was just complaining and the code ran without problem, I still had problems with the same code in IDEA 13 since streams.add expected a function that returns Stream and List::stream returns Stream. To solve it I ended up using the following code: List&lt;Person&gt; personList = getPersons(); List&lt;Supplier&lt;Stream&lt;Person&gt;&gt;&gt; streams = new ArrayList&lt;&gt;(); streams.add(personList::stream); streams.add(personList::parallelStream);
tagged with: method-reference
tagged with: java
type: Question
has title: What is the class of method references?
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/21409879
possible better answer: http://stackoverflow.com/a/21427780
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/21409879
favorite count: 0
has answer: http://stackoverflow.com/a/21427780

http://stackoverflow.com/a/21494340
has comment: http://stackoverflow.com/comment/56782223
score: 84
has body: A button is simply an actor in libgdx. To render an actor you use a stage that contains all the actors of the screen, renders them and updates them. I assume you want a button with text, so you should use the class TextButton and add it to a stage. A TextButton takes a string to render and a ButtonStyle, in this case a TextButtonStyle, which is basically a class that contains all the information about the button (font, drawable to render while not pressed, drawable to render while pressed etc). public class ButtonExample extends Game{ Stage stage; TextButton button; TextButtonStyle textButtonStyle; BitmapFont font; Skin skin; TextureAtlas buttonAtlas; @Override public void create() { stage = new Stage(); Gdx.input.setInputProcessor(stage); font = new BitmapFont(); skin = new Skin(); buttonAtlas = new TextureAtlas(Gdx.files.internal("buttons/buttons.pack")); skin.addRegions(buttonAtlas); textButtonStyle = new TextButtonStyle(); textButtonStyle.font = font; textButtonStyle.up = skin.getDrawable("up-button"); textButtonStyle.down = skin.getDrawable("down-button"); textButtonStyle.checked = skin.getDrawable("checked-button"); button = new TextButton("Button1", textButtonStyle); stage.addActor(button); } @Override public void render() { super.render(); stage.draw(); } } So whats happening here? I am creating a stage, a font and a textureatlas with all the textures for the buttons in "buttons.pack". Then I initialize an empty TextButtonStyle and and i add the font and the textures for the up, down and checked states. font, up, down and checked are all static variables of type Drawable so you can really pass it any kind of Drawable (texture, 9-patch etc). Then simply add the button to the Stage. Now in order to do something when the button is actually clicked, you have to add a listener to the button, a ChangeListener. button.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { System.out.println("Button Pressed"); } }); Of co…
type: Answer
downvote count: 0
upvote count: 84
has comment: http://stackoverflow.com/comment/40164026
has comment: http://stackoverflow.com/comment/32451663
has comment: http://stackoverflow.com/comment/40080379
answers question: http://stackoverflow.com/q/21488311
has comment: http://stackoverflow.com/comment/47864465
accepted answer of: http://stackoverflow.com/q/21488311
type: AcceptedAnswer

http://stackoverflow.com/q/21499501
has title: JavaFX classes are not recognised in Eclipse
has body: I am a relative newbie to programming, I have a bit of experience building Swing apps and I now want to try my hand at learning JavaFX. I am using Eclipse Kepler as my IDE. I understood from the JavaFX website that JavaFX is included in the JDK7 - Quote: "The first step in getting started with JavaFX is to download and install the Java SE 7 JDK, which includes the JavaFX runtime libraries and utilities. See the JDK 7 and JRE 7 Installation Guide for instructions." However, when I try to import the Oracle JavaFX HelloWorld example (http://docs.oracle.com/javafx/2/get_started/hello_world.htm) into an Eclipse project I get errors on the JavaFx package imports. The only suggestions I get are to create new classes etc or 'search repositories for javafx.application' Does this mean that Eclipse does not support JavaFX out of the box? So my question to the community is two-fold: 1. please explain how to use JavaFX working in Eclipse. I checked out other answers which seem to indicate that I should install f(x)eclipse. But... before you tell me that this is a duplicate question, my second question is please also help me understand how, when Oracle say that JavaFX is included in JDK7, it is not possible to import those packages regardless of the IDE (just like it is possible with Swing). Thanks
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/21499658
tagged with: eclipse
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21523041
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21523041
has comment: http://stackoverflow.com/comment/32455298
has comment: http://stackoverflow.com/comment/32455217
has answer: http://stackoverflow.com/a/21499658
favorite count: 0
answer count: 2
upvote count: 1

http://stackoverflow.com/a/76175983
upvote count: 6
type: Answer
score: 6
downvote count: 0
answers question: http://stackoverflow.com/q/21441827
has body: Its simple For converting json string to class type use readValue For converting object type to class type use convertValue On printing, object looks like this SampleClass(id=61, applicationReference=AP251, accountId=fghsdjffhhjf) On printing, jsonString a looks like this {"method":"POST","url": "xyz.com"}

http://stackoverflow.com/comment/32329085
type: QuestionComment
has text: possible duplicate of http://stackoverflow.com/questions/215497/in-java-whats-the-difference-between-public-default-protected-and-private
comment on: http://stackoverflow.com/q/21428595
score: 0
type: Comment

http://stackoverflow.com/comment/32432571
type: QuestionComment
has text: That would explain a lot. The textbook claims to be updated for Java 1.6, but maybe not all of it got updated...
comment on: http://stackoverflow.com/q/21486900
score: 0
type: Comment

http://stackoverflow.com/comment/32591517
type: Comment
comment on: http://stackoverflow.com/a/21571857
type: AnswerComment
has text: Thanks. And sorry, I missed the last two comments. Still - if you really want to rely on this behavior (i.e. that subclasses in other packages are unable to overwrite the protected field), then you must somehow enforce, that subclasses cannot be declared in the same package. Not sure if this is possible to do for compile time checks though...
score: 0

http://stackoverflow.com/comment/32407292
has text: That is wicked retarded. If you have an explanation as to why that happens, I'd love to hear.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21472202
type: AnswerComment

http://stackoverflow.com/comment/32194334
type: Comment
type: QuestionComment
score: 2
has text: I'm curious why don't you want to use string?
comment on: http://stackoverflow.com/q/21352751

http://stackoverflow.com/comment/32319646
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21422787
type: AnswerComment
has text: That seems like a broader question, so if you want more information on it, you should probably open a new question on that subject rather than handling it here in comments.

http://stackoverflow.com/a/21401898
type: Answer
downvote count: 0
score: 1
has body: There is no standard Java API to do this. You could identify an (operating system specific!!) external command to do this, and then invoke that command using Runtime.exec(...) or equivalent. However, I think you are better off doing this directly; e.g. by running commands from the command line by hand. Tinkering around with system account passwords in a program: requires elevated privilege, and programs that can elevate their privilege are a bad idea, is potentially dangerous, since if the program messed it could effectively disable the account. (Exactly how dangerous that is depends on the importance of the account, and whether there are easy ways to undo the damage.)
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21401276
answers question: http://stackoverflow.com/q/21401276

http://stackoverflow.com/comment/32371477
has text: Allright, so you don't use a stage. But how can I add buttons without a stage? Or is it possible to have a stage that only covers parts of the screen?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21444289

http://stackoverflow.com/comment/32266772
type: QuestionComment
has text: The contract for `hashCode()` states: "If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.". If you're implementing `equals()` but not `hashCode()`, you're likely breaking that contract.
type: Comment
comment on: http://stackoverflow.com/q/21392523
score: 0

http://stackoverflow.com/comment/32413974
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21475917
has text: check for java.exe,javaw.exe java applications.

http://stackoverflow.com/q/21500692
has title: What is causing a broken class on re-build of mixed Scala/Java project?
has body: I'm working on a mixed Scala/Java project. I receive this broke class in Eclipse "problem" tab everytime I re-build the Scala code : Description Resource Path Location Type error while loading JsonSerialize$Inclusion, class file 'C:\Users\Adrian\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar(org/codehaus/jackson/map/annotate/JsonSerialize$Inclusion.class)' is broken (class java.lang.UnsupportedOperationException/addChild inapplicable for &lt;none&gt;) rec-manager Unknown Scala Problem Description Resource Path Location Type error while loading org.codehaus.jackson.map.annotate., class file 'C:\Users\Adrian\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar(org/codehaus/jackson/map/annotate/JsonSerialize$Inclusion.class)' is broken (class java.lang.UnsupportedOperationException/addChild inapplicable for &lt;none&gt;) rec-manager Unknown Scala Problem This issue does not occur when I re-build the Java portion of the code base. The class does not seem to broken as all is fine when I re-build the Java code.What could be causing this issue ? If I perform a clean rebuild of the entire project then the issue does not occur.
tagged with: java
tagged with: m2e
type: Question
has comment: http://stackoverflow.com/comment/32457380
has answer: http://stackoverflow.com/a/21501272
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21504903
type: UnansweredQuestion
tagged with: scala
tagged with: maven

http://stackoverflow.com/q/21399359
has comment: http://stackoverflow.com/comment/32344733
type: Question
has body: I have to take input from a user in a single line separated by commas. I have saved that input in an array list. Now I want to search that data in the manner below ... How can it be done? I want to search in this manner: Enter any alphabet from A – Z: &lt;A&gt; Please select a range: Aa-Ac | Ad-Ad | Ae-Al | Am-Am | An-Ao | Ap-Ar | As-At | Au-Aw | Ax-Az &lt;Aa-Ac&gt; A-> Aa-Ac: now data with in this range will be printed. Here is what I have already done import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Scanner; import java.util.concurrent.TimeUnit; import javax.lang.model.element.Element; public class practice { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { System.out.println(" Welcome to Your Own A-Z Drug Guide"); System.out.println("Press 1 to enter new drugs"); System.out.println("Press 2 for browsing"); System.out.println("Press 3 for exiting"); int choice = sc.nextInt(); switch(choice){ case 1: System.out.println("Please enter drugs name"); String drugsName = sc.next(); String[] drugs = drugsName.split("\\,"); Arrays.sort(drugs); List&lt;String&gt; list = Arrays.asList(drugs); System.out.println(list); System.out.println(matches(list, "aa")); break; case 2: System.out.println(" Enter any alphabet from A – Z:"); String alphabet = sc.nextLine(); System.out.println("Please select a range"); if(alphabet=="a"){ System.out.println("Aa-Ac | Ad-Ad | Ae-Al | Am-Am | An-Ao | Ap-Ar | As-At | Au-Aw | Ax-Az"); String range = sc.nextLine(); //System.out.println(matches(list, "aa")); break; } } } public static List&lt;String&gt; matches (List&lt;String&gt; dataList, String matchStr){ List&lt;String&gt; result = new ArrayList&lt;String&gt;(); if (matchStr != null) { matchStr = matchStr.toLowerCase(); for(String d : d…
score: 0
tagged with: java
has title: how to retrieve data from array list in desired manner
has comment: http://stackoverflow.com/comment/32278151
has comment: http://stackoverflow.com/comment/32278380
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21355868
has body: When you rotate your phone, it destroys the activity and creates again but it saves everything to resume, onCreate() method you create textviews again although they are already in the view. You should check them before create. You can do that by checking savedInstanceState, if it's not null, that means it's being recreated again. if (savedInstanceState == null){ // create your textviews }
accepted answer of: http://stackoverflow.com/q/21353704
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21353704
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/67683655
score: 0
type: Comment
has text: My `.properties` file is loaded at startup through spring and I've added the property as a `-D` parameter when starting tomcat, but it doesn't work. Any idea what's going wrong ?
comment on: http://stackoverflow.com/a/24941318
type: AnswerComment

http://stackoverflow.com/comment/32208006
type: AnswerComment
comment on: http://stackoverflow.com/a/21356043
type: Comment
has text: and how do you plan to deal with recursion if you keep doing getString? The whole point is recursing through an object..when a getObject throws exception..means its a String..which is when I am doing a getString..
score: 0

http://stackoverflow.com/q/21484886
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 1
tagged with: stack-overflow
score: 0
tagged with: sockets
has body: I am making a simple client-server messenger pair with Sockets and JSwing, and I have recently run into a StackOverflow error. I know(or at least think) that it's caused by a recursive functon(which I don't think I have, but I may) that doesn't have a correct termination condition(does this mean like a return; in a switch statement?) Here's some of the error(since it's a StackOverflow, it repeats itself, of course) Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at java.util.HashMap.getEntry(Unknown Source) at java.util.HashMap.get(Unknown Source) at sun.awt.AppContext.get(Unknown Source) at com.sun.java.swing.SwingUtilities3.getDelegateRepaintManager(Unknown Source) at javax.swing.RepaintManager.getDelegate(Unknown Source) at javax.swing.RepaintManager.addDirtyRegion(Unknown Source) at javax.swing.JComponent.repaint(Unknown Source) at java.awt.Component.repaint(Unknown Source) at javax.swing.JComponent.setBackground(Unknown Source) at javax.swing.LookAndFeel.installColors(Unknown Source) at javax.swing.LookAndFeel.installColorsAndFont(Unknown Source) at javax.swing.plaf.basic.BasicPanelUI.installDefaults(Unknown Source) at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source) at javax.swing.JComponent.setUI(Unknown Source) at javax.swing.JPanel.setUI(Unknown Source) at javax.swing.JPanel.updateUI(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JPanel.&lt;init&gt;(Unknown Source) at javax.swing.JRootPane.createGlassPane(Unknown Source) at javax.swing.JRootPane.&lt;init&gt;(Unknown Source) at javax.swing.JFrame.createRootPane(Unknown Source) at javax.swing.JFrame.frameInit(Unknown Source) at javax.swing.JFrame.&lt;init&gt;(Unknown Source) at Socket_Swing_Database_Test.SocketManager.&lt;init&gt;(SocketManager.java:9) at Socket_Swing_Database_Test.ClientSwing.&lt;init&gt;(ClientSwing.java:6) at Socket_Swing_Database_Test.SocketManager.&lt;init&gt;(SocketMana…
tagged with: swing
type: AnsweredQuestion
has title: Java Swing & Socket Messenger StackOverflow Error
tagged with: java
has answer: http://stackoverflow.com/a/21485137
accepted answer: http://stackoverflow.com/a/21485137

http://stackoverflow.com/q/21480414
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has title: Why does this headset detection code execute twice?
type: UnansweredQuestion
has body: I've found several similar examples of headset state detection all using a switch to determine the state of the ACTION_HEADSET_PLUG broadcast. I'm using this code in a service to trigger some other code when a headset is plugged in. The following example does indeed detect the correct headset state but for some reason seems to run twice..ie. when I plug the headset in I get two "Headset is plugged" log messages in a row and another two "Headset was unplugged" when I unplug. Any code I drop in the switch statement also gets called twice. I don't understand why this is so. How can change this so my code is only called once? public class HeadsetObserverService extends Service { private static final String TAG = "HeadsetObserverService"; @Override public IBinder onBind(Intent arg0) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { // Create a filter. We are interested in the Intent.ACTION_HEADSET_PLUG action IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_HEADSET_PLUG); // Register a new HeadsetReceiver registerReceiver(new HeadsetReceiver(), filter); // We return START_STICKY. If our service gets destroyed, Android will try to restart it when resources are available. return START_STICKY; } private class HeadsetReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_HEADSET_PLUG)) { int state = intent.getIntExtra("state", -1); switch (state) { case 0: Log.d("unplugged", "Headset was unplugged"); // Cancel notification here break; case 1: Log.d("plugged", "Headset is plugged"); // Show notification break; default: Log.w("uh", "I have no idea what the headset state is"); } } } } }
tagged with: android
linked to: http://stackoverflow.com/q/4092438
has answer: http://stackoverflow.com/a/21480745
upvote count: 1
tagged with: android-intent
type: Question

http://stackoverflow.com/comment/70121096
score: 0
type: Comment
type: QuestionComment
has text: @SurajMenon - Would you care to share what was wrong? I am in similar situation
comment on: http://stackoverflow.com/q/21406745

http://stackoverflow.com/a/22400502
score: 0
answers question: http://stackoverflow.com/q/21413526
type: Answer
has comment: http://stackoverflow.com/comment/34069363
has body: Just posted this that may help you as was faced with the same issues you describe in your quetion - Is real time change feedback with Spring/Tomcat/Intellij possible?

http://stackoverflow.com/q/21409774
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: liquibase
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/21458405
has comment: http://stackoverflow.com/comment/32309137
has title: Liquibase + Maven: How to keep both testing DB and developing DB updated during mvn build?
downvote count: 0
answer count: 1
has body: I am very new using liquibase. I have a JSP web application (no framework used), and I use a mysql db schema for testing and other one for developing. I want to know how can I configure liquibase maven plugin to update both DB's on building time.
favorite count: 0
linked to: http://stackoverflow.com/q/9606585
has answer: http://stackoverflow.com/a/21458405
tagged with: maven

http://stackoverflow.com/comment/32224494
type: Comment
comment on: http://stackoverflow.com/a/21369422
has text: How do I do this? If I write Clip clip = AudioSystem.getClip( ); It doesnt recognize it as an object. How is the object declared?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32455979
comment on: http://stackoverflow.com/a/21498995
has text: Hovercraft, I deleted some of my comments to prevent this from flooding this chat. Also, I had several goes and I came to this but it is not properly. (edited my code).
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21363115
has answer: http://stackoverflow.com/a/21364211
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32212895
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21363424
has comment: http://stackoverflow.com/comment/32212910
type: Question
has body: My Code is: Set&lt;String&gt; s1=new TreeSet&lt;String&gt;(); s1.add(name); s1.add(gender); s1.add(dob); How to read these variables and write it to a file? Should i use Buffered Reader and Buffered Writer??
downvote count: 0
tagged with: data-structures
answer count: 3
has answer: http://stackoverflow.com/a/21363304
has title: How to read contents from TreeSet and Write to file?
favorite count: 0
has comment: http://stackoverflow.com/comment/32212812

http://stackoverflow.com/q/21468814
has answer: http://stackoverflow.com/a/21516147
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21630474
has title: Custom view isn't being restored after adding it to a layout from AsyncTask's onPostExecute()
has body: I've written a pretty large custom view which overrides onSaveInstanceState() and onRestoreInstanceState(Parcelable state). I wanted to populate a LinearLayout with my custom view, so I wrote the following code: public class MainActivity extends Activity { private LinearLayout mRootLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mRootLayout = (LinearLayout) findViewById(R.id.root_layout); int i; // Test: adding 10 instances of MyCustomView. for (i = 0; i &lt; 10; ++i) { MyCustomView cv = new MyCustomView(this); // I set an ID for this view so that onSaveInstanceState() and // onRestoreInstanceState(Parcelable state) will be called // automatically. cv.setId(++i); mRootLayout.addView(cv); } } // ... } It works fine - mRootLayout is indeed being populated with 10 instances of MyCustomView, and each instance of MyCustomView is being properly restored after, for example, screen rotation. I've noticed that due to the fact that MyCustomView is pretty large, my code is being heavy on the UI thread. To solve the issue and take some effort off of the UI thread, I decided to use a custom AsyncTask, which will create an instance of MyCustomView in doInBackground() and add it to the the main layout ( mRootLayout ) in onPostExecute(). The following code is my custom AsyncTask: private class LoadMyCustomViewTask extends AsyncTask&lt;Void, Void, MyCustomView&gt; { private Context mContext; private LinearLayout mLayoutToPopulate; private int mId; public LoadMyCustomViewTask(Context context, LinearLayout layout, int id) { mContext = context; mLayoutToPopulate = layout; mId = id; } @Override protected MyCustomView doInBackground(Void... params) { MyCustomView cv = new MyCustomView(mContext); return cv; } @Override protected void onPostExecute(MyCustomView result) { result.setId(mId); mLayoutToPopulate.addView(result); } } In MainActivity I use it as follows: public class MainActivity ex…
score: 1
tagged with: multithreading
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21630474
downvote count: 0
has answer: http://stackoverflow.com/a/21517771
favorite count: 0
tagged with: android-asynctask
possible better answer: http://stackoverflow.com/a/21516147
tagged with: android
has answer: http://stackoverflow.com/a/21612990

http://stackoverflow.com/comment/32208194
has text: it depend on whether the resource is required for user's request. If it is required, you can throws exception. If it is not required, you can catch the exception and output it in log file. You can also set an flag in your code and set it false when resource failed to initialized. The latter request will judge the flag. If it is false, it will skip the code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21360358

http://stackoverflow.com/q/21414435
has answer: http://stackoverflow.com/a/21416655
tagged with: macos
score: 2
has comment: http://stackoverflow.com/comment/34531696
type: AnsweredQuestion
has body: I am having no luck using the clipboard to copy/paste text between other applications and JMeter or vice-versa. I am able to copy-paste text and test elements within JMeter. I'm running JMeter 2.11 via the binary distribution by running 'bin/jmeter.sh' on OS X 10.9.1 running Java 1.7.0_45. I have attempted to use the clipboard with System and Mac OS X look-and-feels, per this previous question: Strangely copying and pasting a text in Jmeter is not working for in Mac I have also attempted, with no luck, this procedure to grant system clipboard permission to AWT: http://www.shodor.org/interactivate/resources/InstructionsCopyPaste/ Any advice on what I can do to get JMeter to share a clipboard with the rest of the system?
tagged with: jmeter
downvote count: 0
tagged with: clipboard
has answer: http://stackoverflow.com/a/27555449
accepted answer: http://stackoverflow.com/a/27555449
has answer: http://stackoverflow.com/a/23483327
type: Question
has answer: http://stackoverflow.com/a/21496846
tagged with: copy-paste
tagged with: java
possible better answer: http://stackoverflow.com/a/21416655
has title: Copy/Paste fails on MacOsX in JMeter
upvote count: 2
has comment: http://stackoverflow.com/comment/32440681
has answer: http://stackoverflow.com/a/70516128
favorite count: 0
linked to: http://stackoverflow.com/q/14986692
answer count: 5

http://stackoverflow.com/comment/32477662
has text: Advisable would be to use `setInexactRepeating` for `API-19` or `setRepeating` instead of `set`. Also you must wake the `CPU` by acquiring a `wakeLock`. Do consider alarms are wiped off after reboot, you must include a `boot broadcast listener` from your `Manifest.xml` Further reading: http://developer.android.com/training/scheduling/alarms.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21511941

http://stackoverflow.com/q/21411981
favorite count: 0
tagged with: android
answer count: 1
has body: The problem i am having is that i have a time string which is represented in terms of "hh:mm:ss" and the server only accepts float numerical for the time (this is beyond my control). Currently i am removing all ':' characters from the String, so for example "11:23:23" becomes "112323". With the "new" String i can then convert it to a number representation for example: int x = Integer.parseInt("112323); This will produce the integer value 112323. Now, my problem is because it is a timer, sometimes the time represented in the String is quite low. If i had the time string "00:00:01" and removed the ':' characters it would produce the integer value 1. This is because if am not mistaken, the integer value 000001 will be "trimmed" as the 0's do not change the value of the integer so the value 1 is returned. Is there a way to specify that i want to display the full 6 digits regardless of the fact they maybe "insignificant" in terms of the number value? my code: String timeTrimmed = pois.get(i).getTimeStamp().replaceAll(":",""); int result = Integer.parseInt(timeTrimmed); is it possible to do something like this: String timeTrimmed = pois.get(i).getTimeStamp().replaceAll(":",""); int result = Integer.parseInt(######,timeTrimmed); with the # representing the fact i want the integer to keep all the digits? I hope you understand what i mean, Cheers, Chris.
has comment: http://stackoverflow.com/comment/32300334
has comment: http://stackoverflow.com/comment/32300543
has comment: http://stackoverflow.com/comment/32300498
has title: Android (Java) convert a hh:mm:ss time String into a number representation
has answer: http://stackoverflow.com/a/21412249
upvote count: 1
has comment: http://stackoverflow.com/comment/32300495
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21412249
type: Question
has comment: http://stackoverflow.com/comment/32300645
has comment: http://stackoverflow.com/comment/32300447
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/32300548

http://stackoverflow.com/comment/32365331
comment on: http://stackoverflow.com/q/21448328
score: 1
has text: @Jayasagar: I don't know how to answer that question. Those functions can't be implemented in pure Java because if you try it, you won't be able to.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21364012
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21363175
has comment: http://stackoverflow.com/comment/32218075
answers question: http://stackoverflow.com/q/21363175
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32218216
has comment: http://stackoverflow.com/comment/32218151
has body: Is there are way I can achieve this? You would need to create your own doclet by subclassing the default one, a brief look through the relevant source code suggests that you would just need to provide your own subclass of ConstantsSummaryWriterImpl whose getValue(FieldDoc) method is overridden to use member.constantValue() in place of member.constantValueExpression(). To wire this writer in at the appropriate place you would then also need to subclass HtmlDoclet and override configuration() to return your own subclass of ConfigurationImpl which in turn returns your own subclass of WriterFactoryImpl which in turn returns your custom constants writer, and finally use the -doclet option to javadoc to tell it to use your custom doclet instead of the standard one.
type: AcceptedAnswer

http://stackoverflow.com/q/21362530
has comment: http://stackoverflow.com/comment/32229106
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/32235923
has body: I've seen this asked a lot, but no definitive answers, i DON'T want to use Java Web Start, I need my program to run inside the browser, as a Applet, but when i coded it i made it using a JFrame so i could text it and execute it from any PC, now i need to embed it into my page, is there anything i can do to "wrap" my current executable .jar in a applet so i can embed it. or would it require i rebuild my entire program? I have tried Java Web Start already and it doesn't suit my needs. Thank you for any help you can provide
score: 0
tagged with: japplet
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21371970
tagged with: swing
has comment: http://stackoverflow.com/comment/32211876
tagged with: java
has title: Wrapping a JFrame in a JApplet?
type: Question

http://stackoverflow.com/q/21449995
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21450707
tagged with: php
type: Question
has comment: http://stackoverflow.com/comment/32405452
tagged with: java
has body: I own a sports apparel company and I'm looking to have an applet built that will allow customers to see how their team names will look in certain colors on jerseys. Below you can see the final result of a competitor site's Flash applet where text is rendered on 2D surfaces/images. My requirements: I need users to be able to set the font, primary text color, outline text color, and text style (arched or straight). So my question-- Is this sort of text rendering possible with only Javascript/PHP? If so, what limitations do you for see? I've been told the arching and outline text color may be issues. I've also been told that I may have to upload library files to a server where the actual rendering may take place. If not, what scripting would you guys recommend? I'm trying to stay away from Flash because it's slow and costly. I'll be passing this onto our developers so please feel free to be as detailed as possible. I figure'd I'd save them some leg work! Thank you!
answer count: 2
has title: Is text rendering possible onto 2D images with Javascript/PHP?
tagged with: javascript
tagged with: applet
has answer: http://stackoverflow.com/a/21450152
tagged with: css

http://stackoverflow.com/a/21486497
type: Answer
has body: Change to: scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { float x = (float) Math.random(); final float targetVolume=(x &lt; 0.5)?0:1; scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { if (targetVolume==1){ mp.setVolume(startingVolume+volumeIncrement, startingVolume+volumeIncrement); } else { mp.setVolume(startingVolume-volumeIncrement, startingVolume-volumeIncrement); } } }, 0, 1, TimeUnit.SECONDS); } }, 0, 5, TimeUnit.SECONDS);
answers question: http://stackoverflow.com/q/21485651
has comment: http://stackoverflow.com/comment/32442328
score: 0

http://stackoverflow.com/comment/32205456
has text: Ok,I just check java doc,iterator is a feature of collection,class Object itself does not provide such feature.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21358807

http://stackoverflow.com/a/21469983
answers question: http://stackoverflow.com/q/21469955
has body: In this case nodes are indexes of a matrix. You have to be aware of zero based indexes in java, so node 1 is actually in [0,0] position etc. the edge between node 1 and 3 can be seen at row 1, column 3 and has value 2 means edge weight is 2 and is in [0,2], and since graph is undirected also in [2,0]. Note that matrices representing undirected graphs are transposed.
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/32219706
type: Comment
comment on: http://stackoverflow.com/a/21366426
has text: Yes, if you want to demonstrate that knowledge by using some design pattern :). You can use it, sounds applicable here.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32389110
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21461987
has text: "what conceivable use" - in these days of cloud computing I can see it being extremely useful to be able to automatically monitor the CPU load of other processes on the machine for auto-scaling purposes. Amazon EC2 already collects these kinds of statistics at the machine level but it also lets you define your own [custom metrics](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/publishingMetrics.html) that are more specific to your own application.

http://stackoverflow.com/comment/32351791
type: Comment
comment on: http://stackoverflow.com/a/21441135
has text: yes, because string.xml is an xml file, and xml parsing parses the xml entities, which textView does not.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21481204
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21481125
answers question: http://stackoverflow.com/q/21481125
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: It's not UTF-8, it's URL-like encoding, and you can get it using the URLEncoder class: String encoded = URLEncoder.encode("Стек"); System.out.println(encoded); Result: %D0%A1%D1%82%D0%B5%D0%BA IDEOne working example

http://stackoverflow.com/a/21506063
type: Answer
answers question: http://stackoverflow.com/q/21504308
upvote count: 3
has body: You might want to look at how these PLAFs do it. import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; class SwingSpinnerLook { public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { final JPanel gui = new JPanel(new BorderLayout()); JSpinner spinner = new JSpinner( new SpinnerNumberModel(10,1,100,1)); gui.add(spinner, BorderLayout.LINE_END); final UIManager.LookAndFeelInfo[] plafInfos = UIManager.getInstalledLookAndFeels(); String[] plafNames = new String[plafInfos.length]; for (int ii=0; ii&lt;plafInfos.length; ii++) { plafNames[ii] = plafInfos[ii].getName(); } final JComboBox&lt;String&gt; plafChooser = new JComboBox&lt;String&gt;(plafNames); gui.add(plafChooser); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int index = plafChooser.getSelectedIndex(); try { UIManager.setLookAndFeel( plafInfos[index].getClassName() ); SwingUtilities.updateComponentTreeUI(gui); } catch(Exception ex) { ex.printStackTrace(); } } }; plafChooser.addActionListener(al); JOptionPane.showMessageDialog(null, gui); } }; // Swing GUIs should be created and updated on the EDT // http://docs.oracle.com/javase/tutorial/uiswing/concurrency SwingUtilities.invokeLater(r); } }
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32476431

http://stackoverflow.com/comment/32200020
type: QuestionComment
score: 1
has text: CDI is much more robust than JSF CI. Dependency faults can be identified statically/at deploy time and it is less prone to scope leaks. Consider JSF CI as deprecated.
comment on: http://stackoverflow.com/q/21353526
type: Comment

http://stackoverflow.com/comment/32355234
score: 3
type: AnswerComment
has text: Internet, the point here is to know how large of a number it is on spot and plainly laugh on the interviewer face (I would hire you on spot). No use trying to calculate `3^([the mentioned number])`.
type: Comment
comment on: http://stackoverflow.com/a/21442694

http://stackoverflow.com/comment/32441319
type: QuestionComment
comment on: http://stackoverflow.com/q/21491504
has text: This code is OK, your problem is outside of this class.
score: 1
type: Comment

http://stackoverflow.com/a/21526669
has comment: http://stackoverflow.com/comment/32547238
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32546646
accepted answer of: http://stackoverflow.com/q/21487253
answers question: http://stackoverflow.com/q/21487253
has comment: http://stackoverflow.com/comment/32546566
has body: "My Problem: What ever I try I cannot travel to a new destination. When I click the country I want to go to, the same country im at pops up again." I think what's going on is that you're missing the whole idea of what extending a class does. It in no way makes them reference any of the same inherited objects. In order for that to happen, a reference would need to be pass of the same object. What I see you doing is create a new Engine() every time the button is pressed. That makes perfect sense as to why you're getting the same country popping up. What I would recommend id maybe using a CardLayout. Since your England and Germany objects seem mainly consist of a JPanel with components and some logic, You can make those classes extends JPanel. Add those panels to a main panel with a CardLayout. When you want to go to different countries, just change the panel of the CardLayout. See this example foe how to use a CardLayout also you can go through the How to Use CardLayout tutorial
upvote count: 2

http://stackoverflow.com/comment/32226392
comment on: http://stackoverflow.com/q/21370358
score: 0
type: Comment
type: QuestionComment
has text: I know flushing the buffer is only usable after entering an integer which is why I'm rather stuck on what to do here.

http://stackoverflow.com/q/21423088
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21423175
linked to: http://stackoverflow.com/q/18274391
has answer: http://stackoverflow.com/a/21423142
answer count: 4
has body: I want to count the number of words and lines from a string content. here is my code: private int[] getLineAndWordCount(final String textContent) { int wordCount = 0; int lineCount = 0; if (textContent.length() &gt; 0) { textContent = textContent.replace("\t", " "); String[] newLineArrays = textContent.split("\n"); lineCount = newLineArrays.length; for (String newLineStr : newLineArrays) { String[] wordsArray = newLineStr.trim().split(" "); for (String word : wordsArray) { if (word.length() &gt; 0) { wordCount++; } } } } return new int[]{lineCount, wordCount}; } This codes works fine but during exceution it will create so many subStrings. So is there any other effective way to do the same thing. Thanks.
score: 2
tagged with: java.util.scanner
tagged with: java
has answer: http://stackoverflow.com/a/21423237
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/21423374
linked to: http://stackoverflow.com/q/18136045
downvote count: 0
tagged with: string
has title: Count no of lines and words from string
favorite count: 0
has comment: http://stackoverflow.com/comment/32319668
upvote count: 2

http://stackoverflow.com/a/21474816
score: 3
upvote count: 3
has body: You can access Jenkins remotely using the remote api . This can be used to install plugins as well, look at this gist and for example: curl -X POST -d '&lt;jenkins&gt;&lt;install plugin="git@2.0" /&gt;&lt;/jenkins&gt;' --header 'Content-Type: text/xml' http://localhost:8080/pluginManager/installNecessaryPlugins will install the git plugin. So by using some HTTP library in Java you can do this from Java as well, posting HTTP requests to the remote api and installing plugins.
has comment: http://stackoverflow.com/comment/32470240
answers question: http://stackoverflow.com/q/21474640
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32415026

hibernate-batch-updates
type: Tag
tags question: http://stackoverflow.com/q/21457355
tag name: hibernate-batch-updates

http://stackoverflow.com/q/21474297
has answer: http://stackoverflow.com/a/21475009
has comment: http://stackoverflow.com/comment/32410611
has answer: http://stackoverflow.com/a/21474335
answer count: 6
has title: Trouble Understanding Recursion
has answer: http://stackoverflow.com/a/21474385
favorite count: 0
has comment: http://stackoverflow.com/comment/32410620
has comment: http://stackoverflow.com/comment/32410661
has answer: http://stackoverflow.com/a/21474555
upvote count: 6
has comment: http://stackoverflow.com/comment/32410590
has body: Ok, so I have a program: public class Rec { public static void main(String[] args) { test(5); } static void test(int n) { if (n &gt; 0) { System.out.println(n); test(n-1); System.out.println(n); } } It's output is 5,4,3,2,1,1,2,3,4,5. My question is, why/how does the second println(n) statement get executed? I thought that the function call would completely cut it off, instead it acted in a way that baffles me. This isn't homework or anything, I just really am having a hard time understanding how recursion works.
type: UnansweredQuestion
downvote count: 3
has comment: http://stackoverflow.com/comment/32411038
has answer: http://stackoverflow.com/a/21474713
has comment: http://stackoverflow.com/comment/32410594
type: Question
tagged with: recursion
score: 3
has answer: http://stackoverflow.com/a/21474340
tagged with: java

http://stackoverflow.com/a/21453951
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21453846
has body: UserServiceImpl need to implements UserService and it should be fine. Code example: public class UserServiceImpl implements UserService { ... stuff }
type: Answer
answers question: http://stackoverflow.com/q/21453846
has comment: http://stackoverflow.com/comment/32407514
score: 4
upvote count: 4
type: AcceptedAnswer

header
type: Tag
tags question: http://stackoverflow.com/q/21422294
tags question: http://stackoverflow.com/q/21480352
tag name: header

http://stackoverflow.com/q/21370448
upvote count: 1
has body: I am experiencing difficulties to install some project based on a build.gradle file. I was told in a precedent post, that I should use Android Studio but it seems even more difficult (reported conflict for gradle 1.10 and Android Studio). So I am asking if it is possible to import the project directly in my ide, https://github.com/chrisbanes/ActionBar-PullToRefresh. If yes, should I put the library folder below in my libs folder ? Here's a screen of the file hierarchy
downvote count: 1
tagged with: java
type: Question
answer count: 2
tagged with: intellij-idea
has title: How to import project - intellij
has answer: http://stackoverflow.com/a/21370506
score: 0
linked to: http://stackoverflow.com/q/21356015
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/21370533
type: UnansweredQuestion

http://stackoverflow.com/comment/32246524
type: Comment
type: QuestionComment
has text: Use POJO for these 3 attributes. It seems name, email, id
comment on: http://stackoverflow.com/q/21381873
score: 1

http://stackoverflow.com/comment/32428413
score: 0
type: QuestionComment
has text: Just updated with something along those lines.
type: Comment
comment on: http://stackoverflow.com/q/21480457

http://stackoverflow.com/a/21498133
score: 3
upvote count: 4
answers question: http://stackoverflow.com/q/21498112
type: Answer
has body: Read the manual: headMap:Returns a view of the portion of this map whose keys are strictly less than toKey. myMap2 is a map with keys less than d. f is above d.
downvote count: 1

http://stackoverflow.com/a/21488914
type: AcceptedAnswer
has body: The issue is that you are calling refresh() without a ServletContext being registered, so none is available when the beans are initialized. Get rid of this call rootContext.refresh(); The ContextLoaderListener will take care of calling refresh(). The constructor javadoc explains what happens when the ApplicationContext passed as an argument isn't refreshed: If the context has already been refreshed or does not implement ConfigurableWebApplicationContext, none of the above will occur under the assumption that the user has performed these actions (or not) per his or her specific needs.
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21488252
answers question: http://stackoverflow.com/q/21488252
score: 4

http://stackoverflow.com/q/21413158
tagged with: android
has comment: http://stackoverflow.com/comment/32303650
favorite count: 0
accepted answer: http://stackoverflow.com/a/21425187
has body: I need a mapping between c structure and java class model. reason is that i want to call a method of c which is returning a structure for which i have model class in java. I have successfully called native method with primitive data types or void from Java code. but not with any object for my case AlacFile or just Object obj. see code for what i am saying. c code... alac_file * Java_org_phlo_AirReceiver_AirReceiver_create_alac2(JNIEnv* env, jclass thiz, int samplesize, int numchannels) { return create_alac(samplesize, numchannels); } alac_file *create_alac(int samplesize, int numchannels){ alac_file *newfile = (alac_file*)malloc(sizeof(alac_file)); newfile-&gt;samplesize = samplesize; newfile-&gt;numchannels = numchannels; newfile-&gt;bytespersample = (samplesize / 8) * numchannels; return newfile; } i have a structure for alac_file defined in c class. and I am calling this method from java as follows. public native AlacFile create_alac2(int samplesize , int numchannels ); Output; Compiled successfullly and run. Received a crash when this above native method called. crash is as follows. 01-28 03:51:56.202: I/AirReceiver(31668): Registered AirTunes service '08606EB2F10B@localhost (p2p0)' on fe80::860:6eff:feb2:f10b%p2p0/fe80::860:6eff:feb2:f10b%p2p0%5 01-28 03:51:56.212: I/System.out(31668): Loading libraray BEFORE 1111 01-28 03:51:56.212: D/dalvikvm(31668): Trying to load lib /data/app-lib/com.example.airreceiver-1/libhairtunes.so 0x4212dad0 01-28 03:51:56.232: D/dalvikvm(31668): Added shared lib /data/app-lib/com.example.airreceiver-1/libhairtunes.so 0x4212dad0 01-28 03:51:56.232: D/dalvikvm(31668): No JNI_OnLoad found in /data/app-lib/com.example.airreceiver-1/libhairtunes.so 0x4212dad0, skipping init 01-28 03:51:56.232: I/System.out(31668): Loading libraray AFTER 1111 01-28 03:51:56.232: W/dalvikvm(31668): No implementation found for native Lorg/phlo/AirReceiver/AirReceiver;.create_alac2:(II)Lcom/beatofthedrum/alacdecoder/AlacFile; 01-28 03:51:56.242: W/dalvikvm(…
has answer: http://stackoverflow.com/a/21413831
has comment: http://stackoverflow.com/comment/32303572
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32302640
possible better answer: http://stackoverflow.com/a/21413831
score: 1
tagged with: java
upvote count: 1
tagged with: android-ndk
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21425187
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has title: NDK with JNI while calling method with a return type non primitive
linked to: http://stackoverflow.com/q/10130819

http://stackoverflow.com/q/21425965
type: Question
tagged with: jstl
tagged with: jsp
has comment: http://stackoverflow.com/comment/32324768
has comment: http://stackoverflow.com/comment/32325151
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32324695
has comment: http://stackoverflow.com/comment/32325328
has comment: http://stackoverflow.com/comment/32324782
has comment: http://stackoverflow.com/comment/32324764
has title: JSTL nested forEach Lists throwing error
has comment: http://stackoverflow.com/comment/32324956
has comment: http://stackoverflow.com/comment/32324511
has body: I am trying use JSTL on an old project where I have to use nested forEach. My requirement is for example to iterate through a countries list, where each country will have a StateList which will contain State details. &lt;c:forEach items="${countryList}" var="country"&gt; &lt;c:out value="${country.name}" escapeXml="true" /&gt; &lt;c:forEach items="${country.StateList}" var="state"&gt; &lt;c:out value="${state.name}" escapeXml="true" /&gt; &lt;/c:forEach&gt; &lt;/c:forEach&gt; When I try these I am getting error. An error occurred while evaluating custom action attribute "items" with value "${country.StateList}": Unable to find a value for "StateList" in object of class "com.pack.Country" using operator "." (null) What I am doing wrong? Is there a alternate method to do the same without using scriplets? Issue Solved : The problem was that i used StateList instead of stateList as list name in class. Thanks.
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32325318

http://stackoverflow.com/a/21487428
has comment: http://stackoverflow.com/comment/32434173
type: Answer
downvote count: 2
has body: Edit:: Whoops, read too fast, you wanted numbers, not digits. I believe someone has already answered above. I also have answered the question using my original (but incorrect) approach Previous Answer Look at Java's isDigit(char c). It may look something like: public static void getSum(string a) { int sum = 0; for(int i = 0; i &lt; a.length(); i++) { if(Character.isDigit(a.charAt(i))) { sum += Integer.parseInt(a.charAt(i)); } } System.out.println(sum); } New answer using an iterative approach public static void getSum(String a) { int sum = 0; String num = ""; for(int i = 0; i &lt; a.length(); i++) { if(Character.isDigit(a.charAt(i))) { num = num + a.charAt(i); } else { if(!num.equals("")) { sum = sum + Integer.parseInt(num); num = ""; } } } if(!num.equals("")) { sum = sum + Integer.parseInt(num); } System.out.println(sum); }
has comment: http://stackoverflow.com/comment/32433393
has comment: http://stackoverflow.com/comment/32433296
score: -2
has comment: http://stackoverflow.com/comment/32433233
answers question: http://stackoverflow.com/q/21487340
upvote count: 0
has comment: http://stackoverflow.com/comment/32433461
has comment: http://stackoverflow.com/comment/32433237

http://stackoverflow.com/comment/32268972
comment on: http://stackoverflow.com/q/21393371
score: 0
has text: @DavidConrad which I don't believe will ever happen.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21481910
answer count: 3
has comment: http://stackoverflow.com/comment/32424177
has answer: http://stackoverflow.com/a/21482081
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21482064
has comment: http://stackoverflow.com/comment/32423329
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21482111
has body: as i am newbie.i have tried some code..pls suggeesst some problem.. am getting this error.pls help me solve this problem.. import java.util.Scanner; import java.io.*; package calculator; public class calc { public static void main(String[] args) { } private int valueA; private int valueB; private String operator; private char operatorA; public int getvalueA() { return valueA; } public int getvalueB() { return valueB; } { Scanner keyboard = new Scanner(System.in); System.out.println("Enter problem."); { valueA = keyboard.nextInt(); valueB = keyboard.nextInt(); operator = keyboard.next(); operatorA = operator.charAt(0); int add = valueA + valueB; int minus = valueA - valueB; int multiply = valueA * valueB; int divide = valueA / valueB; String clearScreen = null; switch (operatorA) { case '+': System.out.println(add); break; case '-': System.out.println(minus); break; case '*': System.out.println(multiply); break; case '/': System.out.println(divide); case 'C': System.out.println(clearScreen); break; default: System.out.println("unknown operator '" + operator + "'. Please try again."); break; } } } pls provide corrective points??? : Syntax error, insert "}" to complete MethodBody
has comment: http://stackoverflow.com/comment/32425472
has title: JAVA ERROR .need suggestion in form of comments or codes if possible pls,

http://stackoverflow.com/comment/32201271
comment on: http://stackoverflow.com/a/21356385
score: 0
type: AnswerComment
has text: But I want to have the JOption Pane when I click the button, so this is the case when an action is performed
type: Comment

http://stackoverflow.com/comment/32379403
score: 0
comment on: http://stackoverflow.com/a/21457039
type: Comment
has text: That worked. Thanks. Can you maybe explain why it works?
type: AnswerComment

querying
type: Tag
tags question: http://stackoverflow.com/q/21464443
tag name: querying

http://stackoverflow.com/a/21397031
downvote count: 0
answers question: http://stackoverflow.com/q/21396979
has comment: http://stackoverflow.com/comment/32274593
type: Answer
upvote count: 1
score: 1
has body: Use real map, I mean java.util.Map which keeps key-value pair ex. Map&lt;Key,Value&gt; Map&lt;String,String&gt; map= new HashMap&lt;String,String&gt;(); map.add("RSA256","SHA256withRSA"); map.add("SHA384","SHA384withRSA"); map.add("SHA512","SHA512withRSA"); ... public String getAlgorithm(String alg) { return map.get(alg); }

http://stackoverflow.com/a/21394722
has body: What you want desire is know as a cross-cutting concern. Take a look at Aspect Oriented programming. You can write code that is executed on method calls, where you select the method call based on semantic java signatures. This will decouple your logging concern from your business logic concerns. You should find some immediate examples in the AspectJ documentation. http://eclipse.org/aspectj/doc/released/progguide/starting-development.html#profiling-and-logging
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21394466
type: Answer
downvote count: 0

http://stackoverflow.com/a/21432374
has comment: http://stackoverflow.com/comment/51278989
has comment: http://stackoverflow.com/comment/51293043
has body: To get a Random Row, first get list of total question and get any one. public Question getRandomQuestion(EntityManager em) { Query countQuery = em.createNativeQuery("select count(*) from Question"); long count = (Long)countQuery.getSingleResult(); Random random = new Random(); int number = random.nextInt((int)count); Query selectQuery = em.createQuery("select q from Question q"); selectQuery.setFirstResult(number); selectQuery.setMaxResults(1); return (Question)selectQuery.getSingleResult(); } Note: You may need to implement a logic to avoid duplicates while calling method more than once.
answers question: http://stackoverflow.com/q/21432078
has comment: http://stackoverflow.com/comment/51159121
upvote count: 8
has comment: http://stackoverflow.com/comment/62981342
downvote count: 2
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/51274503
has comment: http://stackoverflow.com/comment/51238954
has comment: http://stackoverflow.com/comment/51159071
has comment: http://stackoverflow.com/comment/32389718

http://stackoverflow.com/q/21356511
answer count: 2
upvote count: 0
favorite count: 0
has title: CallableStatement arrayindexoutofbound
tagged with: callable-statement
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21356541
tagged with: java
tagged with: mysql
downvote count: 1
type: Question
tagged with: indexoutofboundsexception
score: -1
has body: public int CalableStatement(String query,Login login,String type) throws ClassNotFoundException, SQLException { int i =0; try { Connection con = getConnection(); //String q = query+"(?,?,?)"; CallableStatement cst = con.prepareCall("call loginPlan_k(?,?,@result)"); //Login login = null ; //String type=lassType.getType(); /*if(type.equals("login")) { login = (Login)o; }*/ System.out.println(login.getUserName()+"DataAccess"); cst.setString(1, login.getUserName()); cst.setString(2, login.getPassword()); cst.registerOutParameter(3,java.sql.Types.INTEGER); ResultSet rs = cst.executeQuery(query); i = cst.getInt(1); yyy }catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return i ; } java.lang.ArrayIndexOutOfBoundsException: 20outputfromdb status0 at com.mysql.jdbc.CallableStatement.checkIsOutputParam(CallableStatement.java:680) at com.mysql.jdbc.CallableStatement.registerOutParameter(CallableStatement.java:2015) at Plan__K_Utilities.DataBaseAccess.CalableStatement(DataBaseAccess.java:72) at PLan__K_MYSQL_DAL.LoginClass.Authenticate(LoginClass.java:22) at ServletPackage.Login.doPost(Login.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.cata…
has answer: http://stackoverflow.com/a/21356538

http://stackoverflow.com/q/21453846
has answer: http://stackoverflow.com/a/21480249
tagged with: autowired
type: AnsweredQuestion
has title: Autowiring Error
tagged with: java
type: Question
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/21458331
accepted answer: http://stackoverflow.com/a/21453951
has answer: http://stackoverflow.com/a/21453951
tagged with: spring
tagged with: spring-mvc
has body: My project is using Spring 4. I am new to Spring. I was trying out the example shown in this question How does autowiring work in spring?. My project looks like this: web.xml: <?xml version="1.0" encoding="UTF-8"?> CCHP index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / contextConfigLocation /WEB-INF/dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener dispatcher-serlvet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd 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/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.mj.cchp" /> <mvc:annotation-driven /> <context:annotation-config /> /WEB-INF/jsp/ .jsp </beans> The controller: @Controller @RequestMapping("/user") public class UserController { @Autowired UserService userService; @RequestMapping(value = "/add", method = RequestMethod.POST) public ModelAndView add(@Valid @ModelAttribute("user") UserBean user, BindingResult result) { String message; if (result.hasErrors() && user != null) message = "User Add failed"; else { userService.addUser(user); message = "Successfully added user"; } return new ModelAndView("success", "message", message); } @RequestMapping(value = "/register") public ModelAndView register(@ModelAttribute("user") UserBean user, BindingResult result) { List<String> roles = new ArrayList<String>…
has answer: http://stackoverflow.com/a/21458331
linked to: http://stackoverflow.com/q/3153546
has comment: http://stackoverflow.com/comment/32382259

http://stackoverflow.com/comment/32255001
type: AnswerComment
has text: Maybe you are right, my answer has already been downvoted several times which I think is not fair. There maybe better answers, in fact I have upvoted another one, but I find a bit disgusting how this happens very frequently.
type: Comment
comment on: http://stackoverflow.com/a/21386092
score: 0

http://stackoverflow.com/comment/32442196
comment on: http://stackoverflow.com/q/21491924
type: QuestionComment
has text: Duplicate of [NullPointerException in array](http://stackoverflow.com/questions/16323030/nullpointerexception-in-array), among others
score: 0
type: Comment

http://stackoverflow.com/comment/32432653
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21487096
has text: It is not clear what works or what does not work - can you give a more specific example?

http://stackoverflow.com/comment/32444421
comment on: http://stackoverflow.com/a/21371675
has text: Hey I like your tag idea but how do I get it to the next screen? Or access the tag on the next screen or something that lets the next screen know the object id so I can query it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21420730
favorite count: 0
has title: Instance and Constant variables
upvote count: 2
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32315952
has comment: http://stackoverflow.com/comment/32315878
has answer: http://stackoverflow.com/a/21420811
has comment: http://stackoverflow.com/comment/32323161
has answer: http://stackoverflow.com/a/21420867
has comment: http://stackoverflow.com/comment/32315786
has comment: http://stackoverflow.com/comment/32315991
has body: I was wondering is a variable could be both instance and constant? For example would private final int Min=25; be both an instance variable and a constant variable?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32315865
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21420875
has answer: http://stackoverflow.com/a/21420843
has comment: http://stackoverflow.com/comment/32316055
has comment: http://stackoverflow.com/comment/32315867
has answer: http://stackoverflow.com/a/21420861
has comment: http://stackoverflow.com/comment/32316570
has comment: http://stackoverflow.com/comment/32315882

http://stackoverflow.com/a/21480789
answers question: http://stackoverflow.com/q/21480625
has comment: http://stackoverflow.com/comment/32421504
type: Answer
has body: I'm not shure, but i have tested with success this xsd &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt; &lt;xsd:element name="rootelement"&gt; &lt;xsd:complexType&gt; &lt;xsd:all&gt; &lt;xsd:element name="optional_element" minOccurs="0"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:maxLength value="26"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="required_element" minOccurs="1"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:maxLength value="26"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="optional_complex_type" minOccurs="0"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="ct_1"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:maxLength value="26"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;xsd:element name="required_complex_type" minOccurs="1"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="ct_1"&gt; &lt;xsd:simpleType&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:maxLength value="26"/&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:all&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:schema&gt;
upvote count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/32421884
has comment: http://stackoverflow.com/comment/32422776
score: -2

http://stackoverflow.com/comment/32450591
type: QuestionComment
has text: Simply add `public static void main(String[] args){Elevator();}` to your code
score: 0
comment on: http://stackoverflow.com/q/21496738
type: Comment

http://stackoverflow.com/comment/32472813
score: 1
type: Comment
type: QuestionComment
has text: What does it mean 'initially'? If that means first page request without any message and show your message after submitting the form, than null as initial value String message = null is enough.
comment on: http://stackoverflow.com/q/21508552

http://stackoverflow.com/a/21425045
has comment: http://stackoverflow.com/comment/32322985
type: Answer
answers question: http://stackoverflow.com/q/21424923
has comment: http://stackoverflow.com/comment/32323078
has comment: http://stackoverflow.com/comment/32323191
score: 0
has body: You can go with this String func = "sin";// or any function you want like cos. String a = "(3e4+2e2)sin(30)"; a = a.replaceAll("[)]" + func, ")*siz"); System.out.println(a);

http://stackoverflow.com/comment/32458834
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21497353
has text: OK let me edit my initial question and make the situation more clearer.

http://stackoverflow.com/q/21373245
has answer: http://stackoverflow.com/a/21373316
has body: I am working on a project on which I did all the hard work however I still have some issue that I don't know to do resolve. I have an array containing row data where each line below represent an array cell and X,Y are variables and may change. x GETFIELD x PUTFIELD y GETFIELD y PUTFIELD I need to find out how many get-field for x and put-field for x and the same for the rest of the variables. x , 1 get-field , 1 put-field y , 1 get-field , 1 put-field total get-field:2 , total put-field:2 or any format that gives the same analysis.
tagged with: arrays
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32231509
favorite count: 0
has comment: http://stackoverflow.com/comment/32231734
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has title: Formatting inside array

http://stackoverflow.com/a/21476473
type: Answer
answers question: http://stackoverflow.com/q/21456412
has body: Saying you want an integer value and you want a leading zero is contradictory. Numeric data types have just the number value; only a String representation of that number has a leading zero. So you need to decide… Do you want: An integer (example: 1) A String (example: 01) A time (example: 01:30) Generally if working with date-time values, you should treat them as such. Rather than use the notoriously troublesome java.util.Date/Calendar classes, use either the Joda-Time library or the new java.time.* classes in Java 8. Example code using Joda-Time 2.3. String input = "01:30"; LocalTime localTime = new LocalTime( input ); int hourOfDay = localTime.getHourOfDay(); int minuteOfHour = localTime.getMinuteOfHour(); Dump to console… System.out.println( "localTime: " + localTime ); System.out.println( "hourOfDay: " + hourOfDay ); System.out.println( "minuteOfHour: " + minuteOfHour ); When run… localTime: 01:30:00.000 hourOfDay: 1 minuteOfHour: 30
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/32355173
score: 0
type: Comment
has text: @MartijnCourteaux The `dataSize`? It's an instance variable.
comment on: http://stackoverflow.com/a/21439628
type: AnswerComment

http://stackoverflow.com/a/21387981
upvote count: 1
downvote count: 0
has body: You can use FillLayout or GridLayout (with GridData being set to grab excess horizontal and vertical space). http://help.eclipse.org/helios/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/FillLayout.html http://help.eclipse.org/indigo/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/layout/GridLayout.html
type: Answer
answers question: http://stackoverflow.com/q/21354327
score: 1

http://stackoverflow.com/comment/32349109
has text: I see what you are saying, but in this specific case I'm dealing with a rectangular 2d array :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21439722

http://stackoverflow.com/q/21485154
tagged with: java
type: Question
tagged with: jsf-2
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21528290
has body: when i try to update the datatable from a comandLink on the first time it works fine, However on the second time the datatable disapeares yet i still see the paginator. here is the datatable code : &lt;p:dataTable id="tabexam" paginatorPosition="bottom" var="exam" value="#{dyna.examViewDataModel}" widgetVar="examTable" emptyMessage="aucun résultat trouvé pour votre recherche" paginator="true" rows="40" selection="#{dyna.selectedExamen}" selectionMode="single" resizableColumns="true" draggableColumns="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="40,80,120" rowStyleClass="#{exam.studyWithRv_1 == 0 ? 'RV' : exam.studyUrgence == 1 ? 'Urgent' : null}"&gt; &lt;p:column&gt; &lt;p:outputLabel value="#{column.dbname}" styleClass="fonty"/&gt; &lt;/p:column&gt; &lt;/p:columns&gt; &lt;/p:datatable&gt; this is the command link code : &lt;ui:repeat var="list" value="#{dyna.userlist}" varStatus="loop"&gt; &lt;center&gt; &lt;p:commandLink id="listerlink" title="Afficher la liste" actionListener="#{datatableBean.updatecolumns(list.id.tbCode)}" update=":form1:tabexam,:form1:msg,:form1:displaycols"&gt; &lt;p:graphicImage id="imglist" value="/images/Liste_Cold.png"/&gt;&lt;br&gt;&lt;/br&gt; &lt;p:outputLabel value="#{list.id.tbCode}"/&gt;&lt;br&gt;&lt;/br&gt; &lt;/p:commandLink&gt; &lt;/center&gt; &lt;/ui:repeat&gt; Additional Info: No Nested forms. Using p:Layout. Beans Scope : ViewScoped. Everything works fine when draggableColumns="false". what possibly i could be missing ?
accepted answer: http://stackoverflow.com/a/21528290
tagged with: datatable
has comment: http://stackoverflow.com/comment/32431525
tagged with: jsf
type: AnsweredQuestion
has title: Primefaces datatable disapeares after update from commandLink
tagged with: primefaces

http://stackoverflow.com/comment/32317740
comment on: http://stackoverflow.com/q/21420628
score: 0
type: Comment
type: QuestionComment
has text: Yes, please post the context, the aspect, the pointcut, the advised bean definition, and the injection target. For better results, post a reproducible example.

http://stackoverflow.com/a/21443267
has comment: http://stackoverflow.com/comment/32355885
has body: By referring to ac with the Account type modifier as follows you are causing it to be treated as a local variable: // Create a local variable "ac", does not affect the class variable Account ac = NonBillableAccount.BUSINESS_DEVELOPMENT; if (this.ac == null){ System.println('It does still equal null!'); // yep, it's null } Try this instead to set the ac property on your test class: // refers to the class variable implicitly ac = NonBillableAccount.BUSINESS_DEVELOPMENT; or // refers to the class variable explicitly this.ac = NonBillableAccount.BUSINESS_DEVELOPMENT; This is known as "shadowing" (explained here) which allows you to use the same variable names in different contexts. In your test methods it expands ac to this.ac in the compiler, which throws the NPE when you call ac.getName() as you have not set the class property yet.
downvote count: 0
answers question: http://stackoverflow.com/q/21443225
score: 3
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/32355872
has comment: http://stackoverflow.com/comment/32355801

http://stackoverflow.com/q/21411524
score: -1
answer count: 3
upvote count: 0
tagged with: amazon-web-services
favorite count: 0
has title: Use a backend web service or not
tagged with: android
tagged with: architecture
has answer: http://stackoverflow.com/a/21703198
type: UnansweredQuestion
has body: We are building a new app that would require to store some data in S3 or DynamoDB. The number of users for this app would be relatively small (~ 500). There are 2 ways of designing this. We can either use the AWS SDK to persist information directly from the app Build a back-end web service that talks to the data store and use HTTP to communicating with this service. There are multiple pros and cons for each like Option #1 is way simpler and avoids a lot of overhead, Option #2 however is cleaner and provides better encapsulation. Also the back end web service could be used for any other task processing in the future. Based on what aspects should once decide which option to choose ? Any help would be appreciated
tagged with: soa
downvote count: 1
has answer: http://stackoverflow.com/a/21412307
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21413460

http://stackoverflow.com/comment/32270385
score: 1
has text: you already store all the counters, so just find the one with the highest value. also, your counter should be an array of 10 ints, not 10 seperate ints.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21394583

http://stackoverflow.com/a/21369178
type: Answer
has body: As it seems from your commands history, you can replace hadoop by /usr/local/hadoop/bin/hadoop and it should help. If you want to use hadoop command without specifying the full path to it, you can edit ~/.bashrc file and add the following line: export PATH=$PATH:/usr/local/hadoop/bin/ Then you need to reopen your terminal.
downvote count: 1
upvote count: 44
score: 43
has comment: http://stackoverflow.com/comment/32230717
has comment: http://stackoverflow.com/comment/49084333
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21369102
has comment: http://stackoverflow.com/comment/44376823
accepted answer of: http://stackoverflow.com/q/21369102

http://stackoverflow.com/a/21371024
type: Answer
score: 0
upvote count: 1
downvote count: 1
has body: Sets have only unique elements by nature so that would be the correct type to use in your situation. First however you will need to properly override the hashcode() and equals() method of your User class. After that just try to add all instances to the a set and be done with it. Set&lt;User&gt; uniqueUsers = new HashSet&lt;User&gt;(); for (User unique : listNew) { if (!listOld.contains(unique)) { uniqueUsers.add(unique); } }
answers question: http://stackoverflow.com/q/21370900

http://stackoverflow.com/a/21357755
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32204201
accepted answer of: http://stackoverflow.com/q/21357638
answers question: http://stackoverflow.com/q/21357638
has body: Your formatting is wrong, it should be: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:paddingTop="?attr/actionBarSize"&gt; You should define dimensions in dimens.xml, not inside the layout.
has comment: http://stackoverflow.com/comment/32204135
score: 12
upvote count: 12

http://stackoverflow.com/comment/32226455
score: 0
comment on: http://stackoverflow.com/q/21370358
has text: @bmargulies This is how flushing a buffer was explained by my lecturer. Either way, I've fixed it. As I said, flushing a buffer is used after inputting an integer and in my tired state, I forgot to actually try it after the integer input which was the issue. I think it's time to sleep. In terms of using a scanner directly connected to System.in, this is what I've been taught so far and I'm assuming that if there's issues with this and it's not practical in the real world, we'll be taught a different, more efficient method.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32258327
comment on: http://stackoverflow.com/a/21388246
type: AnswerComment
has text: -1 passwords typically *are not* stored in [encrypted](http://en.wikipedia.org/wiki/Encryption) form. Hashed, but not encrypted. (And your answer mostly repeats existing one...)
type: Comment
score: 1

http://stackoverflow.com/comment/32453494
score: 3
comment on: http://stackoverflow.com/q/21498563
type: Comment
type: QuestionComment
has text: `System.out.println(9/60);`

http://stackoverflow.com/q/21374584
has answer: http://stackoverflow.com/a/21380240
type: Question
has body: I am trying to authenticate against OAuth based Quickbook API through a java program which is following, OAuthAuthorizer authorizer = new OAuthAuthorizer(consumerKey, consumerSecret, accessToken, accessTokenSecret); try { Context context = new Context(authorizer, apptoken, ServiceType.QBO, realmID); DataService service = new DataService(context); Customer customer = getCustomer(); service.addAsync(customer, new CallbackHandler() { @Override public void execute(CallbackMessage message) { // TODO Auto-generated method stub System.out.println(message.getAttachableResponse()); } }); } catch (FMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } I have provided values for consumer key, consumer secret, access token, access secret token, app token and realmId but still I am getting an exception which is following, com.intuit.ipp.exception.FMSException: ERROR CODE:3200, ERROR MESSAGE:message=Exception authenticating OAuth; errorCode=003200; statusCode=401, ERROR DETAIL:null Am I doing something wrong or missing something ?
tagged with: quickbooks
score: 0
accepted answer: http://stackoverflow.com/a/21380240
answer count: 1
has title: Unable to authenticate Quickbook API
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21396139
has comment: http://stackoverflow.com/comment/32273767
tagged with: indexing
has title: List with Int as first argument and String as second (Java)
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32273396
has answer: http://stackoverflow.com/a/21396356
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32274106
has body: I'm trying to write a method that returns an int index as the first argument and a string as the second. The method should insert the string into a list by order of the index's. If the Int is negative or leaves a gap, it should throw IllegalArgumentException. Here's what I've done: public MitchList() { data = new String[2]; size = 0; } public int size() { return size; } public void add(int index, String s){ if (data.length == size) { String[] newArray = new String[data.length*2]; for (int i=0; i &lt; data.length; i++) { newArray[i] = data[i]; } data = newArray; } if (index &gt; 0 || index &lt;size){ throw new IllegalArgumentException(); } if (data[index] != ""){ for (int i = 0; i &lt;size; i++){ s = data[index]; } } data[index] = s; size++; } The JUnit test is saying it is failing. It should return a list like: 1, Cat 2, Dog 3, Squirrel So on.. Any ideas on a solution? UPDATE Here's what I have now. /** &lt;P&gt;{@code java MitchList}&lt;/P&gt; **/ public class MitchList { private String[] asData; private int iSize; public static final void main(String[] igno_red) { MitchList ml = new MitchList(); test(ml, 0, "hello"); test(ml, 1, "goodbye"); } public static final void test(MitchList m_l, int i_ndex, String s_tring) { m_l.add(i_ndex, s_tring); System.out.print(s_tring + ", "); } public MitchList() { asData = new String[2]; iSize = 2; } public int iSize() { return iSize; } public void add(int index, String s){ System.out.println("asData.length=" + asData.length + ", iSize=" + iSize + ""); if (asData.length == iSize) { System.out.println("1"); String[] newArray = new String[asData.length*2]; for (int i=0; i &lt; asData.length; i++) { newArray[i] = asData[i]; } asData = newArray; } if (index &gt; 0 || index &lt;iSize){ System.out.println("2"); throw new IllegalArgumentException("index (" + index + ") must be greater than zero and less than size (" + iSize + ")"); } System.out.println("asData[" + index + "]=" + asData[index] + ""); if (asData[index] != ""){ System.out.p…
type: Question
possible better answer: http://stackoverflow.com/a/21397296
has comment: http://stackoverflow.com/comment/32273409
tagged with: arguments
has answer: http://stackoverflow.com/a/21397296
accepted answer: http://stackoverflow.com/a/21396356
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/32274158
downvote count: 1

http://stackoverflow.com/q/21441427
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21441527
has answer: http://stackoverflow.com/a/21441471
has answer: http://stackoverflow.com/a/21441510
type: Question
linked to: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/21441471
has title: why isn't if statement working correctly
duplicate of: http://stackoverflow.com/q/513832
score: 0
has body: I'm grabbing the current win7 username which is rsmith but my if statement below displays: 0000 rsmith 2222 rsmith Why doesn't my if == line work as expected? The userName IS rsmith String userName = System.getProperty("user.name"); System.out.println("0000 " + userName + "\n"); if (userName == "rsmith"){ System.out.println("1111 " + userName + "\n"); } else { System.out.println("2222 " + userName + "\n"); }
has answer: http://stackoverflow.com/a/21441451
tagged with: java
accepted answer: http://stackoverflow.com/a/21441451

http://stackoverflow.com/comment/32266406
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21387557
has text: You could probably have left all the code out of the question and worded it something like this... "Whats the reasoning behind the mathematical formula for converting base 10 fractions to base 2?".

http://stackoverflow.com/comment/32276300
comment on: http://stackoverflow.com/q/21398033
has text: Don't know if your login-credentials are valid or not, but I would remove them.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/21422464
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/25183636
has title: Change fielderror color?
has comment: http://stackoverflow.com/comment/32319124
answer count: 4
score: 2
has answer: http://stackoverflow.com/a/25183969
has comment: http://stackoverflow.com/comment/32318645
upvote count: 2
accepted answer: http://stackoverflow.com/a/21424353
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25183636
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32318691
has comment: http://stackoverflow.com/comment/32318662
tagged with: java
has comment: http://stackoverflow.com/comment/32318945
has answer: http://stackoverflow.com/a/21424353
has comment: http://stackoverflow.com/comment/32318712
tagged with: struts2
has body: I am using struts2 validation using the validate() method in my Action class. I add FieldErrors using addFieldError() method. The field error gets displayed on top of each field of my form. Action class: (This validates setMapServerDetails action) /*---------------------VALIDATION------------------------------------*/ public void validateSetMapServerDetails(){ if(getMapServer().getServerName().length() == 0){ addFieldError("mapServer.serverName", "Name is Required"); } } The problem is the error gets displayed in plain text, I want the error in red color. How should I change it to red? EDIT: JSP: Configure Map Server <s:head /> <s:form action="setMapServerDetails" validate="true"> <s:textfield name="mapServer.serverName" label="Server Name"></s:textfield> <s:textfield name="mapServer.serverIp" label="Server IP"></s:textfield> <s:textfield name="mapServer.serverPort" label="Server Port"></s:textfield> <s:textfield name="mapServer.applicationName" label="Application Name"></s:textfield> <s:textfield name="mapServer.remarks" label="Remarks"></s:textfield> <s:submit value="Save"></s:submit> </s:form>
has answer: http://stackoverflow.com/a/21422744
tagged with: validation
downvote count: 0

http://stackoverflow.com/q/21377701
score: 0
has answer: http://stackoverflow.com/a/26628259
tagged with: mpxj
has body: i am trying to update mpx file using MPXWrite, Actually i converted mpp file to mpx file so that now i am able to read all the tasks and task details. But i want to update % Completion on particular task in mpx file how i do that. Can any one provide code for that. Thanks in Advance.. Please help me out from this problem // Like this i am reading mpx file private static void readMPX(String inputFile){ File f = new File(inputFile); MPXReader read1 = new MPXReader(); ProjectFile pFile = null; try{ pFile = read1.read(f); }catch(Exception e){ e.printStackTrace(); } List llist=pFile.getAllTasks(); for(int i=1;i&lt;10/*llist.size()*/;i++) { Task t=(Task)llist.get(i); System.out.println("------------------------------------"); System.out.println("Task Details : "+i +llist.get(i)); System.out.println("WBS : "+t.getWBS()); System.out.println("WBS Leve : "+t.getWBSLevel()); System.out.println("Task name : "+t.getName()); System.out.println("Duration : "+t.getDuration()); //System.out.println("Task Unique ID : "+t.getUniqueID()); // System.out.println("Task Unique ID : "+t.getUniqueID()); System.out.println("Base Line Start : "+t.getBaselineStart()); System.out.println("Base Line Finish : "+t.getBaselineFinish()); System.out.println("Actual Start Date : "+t.getActualStart()); // System.out.println("\tFinish Date : "+t.getFinish()); System.out.println("Actual End Date : "+t.getActualFinish()); System.out.println("% Complete : "+t.getPercentageComplete()); //getSubTasks(t,t.getUniqueID()); System.out.println("------------------------------------"); } }
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24454122
has title: How to update a perticular row in mpx file using MPXWriter in java
type: Question
has answer: http://stackoverflow.com/a/24454122
answer count: 2
accepted answer: http://stackoverflow.com/a/26628259
tagged with: ms-project

http://stackoverflow.com/q/21497201
tagged with: java
has title: App force closes when a textedit is left blank
type: Question
tagged with: textedit
answer count: 2
has comment: http://stackoverflow.com/comment/32451061
accepted answer: http://stackoverflow.com/a/21497261
has comment: http://stackoverflow.com/comment/32451314
favorite count: 0
has comment: http://stackoverflow.com/comment/32451064
tagged with: android
has answer: http://stackoverflow.com/a/21497239
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/21497261
downvote count: 1
possible better answer: http://stackoverflow.com/a/21497239
type: AnsweredQuestion
has body: I am a new android programmer and I am trying to make a "Quadratic Equation Solver App". The user has to input 3 values in 3 respective TextEdit-s and those values are stored in doubles. If the user leaves one of the inputs blank , the app force closes. How can I set all values to 0 by default , so the app doesn't force close ? public class MainActivity extends Activity { EditText inputA, inputB, inputC; TextView nrRoots, root1, root2, roots; Button bStepByStep, calculate; Double a, b, c, D, x1, x2, x, dRootNr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); inputA = (EditText) findViewById(R.id.etParamA); inputB = (EditText) findViewById(R.id.etParamB); inputC = (EditText) findViewById(R.id.etParamC); nrRoots = (TextView) findViewById(R.id.tvNrRoots); root1 = (TextView) findViewById(R.id.tvRoot1); roots = (TextView) findViewById(R.id.tvRoots); root2 = (TextView) findViewById(R.id.tvRoot2); calculate = (Button) findViewById(R.id.bCalculate); bStepByStep = (Button) findViewById(R.id.bStepByStep); calculate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { a = Double.parseDouble(inputA.getText().toString()); b = Double.parseDouble(inputB.getText().toString()); c = Double.parseDouble(inputC.getText().toString()); double D = Math.sqrt((b * b) - (4 * a * c)); if (D == 0) { nrRoots.setText("The equation " + a + "x^2+" + b + "x+" + c + "=0 has 1 distinct root."); x = ((-1) * b) / (2 * a); root1.setText("x=" + x); root2.setText(""); roots.setText(""); } else if (D &gt; 0) { nrRoots.setText("The equation " + a + "x^2+" + b + "x+" + c + "=0 has 2 distinct roots."); x1 = (((-1) * b) + D) / (2 * a); x2 = (((-1) * b) - D) / (2 * a); root1.setText("x1= " + x1); root2.setText("x2= " + x2); } else { nrRoots.setText("The equation " + a + "x^2+" + b + "x+" + c + "=0 has no distinct roots."); root1.setText(""); root2.setText(""); } } });

http://stackoverflow.com/a/21358803
has body: Ok, I noticed i can fix this in the following way: task integTest2(type: Test) { useTestNG() testClassesDir = project.sourceSets.special.output.classesDir classpath = classpath.plus(files(testClassesDir)) testSrcDirs += project.sourceSets.special.java.srcDirs.toList() } This works, but looks quite... stupid. Why do I need to tell the test task, that directory with classes to test should be on the classpath? "Please test classes that are in that directory. Oh, by the way, to load them, try looking in the directory in which they are". Am I doing something wrong?
accepted answer of: http://stackoverflow.com/q/21358604
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32205681
has comment: http://stackoverflow.com/comment/32237944
has comment: http://stackoverflow.com/comment/32206169
type: Answer
has comment: http://stackoverflow.com/comment/32206463
has comment: http://stackoverflow.com/comment/32254111
score: 1
has comment: http://stackoverflow.com/comment/32234119
has comment: http://stackoverflow.com/comment/32232759
answers question: http://stackoverflow.com/q/21358604
has comment: http://stackoverflow.com/comment/32253058

http://stackoverflow.com/a/70098396
has body: WebElement programs = driver.findElement(By.xpath("//*[@id=\'contentblock\']/section/div[6]/select")); programs.sendKeys(Keys.CONTROL+"a");
type: Answer
answers question: http://stackoverflow.com/q/21421790
score: 0
has comment: http://stackoverflow.com/comment/123919011

http://stackoverflow.com/a/38055625
type: Answer
has body: public class UtilsInt { int leadingZerosInt(int i) { return leadingZeros(i,Integer.SIZE); } /** * use recursion to find occurence of first set bit * rotate right by one bit &amp; adjust complement * check if rotate value is not zero if so stop counting/recursion * @param i - integer to check * @param maxBitsCount - size of type (in this case int) * if we want to check only for: * positive values we can set this to Integer.SIZE / 2 * (as int is signed in java - positive values are in L16 bits) */ private synchronized int leadingZeros(int i, int maxBitsCount) { try { logger.debug("checking if bit: "+ maxBitsCount + " is set | " + UtilsInt.intToString(i,8)); return (i &gt;&gt;&gt;= 1) != 0 ? leadingZeros(i, --maxBitsCount) : maxBitsCount; } finally { if(i==0) logger.debug("bits in this integer from: " + --maxBitsCount + " up to last are not set (i'm counting from msb-&gt;lsb)"); } } } test statement: int leadingZeros = new UtilsInt.leadingZerosInt(255); // 8 test output: checking if bit: 32 is set |00000000 00000000 00000000 11111111 checking if bit: 31 is set |00000000 00000000 00000000 01111111 checking if bit: 30 is set |00000000 00000000 00000000 00111111 checking if bit: 29 is set |00000000 00000000 00000000 00011111 checking if bit: 28 is set |00000000 00000000 00000000 00001111 checking if bit: 27 is set |00000000 00000000 00000000 00000111 checking if bit: 26 is set |00000000 00000000 00000000 00000011 checking if bit: 25 is set |00000000 00000000 00000000 00000001 bits in this integer from: 24 up to last are not set (i'm counting from msb-&gt;lsb)
score: 0
answers question: http://stackoverflow.com/q/21350827

http://stackoverflow.com/comment/32422485
type: QuestionComment
has text: can you elaborate or reword what do you mean by the oldsetting and new setting?
comment on: http://stackoverflow.com/q/21481353
score: 0
type: Comment

http://stackoverflow.com/comment/46373525
type: Comment
type: QuestionComment
has text: maybe this will help you [How can we prevent service from killing by OS in android][1] [1]: http://stackoverflow.com/questions/9696861/how-can-we-prevent-service-from-killing-by-os-in-android
score: 0
comment on: http://stackoverflow.com/q/21512809

http://stackoverflow.com/comment/32367440
type: Comment
comment on: http://stackoverflow.com/a/21449514
type: AnswerComment
score: 0
has text: But I saved the Employee object before its child flusing.

http://stackoverflow.com/comment/32267571
type: QuestionComment
has text: I have attached a screen shot. Hope that helps :-)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21392780

http://stackoverflow.com/comment/32391530
has text: I'm talking about you showing us what you have tried. We don't really give out code on SO.
type: QuestionComment
comment on: http://stackoverflow.com/q/21463535
type: Comment
score: 1

http://stackoverflow.com/q/21511004
has title: How to extract separate portions of HTML with Jsoup?
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21513881
tagged with: jsoup
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I have already used some of the Jsoup methods to get this string that contains a portion of the webpage's HTML code: protected String doInBackground(String... arguments) { // extract arguments String newsurl = arguments[0]; // Document doc = null; try { doc = Jsoup.connect(newsurl).get(); } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } if (doc != null) { Elements myElements = doc.getElementsByClass("news_list"); string1 = myElements.toString(); Log.i("ELEMENTS HTML", string1); } else { string1 = "FAILED"; } return string1; } However, I can't really find methods that would then further divide the HTML file into string-able portions from the Elements class. I have the feeling that my approach is incorrect. The portion of HTML I want to work with looks like this: 1/16/2014 Science Fair The annual Science Fair of the American College of Sofia took place on Wednesday, January 15. You could see photos of some of the incredible projects and experiments in our photo gallery. more 1/10/2014 ACS Students’ Results from PISA 2012 ACS recently received the official results of our students’ performance at the Programme for International Student Assessment (PISA) 2012. PISA is a triennial international survey developed by the Organisation for Economic Co-operation and Development (OECD) that takes place since 2000. It evaluates education systems worldwide by testing the skills and knowledge of 15-16-year-old students in the key subjects: reading, mathematics and science, with a focus on one subject in each year of assessment. In 2012, the assessment focused on students’ knowledge in mathematics. more 12/20/2013 PHOTOS FROM THE CHRISTMAS CONCERT AND THE ALUMNI RECEPTION You can see some great photos from the amazing Annual Christmas Concert taken by Konstantin Karchev from 11 Grade, as well as some photos from the Alumni Reception by visiting the photogallery of the website. more 12/19/2013 THREE ACS MEDAL-WINNERS MEET PRESID…
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21513881
tagged with: http://stackoverflow.com/tag/html
tagged with: java

http://stackoverflow.com/q/21442322
type: Question
answer count: 2
upvote count: 12
downvote count: 0
linked to: http://stackoverflow.com/q/3976344
score: 12
tagged with: singleton
has body: I have a server side application where clients can request to reload the configuration. If a client request to reload the configuration, this should not be done immediately, but with an delay of 1 minute. If another client also requests to reload the configuration in the same minute, this request should be ignored. My idea is to schedule a task with a ScheduledExecutorService like: ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.schedule(new LoadConfigurationTask(), 1, TimeUnit.MINUTES); public class LoadConfigurationTask Runnable { public void run() { // LoadConfiguration } } How can I check if a LoadConfigurationTask has been scheduled, but not executed yet, to be able to ignore further requests until the configuration is reloaded ?
favorite count: 0
has answer: http://stackoverflow.com/a/21442802
tagged with: timer
tagged with: multithreading
has answer: http://stackoverflow.com/a/21442816
has comment: http://stackoverflow.com/comment/32412240
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21442816
accepted answer: http://stackoverflow.com/a/21442802
has title: ScheduledExecutorService - Check if scheduled task has already been completed
has comment: http://stackoverflow.com/comment/32421916

http://stackoverflow.com/a/21490378
score: 0
answers question: http://stackoverflow.com/q/21490239
type: Answer
has body: Binary search works for Collections (ArrayList is implementation of it) too. Method is in java.util.Collections public static &lt;T&gt; int binarySearch(List&lt;? extends Comparable&lt;? super T&gt;&gt; list, T key)` Your element class should implement Comparable interface and implement public int compareTo(T o); method

http://stackoverflow.com/q/21385024
downvote count: 0
has answer: http://stackoverflow.com/a/21864045
tagged with: string
tagged with: unicode
favorite count: 0
accepted answer: http://stackoverflow.com/a/21864045
tagged with: case-sensitive
has comment: http://stackoverflow.com/comment/32957412
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32252765
tagged with: java
score: 6
type: Question
has title: Purpose of String.toLowerCase() with default locale?
tagged with: locale
has answer: http://stackoverflow.com/a/21385290
has comment: http://stackoverflow.com/comment/32954195
has answer: http://stackoverflow.com/a/21385455
has comment: http://stackoverflow.com/comment/32252666
possible better answer: http://stackoverflow.com/a/21385290
answer count: 3
has body: Java has two overloads each for String.toLowerCase and toUpperCase. One of the overloads takes a Locale as a parameter while the other one takes no parameters and uses the default locale (Locale.getDefault()). The parameterless variants might not work as expected because case conversion respects internationalization, and the default locale is system dependent. Most notably, the lower case i is converted to an upper case dotted İ in the Turkish locale. What is the purpose of these methods? Do the parameterless variants have any legitimate use? Or perhaps they were just a design mistake? (Not unlike several I/O APIs that use the system default character encoding by default.)

http://stackoverflow.com/q/21468625
tagged with: regex
has answer: http://stackoverflow.com/a/21469020
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/32401533
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32401440
has answer: http://stackoverflow.com/a/21468871
score: 0
answer count: 3
has title: Scanner for first, middle,lastname
has answer: http://stackoverflow.com/a/21468864
has comment: http://stackoverflow.com/comment/32401641
has comment: http://stackoverflow.com/comment/32401882
has body: The following is the requirement: i. If there is a first, middle, and last, only display the first and last name ii. If there is a first and last, then display both first and last iii. If there is only a first name, then just display it I have the following code: String fullName = "first middle last"; Scanner nameScanner = new Scanner(fullName); nameScanner.findInLine(" "); MatchResult result = nameScanner.match(); if(result.groupCount() &gt; 2) { System.out.println(result.group(1)+ " "+ result.group(3)); } else { System.out.println(fullName); } When I try to run the code I get Exception in thread "main" java.lang.IllegalStateException: No match result available at java.util.Scanner.match(Unknown Source) at com.assignment.RunAssignmentApp.main(RunAssignmentApp.java:48) What am I doing wrong ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32401401

http://stackoverflow.com/q/21390830
has answer: http://stackoverflow.com/a/21390873
has comment: http://stackoverflow.com/comment/32263194
score: 0
has comment: http://stackoverflow.com/comment/32263901
has comment: http://stackoverflow.com/comment/32265477
answer count: 1
has comment: http://stackoverflow.com/comment/32263316
tagged with: variables
linked to: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/32263459
favorite count: 0
tagged with: currency
has comment: http://stackoverflow.com/comment/32263362
has comment: http://stackoverflow.com/comment/32264843
accepted answer: http://stackoverflow.com/a/21390873
has body: I'm currently working on an assignment for school where I need to write a program that it needs to return your change in this mode Input: purchaseAmount: $12.45 givenAmount: $15.00 Output: Change: $2.55 2 one dollar bills 2 quarters 1 nickel But, if I work with this case scenario it works fine. Now, If I want this scenario to work this what I get Input: purchaseAmount: $19.51 givenAmount: $50.01 Output: Twenty dollar bill 1 Ten dollar bill: 1 Quarters: 1 Dimes: 2 Pennies: 4 Which is incorrect since I'm returning to the costumer 30.49 instead of 30.5 Can't figure out whats the issue here. Thanks boolean isFiveBillOn = false, isTwentybillOn = false, isTenbillOn = false, isDollarOn = false, isQuartersOn = false, isDimesOn = false, isNicklesOn = false, isPenniesOn = false; //retrieve amount due String moneyd = JOptionPane.showInputDialog("Enter the amount due"); double amountd = Double.parseDouble(moneyd); String moneyr = JOptionPane.showInputDialog("Enter amount you would like to pay"); double amountr = Double.parseDouble(moneyr); //calculate difference double difference = (amountr - amountd); //convert to pennies int balance = (int)(difference * 100); //twenty dollar bill int twentydollars = balance / 2000; balance = (balance % 2000); if (twentydollars &gt; 0) { isTwentybillOn = true; } //ten dollar bill int tendollars = balance / 1000; balance = (balance % 1000); if (tendollars &gt; 0) { isTenbillOn = true; } //five dollar bill int fivedollars = balance / 500; balance = (balance % 500); if (fivedollars &gt; 0) { isFiveBillOn = true; } //dollar bill int dollars = balance / 100; balance = (balance % 100); if (dollars &gt; 0) { isDollarOn = true; } //quartes int quarters = balance / 25; balance = (balance % 25); if (quarters &gt; 0) { isQuartersOn = true; } //dimes int dimes = balance / 10; balance = (balance % 10); if (dimes &gt; 0) { isDimesOn = true; } //nickles int nickles = balance / 5; balance = (balance % 5); if (nickles &gt; 0){ isNicklesOn = true; } //pennies i…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32263732
has comment: http://stackoverflow.com/comment/32263343
has comment: http://stackoverflow.com/comment/32265408
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/32263269
has title: How do I properly return money double variable in Java
type: Question
tagged with: java

http://stackoverflow.com/a/21387427
has body: static variables are class variables. There is only one copy of static variables per class. You are overwriting the static variables actually. By removing the static keyword from all the three variables, you will now have instance variables. Every object of the class has its own copy of instance variables. So the three declarations should be: public String name; public int ticketsRequired; public float heightRequirement; Now each object will have its own copy of these variables and you will get correct output.
answers question: http://stackoverflow.com/q/21387240
upvote count: 1
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/21402414
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21436838
tagged with: java
has title: How to make the url of links on Screens in Moqui to be relative rather than absolute?
accepted answer: http://stackoverflow.com/a/21436838
type: Question
answer count: 1
downvote count: 0
tagged with: javascript
tagged with: tomcat
tagged with: freemarker
favorite count: 0
score: 2
has body: The link for JavaScript and CSS files appear to have an absolute URL like: &lt;script type="text/javascript" src="http://test.dp.com:8080/js/jquery-1.9.1.min.js" language="javascript"&gt; &lt;script type="text/javascript" src="http://test.dp.com:8080/js/bootstrap.min.js" language="javascript"&gt; &lt;script type="text/javascript" src="http://test.dp.com:8080/js/holder.js" language="javascript"&gt; &lt;link type="text/css" href="css/bootstrap.css" rel="stylesheet"&gt; but I would like them to be: &lt;script type="text/javascript" src="js/jquery-1.9.1.min.js" language="javascript"&gt; &lt;script type="text/javascript" src="js/bootstrap.min.js" language="javascript"&gt; &lt;script type="text/javascript" src="holder.js" language="javascript"&gt; &lt;link type="text/css" href="css/bootstrap.css" rel="stylesheet"&gt; It is also similar to the link on Screen. I would like to have them relative, then it can be possible to add a reverse proxy in front of the application.
upvote count: 2
tagged with: moqui

http://stackoverflow.com/q/21372411
tagged with: java
score: 0
tagged with: classnotfoundexception
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has body: My application is perfectly working when running locally but crashes with ClassNotFoundException every time. I read that this might occur when you forgot to include some dependencies to WEB-INF/libs, but class in question is my own and doesn't use any dependencies. I looked into builded application folder and .class file for this class is there. What could be wrong? javax.servlet.ServletContext log: org.tuckey.web.filters.urlrewrite.Run ERROR: could not find handlers.user.battle.BattleVerifyHandler got a java.lang.NoClassDefFoundError: battle/Utilities/UnitTypeHelperBase java.lang.NoClassDefFoundError: battle/Utilities/UnitTypeHelperBase at com.google.appengine.runtime.Request.process-3aeeaae5c6df581c(Request.java) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:111) at org.tuckey.web.filters.urlrewrite.Run.prepareRunObject(Run.java:252) at org.tuckey.web.filters.urlrewrite.Run.initialise(Run.java:188) at org.tuckey.web.filters.urlrewrite.Run.initialise(Run.java:133) at org.tuckey.web.filters.urlrewrite.RuleBase.initialise(RuleBase.java:284) at org.tuckey.web.filters.urlrewrite.NormalRule.initialise(NormalRule.java:118) at org.tuckey.web.filters.urlrewrite.Conf.initialise(Conf.java:440) at org.tuckey.web.filters.urlrewrite.Conf.&lt;init&gt;(Conf.java:132) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.loadUrlRewriterLocal(UrlRewriteFilter.java:294) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.loadUrlRewriter(UrlRewriteFilter.java:262) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.init(UrlRewriteFilter.java:253) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.C…
has comment: http://stackoverflow.com/comment/32232775
has comment: http://stackoverflow.com/comment/32229992
answer count: 0
upvote count: 1
downvote count: 1
type: Question
has title: Everything is normal on local GAE server but ClassNotFound in production

http://stackoverflow.com/a/31028909
answers question: http://stackoverflow.com/q/21385630
type: Answer
score: 0
has body: It seems there is currently not a better option. This issue was reported here in 2012: https://github.com/neo4j/neo4j/issues/37

http://stackoverflow.com/a/21504462
has body: You need a .class for each class. The usual solution is to combine them into a .jar. The .jar file can be downloaded and moved around as a single file, regardless of how many classes it represents. You can mark it to identify the main class, so it can be run much as a single class file. Creating a .jar is one of the options in Eclipse for File-Export
has comment: http://stackoverflow.com/comment/32465166
has comment: http://stackoverflow.com/comment/32464512
has comment: http://stackoverflow.com/comment/32464507
upvote count: 2
has comment: http://stackoverflow.com/comment/33555130
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32464663
has comment: http://stackoverflow.com/comment/32464598
type: Answer
answers question: http://stackoverflow.com/q/21504403
score: 2
accepted answer of: http://stackoverflow.com/q/21504403
downvote count: 0
has comment: http://stackoverflow.com/comment/32465486

http://stackoverflow.com/a/21370160
score: 0
answers question: http://stackoverflow.com/q/21368092
type: Answer
has body: As I posted in your crosspost you can use HtmlUnit to avoid having to write all that code. The getting started guide shows an example of logging in. Right now what you have looks like a GET request here since the URLs are in the parameter. String encodedParams = URLEncoder.encode("login=true&amp;email=kevin@example.com&amp;pwd=mypassword"); Alternatively, you could try the Apache Http Components library.

http://stackoverflow.com/comment/32286423
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21404209
type: QuestionComment
has text: Your question seems to be too broad for me

http://stackoverflow.com/a/23097387
type: Answer
has body: A class completely replaces another when using Gradle flavors (of the same name obviously). Best practice to avoid reusing code is to have all shared code in your MainActivity so you don't duplicate it (otherwise changes have to be made in multiple locations). Reference any additional code/overrides in your AnotherActivity class.
answers question: http://stackoverflow.com/q/21436806
score: 0

http://stackoverflow.com/comment/32212681
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21362999
has text: Just mentioning the source is not enough: making your answer nothing but a copy-paste, with no contribution of your own, is plagiarism just as well.
score: 0

http://stackoverflow.com/comment/32313941
score: 0
has text: Your approach is correct if your bits are arranged as ARGB with 8 bits each.
comment on: http://stackoverflow.com/q/21419558
type: Comment
type: QuestionComment

runtime-error
tags question: http://stackoverflow.com/q/21482377
tag name: runtime-error
tags question: http://stackoverflow.com/q/21351727
tags question: http://stackoverflow.com/q/21480194
tags question: http://stackoverflow.com/q/21444846
tags question: http://stackoverflow.com/q/21366639
tags question: http://stackoverflow.com/q/21387722
tags question: http://stackoverflow.com/q/21446262
type: Tag
tags question: http://stackoverflow.com/q/21359980

http://stackoverflow.com/comment/32354102
comment on: http://stackoverflow.com/a/21442316
has text: So what is the 'L' needed for in the second case if there's an implicit conversion, aka why not just write the first one?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21485253
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21485150
downvote count: 0
has comment: http://stackoverflow.com/comment/32436608
type: Answer
has body: Summary answer: int length = Hold_Container_Data.length(); String str = Hold_Container_Data.substring(length-100,length);

http://stackoverflow.com/comment/74671582
score: 0
comment on: http://stackoverflow.com/q/21407840
type: Comment
type: QuestionComment
has text: jeejava.com/spring-service-layer-bean-validation/

http://stackoverflow.com/a/21477290
has body: I am not able to understand what exactly you want to do with 'y' so have counted them seperately. It is necessary to first remove all the non-word characters from the input. I have modified your code (though haven't optimized): System.out.print("Enter a string: "); String origphrase = new Scanner(System.in).nextLine(); String phrase = origphrase.replaceAll("\\W",""); int i, length, vowels = 0; int consonants = 0; int ys=0; String j; length = phrase.length(); for (i = 0; i &lt; length; i++) { j = "" + phrase.charAt(i); boolean isAVowel = "aeiou".contains(j.toLowerCase()); boolean y = "y".contains(j.toLowerCase()); if(isAVowel){ vowels++; }else if(y){ ys++; }else{ consonants++; } } System.out.println("Phrase:"+origphrase); System.out.println("Vowels:"+vowels); System.out.println("Consonants:"+consonants); System.out.println("Y's:"+ys);
type: Answer
has comment: http://stackoverflow.com/comment/32415533
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21470539

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/21353558
tags question: http://stackoverflow.com/q/21380009
tags question: http://stackoverflow.com/q/21399313
type: Tag
tags question: http://stackoverflow.com/q/21457258
tags question: http://stackoverflow.com/q/21371413

http://stackoverflow.com/a/21453434
has body: There is a bug report here (Bug 213193). Unfortunately it doesn't look like you can expect this to be fixed any time soon... Section#setTitleBarBackground is working now - sets the top color of the section background gradient like in RCP. Section#setTitleBarGradientBackground sets a color (Section#COLOR_GBG) that is never used in Section class??!! Section#setTitleBarBorderColor - has no effect.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21453255
upvote count: 2
answers question: http://stackoverflow.com/q/21453255
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21486968
type: Answer
has comment: http://stackoverflow.com/comment/32432441
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32432557
answers question: http://stackoverflow.com/q/21486836
downvote count: 0
has comment: http://stackoverflow.com/comment/32432409
has body: You wouldn't use String.split() or a StringTokenizer Use a for loop that increments by 5, checking against length of your string Use String.substring() to extract the 5 character strings. To compute the length of the target array you need, you'll need to divide your string length by 5. A Better idea is to use a List&lt;String&gt;.

http://stackoverflow.com/q/21513655
has comment: http://stackoverflow.com/comment/32480664
has body: Class1 package package1; public class Class1 { public double function1(double parameter1, double parameter2) { //my function here, which returns something, for e.g: return(parameter1 + parameter2) } } Class2 import package1.Class1; public class Class2 { public double function2(double parameter3) { //I want to use the result of the "function1" (which uses parameters) //in this function here like this: double variable1; Class1 obj1 = new Class1() variable1 = obj1.function1(parameter1, parameter2) } } If I declare the variables "parameter1" and "parameter2" INSIDE the "function1" (and initialize them there-itself), it returns no error. But if I put "parameter1" and "parameter2" as PARAMETERS of "function1", then it returns an error: "cannot find variable parameter1". What should I do???
score: -1
tagged with: bluej
favorite count: 0
has answer: http://stackoverflow.com/a/21513810
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32480647
has title: How to call a method of another class in another package, which has its own parameters?
has answer: http://stackoverflow.com/a/21513854
tagged with: java
downvote count: 1
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/52961036
score: 0
type: AnswerComment
type: Comment
has text: We can get the last 5 five digit values in the list using comparator with list.subList(index,index);
comment on: http://stackoverflow.com/a/32552554

http://stackoverflow.com/q/21412807
favorite count: 0
type: Question
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/21413083
answer count: 2
score: 5
possible better answer: http://stackoverflow.com/a/21413289
has answer: http://stackoverflow.com/a/21413289
upvote count: 5
tagged with: java
has body: Could anyone write or give a link to useful keyboard shortcuts in NetBeans? I use this IDE and I would like to know useful things, when creating any application in java. I ask for more than Ctrl+Space, but I ask for keyboard shortcuts especially in Java. On the Internet I found a lot of keyboard shortcuts, but I cannot find site with useful ones.
has title: Netbeans useful keyboard shortcuts
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21413083

http://stackoverflow.com/comment/32437439
comment on: http://stackoverflow.com/a/21488626
has text: I am trying to try all possible combination on a string to see what combination matches.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21510103
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
tagged with: esri
has answer: http://stackoverflow.com/a/25815125
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24150681
has title: Opening file geodatabase using ESRI android API
type: UnansweredQuestion
upvote count: 1
tagged with: gis
has body: for some time I am trying to open file godatabase on android using ESRI api in version 10.2. I have a file godatabase made with Arccatalog 10.1. It contains one layer. I can open it in Arcmap so everything looks fine here. The geodatabase is in folder named android.gdb I copied it to microSD card and tried to open it using this code: new com.esri.core.gdb.Geodatabase("/mnt/sdcard2/android.gdb"); The "/mnt/sdcard2/android.gdb" file exists and is a folder and I have read and write permissions. I get a RuntimeException with the message that the goedatabase file could not be opened. Anyone had similiar issues with that ?

http://stackoverflow.com/comment/32318264
has text: I tried your way, file structure: WebContent/WEB-INF/Loggedin.jsp, LoginServlet /ClassGrading/*
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21422204

http://stackoverflow.com/comment/32470897
score: 0
has text: Aha. I was too quick and didn't look at that either. Good pick up.
type: Comment
comment on: http://stackoverflow.com/a/21504615
type: AnswerComment

http://stackoverflow.com/comment/32426255
type: AnswerComment
type: Comment
has text: @JeffGohlke [`isInstance`](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29) isn't a static method.
comment on: http://stackoverflow.com/a/21483441
score: 0

http://stackoverflow.com/a/21369791
answers question: http://stackoverflow.com/q/21368645
type: Answer
score: 1
upvote count: 1
has body: Several questions you need to ask your self... How scalable is it? What are the performance considerations? How scalable is it? If you take a look at your current approach, you have a single ActionListener monitoring ALL the buttons. What happens if you need to increase the number of Timers to 20, 100, 1000? That's a lot of extra work and a very large if statement. Now, I'm particular about maintaining levels of responsibility and having had to maintain a multi-level if statements within an ActionListener before, really dislike this approach... Instead, you could put everything (the buttons for example) in some kind of List and loop over the list when the actionPerformed method is called, but even that becomes difficult to manage and may not meet the requirements of your design in the long run. You may or can not allow the ActionListener to know about your buttons or you can't access the List due to reference issues, etc... Personally, I would create two classes, a StartActionListener and a StopActionListener. These would take a reference to (at least) a Timer. This would mean, to add a new start button, you would simply need to create a new JButton and create a new instance of StartActionListener and register to the button. You would do a similar thing for the stop button, registering an instance of StopActionListener with it. This divorce the listener design from the application design, as the listeners won't actually need to care about the buttons at all, only the Timer they are managing. It means that each listener is responsible for just one thing and provides a level of abstraction to the design, giving you freedom to choose how to actually implement the overall design/requirements. You may also wish to take a look at How to use Actions which provides with the ability to provide configuration details for the action, making even easier to create controls. What are the performance considerations? Having multiple Timers running may not scale well and will introdu…
accepted answer of: http://stackoverflow.com/q/21368645
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32355022
type: Comment
has text: How would using `AtomicInteger` ensure all threads get the same values of X and Y. That's really not what it does.
comment on: http://stackoverflow.com/a/21442821
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32318124
has text: I am not using Scala-IDE plugin. I am using a Java program that calls method in the ApacheKafka library and that is in Scala. I have the source attached, I mean it is pointing to correct source location.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21421667
score: 0

http://stackoverflow.com/comment/32471579
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21508559
score: 0
has text: what is for integer array `a`?

http://stackoverflow.com/q/21456643
downvote count: 1
type: Question
tagged with: counter
upvote count: 0
has comment: http://stackoverflow.com/comment/32379079
answer count: 1
has comment: http://stackoverflow.com/comment/32378795
has answer: http://stackoverflow.com/a/21457186
favorite count: 0
tagged with: timer
has body: I would link to execute a method from within my thread every 5 seconds. The outline of my class is as follows. private static Timer timer = new Timer(); public class myThread implements Runnable { public void run() { //listens for incoming messages while(true) { //process queue timer.schedule(new TimerTask() { process_queue(); }, 5*1000); } } public static void process_queue() { //processes queue System.out.println("boom"); } } Any help would be appreciated.
has title: Running a Timer From Within a Java Thread
has comment: http://stackoverflow.com/comment/32379272
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32379158
tagged with: java
tagged with: multithreading

http://stackoverflow.com/q/21509622
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32473426
has title: Changing a variable name
has comment: http://stackoverflow.com/comment/32473445
downvote count: 5
answer count: 1
has answer: http://stackoverflow.com/a/21509718
has comment: http://stackoverflow.com/comment/32473337
accepted answer: http://stackoverflow.com/a/21509718
tagged with: variables
has comment: http://stackoverflow.com/comment/32473346
has comment: http://stackoverflow.com/comment/32473414
favorite count: 0
has comment: http://stackoverflow.com/comment/32473354
has body: So I'm making a simple game in java. In this game I want there to be an infinite number of players. The game is Dictionary, but not the one where you race to find a word in a dictionary. How to play: A person chooses a word that no one would know. Everyone enters a made up definition that is believable. Each person guesses which one is the real definition. You get a point for guessing correctly and for the number of people who guess your word (Steps 2 and 3 are ignored by the person who chooses a word) My program (So far): Choose start or quit When start is pressed the number of players selected (Not including word selector). Word selector chooses word in JPasswordField Enters definition in JPasswordField The word is told to Player 1 and then they must enter a definition into a JPasswordField Repeats step 5 until the times repeated are equal to the number of players. The problem I'm having: Player + numberrepeated = passwordfield.getText; doesnt exist. I need to have the variable change each time.

http://stackoverflow.com/a/21376214
type: Answer
answers question: http://stackoverflow.com/q/21376093
has comment: http://stackoverflow.com/comment/32237191
has body: The effect of what you say is basically correct. The problem with your formulation concerns when things happen. When you write String a="hi"; or indeed, your Java file has the string literal "hi" anywhere in it, then this string literal is allocated only once: when the class is loaded, when your code starts running. Then the initialization of a just uses the existing String object. But when you have an explicit constructor call as in String a=new String("hi"); then a new String is created. new means a new string object.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32236962
has comment: http://stackoverflow.com/comment/32236847
downvote count: 0
has comment: http://stackoverflow.com/comment/32237083

http://stackoverflow.com/a/21454609
answers question: http://stackoverflow.com/q/21452716
upvote count: 7
has comment: http://stackoverflow.com/comment/32378740
accepted answer of: http://stackoverflow.com/q/21452716
score: 7
type: AcceptedAnswer
downvote count: 0
has body: Shouldn't the url be something like: String url = "jdbc:mysql://" + MYSQL_DATABASE_HOST + ":" + MYSQL_DATABASE_PORT + "/" + MYSQL_DATABASE_NAME; I.e. the protocol is "jdbc:mysql:" and the parameters are not (?) substituted automatically in the string...
type: Answer

http://stackoverflow.com/q/21492860
type: Question
answer count: 1
score: 0
tagged with: java
has body: I want to add a JButton to the tab bar of my JTabbedPane and this button shouldn't be a tab! Or to maybe say it more clearly, i want to add another component to the area where tabs reside. How can i achieve this? Which part of the JTabbedPane do i have to rewrite?
has title: How to add a button in the tab bar of JTabbedPane, that is not a tab?
has answer: http://stackoverflow.com/a/21523333
type: AnsweredQuestion
tagged with: button
tagged with: tabs
tagged with: jtabbedpane
accepted answer: http://stackoverflow.com/a/21523333

c++
tags question: http://stackoverflow.com/q/21390972
tags question: http://stackoverflow.com/q/21454701
tags question: http://stackoverflow.com/q/21496151
tags question: http://stackoverflow.com/q/21408356
type: Tag
tags question: http://stackoverflow.com/q/21385232
tags question: http://stackoverflow.com/q/21443297
tags question: http://stackoverflow.com/q/21486715
tags question: http://stackoverflow.com/q/21511135
tags question: http://stackoverflow.com/q/21398650
tags question: http://stackoverflow.com/q/21436808
tags question: http://stackoverflow.com/q/21400700
tags question: http://stackoverflow.com/q/21435848
tags question: http://stackoverflow.com/q/21382994
tags question: http://stackoverflow.com/q/21503950
tags question: http://stackoverflow.com/q/21480981
tags question: http://stackoverflow.com/q/21428793
tags question: http://stackoverflow.com/q/21422998
tags question: http://stackoverflow.com/q/21352310
tags question: http://stackoverflow.com/q/21419367
tag name: c++
tags question: http://stackoverflow.com/q/21413158

http://stackoverflow.com/comment/32458113
comment on: http://stackoverflow.com/q/21501142
score: 0
has text: in this example i have only used 3 but I have like 8-10 in total.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32332889
score: 0
comment on: http://stackoverflow.com/q/21429962
type: QuestionComment
has text: @AnkitLamba What date format do you want to receive?
type: Comment

http://stackoverflow.com/comment/32325318
has text: Thanks guys, The issue was silly. I was using StateList as the name in the Country Class. Now i made it to stateList it worked like expected. Thanks a Lot for your Time and Efforts.
comment on: http://stackoverflow.com/q/21425965
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/21483980
has body: Not sure if this is what you need: \+(\d+!) It matches 2! and 3! and 44! See it in action
type: Answer
has comment: http://stackoverflow.com/comment/32433203
score: 0
answers question: http://stackoverflow.com/q/21483446

http://stackoverflow.com/a/21513975
type: Answer
answers question: http://stackoverflow.com/q/21513909
score: 0
has body: Initialize the array after you know how many "things" there are: public static void main(String[] args) { System.out.println("How many things ? "); timesNames = myScanner.nextInt(); names = new String[timesNames]; content = new String[timesNames];

jdbc
tags question: http://stackoverflow.com/q/21362228
tags question: http://stackoverflow.com/q/21499861
tags question: http://stackoverflow.com/q/21478666
tags question: http://stackoverflow.com/q/21452804
tags question: http://stackoverflow.com/q/21452482
tags question: http://stackoverflow.com/q/21393373
tags question: http://stackoverflow.com/q/21358552
tags question: http://stackoverflow.com/q/21428961
tags question: http://stackoverflow.com/q/21498293
tags question: http://stackoverflow.com/q/21378262
tags question: http://stackoverflow.com/q/21417041
tags question: http://stackoverflow.com/q/21478459
tags question: http://stackoverflow.com/q/21357517
tags question: http://stackoverflow.com/q/21361781
tags question: http://stackoverflow.com/q/21446606
tags question: http://stackoverflow.com/q/21430527
tags question: http://stackoverflow.com/q/21472682
tags question: http://stackoverflow.com/q/21381820
tags question: http://stackoverflow.com/q/21394667
type: Tag
tags question: http://stackoverflow.com/q/21452716
tags question: http://stackoverflow.com/q/21512480
tags question: http://stackoverflow.com/q/21510360
tags question: http://stackoverflow.com/q/21447077
tags question: http://stackoverflow.com/q/21470827
tags question: http://stackoverflow.com/q/21391219
tags question: http://stackoverflow.com/q/21371938
tags question: http://stackoverflow.com/q/21402088
tags question: http://stackoverflow.com/q/21386941
tags question: http://stackoverflow.com/q/21360259
tags question: http://stackoverflow.com/q/21377026
tags question: http://stackoverflow.com/q/21485461
tags question: http://stackoverflow.com/q/21384113
tags question: http://stackoverflow.com/q/21351000
tags question: http://stackoverflow.com/q/21480365
tags question: http://stackoverflow.com/q/21476755
tags question: http://stackoverflow.com/q/21380043
tags question: http://stackoverflow.com/q/21460527
tags question: http://stackoverflow.com/q/21359207
tags question: http://stackoverflow.com/q/21508212
tags question: http://stackoverflow.com/q/21460936
tags question: http://stackoverflow.com/q/21442442
tags question: http://stackoverflow.com/q/21451388
tags question: http://stackoverflow.com/q/21383909
tags question: http://stackoverflow.com/q/21414860
tags question: http://stackoverflow.com/q/21351002
tags question: http://stackoverflow.com/q/21447161
tags question: http://stackoverflow.com/q/21510372
tags question: http://stackoverflow.com/q/21416619
tags question: http://stackoverflow.com/q/21364133
tags question: http://stackoverflow.com/q/21499876
tags question: http://stackoverflow.com/q/21485325
tags question: http://stackoverflow.com/q/21510353
tags question: http://stackoverflow.com/q/21444359
tags question: http://stackoverflow.com/q/21481742
tag name: jdbc
tags question: http://stackoverflow.com/q/21360131
tags question: http://stackoverflow.com/q/21418275
tags question: http://stackoverflow.com/q/21411930
tags question: http://stackoverflow.com/q/21379824
tags question: http://stackoverflow.com/q/21375485
tags question: http://stackoverflow.com/q/21414676

http://stackoverflow.com/a/21384222
downvote count: 0
type: Answer
upvote count: 1
has body: Yes, it is. The following code will execute the method someMethod in the MainClass. import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class MainClass { public static final boolean BOOT_TEST = true; public static final String BOOT_CLASS = "MainClass"; public static final String BOOT_METHOD = "someMethod"; public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { if (MainClass.BOOT_TEST) { Class bootClass = Class.forName(BOOT_CLASS); Method bootMethod = bootClass.getDeclaredMethod(BOOT_METHOD, null); bootMethod.invoke(null, null); } } public static void someMethod() { System.out.println("Some method executing..."); } } What you need to do is get the class object for the class whose method you wish to execute dynamically by using the static method Class.forName(String) passing in the class's name. subsequently you can request the method you wish to execute using the getDeclaredMethod(String, Class&lt;?&gt;...) passing in the method's name and parameter types. Following that you can call invoke(Object, Object...) on the method with two null arguments (execute the method on no instance of the class (static execution) without any parameters).
score: 1
answers question: http://stackoverflow.com/q/21383984

http://stackoverflow.com/q/21403750
score: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/2745265
tagged with: arraylist
has comment: http://stackoverflow.com/comment/32286076
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21403804
has comment: http://stackoverflow.com/comment/32285591
linked to: http://stackoverflow.com/q/2745265
has title: Why cannot add an ArrayList<String> into an ArrayList<Object>?
type: Question
tagged with: object
tagged with: java
has body: This is kinda working: ArrayList&lt;Object&gt; list1 = new ArrayList&lt;&gt;(); list1.add("Hello"); list1.add(1.5); list1.add(new Whatever()); ArrayList&lt;ArrayList&lt;Object&gt;&gt; listAll = new ArrayList&lt;&gt;(); listAll.add(list1); In an ArrayList of Object you can add any Object... also you can add the same ArrayList with Objects into another ArrayList of Object. Why is this not working: ArrayList&lt;String&gt; list1 = new ArrayList&lt;&gt;(); list1.add("Hello"); list1.add(new String("World!")); ArrayList&lt;ArrayList&lt;Object&gt;&gt; listAll = new ArrayList&lt;&gt;(); listAll.add(list1); I have an ArrayList of Strings (String is an Object) and I cannot add these although these are Objects in listAll. PS: JDK1.7 Edit: Well I do read this 'duplicate', about Dogs and Cats. Not sure I got it, but alright :)

http://stackoverflow.com/a/21505436
answers question: http://stackoverflow.com/q/21505410
upvote count: 1
downvote count: 0
type: Answer
has body: As long as the method names are properly descriptive, this is a good practice.
score: 1

http://stackoverflow.com/q/21393725
tagged with: scala
has answer: http://stackoverflow.com/a/21393865
answer count: 1
score: 0
tagged with: java
has title: java.net.DatagramSocket Bind error
has body: I'm experimenting with some client server code where the server is a C program on a Linux VM and the client is a scala application on the Host Mac OSX. The client run on my host machine ( MacOs X ) which just does this val ia = InetAddress.getByName("10.0.1.5") val socket = new DatagramSocket( 9345, ia ) Every time I run the above, the creation of the DatagramSocket fails with Can't assign requested address (I haven't got past that little snippet yet but basically its just a basic echo client-server) I'm running a little server snippet written in C on a linux Virtual Machine. Its just a simple echo server. int main(int argc, char *argv[]) { int sock, length, n; socklen_t fromlen; struct sockaddr_in server; struct sockaddr_in from; char buf[1024]; if (argc &lt; 2) { fprintf(stderr, "ERROR, no port provided\n"); exit(0); } sock=socket(AF_INET, SOCK_DGRAM, 0); if (sock &lt; 0) error("Opening socket"); length = sizeof(server); memset(&amp;server, 0, length); server.sin_family=AF_INET; server.sin_addr.s_addr=INADDR_ANY; server.sin_port=htons(atoi(argv[1])); if (bind(sock,(struct sockaddr *)&amp;server,length)&lt;0) error("binding"); fromlen = sizeof(struct sockaddr_in); while (1) { n = recvfrom(sock,buf,1024,0,(struct sockaddr *)&amp;from,&amp;fromlen); if (n &lt; 0) error("recvfrom"); write(1,"Received a datagram: ",21); write(1,buf,n); n = sendto(sock,"Got your message\n",17, 0,(struct sockaddr *)&amp;from,fromlen); if (n &lt; 0) error("sendto"); } return 0; } I run the above server with a.out 9345 // a.out exec name, 9345 -port number I checked to make sure the port number wasn't being used. When I run a simple client on the host machine written in C, I have no problem reaching out to the echo server. Here is the C client: #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #include &lt;arpa/inet.h&gt; #include &lt;netdb.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt; voi…
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
type: Question

http://stackoverflow.com/a/21376166
answers question: http://stackoverflow.com/q/21375961
score: 0
type: Answer
has body: For more details, please refer to my github repo. Hello buddy, I love spring-web-mvc so deeply that I would use it as my primary dispatcher framework. Integrated with spring and hibernate, this SSH framework will be rather powerful and easy for you to develop a web application. spring is a bean container and factory pattern that maintain all instances and beans in your backend application. hibernate is a ORM framework use to free you from nasty and fundamental SQL. springmvc is a dispatcher framework like struts, but I think springmvc is much better than struts due to its convenience. spring To achieve them, first you need to register the spring in web.xml contextConfigLocation classpath*:applicationContext.xml org.springframework.web.context.ContextLoaderListener In spring, you could use xml based configurationor annotation based configuration. I personally prefer annotation because it is much easier. For DAO bean, you could use package scan in applicationContext.xml <context:component-scan base-package="root-package-name"/> Then you should put your applicationContext.xml into your classpath as the depicted to configure the spring container. hibernate Next you need to configure hibernate. Beware hibernate need to configure in applicationContext.xml rather than web.xml. Actually you can use other ORM framework. I just provide you as an example from me. All entity could be automatically scanned by: rugal.center.core.entity org.hibernate.dialect.MySQLDialect false validate false false Isn't it easy? spring-web-mvc Finally it is springmvc that matters. you need to register it in web.xml <servlet> springmvc org.springframework.web.servlet.DispatcherServlet default /static/* springmvc / After this, you need a springmvc-sevlet.xml under WEB-INF folder, which used to configure URL-mapping, response rule and so on. all controller in springmvc could be scanned automatically by: <mvc:annotation-driven > <context:component-scan base-package="rugal.**.controller"> <context:incl…

http://stackoverflow.com/comment/32650154
type: AnswerComment
has text: I'm using code-first approach. The wsdl is generated from the ServiceImplementation. I dont want to edit the wsdl manually after it has been generated. So I need a way to define that a field may not be empty by annotations or something else that infuences the generation-process.
type: Comment
comment on: http://stackoverflow.com/a/21483935
score: 0

http://stackoverflow.com/comment/32379819
comment on: http://stackoverflow.com/a/21457039
score: 0
type: AnswerComment
type: Comment
has text: I am not sure :) batch.begin() batch.end() is a block of code that draws things on screen, I just figured stage.draw() might affect this process

http://stackoverflow.com/a/21375302
answers question: http://stackoverflow.com/q/21375218
type: Answer
has body: Java won't execute any client-side JavaScript. It will just read it. If you want a browser, use a browser.
has comment: http://stackoverflow.com/comment/32235151
upvote count: 1
has comment: http://stackoverflow.com/comment/32235608
score: 1
downvote count: 0

http://stackoverflow.com/q/21405427
tagged with: jenkins-cli
has title: How to create a job in jenkins by using simple Java program
has answer: http://stackoverflow.com/a/21406254
has body: I am new to Jenkins, I want to create a new job using Java. Can any one help me? What are the APIs need to use and is there any sample code?
has comment: http://stackoverflow.com/comment/32288491
has comment: http://stackoverflow.com/comment/32288540
answer count: 1
downvote count: 0
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32318937
type: Question

resolve
tags question: http://stackoverflow.com/q/21492506
tag name: resolve
type: Tag

out-of-memory
tags question: http://stackoverflow.com/q/21396261
tags question: http://stackoverflow.com/q/21375331
tags question: http://stackoverflow.com/q/21430906
type: Tag
tags question: http://stackoverflow.com/q/21500213
tag name: out-of-memory
tags question: http://stackoverflow.com/q/21437699
tags question: http://stackoverflow.com/q/21481277
tags question: http://stackoverflow.com/q/21408300

http://stackoverflow.com/comment/32205059
type: Comment
type: QuestionComment
has text: A raw logcat has a lot of noise in it. Which lines are from your app? (What's its name and/or pid?) See http://stackoverflow.com/questions/6405422/logcat-filtering. Does your game use an input device? (On-screen keyboard?) Any interesting settings? Do you do any networking in your app?
comment on: http://stackoverflow.com/q/21354075
score: 0

http://stackoverflow.com/comment/39789718
type: Comment
has text: Do I need to unproject all touch events? I have only implemented it for the "tap" function but not for the "pan" function. It seems to work so far but the "pan" function is "jumping around" sometimes, could this be caused by not unprojecting the "pan" function?
comment on: http://stackoverflow.com/a/21354459
score: 0
type: AnswerComment

http://stackoverflow.com/q/21482078
has comment: http://stackoverflow.com/comment/32423622
tagged with: java
has answer: http://stackoverflow.com/a/21493565
downvote count: 2
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/21482322
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21482668
has title: Compare dates using comparator in Java
favorite count: 0
has body: I would like to compare date times in such a way that I get the end result values that have been sorted in Date ascending and Time descending order. How could I achieve this in java using Joda-Time library? Data: 01/31 5:50 01/31 5:40 01/30 2:20 Result 01/31 5:40 01/31 5:50 01/30 2:20
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32424069
has comment: http://stackoverflow.com/comment/32424155

http://stackoverflow.com/comment/32290236
type: AnswerComment
has text: Cool, thats awesome.. Ill check out Selenium :)
type: Comment
comment on: http://stackoverflow.com/a/21402592
score: 0

http://stackoverflow.com/comment/32236072
type: AnswerComment
comment on: http://stackoverflow.com/a/21375845
type: Comment
score: 1
has text: Hello!!! as for vipul mittal reply i need to retrieve the values from a text file located in Android! this files contains 6 values different from device to device!

http://stackoverflow.com/comment/32430388
type: AnswerComment
has text: Ah that explains it indeed, funny enough I'm having Algorithms as course starting next week on university... I didn't realise I was implementing such algorithm.
type: Comment
comment on: http://stackoverflow.com/a/21479009
score: 0

http://stackoverflow.com/q/21444095
type: Question
linked to: http://stackoverflow.com/q/19059244
upvote count: 1
has comment: http://stackoverflow.com/comment/32357518
favorite count: 0
answer count: 1
tagged with: apache-commons-io
has body: I am trying to download the file to local disk from the URL. So I'm trying to use the FileUtils.copyURLToFile(new URL(url), filename); But I get IOException Occurred java.io.EOFException: End of input or Premature EOF often without complete download of file. Please let me know what's wrong in this line. What can I check before writing this file?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21444183
tagged with: apache-commons
downvote count: 0
tagged with: eofexception
has title: EOFException with FileUtils.copyURLToFile
score: 1
tagged with: java

http://stackoverflow.com/a/21423541
score: 1
downvote count: 0
type: Answer
has body: use below code for both spinner ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(ListSpinners.this, android.R.layout.simple_spinner_item, list); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
answers question: http://stackoverflow.com/q/21360823
upvote count: 1

http://stackoverflow.com/comment/32251146
type: Comment
type: QuestionComment
has text: @m0skit0 the pattern is that the "c" number goes down by one every time (210 210 210) and it repeats, the "b" number goes down by one and starts repeating the same (210 210 210) pattern when the "c" number hits 0, and the "a" number goes down by one and starts repeating it once the "b" number hits 0. PLEASE HELP ME SOMEBODY
score: 0
comment on: http://stackoverflow.com/q/21383761

http://stackoverflow.com/a/21471111
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21471087
answers question: http://stackoverflow.com/q/21471087
has body: Which thread do you call delay()? The UI thread? If it is the case, you may your applet not responsive and break your app. Try the callback function approach.
type: AcceptedAnswer

http://stackoverflow.com/comment/32454765
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21499156
has text: There is one for any `T[]` since Java 1.6. Are you using an old JDK?
type: Comment

http://stackoverflow.com/comment/32206182
score: 1
comment on: http://stackoverflow.com/q/21359203
type: QuestionComment
has text: You don't get objects from class files.
type: Comment

http://stackoverflow.com/q/21407956
type: Question
answer count: 2
tagged with: lambdaj
has comment: http://stackoverflow.com/comment/32298158
possible better answer: http://stackoverflow.com/a/21426449
has answer: http://stackoverflow.com/a/21426449
accepted answer: http://stackoverflow.com/a/21411740
downvote count: 0
favorite count: 0
has body: During a Java integration project I did last year I discovered lambdaj and was immediately convinced by its ability to let me produce more readable code faster. I remember reading about lambda expressions coming to 1.8 around that time as well and thinking that I had found a plugin that already brought me all that functionality. Now I'm revisiting lambda expressions and see that I may have been mistaken on lambdaj's purpose and scope. The way I see it now, lambdaj doesn't really offer lambda expressions but is rather a domain specific language designed to replace repetitive loops on collections. Its DSL syntax was made to look similar to anonymous functions and provides some of the same functionality such as closures and curried functions, but in the end it's limited by the JLS. I'm now wondering what 1.8's lambda expressions can bring to a Java project that lambdaj can't. Is it just a matter of increased performance with native support for anonymous functions? Will expressions similar to lambdaj's collection manipulation functions be present in 1.8? Or are the lambda expressions in 1.8 meant for me to create my own anonymous functions. In that case, should a specific version of lambdaj be made for 1.8 that recreates the function library using real anonymous functions?
has title: Lambda expressions versus lambdaj
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21411740
score: 7
tagged with: java
upvote count: 7

http://stackoverflow.com/comment/32260968
score: 0
type: Comment
has text: It depends on if she considers "n" to be the size of the matrix or the size of a side of the matrix. According to the function she gave you, n is **not** the size of the matrix, it's the length of a side, so the time complexity should still be O(n^2). If she wanted something else, she should have specified in the problem.
comment on: http://stackoverflow.com/a/21386434
type: AnswerComment

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/21477283

http://stackoverflow.com/a/21366591
score: 1
has body: both ways are almost identical, new int[] also uses for loop to make all of them zero (optimized) but will throw the old array and make the GC work, so both ways almost identical
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21366560
downvote count: 0

http://stackoverflow.com/q/21501162
has comment: http://stackoverflow.com/comment/32458147
has answer: http://stackoverflow.com/a/21501653
has answer: http://stackoverflow.com/a/21501681
tagged with: java
has comment: http://stackoverflow.com/comment/32458347
type: Question
has title: How can I make the following regex match my censors? Java
has body: I am trying to censor specific strings, and patterns within my application but my matcher doesn't seem to be finding any results when searching for the Pattern. public String censorString(String s) { System.out.println("Censoring... "+ s); if (findPatterns(s)) { System.out.println("Found pattern"); for (String censor : foundPatterns) { for (int i = 0; i &lt; censor.length(); i++) s.replace(censor.charAt(i), (char)42); } } return s; } public boolean findPatterns(String s) { for (String censor : censoredWords) { Pattern p = Pattern.compile("(.*)["+censor+"](.*)");//regex Matcher m = p.matcher(s); while (m.find()) { foundPatterns.add(censor); return true; } } return false; } At the moment I'm focusing on just the one pattern, if the censor is found in the string. I've tried many combinations and none of them seem to return "true". "(.*)["+censor+"](.*)" "(.*)["+censor+"]" "["+censor+"]" "["+censor+"]+" Any help would be appreciated. Usage: My censored words are "hello", "goodbye" String s = "hello there, today is a fine day." System.out.println(censorString(s)); is supposed to print " ***** today is a fine day. "
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32458316
has comment: http://stackoverflow.com/comment/32458196
has comment: http://stackoverflow.com/comment/32458432
linked to: http://stackoverflow.com/q/47882
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/32458291
has comment: http://stackoverflow.com/comment/32458378

http://stackoverflow.com/q/21394643
tagged with: eclipse
score: 0
answer count: 2
has body: I'm trying to use an ant build script to create a web service client as given here Here's my ant build file :wsbuild.xml <arg line="-keep -s ./src -p com.test http://localhost:1234/HelloWeb?wsdl"/> And here is the project structure . I get the following error. BUILD FAILED C:\Users\User\workspace_ee\WebService\com\wsbuild.xml:5: Execute failed: java.io.IOException: Cannot run program "wsimport": CreateProcess error=2, The system cannot find the file specified Any idea as to what I'm doing wrong here?
has answer: http://stackoverflow.com/a/21394683
type: UnansweredQuestion
has title: What am I doing wrong with this ant build file to create a web service client?
tagged with: java
type: Question
tagged with: ant
has answer: http://stackoverflow.com/a/43641750

http://stackoverflow.com/q/21501706
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32459192
tagged with: struts2
has title: WARNING: Got result of null when trying to get Boolean. in fieldexpression validation in struts 2
tagged with: validation
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32462916
has body: I have action class and do validation in xml. All validation is successful except this one personBean.carModels personBean.carModels.length>0 You must select at least one value The warning is: лют. 01, 2014 8:03:53 PM com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn WARNING: Got result of null when trying to get Boolean. In personBean class there is List carModels with getters and setters. If I do not use validation with the above code then all is ok and carModels is updated. Why is this? Thank you!
has comment: http://stackoverflow.com/comment/32459532
score: 2
answer count: 0

http://stackoverflow.com/a/21415984
has comment: http://stackoverflow.com/comment/32307991
answers question: http://stackoverflow.com/q/21415885
has comment: http://stackoverflow.com/comment/32307829
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21415885
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32308275
has comment: http://stackoverflow.com/comment/32307923
type: Answer
has body: You never clear your graphicBugArrayList, but only draw the first few elements over and over. Try this in your loop: for(int i=0; i&lt;world1.getNumberofbugs(); i++) { Ellipse2D obscircle = new Ellipse2D.Double(getWorld1().bugArrayList.get(i).getHPosition(), getWorld1().bugArrayList.get(i).getVPosition(), 14, 15); graphicBugArrayList.add(i, obscircle); g2.setPaint(Color.RED); g2.fill(graphicBugArrayList.get(i)); g2.draw(graphicBugArrayList.get(i)); }
score: 2
downvote count: 0

jpa
tags question: http://stackoverflow.com/q/21433911
tags question: http://stackoverflow.com/q/21417041
tags question: http://stackoverflow.com/q/21421395
tags question: http://stackoverflow.com/q/21511782
tags question: http://stackoverflow.com/q/21427593
tags question: http://stackoverflow.com/q/21417958
tags question: http://stackoverflow.com/q/21388972
tags question: http://stackoverflow.com/q/21385497
tags question: http://stackoverflow.com/q/21435103
tags question: http://stackoverflow.com/q/21405897
tags question: http://stackoverflow.com/q/21444720
tags question: http://stackoverflow.com/q/21466904
tags question: http://stackoverflow.com/q/21451492
tags question: http://stackoverflow.com/q/21497089
tags question: http://stackoverflow.com/q/21375527
tags question: http://stackoverflow.com/q/21368316
tags question: http://stackoverflow.com/q/21497536
tags question: http://stackoverflow.com/q/21475322
tags question: http://stackoverflow.com/q/21472456
tags question: http://stackoverflow.com/q/21403470
tags question: http://stackoverflow.com/q/21489074
tags question: http://stackoverflow.com/q/21378375
tags question: http://stackoverflow.com/q/21381943
tags question: http://stackoverflow.com/q/21402123
tags question: http://stackoverflow.com/q/21378220
tags question: http://stackoverflow.com/q/21499386
tags question: http://stackoverflow.com/q/21442667
tags question: http://stackoverflow.com/q/21406333
tags question: http://stackoverflow.com/q/21474942
tags question: http://stackoverflow.com/q/21462633
tags question: http://stackoverflow.com/q/21431665
tags question: http://stackoverflow.com/q/21488333
tags question: http://stackoverflow.com/q/21356448
tags question: http://stackoverflow.com/q/21496764
tags question: http://stackoverflow.com/q/21476344
type: Tag
tags question: http://stackoverflow.com/q/21430282
tags question: http://stackoverflow.com/q/21436553
tags question: http://stackoverflow.com/q/21439776
tags question: http://stackoverflow.com/q/21504764
tags question: http://stackoverflow.com/q/21364395
tags question: http://stackoverflow.com/q/21379405
tags question: http://stackoverflow.com/q/21494890
tags question: http://stackoverflow.com/q/21460074
tags question: http://stackoverflow.com/q/21362576
tags question: http://stackoverflow.com/q/21468506
tags question: http://stackoverflow.com/q/21450767
tags question: http://stackoverflow.com/q/21510938
tags question: http://stackoverflow.com/q/21384111
tags question: http://stackoverflow.com/q/21433047
tags question: http://stackoverflow.com/q/21457361
tags question: http://stackoverflow.com/q/21371192
tags question: http://stackoverflow.com/q/21374230
tags question: http://stackoverflow.com/q/21467698
tags question: http://stackoverflow.com/q/21380765
tags question: http://stackoverflow.com/q/21480337
tags question: http://stackoverflow.com/q/21454925
tags question: http://stackoverflow.com/q/21486177
tags question: http://stackoverflow.com/q/21502382
tags question: http://stackoverflow.com/q/21365686
tags question: http://stackoverflow.com/q/21497991
tags question: http://stackoverflow.com/q/21435645
tags question: http://stackoverflow.com/q/21376891
tags question: http://stackoverflow.com/q/21390667
tags question: http://stackoverflow.com/q/21456494
tags question: http://stackoverflow.com/q/21511326
tags question: http://stackoverflow.com/q/21415177
tags question: http://stackoverflow.com/q/21363423
tags question: http://stackoverflow.com/q/21399975
tags question: http://stackoverflow.com/q/21363987
tag name: jpa
tags question: http://stackoverflow.com/q/21368008
tags question: http://stackoverflow.com/q/21364034
tags question: http://stackoverflow.com/q/21463882
tags question: http://stackoverflow.com/q/21496836
tags question: http://stackoverflow.com/q/21378599
tags question: http://stackoverflow.com/q/21513695
tags question: http://stackoverflow.com/q/21446269
tags question: http://stackoverflow.com/q/21410815
tags question: http://stackoverflow.com/q/21372116

http://stackoverflow.com/comment/32287877
has text: @EJP The String could contain other characters than digits, it could be empty, or it could be too large for an int or float.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21397919

http://stackoverflow.com/a/21371298
has body: List&lt;String&gt; is a Parameterized Type representing a List which can contain objects of type String only whereas List&lt;?&gt; is an Unbounded Wildcard Type representing a List that can contain only objects of some unknown type. As per Effective Java, both are safe to use except for a List of Raw Type which can lead to exceptions at runtime and is provided only for compatibility and interoperability with legacy code written before the introduction of generics.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21371087
score: 1

http://stackoverflow.com/comment/32312508
has text: when i use it in onScrollStateChanged it returns 0, not the real count from method above
comment on: http://stackoverflow.com/a/21418695
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21412438
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/12878012
tagged with: constructor
has title: create database connection once only
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21412805
has body: public class Database { private String ric; private String volume; private String _url; private String _userId; private String _password; private String _dbLib; private String _dbFile; private Connection _conn; private PreparedStatement _statement; public Database(LSE item) { ric = item.get_ric(); volume = item.get_volume(); } public void writeToDb() throws SQLException{ //setString } } I have a ItemDispatcher class: public class ItemDispatcher implements Runnable { private LSE lse; public ItemDispatcher(LSE lseItem) { this.lse= lseItem; } @Override public void run() { try { new Database(lse).writeToFile(); } catch (IOException e) { e.printStackTrace(); } } } run() method in ItemDispatcher runs repeatedly. I want to create database connection and prepareStatement in Database class, but doing this on Database class constuctor would create connection many times over. How can I change my design to create connection just once and not over and over again on every execution of run(). I am trying to not do this in any other class and just Database class
type: Question
has answer: http://stackoverflow.com/a/21412732
has answer: http://stackoverflow.com/a/21412712

http://stackoverflow.com/comment/32302395
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21412935
has text: Are you trying to log your application's loggable entries or those of Maven?

http://stackoverflow.com/a/21452849
answers question: http://stackoverflow.com/q/21452807
score: 0
has body: your issue is related to the fact that you are performing a division between integer. You have to cast at least one of the two operands
type: Answer

http://stackoverflow.com/comment/32348024
type: AnswerComment
has text: It does , before posting this post when the servlet gets empty strings as the Username & Password , it forwards to another JSP that says that there has been a problem . 10x.
type: Comment
comment on: http://stackoverflow.com/a/21439028
score: 0

http://stackoverflow.com/a/21428768
has body: Just put @Query on your interface methods and write your JPQL there. Examples here: http://docs.oracle.com/javaee/7/tutorial/doc/persistence-querylanguage005.htm#BNBVL e.g. SELECT DISTINCT a FROM A a WHERE NOT EXISTS (SELECT b FROM B b WHERE &lt;&lt;put your condition here&gt;&gt;)
has comment: http://stackoverflow.com/comment/32330057
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21428302
score: 1
has comment: http://stackoverflow.com/comment/32412726
has comment: http://stackoverflow.com/comment/32330319
has comment: http://stackoverflow.com/comment/32416301
downvote count: 0
has comment: http://stackoverflow.com/comment/32350250
answers question: http://stackoverflow.com/q/21428302
has comment: http://stackoverflow.com/comment/32329855
type: AcceptedAnswer

http://stackoverflow.com/q/21436184
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/24034752
tagged with: sms-gateway
tagged with: coldfusion
has body: I am running ColdFusion 10 Enterprise on a windows server that has multiple IP addresses assigned to it. I can bind my HTTP traffic to a specific IP address using IIS bind (and or changing the tomcat server.xml connector). But I am trying to bind the ColdFusion SMS Gateway to a specific IP so that SMPP traffic comes from the specific IP I want to bind it to in order to get through a clients firewall. Is it possible to bind the SMS Gateway to a specific IP, is this a tomcat config issue, a JVM parameter, or is their a way to configure the SMS Gateway directly?
type: AnsweredQuestion
score: 3
has title: Bind a ColdFusion SMS gateway to a specific IP address
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24034752
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21479658
linked to: http://stackoverflow.com/q/19659134
has comment: http://stackoverflow.com/comment/32582255
has comment: http://stackoverflow.com/comment/32745906
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32582145
has comment: http://stackoverflow.com/comment/32665503
has comment: http://stackoverflow.com/comment/32447554
has comment: http://stackoverflow.com/comment/32445852
has title: Javaws application getting permission warning while MANIFEST has the Permissions Attribute
has body: I am running my application through javaws and I am getting the following message although I have the following line in my jar MANIFEST.MF. Permissions: all-permissions This application will be blocked in a future Java security update because the JAR file manifest does not contain the Permissions attribute. Please contact the Publisher for more information. More Information What could I be doing wrong? Here is my Manifest file content: Manifest-Version: 1.0 Application-Library-Allowable-Codebase: * Application-Name: XYZ Permissions: all-permissions Created-By: 1.6.0_24 (Sun Microsystems Inc.) Caller-Allowable-Codebase: * Main-Class: com.xyz.Main Codebase: * Name: com/xyz/print/Table.class SHA1-Digest: VTfZjW9GqKB39EmlNA= Name: common Implementation-Vendor: XYZ Implementation-Title: client Implementation-Version: 1391524251884 Specification-Vendor: XYZ Built-By: kuka Specification-Title: Client Specification-Version: Name: com/xyz/print/Element$1.class SHA1-Digest: ucbptZrxyzfaalv6FYw=
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32593275
has comment: http://stackoverflow.com/comment/32509609
tagged with: permissions
score: 2
answer count: 0
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32454643
has comment: http://stackoverflow.com/comment/32445264
has comment: http://stackoverflow.com/comment/32581736
type: Question
has comment: http://stackoverflow.com/comment/32635868
has comment: http://stackoverflow.com/comment/32581800
has comment: http://stackoverflow.com/comment/32708886
has comment: http://stackoverflow.com/comment/37753497
has comment: http://stackoverflow.com/comment/32468587
tagged with: java-web-start
tagged with: manifest

http://stackoverflow.com/comment/32455170
type: AnswerComment
score: 0
has text: Does that compile? Because `new Object().get()` should tell you that there is no such method (even though you define one in an anonymous subclass).
type: Comment
comment on: http://stackoverflow.com/a/21499493

http://stackoverflow.com/comment/36320542
score: 0
comment on: http://stackoverflow.com/a/21416197
type: AnswerComment
type: Comment
has text: @MrSMAK can u please help me how can i write same code of zoomin and zoomout buttons for paging.i am using paging and on every page there will be a image and zoomin and zoomout buttons.Where will i write code for zoomin and zoomout buttons may i need to write zoomin and zoomout btns functionality inside this method: public Object instantiateItem(ViewGroup container, int position) {}

http://stackoverflow.com/a/26453497
answers question: http://stackoverflow.com/q/21448596
score: 0
type: Answer
has body: Go to the camera app first, then run your application. The camera app automatically changes your view.

tomcat7
tags question: http://stackoverflow.com/q/21387077
tags question: http://stackoverflow.com/q/21385548
tags question: http://stackoverflow.com/q/21397775
tags question: http://stackoverflow.com/q/21414969
tags question: http://stackoverflow.com/q/21399814
tags question: http://stackoverflow.com/q/21455155
tags question: http://stackoverflow.com/q/21441024
type: Tag
tags question: http://stackoverflow.com/q/21368570
tags question: http://stackoverflow.com/q/21484280
tag name: tomcat7
tags question: http://stackoverflow.com/q/21441699
tags question: http://stackoverflow.com/q/21487276

http://stackoverflow.com/comment/32241969
type: Comment
comment on: http://stackoverflow.com/a/21375499
score: 0
type: AnswerComment
has text: Does this method scale things automatically according to screen resolution? having a hard time understanding it.

lis
tags question: http://stackoverflow.com/q/21411620
tag name: lis
type: Tag

http://stackoverflow.com/q/21412809
has answer: http://stackoverflow.com/a/21413097
accepted answer: http://stackoverflow.com/a/21413097
tagged with: java
has title: Updating Total in Java Loop
type: Question
upvote count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/21412964
has body: I am having trouble updating the total for each time the loop runs. I've been using the values 2, 50 and 5 to check my work. The total should read: 3, 4.5, 6.75, 10.125, 15.1875, but all I can get is the first total. Any help is very much appreciated! Thanks!! Here's my code: import java.util.Scanner; public class Population { public static void main(String[] args) { int startingOrganisms; int dailyPopulation; int daysMultiply; double dailyTotal = 0; double dailyTotal2 = 0; double dailyTotal3 = 0; Scanner keyboard = new Scanner(System.in); System.out.println("Starting # of Organisms:"); startingOrganisms = keyboard.nextInt(); System.out.println("Daily Population Increase(%):"); dailyPopulation = keyboard.nextInt(); System.out.println("# of Days They'll Multiply:"); daysMultiply = keyboard.nextInt(); for (int i = 1; i&lt;=daysMultiply; i++) { dailyTotal = startingOrganisms*dailyPopulation*.01; dailyTotal2 = startingOrganisms + dailyTotal; System.out.println("Population for day " + i + " = " + dailyTotal2); } } }
has answer: http://stackoverflow.com/a/21413214
answer count: 3
favorite count: 0
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21412964
tagged with: loops
type: AnsweredQuestion

http://stackoverflow.com/q/21359044
favorite count: 0
has body: I've spent quite a while working on Problem #23 on Project Euler. The answer the program below gives me is 4190428, and I can't figure out why. I think it's probably a one or two character mistake somewhere. public long problem23() { ArrayList&lt;Integer&gt; abundantNumbers = new ArrayList&lt;Integer&gt;(); int limit = 28123; for(int i = 2; i &lt; limit; i++) { if(isAbundantNum(i)) { abundantNumbers.add(i); } } boolean [] abundantSum = new boolean [limit+1]; for(int a = 0; a &lt; abundantNumbers.size(); a++) { for(int b = 1; b &lt; abundantNumbers.size(); b++) { int temp = abundantNumbers.get(a) + abundantNumbers.get(b); if(temp &lt;= limit) { abundantSum[temp] = true; } else { break; } } } long sum = 0; for(int i = 1; i &lt;= limit; i++) { if(!abundantSum[i]) { sum += i; } } return sum; } public boolean isAbundantNum(int n) { int factorSum = 1; for(int i = 2; i &lt; Math.sqrt(n); i++) { if(n%i == 0) { factorSum += i; factorSum += n/i; } } if(factorSum &gt; n) { System.out.println(n); return true; } return false; } Edit: Added isAbundantNum(int n) method.
upvote count: 2
has comment: http://stackoverflow.com/comment/32206034
has comment: http://stackoverflow.com/comment/32206075
has comment: http://stackoverflow.com/comment/32206063
has answer: http://stackoverflow.com/a/21359252
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32205901
accepted answer: http://stackoverflow.com/a/21359252
has comment: http://stackoverflow.com/comment/32205934
downvote count: 1
has answer: http://stackoverflow.com/a/27138206
type: Question
possible better answer: http://stackoverflow.com/a/27138206
has title: Project Euler #23 in Java
answer count: 2

http://stackoverflow.com/comment/32481526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21514101
has text: Could you be more specific as to what you mean by "not working?" do you se the message that you have in onListItemClick in logCat?
score: 0

http://stackoverflow.com/comment/32398794
type: QuestionComment
comment on: http://stackoverflow.com/q/21433914
score: 0
has text: Can you fill in what values you are passing into `accountPage()`?
type: Comment

http://stackoverflow.com/a/21372383
type: Answer
has comment: http://stackoverflow.com/comment/32230693
has comment: http://stackoverflow.com/comment/32229974
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21372327
answers question: http://stackoverflow.com/q/21372327
has comment: http://stackoverflow.com/comment/32230797
has comment: http://stackoverflow.com/comment/32230541
type: AcceptedAnswer
downvote count: 0
has body: Here is a better way to extract the data: String s = "001&gt;10102011&gt;874837&gt;Y&gt;Y&gt;TEST001&gt;No\\\\002&gt;11102011&gt;8743834&gt;Y&gt;Y&gt;null&gt;No\\\\"; String[] rows = s.split("\\\\"); for (String r : rows) { String[] cols = r.split("&gt;"); for (String c : cols) { System.out.print(c + "\t"); } System.out.println(); }
has comment: http://stackoverflow.com/comment/32230019
has comment: http://stackoverflow.com/comment/32230137

http://stackoverflow.com/a/21371362
has comment: http://stackoverflow.com/comment/32228313
has comment: http://stackoverflow.com/comment/32229359
downvote count: 0
has comment: http://stackoverflow.com/comment/32228093
has body: Are you initializing keys[] anywhere? You could use smth like that private boolean keys[] = new boolean[MAX_KEYS_AMOUNT] .
type: Answer
answers question: http://stackoverflow.com/q/21371308
has comment: http://stackoverflow.com/comment/32228085
has comment: http://stackoverflow.com/comment/32228257
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32228322
has comment: http://stackoverflow.com/comment/32228187

http://stackoverflow.com/q/21374608
tagged with: db2
has comment: http://stackoverflow.com/comment/32361094
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32241003
favorite count: 0
has comment: http://stackoverflow.com/comment/32246435
has answer: http://stackoverflow.com/a/21387253
has body: I have a requirement where I want to reconcile data between tables which are in different databases in DB2 and out put the differences as a report in java. The approach I am thinking of is: Read first table in a Java Map Collection Read second table in a Java Map Collection Compare the two maps Output the difference in a report Is there any other efficient way to do this through java and sql ? The tables will have around 10 to 15 columns and around 20000 rows of data. Is my approach correct ? P.S.: Things like federating one table into the other database etc. are not allowed.
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has title: Comparing two tables from separate databases in DB2
type: Question
accepted answer: http://stackoverflow.com/a/21387253

http://stackoverflow.com/comment/32196698
has text: http://stackoverflow.com/questions/7461477/how-to-hide-a-jframe-in-system-tray-of-taskbar
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21354028

http://stackoverflow.com/q/21514101
has title: list activity onListItemClick does not firing
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/32482539
has comment: http://stackoverflow.com/comment/32481526
tagged with: java
has answer: http://stackoverflow.com/a/21514425
has answer: http://stackoverflow.com/a/21514126
type: Question
linked to: http://stackoverflow.com/q/14373527
answer count: 2
has comment: http://stackoverflow.com/comment/32482702
has body: I nedd to click on items in list activity to do something, but its not working i search for this problem and saw some answers about this such as : android:focusable="false" android:clickable="false" android:focusableInTouchMode="false" or android:descendantFocusability="afterDescendants" android:descendantFocusability="beforeDescendants" android:descendantFocusability="blocksDescendants" but those are not worked this is my listActivity : public class TrainListActivity extends SherlockListActivity { public static String varStart = "com.example.traininfo.startcity"; public static String varDestination = "com.example.traininfo.destinationcity"; private String start; private String destination; ArrayList&lt;TrainType&gt; trains; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trainlist); Log.i("SearchTrain", "try to get extras..."); start = getIntent().getExtras().getString(varStart); destination = getIntent().getExtras().getString(varDestination); TrainController tc = new TrainController(this); trains = new ArrayList&lt;TrainType&gt;(); trains = tc.getTrainList(start, destination).getTrain(); Log.i("SearchTrain", "got the train list..."); TrainListAdapter adapter = new TrainListAdapter(this, trains); Log.i("SearchTrain", "adapter initialized successfully!!"); setListAdapter(adapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // I want to do something here :( super.onListItemClick(l, v, position, id); Log.i("trainList", "on click"); } } row xml file : &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#27ae60" android:paddingBottom="5dp" android:focusable="true" android:focusableInTouchMode="true" android:clickable="true" &gt; &lt;TextView android:id="@+id/tvTrainName" android:layout_width="match_parent" android:layout_heigh…
score: 0
tagged with: android-listview
has comment: http://stackoverflow.com/comment/32481632
tagged with: listactivity

http://stackoverflow.com/q/21356602
favorite count: 0
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/32202447
tagged with: java
type: Question
has body: It errors at the last line in the client code, with the code. java.io.StreamCorruptedException: invalid stream header: 36353137. I haven't done anything to the stream before this point, so I am unsure what could be causing the problem with the ObjectInputStream. The server class works properly, and follows the behavior I set for it, it is only the client class that is erroring. I thought the problem at first might be because the stream wasn't being flushed, but flushing it did not fix the issue. Apart from that, since this error is happening so early in the code, I am at a loss as to what to add to fix it. Client class - import java.io.*; import java.net.*; public class tcpClient { int nonce; Socket requestSocket; ObjectOutputStream out; ObjectInputStream in; String message; tcpClient(){} void run() { try{ requestSocket = new Socket("localhost", 3223); System.out.println("Connected to localhost in port 3223"); out = new ObjectOutputStream(requestSocket.getOutputStream()); out.flush(); in = new ObjectInputStream(requestSocket.getInputStream()); Server Class - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.Calendar; import java.util.Random; import java.util.Scanner; import javax.swing.Timer; public class TCPMasterServer implements ActionListener { ServerSocket server; Socket client; Random random; Calendar rightNow; Timer timer; String ipaddress; PrintWriter out; BufferedReader ir; public TCPMasterServer() { this.random = new Random(); this.rightNow = Calendar.getInstance(); try { this.server = new ServerSocket(3223); } catch (Exception e) { e.printStackTrace(); } } private void listenForConnection() { try { this.client = this.server.accept(); this.ipaddress = this.client.getInetAddress().getHostAddress(); System.out.println(…
upvote count: 2
has answer: http://stackoverflow.com/a/21357232
accepted answer: http://stackoverflow.com/a/21357232
answer count: 1
has title: Corrupted inputStream

http://stackoverflow.com/q/21430207
type: Question
upvote count: 5
tagged with: java
has body: I am new to parsing field. I'm trying to write a parser code but unable to get the value with respect to a particular tag that value contains ampersand(&amp;). Please help me to get the solution. My xml file looks like &lt;system&gt; &lt;u_id&gt;10145&lt;/u_id&gt; &lt;serial_no&gt;1800015&lt;/serial_no&gt; &lt;branch_name&gt;B &amp; P Infotech Ltd.&lt;/branch_name&gt; &lt;/system&gt; and I have tried with this java code, but it's not giving me proper output. main class package com.satya.xmltest; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; public class SaxTest { public static void main(String[] args) { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SaxtestHandler handler=new SaxtestHandler(); try { SAXParser parser = parserFactory.newSAXParser(); parser.parse("C:\\Users\\abc\\Desktop\\test.xml", handler); } catch (Exception e) { } SystemTo systemTo=handler.systemTo; System.out.println("Uid :"+systemTo.getUid()); System.out.println("serial number :"+systemTo.getSerialNumber()); System.out.println("name :"+systemTo.getName()); } } Handler class In this class the parsing is done and setting the data values to data container class. package com.satya.xmltest; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class SaxtestHandler extends DefaultHandler { String content = ""; SystemTo systemTo=new SystemTo(); @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case "system": System.out.println("inside company"); break; } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { switch (qName) { case "u_id": systemTo.setUid(content); break; case "serial_no": systemTo.setSerialNumber(content); break; case "branch_name": systemTo.setName(content); break; } } @Override public void characters(char[] ch, int start, int length) throws S…
has title: Unable to parse value containing special character? Using sax parser
has answer: http://stackoverflow.com/a/21430358
has answer: http://stackoverflow.com/a/21430590
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/32331798
favorite count: 0
has answer: http://stackoverflow.com/a/21430327
answer count: 4
tagged with: parsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32331931
tagged with: sax
has answer: http://stackoverflow.com/a/21430380

windows
tags question: http://stackoverflow.com/q/21438985
tags question: http://stackoverflow.com/q/21401911
tags question: http://stackoverflow.com/q/21464597
tags question: http://stackoverflow.com/q/21486464
tags question: http://stackoverflow.com/q/21495470
tags question: http://stackoverflow.com/q/21392344
tags question: http://stackoverflow.com/q/21499524
tags question: http://stackoverflow.com/q/21450165
tags question: http://stackoverflow.com/q/21351427
tags question: http://stackoverflow.com/q/21430298
tags question: http://stackoverflow.com/q/21464641
tags question: http://stackoverflow.com/q/21384784
tags question: http://stackoverflow.com/q/21448248
tags question: http://stackoverflow.com/q/21502003
tags question: http://stackoverflow.com/q/21509059
tags question: http://stackoverflow.com/q/21460775
type: Tag
tags question: http://stackoverflow.com/q/21363076
tags question: http://stackoverflow.com/q/21412853
tags question: http://stackoverflow.com/q/21386696
tags question: http://stackoverflow.com/q/21506456
tag name: windows
tags question: http://stackoverflow.com/q/21468553
tags question: http://stackoverflow.com/q/21472034
tags question: http://stackoverflow.com/q/21475917
tags question: http://stackoverflow.com/q/21454951

http://stackoverflow.com/q/21416619
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32311155
has answer: http://stackoverflow.com/a/21418037
tagged with: java
has answer: http://stackoverflow.com/a/21429146
has body: My project contains 4 classes. I don't have idea why it's not working. ConnectionManager class: 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 = ""; private final String CONN_STRING ="jdbc:mysql://localhost:3306/jdbc"; private Connection conn = null; private ConnectionManager(){ } public static ConnectionManager getInstance(){ if(instance==null){ instance = new ConnectionManager(); } return instance; } private boolean openConnection(){ try { conn = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } 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(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } conn=null; } } DBManager class : import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class DbManager { private static Connection conn = ConnectionManager.getInstance().getConnection(); public static void Insert(GetsSets set) throws ClassNotFoundException, SQLException{ Class.forName("com.mysql.jdbc.Driver"); String sql = "INSERT INTO register (fname,lname,gender,state,email,password,age,address,skill) VALUES (?,?,?,?,?,?,?,?,?)"; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.setString(1, set.getFname()); pstmt.setString(2, set.getLname()); pstmt.setString(3, set.getGender()); pstmt.setString(4, set.getState()); pstmt.setString(5, set.getEmail()); pstmt.setString(6, set.getPassword()); pstmt.setString(7, set.getAge()); pstmt.setString(8, set.getAddress()); pstmt.setString(9, set.getSkil…
has title: JSP + JDBC issue
tagged with: servlets
has comment: http://stackoverflow.com/comment/32308512
type: Question
score: 0
has answer: http://stackoverflow.com/a/21417895
has answer: http://stackoverflow.com/a/21416789
tagged with: jdbc
has answer: http://stackoverflow.com/a/21416704
has comment: http://stackoverflow.com/comment/32311175

http://stackoverflow.com/q/21400191
has answer: http://stackoverflow.com/a/21400205
accepted answer: http://stackoverflow.com/a/21400205
score: 1
has answer: http://stackoverflow.com/a/21401747
tagged with: java
type: Question
upvote count: 2
duplicate of: http://stackoverflow.com/q/19690271
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/21400229
answer count: 3
has answer: http://stackoverflow.com/a/21400229
linked to: http://stackoverflow.com/q/19690271
has title: Division on the fly
has body: I'm trying to make a small program in Java which converts Fahrenheit to Celsius. It involves deducting 32 and multiplying by 5/9. So I did this. double Fahrenheit = 100; double celsius = (Fahrenheit - 32) * (5/9); System.out.println(celsius); But for some reason that 5/9 returns zero which ruins it all, even double s = 5/9; returns zero and I don't know why. The only way I found I can do it is if I declare everything and do it slowly, step by step. double x = 5, p = 9, n = (x/p), Fah = 100; double Cel = Fah - 32; Cel = Cel*n; Can anyone tell me why this sort of thing happens, I thought at least declaring it as a double would return a value. And if anyone knows, a way round it.
tagged with: division
type: AnsweredQuestion

http://stackoverflow.com/q/21358334
has answer: http://stackoverflow.com/a/21358813
accepted answer: http://stackoverflow.com/a/21358813
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
has title: Send A list of defined object with Protocol buffer
tagged with: protocol-buffers
has body: Hi guys I want to know if there is a way to send a list of object throw protocol buffer ? as I read this page it say that you can but you need to write code yourself. I actually could not understand what is needed for that so, if someone can help it will be good. Here is the tutorial

http://stackoverflow.com/a/21476111
downvote count: 0
answers question: http://stackoverflow.com/q/21476000
score: 1
has body: Hope this will help you UPDATE Item_detail A JOIN (SELECT Quantity FROM Customer_detail WHERE P_name='ipod') AS B SET Available=A.Available-B.Quantity WHERE A.P_name='ipod';
upvote count: 1
type: Answer

http://stackoverflow.com/comment/32305003
has text: @Kayaman - I wouldn't say that there's "no need" for such a capability. The few languages that have it are capable of some pretty interesting/powerful things as a result.
comment on: http://stackoverflow.com/q/21414093
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32274593
comment on: http://stackoverflow.com/a/21397031
type: Comment
score: 1
has text: Now I can see a Map here. :)
type: AnswerComment

http://stackoverflow.com/comment/32302157
score: 0
type: QuestionComment
has text: it's called escaping, it can be done by Java or Mysql, print your query before to insert to be sure who is causing the problem. http://dev.mysql.com/doc/refman/5.0/en/string-literals.html
type: Comment
comment on: http://stackoverflow.com/q/21412992

http://stackoverflow.com/a/21410838
has body: No, you can't do it unless you store them as string. Or store them as regular int and use string format for the output.
downvote count: 0
answers question: http://stackoverflow.com/q/21410770
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/32213114
type: Comment
score: 1
has text: @MarkoTopolnik, I think you have misunderstood what I mentioned. I didn't mean item is not created, I meant he didn't define any toString() method in GroceryItem, which means it will be using toString of Object or what ever it's super class is.
comment on: http://stackoverflow.com/a/21362577
type: AnswerComment

http://stackoverflow.com/q/21461797
has comment: http://stackoverflow.com/comment/32388347
type: Question
has comment: http://stackoverflow.com/comment/32388073
linked to: http://stackoverflow.com/q/259140
tagged with: servlet-3.0
has comment: http://stackoverflow.com/comment/32388216
tagged with: servlets
upvote count: 2
has body: Is it possible to add a URL pattern to a Servlet dynamically at runtime? For example, when the Servlet starts up, scan a folder for annotations, and then inject those url patterns into the servlet? to provide more clarity - In the Servlet's init file, I want to do this (pseudo-code) // scan all the files in the package my.project.services // find all the classes with the Annotation @Service // read those annotations, find the url patterns in them, and insert them into the servlet
has title: Java - Dynamically Adding URL Pattern to a Servlet
answer count: 1
has comment: http://stackoverflow.com/comment/32388571
favorite count: 0
has answer: http://stackoverflow.com/a/21462193
accepted answer: http://stackoverflow.com/a/21462193
has comment: http://stackoverflow.com/comment/32388430
has comment: http://stackoverflow.com/comment/32388245
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/32419488
type: QuestionComment
comment on: http://stackoverflow.com/q/21479198
has text: @Husam i've added the html
score: 0
type: Comment

http://stackoverflow.com/comment/32342320
type: Comment
type: QuestionComment
has text: Tell more about your requirement. Do you know you want to find "Audi" type 1 and 200 horsePower? Then you don't need loop inside loop. Or do you want to find all sets of similar cars?
comment on: http://stackoverflow.com/q/21434881
score: 0

http://stackoverflow.com/a/21433410
accepted answer of: http://stackoverflow.com/q/21433218
type: Answer
answers question: http://stackoverflow.com/q/21433218
has body: Try uninstalling (completely) and reinstalling NetBeans. That will almost certainly fix your problem and will only take 10 minutes, which is much better than spending several more hours trying to fix a broken installation in a time-critical situation.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32477318
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21511876
has text: "isn't Finally called just before method return?" - No.
type: Comment

http://stackoverflow.com/comment/32200231
comment on: http://stackoverflow.com/q/21356065
score: 0
type: Comment
type: QuestionComment
has text: What is your GetData? Does it have a getInt method?

http://stackoverflow.com/q/21401228
tagged with: gmail
score: 0
has answer: http://stackoverflow.com/a/21421752
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/32281577
possible better answer: http://stackoverflow.com/a/21421752
has answer: http://stackoverflow.com/a/21401489
has body: I'm working on a spring based web app and when a user enters his email and password for a registration i want to a validate them and send him a email.I have used java mail api and set up gmail smtp correctly. Here is my register controller class. @RequestMapping(value = "/globalshop/register", method = RequestMethod.GET) public final ModelAndView registerModel( HttpServletRequest request, HttpServletResponse response) { final String user_email = request.getParameter("user_email"); final String user_password = request.getParameter("user_password"); Properties email_properties = new Properties(); email_properties.put("mail.smtp.auth", "true"); email_properties.put("mail.smtp.starttls.enable", "true"); email_properties.put("mail.smtp.host", "smtp.gmail.com"); email_properties.put("mail.smtp.port", "587"); final String siteEmail = "**************@gmail.com"; final String siteEmailPassword = "*************"; Session session= Session.getInstance(email_properties, new Authenticator() { protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication(siteEmail, siteEmailPassword); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(siteEmail)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(user_email)); message.setSubject("Testing Subject"); message.setText("Dear User,"+ "\n\n You have been successfully registerd with the gift corner!"); Transport.send(message); System.out.println("Done"); } catch (AddressException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); } registerSucessView = new ModelAndView("test_register_succes"); registerSucessView.addObject("welcome", "welcome user"); return registerSucessView; } } user_email and user_password are the incoming request parameters.how can I validate them? If the validation is successful user_email can be set to m…
tagged with: jakarta-mail
type: AnsweredQuestion
tagged with: smtp
has title: JavaMail - Email Authentication for user registration
type: Question
accepted answer: http://stackoverflow.com/a/21401489
tagged with: spring

http://stackoverflow.com/comment/32327812
comment on: http://stackoverflow.com/a/21422694
type: Comment
score: 0
type: AnswerComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/46326/discussion-between-peeskillet-and-ragingbull)

http://stackoverflow.com/comment/32466947
comment on: http://stackoverflow.com/a/21505559
score: 0
type: AnswerComment
type: Comment
has text: Heh, though looking at the bytecode what the *spec* says and what Oracle's JVM *does* seem to be two different things. Bad Oracle ... bad Oracle.

http://stackoverflow.com/a/73234926
type: Answer
has body: If you are using Spring-Data-Jpa +2.7 there is a bug with LIKE parameter using %:param% in queries. It will be fixed in version 3. https://github.com/spring-projects/spring-data-jpa/issues/2548
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/21456494
downvote count: 0

http://stackoverflow.com/a/21415706
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21367972
upvote count: 3
has body: Unfortunately there is no error-page equivalent in java config servlet initialization. You have to override it on application server level
score: 3
answers question: http://stackoverflow.com/q/21367972
type: AcceptedAnswer

http://stackoverflow.com/comment/32403138
score: 0
comment on: http://stackoverflow.com/q/21469768
type: Comment
has text: The "+" is a string value, if I'm not mistaken. Try "_"?
type: QuestionComment

http://stackoverflow.com/q/21479751
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to execute a group of 'select count(*)' queries as a batch in Java?
upvote count: 1
has answer: http://stackoverflow.com/a/21479786
accepted answer: http://stackoverflow.com/a/21479786
type: Question
tagged with: sql-server
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/606234
tagged with: sql-server-2008
has body: EDIT : besides the answer by Gordon, I found this question answered beautifully on this thread While we can execute a group of insert/update statements as a batch, there is no such provision for select statements. I understand that it's impossible to do so because they return results that may have many columns. However, SELECT COUNT(*) FROM table_name returns just one value and that is an integer. Is there a way to run a group of such queries as a batch and retrieve the results as an int array? My particular requirement is to run these queries for a bunch of tables on the same database and then repeat this for more databases. Consider this example: String[] queries = {"SELECT COUNT(*) FROM table1", "SELECT COUNT(*) FROM table2", "SELECT COUNT(*) FROM table3" }; Statement st = connection.createStatement(); for(String q: queries){ st.addBatch(q); } st.executeBatch(); In this case, the executeBatch() command will only return the number of rows affected, which will be zero (I suppose) in this case for each statement. Is there a way to make a batch of such statements considering that they return only one value each? Any workaround? Specific requirements follow.. SQL Procedures are out of question as I have to do this on many different databases and I don't have any access except to read them. I mean, I can store procedures there, but I've been told not to modify the database in any way and just to read from it. Additionally, the number of databases may increase later and I wouldn't be there to install these procedures on them, so I don't want that dependency in order for this solution to be truly flexible. I am using Java with SQL Server 2008 for building a webpage that gets count values from a bunch of tables on various databases and displays them.

http://stackoverflow.com/q/21377981
has answer: http://stackoverflow.com/a/21378526
type: UnansweredQuestion
has title: Cannot convert of type class java.sql.Timestamp to class org.joda.time.DateTime
tagged with: formatdatetime
tagged with: java
type: Question
tagged with: jodatime
tagged with: jstl
answer count: 1
tagged with: jsp
has body: Using jdk-1.7.0_51 and tomcat-7.0.42 on windows 7 platform my JSP page at: &lt;fmt:formatDate value='${abtest.modifiedDate}' pattern="yyyy-MM-dd HH:mm:ss"/&gt; where the abtest.modifiedDate attribute is of type java.util.Date and initialized with java.sql.Timestamp instance. throws the following exception: javax.servlet.jsp.JspException: javax.el.ELException: Cannot convert 1/24/14 4:31 PM of type class java.sql.Timestamp to class org.joda.time.DateTime The error seems to be strange because abtest.modifiedDate attribute is not initialized with org.joda.time.DateTime and it doesn't occur in all environments. Have also tried to replace: &lt;fmt:formatDate... with &lt;joda:format ... tag but got another error: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: value attribute of format tag must be a ReadableInstant or ReadablePartial, was: java.sql.Timestamp
score: 0

http://stackoverflow.com/comment/32263878
type: AnswerComment
comment on: http://stackoverflow.com/a/21367385
type: Comment
has text: I added "implements MyInterface" to the Fragment class, and added the stub routine to the class, but no change. Does the face that I have everything defined in separate .java files have anything to do with this? The example above is all done in one file, but due to the design of my app I need separate files for everything.
score: 0

http://stackoverflow.com/q/21433911
has answer: http://stackoverflow.com/a/21444237
type: AnsweredQuestion
tagged with: java
has body: Hi i am new to spring JPA . I have a table which has two columns namely 'active_from' and 'active_to'.Now I would like to get a column which has a date(ie.current date) which has a value between "active_from" and "active_to".How to acheive this using spring jpa repositories.?
type: Question
has title: how to get a value from a repository with a value which is compared with two fields of a table
score: 0
answer count: 1
tagged with: jpa
tagged with: spring-data-jpa
tagged with: spring
accepted answer: http://stackoverflow.com/a/21444237
tagged with: spring-data

http://stackoverflow.com/comment/32206038
has text: Is `Packet` the class that "contains" the variable? Or `Packet` is the superclass?
type: Comment
comment on: http://stackoverflow.com/q/21359107
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32476735
comment on: http://stackoverflow.com/a/21511454
score: 1
has text: Stop asking everyone if your answers "work for them". If the OP finds that your answer is the best one and is satisfying, then he will upvote and accept it. No need to beg for reputation.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21461754
upvote count: 2
has body: I have this loginscreen class; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package program; import java.sql.*; import javax.swing.JOptionPane; /** * * @author Lacrymae_Ev */ public class loginscreen extends javax.swing.JFrame { public String username; public String getUsername() { return username; } private String pwd; public String getPassword() { return pwd; } /** * Creates new form loginscreen */ public loginscreen() { 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() { Uname_Textfield = new javax.swing.JTextField(); Password_PasswordField = new javax.swing.JPasswordField(); Buton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); Buton.setText("Bağlan"); Buton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ButonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(Uname_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(Password_PasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.…
has comment: http://stackoverflow.com/comment/32388000
has answer: http://stackoverflow.com/a/21462653
type: AnsweredQuestion
tagged with: netbeans
score: 2
possible better answer: http://stackoverflow.com/a/21461896
has title: Call variable from other java class
has comment: http://stackoverflow.com/comment/32388200
has answer: http://stackoverflow.com/a/21461896
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/32388527
has comment: http://stackoverflow.com/comment/32388279
accepted answer: http://stackoverflow.com/a/21462653
downvote count: 0
linked to: http://stackoverflow.com/q/18289930
answer count: 2
tagged with: non-static
tagged with: modal-dialog
favorite count: 0

http://stackoverflow.com/a/21481374
answers question: http://stackoverflow.com/q/21481316
upvote count: 13
has body: You can only import a function from another class if that function is static; so for example this will work: public class Gets { public static void foo() {} } and then import it: import static acs.Gets.foo; If it isn't static however you won't be able to import it. EDIT: As was pointed out in the comments, using static imports can make code more difficult to read, so they should be used with caution. They can be useful if used correctly though.
has comment: http://stackoverflow.com/comment/32447369
has comment: http://stackoverflow.com/comment/32501879
type: AcceptedAnswer
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/32473468
accepted answer of: http://stackoverflow.com/q/21481316
downvote count: 0

http://stackoverflow.com/a/21446920
has comment: http://stackoverflow.com/comment/32362789
type: Answer
has comment: http://stackoverflow.com/comment/32362668
has comment: http://stackoverflow.com/comment/32364585
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32364107
has comment: http://stackoverflow.com/comment/32365007
has comment: http://stackoverflow.com/comment/32362765
accepted answer of: http://stackoverflow.com/q/21446851
has body: This is one solution that I could come up with, where we add a getAmount method to the interface: import java.util.Scanner; public class home { /** * @param args */ public static void main(String[] args) { Scanner s = new Scanner(System.in); final int MAX = 2; Customer [] cust = new Customer[MAX]; int choice = 0; int cnt; double total = 0; for(cnt=0; cnt &lt; MAX &amp;&amp; (choice == 1 || choice ==2 || choice == 0); cnt++){ System.out.println("For a Service customer type 1, for a Purchaser type 2, to terminate the program press 9"); choice = s.nextInt(); switch (choice){ case 1: cust [cnt] = new Service(); break; case 2: cust [cnt] = new Purchaser(); break; default: break; } } for(int i=0; i &lt; cnt; i++){ if(cust[i]!= null) cust[i].showData(); total = cust[i].getAmount() + total; } s.close(); } } abstract class Customer implements Functions { protected String name; } import java.util.Scanner; class Service extends Customer { protected String date; protected double amount; public Service () { getData(); } public void getData() { Scanner s = new Scanner(System.in); System.out.println("Enter the name of the customer"); name = s.nextLine(); System.out.println("Enter date of Service: "); date = s.nextLine(); System.out.println("Enter the cost of Service: "); amount = s.nextDouble(); } public double getAmount(){ return this.amount; } public void showData() { System.out.printf("Customer name: %s The date is: %s, the Amount owed is: %.2f\n",name, date, amount); } } import java.util.Scanner; class Purchaser extends Customer { protected double payment; public Purchaser(){ getData(); } public double getAmount(){ return this.payment; } public void getData() { Scanner s = new Scanner(System.in); System.out.println("Enter the name of the customer"); name = s.nextLine(); System.out.println("Enter payment amount: "); payment = s.nextDouble(); } public void showData() { System.out.printf("Customer name: %s Payment amount is: %.2f\n",name,payment); } } interface Functions { public…
answers question: http://stackoverflow.com/q/21446851
has comment: http://stackoverflow.com/comment/32362790
has comment: http://stackoverflow.com/comment/32395099
has comment: http://stackoverflow.com/comment/32363914
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32364819
has comment: http://stackoverflow.com/comment/32362737
has comment: http://stackoverflow.com/comment/32381514
has comment: http://stackoverflow.com/comment/32364887

http://stackoverflow.com/comment/32431270
comment on: http://stackoverflow.com/a/21485866
has text: `vote` is updated every time the state is changed and therefore `sm.getVote()` always should return the actual value. I prefer to do the whole work in `stateChanged(ChangeEvent)` and personally, I would remove `sm.getVote()`, but this depends on your needs.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21491514
has comment: http://stackoverflow.com/comment/32441851
type: Answer
score: 2
upvote count: 2
has body: Of course it will ask you that every time! You need to save this in a file, and then read from it! //Write PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8"); writer.println(usersName.nextLine()); writer.close(); //Read BufferedReader br = new BufferedReader(new FileReader("the-file-name.txt")); try { while (line != null) { usersName = line; line = br.readLine(); } } finally { br.close(); } Add your logic for determining if there is sth in that file yourself please.
downvote count: 0
answers question: http://stackoverflow.com/q/21491248
has comment: http://stackoverflow.com/comment/32441736

http://stackoverflow.com/a/21508833
has body: Well, if you didn't add your layout to your activity this was your main problem. However you should learn about composing your layouts in xml. This makes your code a lot more readable and maintainable. Also you don't need to worry about switching Threads all the time. If you need to populate your views with runtime data, you should use list views and list adapters. ListViews and ListAdapters are essentials to almost every android app, so you you should really learn about them. If you want your list items to hold more complex layout you can do so by implementing your own custom list adapters. There are also lots of performance tweaks you can do, when using list views. For most use cases generating and managing your layout from code is not a good approach.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21505169
score: 1

http://stackoverflow.com/comment/32454284
type: Comment
has text: This only works if every predicate describes a distinct set of `Result`s. If you have, for example, two predicates `x<3` and `x<5` then the result sets overlap and you need to store the `Result` in two queues if `Result.x=1`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21498377

http://stackoverflow.com/comment/32264780
type: Comment
comment on: http://stackoverflow.com/a/21388168
has text: What I want it to happen is, when the user types in a number, I want it to without the user pressing the OK button, to do the tasks that it is assigned to e.g. invalid input error, enabling then next box ect.
type: AnswerComment
score: 0

frameworks
tags question: http://stackoverflow.com/q/21375902
tag name: frameworks
type: Tag
tags question: http://stackoverflow.com/q/21381035
tags question: http://stackoverflow.com/q/21387842
tags question: http://stackoverflow.com/q/21471290
tags question: http://stackoverflow.com/q/21364547
tags question: http://stackoverflow.com/q/21388976

contains
tags question: http://stackoverflow.com/q/21355121
tag name: contains
type: Tag
tags question: http://stackoverflow.com/q/21466924
tags question: http://stackoverflow.com/q/21370900

xmlunit
tags question: http://stackoverflow.com/q/21352657
tag name: xmlunit
tags question: http://stackoverflow.com/q/21478692
type: Tag

http://stackoverflow.com/a/21495788
type: Answer
answers question: http://stackoverflow.com/q/21473454
has body: You can emulate a corutine like this: class Coruntine extends Thread { Semaphore in = new Semaphore(0); Semaphore out = new Semaphore(0); boolean started=false; public Coruntine() { super.setDaemon(true); } public void method() { if (started) { in.release(); } else { started=true; start(); } try { out.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } } public void _return() { out.release(); try { in.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } } public void run() { while (true) { System.out.println("do stuff 1"); _return(); // like return System.out.println("do stuff 2"); _return(); System.out.println("do stuff 3"); _return(); // then start all over } } } public static void main(String[] args) { Coruntine c = new Coruntine(); c.method(); // should start method System.out.println("do stuff AFTER method() RETURNS 1"); c.method(); // should continue method at same place as it ended System.out.println("do stuff AFTER method() RETURNS 2"); c.method(); // should continue method at same place as it ended System.out.println("do stuff AFTER method() RETURNS 3"); c.method(); // should continue method at same place as it ended System.out.println("do stuff AFTER method() RETURNS 4"); } if method() should return value and/or accept parameters, use blocking queues instead of semaphore(s).
score: 0

http://stackoverflow.com/a/21462412
has comment: http://stackoverflow.com/comment/32389995
has body: the most generic solution would be traffic sniffer.
has comment: http://stackoverflow.com/comment/32439315
type: Answer
has comment: http://stackoverflow.com/comment/32390430
answers question: http://stackoverflow.com/q/21460218
score: 0
has comment: http://stackoverflow.com/comment/32420861

http://stackoverflow.com/comment/32332103
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21429745
type: Comment
has text: Ahhhh, I took out the delete :), Thank you sooo much

http://stackoverflow.com/q/21375208
has comment: http://stackoverflow.com/comment/32235102
has title: java.sql.SQLException: ORA-00942: table or view does not exist)
score: 0
has body: I am getting the following exception, although I have the table present in my schema and also I have the grant to create a table. RequestDAOImplBean;ERROR;DataAccessException : PreparedStatementCallback; bad SQL grammar [INSERT INTO okarmacompl.SERVICE_REQUEST_FAULT (SERVICE_REQUEST_ID, FAULT_CODE, DESCRIPTION, PARAMETER_NAME, TYPE, SERVICE_REQUEST_FAULT_ID) VALUES (?, ?, ?, ?, ?, okarmacompl.SEQUENCESERVICEREQUESTFAULT.nextval)]; nested exception is java.sql.SQLException: ORA-00942: table or view does not exist What could be the possible reason for this
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/32273553
has comment: http://stackoverflow.com/comment/32235052
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32235159
has comment: http://stackoverflow.com/comment/32274661
has comment: http://stackoverflow.com/comment/32239707
has comment: http://stackoverflow.com/comment/32251268
type: Question
has comment: http://stackoverflow.com/comment/32234955
has comment: http://stackoverflow.com/comment/32242346

http://stackoverflow.com/q/21510177
has comment: http://stackoverflow.com/comment/32474382
answer count: 3
has answer: http://stackoverflow.com/a/32716215
downvote count: 0
possible better answer: http://stackoverflow.com/a/35443235
tagged with: embedded-jetty
favorite count: 0
accepted answer: http://stackoverflow.com/a/21510654
has answer: http://stackoverflow.com/a/35443235
upvote count: 6
has title: Embedded Jetty 9
type: AnsweredQuestion
tagged with: java
has body: I dont understand how i can rewrite this code used with jetty 6 for jetty 9 : import org.mortbay.jetty.*; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.jetty.webapp.WebAppContext; public class ApplLauncher { public static void main(String[] args) { Server server = new Server(); Connector connector = new SelectChannelConnector(); connector.setPort(8080); server.addConnector(connector); WebAppContext root = new WebAppContext("C:\\Users\\OZKA\\IdeaProjects\\projectname\\projectname\\web", "/"); root.setWelcomeFiles(new String[]{"index.html"}); //root.addServlet(new ServletHolder(new TestServlet()), "/test"); server.setHandlers(new Handler[]{root}); try { server.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } The code above works fine and response the static content from the web folder and servlets, mapped in web.xml. Here is my attempts to use embeded jetty 9: import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.Handler; public class ApplLauncher { public static void main(String[] args) { System.out.println("Hello from ScalaSbt Web Project"); Server server = new Server(8080); WebAppContext webapp = new WebAppContext("D:\\Dev\\Scala\\ScalaTestProject\\web\\", "/"); ResourceHandler resource_handler = new ResourceHandler(); resource_handler.setWelcomeFiles(new String[]{ "index.html" }); HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] { resource_handler, webapp}); server.setHandler(handlers); try { server.start(); server.join(); } catch(Exception ex) { ex.printStackTrace(); } } } The server is starting, but index.html request throws error: "java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z" I tried to find a working example in Google, but found nothing useful. Offic…
has comment: http://stackoverflow.com/comment/32474314
type: Question
has answer: http://stackoverflow.com/a/21510654
score: 6
tagged with: servlets

http://stackoverflow.com/comment/134363229
type: AnswerComment
comment on: http://stackoverflow.com/a/21417756
type: Comment
has text: Thanks. Although it will throw a `StringIndexOutOfBoundsException` if the filename contains no dot at all. It should rather be like: `String s = (lastDotIndex > -1) ? ... : r + "V1"`.
score: 2

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/21402346
tag name: ksoap2

http://stackoverflow.com/comment/32201165
type: QuestionComment
score: 3
has text: you didnt define `height`. end of..
comment on: http://stackoverflow.com/q/21356563
type: Comment

http://stackoverflow.com/comment/32414419
type: AnswerComment
has text: I got it wrong - turned out it's escaped as `&amp;`. Now it's working just fine.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21471830

http://stackoverflow.com/a/21401182
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32307676
has comment: http://stackoverflow.com/comment/32281575
upvote count: 1
has comment: http://stackoverflow.com/comment/32283116
has body: 1) find the leaf closest to the root of the tree (DFS) 2) find the depth of the given node, if you don't know it already (DFS) 3) find the leaf closest to the given node among its descendants (DFS) The solution is the shortest among 1+2 and 3. It can probably be combined in a single DFS. As pointed by @Eyal, this is wrong. Here is the fix: 1) For every node in the tree, find the closest leaf among its descendants (DFS). 2) For every node along the path from the root of the tree to the given node, add the distance from the node to its closest descendant and the distance to the given node. A solution is given by the smallest sum. You can implement this as follows: Start from the DFS algorithm that finds a closest descendant leaf for all nodes in the tree. Modify the recursive function so that it knows a) the depth of the current node, let Dc, b) the depth of the given node, let Dg, and c) the smallest depth reached since the given node was seen, let Ds, initially set to -1, d) the closest node so far (not necessarily a descendant). Before leaving the function, if the current node is the given node, set Dg= Ds= Dc; else if Dc &lt; Ds, update Ds= Dc and keep the closest node between the closest so far and the closest descendant of the current node, adding a distance penalty Dc - Dg.
answers question: http://stackoverflow.com/q/21400661
type: Answer

http://stackoverflow.com/comment/32287359
comment on: http://stackoverflow.com/a/21403867
score: 2
type: AnswerComment
type: Comment
has text: @AndreyKnuppVital: :D:D:D OK, I can see my reading skills could use some upgrade.

http://stackoverflow.com/comment/32311221
score: 0
type: QuestionComment
type: Comment
has text: The code doesn't even compile.
comment on: http://stackoverflow.com/q/21418122

android-linearlayout
tags question: http://stackoverflow.com/q/21393082
type: Tag
tags question: http://stackoverflow.com/q/21501737
tag name: android-linearlayout
tags question: http://stackoverflow.com/q/21492557

http://stackoverflow.com/a/21490714
type: Answer
has comment: http://stackoverflow.com/comment/32440506
has comment: http://stackoverflow.com/comment/32440737
has comment: http://stackoverflow.com/comment/32440244
has comment: http://stackoverflow.com/comment/32440478
has comment: http://stackoverflow.com/comment/32440145
has comment: http://stackoverflow.com/comment/32440923
has comment: http://stackoverflow.com/comment/32439917
has comment: http://stackoverflow.com/comment/32440660
has comment: http://stackoverflow.com/comment/32440712
has comment: http://stackoverflow.com/comment/32440819
has body: You didn't initialize videoview. You can do that like this: videoview = (ImageView) findViewById(R.id.myImageView)
has comment: http://stackoverflow.com/comment/32440004
answers question: http://stackoverflow.com/q/21490686
downvote count: 1
score: 4
has comment: http://stackoverflow.com/comment/32439864
has comment: http://stackoverflow.com/comment/32440583
has comment: http://stackoverflow.com/comment/32439901
upvote count: 5
has comment: http://stackoverflow.com/comment/32440106

http://stackoverflow.com/comment/32329737
score: 0
type: AnswerComment
has text: please provide new logcat
type: Comment
comment on: http://stackoverflow.com/a/21404064

http://stackoverflow.com/comment/32311698
score: 0
comment on: http://stackoverflow.com/q/21418284
has text: Have a look at `onPause()` and `onStop()` - these method should be called when the user hits any button that sends your app to the background.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21356277
tagged with: java
has comment: http://stackoverflow.com/comment/32201084
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32200971
tagged with: if-statement
score: 0
has answer: http://stackoverflow.com/a/21356299
answer count: 2
has comment: http://stackoverflow.com/comment/32200619
has comment: http://stackoverflow.com/comment/32200646
favorite count: 0
has comment: http://stackoverflow.com/comment/32200616
has answer: http://stackoverflow.com/a/21356308
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32200809
has body: Thanks guys, and, new problem arises. Even if the list and user input is correct, it will still print out "Your movie or/and theatre cannot be found." Things that I have found out about the problem. When there is 1 item in either one of the list (movie 0-1 item &amp; theatre 0-1 item), it will not print out "Your movie or/and theatre cannot be found." But when there is more than 1 item in either 1 of them (movie 1 item &amp; theatre 2 or movie 2 &amp; theatre 1), it will print out the if(found == false) statement. public void addScreening(){ System.out.println("-ADD NEW SCREENING-"); String mTitle = Helper.readString("Enter movie title &gt; "); String tName = Helper.readString("Enter theatre name &gt; "); boolean found = true; while(found == true){ for (int i = 0; i &lt; movies.size(); i++) { for (int j = 0; j &lt; theatres.size(); j++) { if ((movies.get(i).getTitle().contains(mTitle) || mTitle.contains(movies.get(i).getTitle())) &amp;&amp; (theatres.get(j).getName().contains(tName) || tName.contains(theatres.get(j).getName()))) { int year = Helper.readInt("Enter year &gt; "); int month = Helper.readInt("Enter month &gt; "); int day = Helper.readInt("Enter day &gt; "); int hour = Helper.readInt("Enter hour &gt; "); int min = Helper.readInt("Enter min &gt; "); screenings.add(new MovieScreening(Helper.thisDate(year, month, day, hour, min), movies.get(i),theatres.get(j), 0)); System.out.println("Added successfully"); }else if((!movies.get(i).getTitle().contains(mTitle) || !mTitle.contains(movies.get(i).getTitle())) || (!theatres.get(j).getName().contains(tName) || !tName.contains(theatres.get(j).getName()))){ found = false; } } }break; }if (found == false){ System.out.println("Your movie or/and theatre cannot be found."); found = true; } } output -ADD NEW SCREENING- Enter movie title &gt; 3 Enter theatre name &gt; 3 Enter year &gt; 3 Enter month &gt; 3 Enter day &gt; 3 Enter hour &gt; 3 Enter min &gt; 3 Added successfully Your movie or/and theatre cannot be found.
has title: Java - IF statement after While loop not working

thread-safety
tags question: http://stackoverflow.com/q/21359770
tags question: http://stackoverflow.com/q/21438939
tags question: http://stackoverflow.com/q/21416428
tags question: http://stackoverflow.com/q/21447711
tags question: http://stackoverflow.com/q/21472762
tags question: http://stackoverflow.com/q/21374188
tag name: thread-safety
tags question: http://stackoverflow.com/q/21364369
tags question: http://stackoverflow.com/q/21512550
tags question: http://stackoverflow.com/q/21362657
tags question: http://stackoverflow.com/q/21452482
tags question: http://stackoverflow.com/q/21497863
type: Tag

http://stackoverflow.com/comment/32392288
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21463983
has text: I don't have one. But you can basically just read a max of X bytes and then stop. http://stackoverflow.com/questions/15445504/copy-inputstream-abort-operation-if-size-exceeds-limit
type: Comment

http://stackoverflow.com/comment/32260257
score: 0
type: QuestionComment
type: Comment
has text: @Hugo Sousa, sorry for the late reply, I am not creating the boxes elsewhere, there are only made in this piece of code.
comment on: http://stackoverflow.com/q/21387856

http://stackoverflow.com/q/21427037
has comment: http://stackoverflow.com/comment/32326873
duplicate of: http://stackoverflow.com/q/847652
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32326600
has comment: http://stackoverflow.com/comment/32326441
duplicate of: http://stackoverflow.com/q/2466828
has comment: http://stackoverflow.com/comment/32326670
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/847652
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32326533
type: Question
has body: I have created a jar file using eclipse. My jdk version is 1.5.0. when i run that jar file on linux machine with the same JDK it works fine. But when I run this jar on solaris machine with JDK 1.5.0_14 installed it gives error as Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) I couldn't get any solution..?
downvote count: 0
tagged with: solaris
linked to: http://stackoverflow.com/q/2466828
has answer: http://stackoverflow.com/a/21427183
tagged with: linux
has title: Bad version number error in classfile
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/32326478
favorite count: 0

http://stackoverflow.com/q/21444474
has comment: http://stackoverflow.com/comment/32358107
answer count: 1
has answer: http://stackoverflow.com/a/29453509
linked to: http://stackoverflow.com/q/21495864
has comment: http://stackoverflow.com/comment/32449535
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32357990
has comment: http://stackoverflow.com/comment/32367860
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/32358007
has comment: http://stackoverflow.com/comment/32449598
has title: Breaking down the scene into squares
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/32358423
tagged with: arrays
score: 0
has body: How do I break down a 400x400 scene into 40 equal pairs (10x10 squares)? Is the best approach to use a two-dimensional array? How do I select each square after I've divided the screen into 40 equal 10x10 squares? Source code examples and/or tutorials will be greatly appreciated. P.S. I'm using JavaFX Thanks. final Group root = new Group(); Scene scene = new Scene(root, 400, 400); primaryStage.setScene(scene); primaryStage.show();

http://stackoverflow.com/comment/32318964
comment on: http://stackoverflow.com/q/21422548
has text: Dates are not `Select` elements. They are tables indeed
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32338546
comment on: http://stackoverflow.com/a/21433871
type: AnswerComment
type: Comment
has text: So basically you are saying that this should work and if it is not it means that there is something wrong with lists and OP should print them to see problem? It seems [more like a comment to me rather than answer](http://meta.stackexchange.com/questions/118992/are-works-for-me-answers-valid).
score: 2

getstring
tags question: http://stackoverflow.com/q/21452189
tag name: getstring
type: Tag

http://stackoverflow.com/comment/32418056
comment on: http://stackoverflow.com/a/21478754
type: AnswerComment
has text: @MarkoTopolnik you guys are amazing ;) assylias just write him a check and he won't feel bad :D
score: 0
type: Comment

http://stackoverflow.com/comment/32404603
score: 0
type: Comment
type: QuestionComment
has text: You could create an array of bases and check whether x is greater than or equal to `bases[c]` and less than `bases[c+1]`
comment on: http://stackoverflow.com/q/21470222

http://stackoverflow.com/a/21419113
upvote count: 2
answers question: http://stackoverflow.com/q/21419050
type: Answer
has body: You never initialized the variable copyArray.
has comment: http://stackoverflow.com/comment/32313594
has comment: http://stackoverflow.com/comment/32330504
has comment: http://stackoverflow.com/comment/32313096
score: 2
downvote count: 0

http://stackoverflow.com/comment/32358494
has text: two ifs and an if 'else if' are the same thing, no?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21438263
type: Comment

http://stackoverflow.com/comment/32344793
score: 0
comment on: http://stackoverflow.com/q/21414750
type: Comment
type: QuestionComment
has text: Ok, I have updated the post, see is that enough info?

http://stackoverflow.com/comment/32291012
type: QuestionComment
comment on: http://stackoverflow.com/q/21406785
score: 0
has text: Note that this has nothing to do with Java, but with the underlying file system.
type: Comment

http://stackoverflow.com/comment/32260694
type: Comment
has text: I just noticed that the first function states "int j=0; **j<i**; j++" and not "int j=0; j<n; j++". This means the overall function will be n(n+1)/2=(n^2+n)/2=O(n^2). Still not O(n) though. I'll alter my answer so it's correct.
comment on: http://stackoverflow.com/a/21386434
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32478775
type: QuestionComment
comment on: http://stackoverflow.com/q/21512651
has text: 1) When you run it via html, do you get any error messages in the browser's Java console? 2) You look like you really want to use a CardLayout rather than manually swap components. 3) You're better off creating Swing JApplets not AWT Applets. 4) Many will say that you may be far better off using neither, that applet technology is passe, and that most folks are using HTML5/CSS/JS.
type: Comment
score: 1

mysql
tags question: http://stackoverflow.com/q/21428796
tags question: http://stackoverflow.com/q/21414860
tags question: http://stackoverflow.com/q/21375485
tags question: http://stackoverflow.com/q/21452310
tags question: http://stackoverflow.com/q/21442148
tags question: http://stackoverflow.com/q/21512698
tags question: http://stackoverflow.com/q/21487276
tags question: http://stackoverflow.com/q/21432781
tags question: http://stackoverflow.com/q/21464638
tags question: http://stackoverflow.com/q/21499876
tags question: http://stackoverflow.com/q/21412701
tags question: http://stackoverflow.com/q/21350109
tags question: http://stackoverflow.com/q/21356511
tags question: http://stackoverflow.com/q/21394479
tag name: mysql
tags question: http://stackoverflow.com/q/21393373
tags question: http://stackoverflow.com/q/21360393
tags question: http://stackoverflow.com/q/21422583
tags question: http://stackoverflow.com/q/21476000
tags question: http://stackoverflow.com/q/21382725
tags question: http://stackoverflow.com/q/21376488
tags question: http://stackoverflow.com/q/21500681
tags question: http://stackoverflow.com/q/21467477
tags question: http://stackoverflow.com/q/21498293
tags question: http://stackoverflow.com/q/21352501
tags question: http://stackoverflow.com/q/21360131
tags question: http://stackoverflow.com/q/21483066
tags question: http://stackoverflow.com/q/21380733
tags question: http://stackoverflow.com/q/21355188
tags question: http://stackoverflow.com/q/21463727
tags question: http://stackoverflow.com/q/21446606
tags question: http://stackoverflow.com/q/21388925
tags question: http://stackoverflow.com/q/21399660
tags question: http://stackoverflow.com/q/21430527
tags question: http://stackoverflow.com/q/21435223
tags question: http://stackoverflow.com/q/21458672
tags question: http://stackoverflow.com/q/21362815
tags question: http://stackoverflow.com/q/21430325
tags question: http://stackoverflow.com/q/21362631
tags question: http://stackoverflow.com/q/21491981
tags question: http://stackoverflow.com/q/21364395
tags question: http://stackoverflow.com/q/21381895
tags question: http://stackoverflow.com/q/21465439
tags question: http://stackoverflow.com/q/21406483
tags question: http://stackoverflow.com/q/21367424
tags question: http://stackoverflow.com/q/21471097
tags question: http://stackoverflow.com/q/21424910
tags question: http://stackoverflow.com/q/21495637
tags question: http://stackoverflow.com/q/21350301
tags question: http://stackoverflow.com/q/21453302
tags question: http://stackoverflow.com/q/21371938
tags question: http://stackoverflow.com/q/21487802
tags question: http://stackoverflow.com/q/21403470
tags question: http://stackoverflow.com/q/21500781
tags question: http://stackoverflow.com/q/21489074
tags question: http://stackoverflow.com/q/21476777
tags question: http://stackoverflow.com/q/21466391
tags question: http://stackoverflow.com/q/21384113
tags question: http://stackoverflow.com/q/21394667
tags question: http://stackoverflow.com/q/21405272
tags question: http://stackoverflow.com/q/21508417
type: Tag
tags question: http://stackoverflow.com/q/21512480
tags question: http://stackoverflow.com/q/21476960
tags question: http://stackoverflow.com/q/21486576
tags question: http://stackoverflow.com/q/21351010
tags question: http://stackoverflow.com/q/21460527
tags question: http://stackoverflow.com/q/21508212
tags question: http://stackoverflow.com/q/21409533
tags question: http://stackoverflow.com/q/21457361
tags question: http://stackoverflow.com/q/21433096
tags question: http://stackoverflow.com/q/21493154
tags question: http://stackoverflow.com/q/21351002
tags question: http://stackoverflow.com/q/21466952
tags question: http://stackoverflow.com/q/21463584
tags question: http://stackoverflow.com/q/21470480
tags question: http://stackoverflow.com/q/21360536
tags question: http://stackoverflow.com/q/21389079
tags question: http://stackoverflow.com/q/21412992
tags question: http://stackoverflow.com/q/21352055

http://stackoverflow.com/a/21371163
type: Answer
upvote count: 1
has body: As you already said, second will contain list of strings. First contains list of unknown objects and you need to explicilty cast them to proper objects before you use them. There would be other benifits with wild cards when you use them with inheritance like List&lt;? extends ABC&gt; etc. You need to go through the wildcard section of the java docs. Here is a simple tutorial to understand them http://tutorials.jenkov.com/java-generics/wildcards.html
answers question: http://stackoverflow.com/q/21371087
score: 1
downvote count: 0

http://stackoverflow.com/comment/32406033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21471317
type: Comment
has text: so the web client would call directly the service layer?

http://stackoverflow.com/comment/32342558
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21436157
has text: thnks ZouZou it solved my problem.
score: 0

http://stackoverflow.com/comment/32405164
type: AnswerComment
comment on: http://stackoverflow.com/a/21470742
has text: Try it without specifying the ClassLoader: `ResourceBundle RESOURCE = ResourceBundle.getBundle(resourceName, Locale.getDefault());`
score: 0
type: Comment

http://stackoverflow.com/a/21406089
answers question: http://stackoverflow.com/q/21405958
score: 0
has body: You omitted the @Override from your derived class onCreate. UPDATE: I'm not sure what the effects are of calling setContentView twice but that could be the problem. Separate out the code that sets up the drawer, and call that from both of the onCreate methods.
type: Answer

http://stackoverflow.com/comment/32421530
score: 0
type: Comment
type: QuestionComment
has text: JSONP will do the magic trick!
comment on: http://stackoverflow.com/q/21480404

http://stackoverflow.com/a/21416413
upvote count: 6
has comment: http://stackoverflow.com/comment/32310656
has comment: http://stackoverflow.com/comment/32311858
has comment: http://stackoverflow.com/comment/32308316
has comment: http://stackoverflow.com/comment/32313307
has comment: http://stackoverflow.com/comment/32313812
has comment: http://stackoverflow.com/comment/32310016
has body: First you'll have to convert every number to a string, then concatenate the strings and parse it back into an integer. Here's one implementation: int arrayToInt(int[] arr) { //using a Stringbuilder is much more efficient than just using += on a String. //if this confuses you, just use a String and write += instead of append. StringBuilder s = new StringBuilder(); for (int i : arr) { s.append(i); //add all the ints to a string } return Integer.parseInt(s.toString()); //parse integer out of the string } Note that this produce an error if any of the values past the first one in your array as negative, as the minus signs will interfere with the parsing. This method should work for all positive integers, but if you know that all of the values in the array will only be one digit long (as they are in your example), you can avoid string operations altogether and just use basic math: int arrayToInt(int[] arr) { int result = 0; //iterate backwards through the array so we start with least significant digits for (int n = arr.length - 1, i = 1; n &gt;= 0; n --, i *= 10) { result += Math.abs(arr[n]) * i; } if (arr[0] &lt; 0) //if there's a negative sign in the beginning, flip the sign { result = - result; } return result; } This version won't produce an error if any of the values past the first are negative, but it will produce strange results. There is no builtin function to do this because the values of an array typically represent distinct numbers, rather than digits in a number. EDIT: In response to your comments, try this version to deal with longs: long arrayToLong(int[] arr) { StringBuilder s = new StringBuilder(); for (int i : arr) { s.append(i); } return Long.parseLong(s.toString()); } Edit 2: In response to your second comment: int[] longToIntArray(long l) { String s = String.valueOf(l); //expand number into a string String token; int[] result = new int[s.length() / 2]; for (int n = 0; n &lt; s.length()/2; n ++) //loop through and split the string { token = s.substring(…
has comment: http://stackoverflow.com/comment/32309594
answers question: http://stackoverflow.com/q/21416315
has comment: http://stackoverflow.com/comment/32309027
score: 4
has comment: http://stackoverflow.com/comment/32310874
has comment: http://stackoverflow.com/comment/32308752
has comment: http://stackoverflow.com/comment/32309869
type: Answer
has comment: http://stackoverflow.com/comment/32308144
has comment: http://stackoverflow.com/comment/32310057
downvote count: 2
has comment: http://stackoverflow.com/comment/32308969

http://stackoverflow.com/comment/32458321
score: 2
comment on: http://stackoverflow.com/q/21501294
type: QuestionComment
type: Comment
has text: what is the code that you want to handle exception?

http://stackoverflow.com/comment/32217259
comment on: http://stackoverflow.com/a/21365565
score: 0
type: Comment
type: AnswerComment
has text: Thanks for describing my point man, that's what I meant when I said that `p[ this.currentID ]` is null - regardless the index as if the problem was there an ArrayIndexOutOfBoundsException was issued before an NPE - as this is not the case I presume index to be valid either default one or custom one.

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/21511506
tags question: http://stackoverflow.com/q/21379302
type: Tag

http://stackoverflow.com/comment/32418485
type: Comment
has text: Thanks! That did the job! I'll accept this answer once it lets me!
comment on: http://stackoverflow.com/a/21478960
score: 0
type: AnswerComment

http://stackoverflow.com/q/21472034
tagged with: javac
tagged with: windows
has body: I am using MobaXterm, a friendly Unix terminal that runs on Windows. I want to compile a simple Java program using the javac command. After looking at plenty of other forums, I know I need to use the path where Java is installed, but no matter what I try, I keep getting the error javac command not found on the terminal. Can someone please help me out with compiling basic Java programs from within their directory on a Unix terminal on Windows? And yes, I have JDK for Windows installed on my computer, I just don't know how to use it when compiling through the terminal.
has answer: http://stackoverflow.com/a/21472134
has comment: http://stackoverflow.com/comment/32407082
tagged with: unix
has comment: http://stackoverflow.com/comment/32407063
has comment: http://stackoverflow.com/comment/32407540
accepted answer: http://stackoverflow.com/a/21477910
score: 2
has comment: http://stackoverflow.com/comment/32532214
has comment: http://stackoverflow.com/comment/32407064
has title: Compile Java Programs on Unix Terminal on WINDOWS
has comment: http://stackoverflow.com/comment/32532218
has answer: http://stackoverflow.com/a/21477910
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32407156
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21472134
favorite count: 0

http://stackoverflow.com/comment/32218830
comment on: http://stackoverflow.com/a/21366446
type: AnswerComment
score: 0
type: Comment
has text: Read the javadoc. I even gave you the link to it. JMenu doesn't have such a constructor. But it still has a `setIcon()` method. The designers of the class probably didn't provide such a constructor because a JMenu with an icon is almost never wanted.

http://stackoverflow.com/q/21420329
type: UnansweredQuestion
tagged with: netty
has answer: http://stackoverflow.com/a/21825473
score: 0
tagged with: java
has title: Netty 5, how to bind some specify info in channel
has comment: http://stackoverflow.com/comment/32315457
type: Question
has comment: http://stackoverflow.com/comment/32316597
has body: ClientA and Client B connect to the NettyServer. when the connection builds, there is a channel between Client and NettyServer, I want when channel active, I can add Client side info in the channel, so that I can store like Map(ClientInfo,Channel). The on the server side, I can use Map.get(ClientInfo) to get the specific channel, then I can use channel.writeAndFlush() to send message to the specific client. how to implement it? Use attachment? But, in neety5 API ChannelHandler, the attachment example is not the way I want to use. I wander if I can add attachment at Client side, and I can get it at the Server side?
answer count: 1
tagged with: websocket
has comment: http://stackoverflow.com/comment/32316685
has comment: http://stackoverflow.com/comment/32316437

http://stackoverflow.com/a/21388131
score: 2
downvote count: 0
has body: Converting comment to answer You have an extra ; after your } for the onClick(). So it should look like infoButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setContentView(R.layout.info_menu); } // sholdn't be one here since its closing a method }); Its generally not good practice to call setContentView() multiple times in one Activity. This will lead to problems because any Views in your original layout will be null. It is better to start a new Activity (or use Fragments) inside your onClick(). Then in your new Activity set the layout here (info_menu.xml) in setContentView() of your new Activity. So then your onClick() would look something like infoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(), NextActivityName.class); startActivity(i); } }); Intent Docs Activity Docs
answers question: http://stackoverflow.com/q/21372458
accepted answer of: http://stackoverflow.com/q/21372458
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/32290444
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21406091
has text: @RenéLink And according to the [documentation](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-atconfigurable) `Spring will configure new instances of the annotated type ( Account in this case) using a bean definition (typically prototype-scoped) with the same name as the fully-qualified type name ( com.xyz.myapp.domain.Account).`

http://stackoverflow.com/a/21457139
has body: public class InterruptedException extends Exception Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. Occasionally a method may wish to test whether the current thread has been interrupted, and if so, to immediately throw this exception. Best Explanation is Given ╠══ HERE
answers question: http://stackoverflow.com/q/21457058
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21363885
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21364011
has answer: http://stackoverflow.com/a/21363921
type: Question
accepted answer: http://stackoverflow.com/a/21364030
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/21364030
has title: capture expected result with regex
answer count: 3
has body: I am looking for regex with capture group where question mark (?) can be present in my input string. If it is not present it returns the input string as it is, but if ? is present the return the string before the first occurrence of ?. My input can be in following format Pattern 1 abc.txt // result should be abc.txt Pattern 2 abc.txt?param1=qwerty.controller&amp;param2=xsd.txt // result should be abc.txt I tried below Matcher matcher = Pattern.compile("(.*?)\\?").matcher(str1); String group1 = ""; if (matcher.find()) { group1 = matcher.group(); } With this I am able to capture expected result for pattern 2, but I am not sure how to modify it so that I can capture expected result for both pattern 1 and pattern 2. Update:- I know if group1 is empty string, i can make out that input string does not contain any ? and input string is the expected output here. But i am looking for if i can capture both patterns with single regex ?
tagged with: regex-group
tagged with: regex
possible better answer: http://stackoverflow.com/a/21363921

http://stackoverflow.com/q/21415618
type: Question
has title: Delaying actions
answer count: 2
downvote count: 0
score: 1
tagged with: android
has comment: http://stackoverflow.com/comment/32306818
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21415760
upvote count: 1
has body: Im brand new to this Android game development, and i am currently trying to create a platform game. Is there a way to make certain actions (such as changing variable values) have a few second delay without the delaying mechanism halting eveything else? i have already tried new Thread(){ public void run(){ try { Thread.sleep(2000); //variable value change } catch (InterruptedException e) { e.printStackTrace(); } } }.start(); method which i found, but it seems like this method stops any background music that is running with it. Ive also tried the Handler method but it seems to crash the game. I am using libgdx framework.
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/21416075

http://stackoverflow.com/q/21402642
has answer: http://stackoverflow.com/a/22044366
accepted answer: http://stackoverflow.com/a/22080316
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33421227
has body: I understand this is question is completely implementation dependent, but would like to know the general strategy used to migrate the configuration files. We have a product that reads some configurations from properties/XML files. Some default values are configured in the properties file. Customer can change the properties as per his needs. Now suppose we change/add some properties in the file and customer migrates to newer version. How should we merge the customer specific configuration with newly added/updated properties? One way is to write a utility to merge the files, but dont want to do it for every release. Thanks in advance
type: AnsweredQuestion
tagged with: apache-commons-config
has answer: http://stackoverflow.com/a/22080316
type: Question
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/32284342
upvote count: 4
possible better answer: http://stackoverflow.com/a/22044366
answer count: 2
has title: What should be the strategy to migrate configuration files to new version?

http://stackoverflow.com/comment/32212009
comment on: http://stackoverflow.com/q/21362642
type: Comment
type: QuestionComment
has text: Why code it like this? Whats the point of having two internal frames, if you're just going to make one disappear with the opening of another one. You should just use one internal frame with a `CardLayout`, then you can just switch between the `CardLayout` panels.
score: 1

intellij-idea
tags question: http://stackoverflow.com/q/21382304
tags question: http://stackoverflow.com/q/21408788
tags question: http://stackoverflow.com/q/21420621
tags question: http://stackoverflow.com/q/21377323
tags question: http://stackoverflow.com/q/21439482
tags question: http://stackoverflow.com/q/21487219
tags question: http://stackoverflow.com/q/21375867
tags question: http://stackoverflow.com/q/21413526
tags question: http://stackoverflow.com/q/21469042
type: Tag
tags question: http://stackoverflow.com/q/21449067
tags question: http://stackoverflow.com/q/21489931
tags question: http://stackoverflow.com/q/21485591
tags question: http://stackoverflow.com/q/21488735
tag name: intellij-idea
tags question: http://stackoverflow.com/q/21377710
tags question: http://stackoverflow.com/q/21370448
tags question: http://stackoverflow.com/q/21504297
tags question: http://stackoverflow.com/q/21504299
tags question: http://stackoverflow.com/q/21359552
tags question: http://stackoverflow.com/q/21353098
tags question: http://stackoverflow.com/q/21407190
tags question: http://stackoverflow.com/q/21459738
tags question: http://stackoverflow.com/q/21446532
tags question: http://stackoverflow.com/q/21441928
tags question: http://stackoverflow.com/q/21513384
tags question: http://stackoverflow.com/q/21356229
tags question: http://stackoverflow.com/q/21497744
tags question: http://stackoverflow.com/q/21371192
tags question: http://stackoverflow.com/q/21399586
tags question: http://stackoverflow.com/q/21483289
tags question: http://stackoverflow.com/q/21401438
tags question: http://stackoverflow.com/q/21486046
tags question: http://stackoverflow.com/q/21386371
tags question: http://stackoverflow.com/q/21457164
tags question: http://stackoverflow.com/q/21452832
tags question: http://stackoverflow.com/q/21503596
tags question: http://stackoverflow.com/q/21410815
tags question: http://stackoverflow.com/q/21424424

http://stackoverflow.com/comment/32250240
type: Comment
comment on: http://stackoverflow.com/a/21383790
has text: It does appear to compile though. At least Eclipse will compile it happily. So perhaps a bug in the compiler then to allow this?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21437270
score: 6
tagged with: webview
has answer: http://stackoverflow.com/a/32822611
upvote count: 6
has title: Android Webview not working on Android 4.4
tagged with: java
has answer: http://stackoverflow.com/a/21437359
type: Question
answer count: 2
downvote count: 0
tagged with: android-4.4-kitkat
tagged with: android
tagged with: egl
favorite count: 0
has body: I am developing an Android application based on a Webview. All is working fine on Android 4.1 but on 4.4 it throws this errors. 01-29 11:16:03.075: E/eglCodecCommon(2179): glUtilsParamSize: unknow param 0x00000bd0 01-29 11:16:03.095: E/eglCodecCommon(2179): ** ERROR unknown type 0x10037 (glSizeof,72) If I uncomment this line it' working but (logically) not showing anything webview.loadUrl("file:///android_asset/html/index.html"); The Webview config code looks like this. webview = new WebView(this); webview.clearCache(true); webview.clearHistory(); WebSettings webSettings = webview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDomStorageEnabled(true); webview.setWebViewClient(new WebViewClient()); //webview.setWebChromeClient(new WebChromeClient()); webview.addJavascriptInterface(new JavaScriptInterface(this), "Android"); setContentView(webview); webview.loadUrl("file:///android_asset/html/index.html"); The HTML code is exactly My Web App Never I have ever ... Next sdfsdfasfasdf And the Java-Javascript interface is public class JavaScriptInterface { Context mContext; JavaScriptInterface(Context c) { mContext = c; } public String showToast(String toast) { Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); return toast; } public String getPhrase() { String phrase = ""; //phrase = dataHandler.getRandomPhrase(); return phrase; } } Thanks a lot in advance
type: UnansweredQuestion

http://stackoverflow.com/q/21425176
has title: Java Apache POI read Word (.doc) file and get named CHARACTER styles used
has comment: http://stackoverflow.com/comment/32517566
has comment: http://stackoverflow.com/comment/32463776
has comment: http://stackoverflow.com/comment/32474264
has comment: http://stackoverflow.com/comment/32341810
score: 0
tagged with: libreoffice
has comment: http://stackoverflow.com/comment/32461100
linked to: http://stackoverflow.com/q/12753233
tagged with: ms-word
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21539822
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/32476270
accepted answer: http://stackoverflow.com/a/21539822
type: Question
has body: this follows on from here: Java Apache POI read Word (.doc) file and get named styles used at the time (10/2012) there was a solution to finding paragraph styles but not character styles. And yet... if you use LibreOffice Writer to open a Word doc, for example, it does translate styles and highlighting from .doc to .odt ... so someone somewhere appears to have cracked this... I don't know whether the Apache POI team and the LibreOffice/OpenOffice teams are in any way related, but I'd have thought the Apache POI team would've been able to get this functionality from the LO source code. Am I being naive?
tagged with: java
possible better answer: http://stackoverflow.com/a/43597199
has answer: http://stackoverflow.com/a/43597199
has comment: http://stackoverflow.com/comment/32495450
has comment: http://stackoverflow.com/comment/32495881
answer count: 2

http://stackoverflow.com/q/21466215
tagged with: java
answer count: 2
tagged with: javascript
tagged with: tomcat
score: 0
has title: Check if user Name exist
has body: What i want todo with Java and Javascript: If a user try to register an Account, after he write the Login name and klick in the next field, there should be an immediately check, if the Login Name already exist. My Question is now, what is the best performance way. I know, how i can check the username in the database, that is no Problem. But is it possible to cache the List of users in a Application wide variable ? If yes, how or where should i create a such variable ? I use tomcat as server. But no idea how i can do that. Or is it just fine, todo a check on the DB Server. I want something similar like the Registration from hotmail Thanks
type: UnansweredQuestion
tagged with: authentication
has answer: http://stackoverflow.com/a/21466339
has answer: http://stackoverflow.com/a/21466326
tagged with: registration
type: Question

http://stackoverflow.com/comment/32573228
has text: Do you need a Java-based solution?
comment on: http://stackoverflow.com/q/21506270
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21368583
tagged with: ejb
has comment: http://stackoverflow.com/comment/32225420
tagged with: stateless-session-bean
score: 0
has title: Why is an injected value sometimes null inside my custom ConstraintValidator?
has comment: http://stackoverflow.com/comment/32224166
type: UnansweredQuestion
has body: i created a custom ConstraintValidator Annotation which called APIAuth, and i tried to fetch the remote user IP Address Using @Context HttpServletRequest , but the problem is when calling the APIAuth inside my Stateless , the APIAuth custom validator work , and it fetch the remote user ip address , but when i try to refresh the request again quickly , it throw an exception , because of @Context HttpServletRequest be null at this case , it need from me to wait some seconds before trying to request the Stateless Restful again . my APIAuth Code : APIAuth.class @Documented @Constraint(validatedBy = APIAuthValidator.class) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface APIAuth { String message() default ""; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } APIAuthValidator.class public class APIAuthValidator implements ConstraintValidator&lt;APIAuth, String&gt; { @Context private HttpServletRequest client; @Override public void initialize(APIAuth constraintAnnotation) { } @Override public boolean isValid(String value, ConstraintValidatorContext context) { boolean valid = "127.0.0.1".equals(client.getRemoteAddr()); return valid; } Note: i noticed also that when i define the remote user ip address at first inside the initialize() constructor , then it cache the value and didn't update it else after some of seconds , although of refreshing requesting of Restful Stateless API class which contain the calling of my custom annotation many times. Thank you,
has comment: http://stackoverflow.com/comment/32225321
has comment: http://stackoverflow.com/comment/32225465
tagged with: ejb-3.0
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32225240
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/21403054
has comment: http://stackoverflow.com/comment/32284537
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21403625
score: 3
tagged with: instance
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21403244
has body: I came across some code and cannot understand a certain aspect of it although I have done some extensive searching! My question is: Why are parenthesis used in the middle of a method call? package com.zetcode; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class QuitButtonExample extends JFrame { public QuitButtonExample() { initUI(); } private void initUI() { JPanel panel = new JPanel(); getContentPane().add(panel); panel.setLayout(null); JButton quitButton = new JButton("Quit"); quitButton.setBounds(50, 60, 80, 30); quitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { System.exit(0); } }); panel.add(quitButton); setTitle("Quit button"); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { QuitButtonExample ex = new QuitButtonExample(); ex.setVisible(true); } }); } } I am referring to getContentPane().add(panel); statement. I know what it does, but doesn't really understand how it works. I'm new to Java and have the basics in OO like class fields, class methods, instance fields, instance methods, inner classes, but this one.
tagged with: methods
has comment: http://stackoverflow.com/comment/32284623
has answer: http://stackoverflow.com/a/21403112
accepted answer: http://stackoverflow.com/a/21403112
type: Question
answer count: 6
has title: Why are parenthesis used in the middle of a method call in Java?
tagged with: class
has answer: http://stackoverflow.com/a/21403096
upvote count: 3
has answer: http://stackoverflow.com/a/21403441
favorite count: 0
tagged with: field
has answer: http://stackoverflow.com/a/21403471
possible better answer: http://stackoverflow.com/a/21403625

http://stackoverflow.com/q/21487728
upvote count: 3
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/32433927
has answer: http://stackoverflow.com/a/21487771
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32434061
answer count: 2
has body: When researching the builder pattern, the standard pattern is like: new SandwichBuilder().salami().pastrami().cat().build(); Where .salami(), .pastrami(), and .cat() return SandwichBuilders, and .build() returns a Sandwich. Is it considered bad style to, instead, use the following convention? new Sandwich().salami().pastrami().cat(); Where .salami(), .pastrami(), and .cat() return Sandwich directly, foregoing seemingly unnecessary complication?
downvote count: 0
accepted answer: http://stackoverflow.com/a/21487771
has answer: http://stackoverflow.com/a/21487824
favorite count: 0
has title: Builder Pattern: Why do we need .build()?
has comment: http://stackoverflow.com/comment/32434650
possible better answer: http://stackoverflow.com/a/21487824
has comment: http://stackoverflow.com/comment/32434119
type: AnsweredQuestion
tagged with: builder

http://stackoverflow.com/comment/32275241
type: AnswerComment
comment on: http://stackoverflow.com/a/21397449
score: 0
type: Comment
has text: You mean in my Entity.java I write '@Id' above the column and don't change my database configuration ? Ip address keeps changing, so can't keep that

http://stackoverflow.com/comment/41329709
has text: Hi Torsten, Me to facing same issue. Did you resolve orientation issue? If you resolved issues, Please help me
comment on: http://stackoverflow.com/q/21504970
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40509753
has body: Since Java has checked exception you have to add throws MalformedURLException to your methods header or you have to write the method logic inside try/catch blocks.
accepted answer of: http://stackoverflow.com/q/21511768
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21511768
score: 0
type: Answer

http://stackoverflow.com/comment/32228681
type: Comment
type: QuestionComment
has text: Your equals method is requiring all elements of one set to be equal to all elements of another. Unless `ASet` is representing an equivalence class, then there's no reason to do that. If pair-wise equivalence is what you want, you should just rely on `Set.equals` to be implemented properly since `Set` iteration order is not specified.
score: 0
comment on: http://stackoverflow.com/q/21371626

http://stackoverflow.com/comment/32257940
type: Comment
has text: @Rp- yes, I'm testing with Postman in Chrome and the response is returned just fine, and the ID field is populated with a new ID. It frankly looks like there's a magical invisible database somewhere being saved to that I can't find. I haven't written anything regarding TransactionManagers since I'm using a managed Persistence Context.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21371192

http://stackoverflow.com/q/21360912
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/32208916
has title: Create a hashmap inside a class?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21360927
has comment: http://stackoverflow.com/comment/32208918
has body: I want to create a Hashmap inside a class. For example, I have a class in Java that looks like so: public class test{ public static class testClass{ HashMap&lt;String, Integer&gt; data; testClass left; testClass right; testClass(){ left = null; right = null; data.put("", -1); // Exception here } } public static void main(String []args){ testClass database = new testClass(); //Throws an exception here also } } And as you can see from the code above, there is an exception thrown where I try to create the class and when I try to initialize the hashmap. However, from all the examples I've seen, I noticed that you need to create memory for the HashMap using the new keyword. As a result, I'm wondering, is this possible to do? If so, is there a way to fix these exceptions? If anyone could help me out that would be great. Thanks!
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21360926
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/32208925

http://stackoverflow.com/q/21360823
has answer: http://stackoverflow.com/a/21423599
has title: Two spinners look different in same activity
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21426027
tagged with: java
accepted answer: http://stackoverflow.com/a/21423599
type: Question
has body: My application activity Image First spinner is using string array resources. and second is from arrayList in XML file &lt;Spinner android:id="@+id/spnExam" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/Exams" /&gt; &lt;Spinner android:id="@+id/spnPaper" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; Code for spinner two List&lt;String&gt; list = new ArrayList&lt;String&gt;(); c.moveToFirst(); do { list.add(c.getString(2)); } while (c.moveToNext()); c.close(); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(ListSpinners.this, android.R.layout.simple_spinner_dropdown_item, list); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spnPaper.setAdapter(adapter); db.close();
has answer: http://stackoverflow.com/a/21427014
has comment: http://stackoverflow.com/comment/32326962
has answer: http://stackoverflow.com/a/21360982
tagged with: android-spinner
answer count: 6
has answer: http://stackoverflow.com/a/21423541
score: 0
has answer: http://stackoverflow.com/a/21427409
possible better answer: http://stackoverflow.com/a/21360982

http://stackoverflow.com/comment/32381798
score: 0
type: AnswerComment
has text: Note **fully implementing**. This is not even done in the latest JDK8 build, as you can see from the output of my sample code. And sure, **supporting** it requires a compiler which creates the necessary optional attribute entries in the class file, a jvm which can read the optional attribute during class loading and a runtime library which can retrieve the optional attribute and provide them to the `Parameters` objects.
type: Comment
comment on: http://stackoverflow.com/a/21455958

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/21409270
type: Tag

http://stackoverflow.com/comment/32337698
type: Comment
comment on: http://stackoverflow.com/q/21428550
has text: tried a solution below ...see if this you mean to do, although I am not very sure why will you want to do this
score: 0
type: QuestionComment

http://stackoverflow.com/a/21428195
score: 0
type: AcceptedAnswer
type: Answer
has body: sudo sh startup.sh worked. Thanks to all of you to provide me answer previously It is worked fine with only sh startup.sh. It is java permision problem i find now i set full permission on java it is work with sh startup.sh as well.
accepted answer of: http://stackoverflow.com/q/21373582
answers question: http://stackoverflow.com/q/21373582

http://stackoverflow.com/comment/32468248
score: 0
comment on: http://stackoverflow.com/a/21506625
type: AnswerComment
type: Comment
has text: See also several of the answers under "related" at the right side of this page. And/or clarify what you're confused by.

http://stackoverflow.com/comment/32422470
score: 0
type: Comment
type: QuestionComment
has text: @Holger hmm... and how to know GUI SwingWorker thread is done? i want download file one by one
comment on: http://stackoverflow.com/q/21480748

http://stackoverflow.com/comment/32329289
comment on: http://stackoverflow.com/a/21404064
type: AnswerComment
type: Comment
score: 0
has text: Same problem with another Excel file

http://stackoverflow.com/a/21507188
type: Answer
has body: The way you have things defined is effectively an implementation of the Curiously recurring template pattern When you have: public class StateSearch&lt;E extends AbstractState&lt;E&gt;&gt; It means that to use a GameState as its Generic type, it would need to be defined as: public class GameState extends AbstractState&lt;GameState&gt; As for what you really need, it's unclear why you need generics. Why wouldn't a GameState interface suffice?
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21507053
has comment: http://stackoverflow.com/comment/32469560
has comment: http://stackoverflow.com/comment/32469311
downvote count: 0
has comment: http://stackoverflow.com/comment/32486730

http://stackoverflow.com/a/21433500
has body: I assume you attach a listener to each button, to perform an action when the button is clicked. In that listener, before you perform the action that belongs to that button, do some validation: public void actionPerformed (ActionEvent e) { if (e.getSource() == myNotAllowedToClickButton) { return; } // code that does stuff } Even better, make sure the user cannot click the button, by disabling it (myButton.setEnabled(false);).
answers question: http://stackoverflow.com/q/21433374
has comment: http://stackoverflow.com/comment/32337778
type: Answer
has comment: http://stackoverflow.com/comment/32337570
score: 0

http://stackoverflow.com/comment/32409758
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21473391
type: Comment
has text: Is there any other place to check log file.

http://stackoverflow.com/comment/32232869
type: Comment
type: QuestionComment
score: 0
has text: I need some more explanation here.
comment on: http://stackoverflow.com/q/21374028

http://stackoverflow.com/q/21462312
accepted answer: http://stackoverflow.com/a/21462331
type: Question
has comment: http://stackoverflow.com/comment/32389538
has comment: http://stackoverflow.com/comment/32389358
has body: I have a following string: 161544476293,26220\,1385853403,WLAN-EneTec5,-85,0,0 How to split it with comma but avoid \, case. In my case above mentioned String should be split as: 161544476293 26220\,1385853403 WLAN-EneTec5 -85 0 0 Thanks,
answer count: 2
linked to: http://stackoverflow.com/q/21698185
downvote count: 0
has comment: http://stackoverflow.com/comment/32389270
favorite count: 0
has answer: http://stackoverflow.com/a/21462331
tagged with: regex
has title: How to split string with comma but avoid backslash-comma?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21462337
has comment: http://stackoverflow.com/comment/32390124
has answer: http://stackoverflow.com/a/21462337
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32253511
type: Comment
type: QuestionComment
has text: Looks interesting, I'll try with that...
score: 0
comment on: http://stackoverflow.com/q/21384784

http://stackoverflow.com/comment/45806988
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23887891
has text: did you restart your terminal session?
type: AnswerComment

http://stackoverflow.com/q/21447604
tagged with: gson
possible better answer: http://stackoverflow.com/a/21450782
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32364056
tagged with: deserialization
score: 0
has body: I am working on a project in which I am making a call to one of my servers using RestTemplate which is running a restful service and getting the response back from them. The response that I will be getting from my server can be either of these error responses (that's all I have for error response) if something has gone wrong - {"warning": "user_id not found", "user_id": some_user_id} {"error": "user_id for wrong partition", "user_id": some_user_id, "partition": some_partition} {"error": "missing client id", "client_id":2000} or below successful response (it can be any random json string key can also be different) - {"@data": {"oo":"1205000384","p":"2047935"} If I am getting any error response as mentioned above, then I am deserializing it (my bad :( ) so that I can log them as an error with a specific error or warning I got front the server which can be for example - user_id not found or missing client id. If it is a successful response then also I am deserializing it which I don't need for my use case as we don't have any POJO and I just need to return the response as it is which I have got from the server. In my use case, I don't need to deserialize my response string if it is a successful response as we don't have any POJO for that and we are returning the response string as it is which we have got from the server. But just for logging specific error messages (if I am getting error response from the server) I am deserializing it which I am thinking is unnecessary. There might be better solution for my use case. Below is my Java client which is calling Callable task using future.get - public class TestingClient implements IClient { private ExecutorService service = Executors.newFixedThreadPool(10); private RestTemplate restTemplate = new RestTemplate(); @Override public String executeSync(ClientKey keys) { String response = null; try { ClientTask ClientTask = new ClientTask(keys, restTemplate); Future&lt;String&gt; future = service.submit(ClientTask); response = h…
has comment: http://stackoverflow.com/comment/32368038
has answer: http://stackoverflow.com/a/21450782
accepted answer: http://stackoverflow.com/a/21452205
has comment: http://stackoverflow.com/comment/32368540
has comment: http://stackoverflow.com/comment/32365580
has title: Efficient way to detect strings?
has answer: http://stackoverflow.com/a/21452205
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

jpopupmenu
tags question: http://stackoverflow.com/q/21370308
tag name: jpopupmenu
type: Tag
tags question: http://stackoverflow.com/q/21369981

http://stackoverflow.com/q/21492208
has body: I have an interface: public interface ExampleInterface { public void exampleMethod(); public void anotherExampleMethod(); } And an example class: public class ExampleClass implements ExampleInterface{ public ExampleClass() { ........ } public void exampleMethod() { .............. } public void anotherExampleMethod() { .............. } public void myOwnMethod() { ........ } } I instantiate the class by using the interface like so: ExampleInterface exampleClass = new ExampleClass(); Doing this is ok: exampleClass.exampleMethod(); But this is not: exampleClass.myOwnMethod(); However, this works: ExampleClass exampleClass = new ExampleClass(); exampleClass.myOwnMethod(); Why is it when I instantiate with an interface and try to call a method that is not part of the interface it doesn't work? Is there anyway to call myOWnMethod() while still instantiating with the interface?
tagged with: instantiation
has answer: http://stackoverflow.com/a/21492257
has comment: http://stackoverflow.com/comment/32442662
tagged with: java
tagged with: methods
type: Question
score: 0
has comment: http://stackoverflow.com/comment/32442654
answer count: 3
has title: How can I implement my own method when instantiating an interface?
has answer: http://stackoverflow.com/a/21492322
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/21492261

http://stackoverflow.com/a/21363462
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21361322
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32215649
has comment: http://stackoverflow.com/comment/32239294
has comment: http://stackoverflow.com/comment/32216330
has body: You can use a combination of Jsoup and HtmlUnit for your purpose. HtmlUnit would help in case you want to dynamically 'click' those links and scrape the content of the resulting page. You can accumulate the text of those anchor tags to iterate over all of them, Jsoup would also help in accumulating the text of those hyperlinks which can be used by HtmlUnit later - but at a cost of 2 connections. Below is a code sample of scraping the data from one of those hyperlinks from your site url, notice I give your base url and then check for a specific link to get its contents - you can select a specific set of links on your page depending on a pattern. It traverses to you link, clicks it and retrieves the specific set of data you are looking for. Code: public static void main(String[] args) throws FailingHttpStatusCodeException, IOException { final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17); WebRequest request = new WebRequest(new URL( "http://www.firstpost.com/tag/crime-in-india")); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.setJavaScriptTimeout(10000); webClient.getOptions().setJavaScriptEnabled(true); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.getOptions().setTimeout(10000); HtmlPage page = webClient.getPage(request); webClient.waitForBackgroundJavaScript(10000); List&lt;HtmlAnchor&gt; anchors1 = page.getAnchors(); HtmlAnchor link2 = null; for (HtmlAnchor anchor : anchors1) { if (anchor.asText().indexOf( "Why do we care more when NRIs go missing?") &gt; -1) { link2 = anchor; break; } } page = link2.click(); webClient.waitForBackgroundJavaScript(10000); DomNodeList&lt;DomElement&gt; paras = page.getElementsByTagName("p"); for (DomElement el : paras.toArray(new DomElement[paras.size()])) { System.out.println(el.asText()); } } Prints the news article contents:

http://stackoverflow.com/comment/32230543
comment on: http://stackoverflow.com/a/21372704
type: AnswerComment
has text: If I do so for both the Person and Address class. I can only have three-arg constructors. How can I call a one-arg constructor? For example, I have public Student (String firstName, String lastName, String middleInitial, String dateOfBirth) { super(firstName, lastName, middleInitial); and public Student (String streetName, String state, String country) { super(streetName, state, country); How can I get zipcode separately?
score: 0
type: Comment

http://stackoverflow.com/comment/33421227
has text: @sidgate to me changing the props that the application reads is like changing the api, there is no easy way to handle this. I would write a simple utility for this, but this is sooooo dependent on the type of app and what the props actually change/introduce..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21402642

http://stackoverflow.com/comment/32246288
type: AnswerComment
score: 0
type: Comment
has text: btw i didn't downvote .. It throws a runtime exception : Unparseable date: "10-JAN-14 12.48.00.000000000 AM" at java.text.DateFormat.parse(DateFormat.java:337)
comment on: http://stackoverflow.com/a/21381481

http://stackoverflow.com/q/21402084
answer count: 1
has body: UPDATE 2014-01-29: I have changed relationshis so entity code and error changed too I have to store some data in a database and my relations are like this: Order3d 1-----* Draw 1-----* Line I want to save everything like this: Order3d o=new Order3d(); //add data to order (lines and draws) Session s=HibernateUtils.getSessionFactory().openSession(); s.save(o); s.close(); I don't have runtime error but now my line is not inserted (only order3d and drawfile are saved) here are my entities (obviously, they are POJO so I didn't copy getters and setters): @Entity @Table (name="order3d") public class Order3d implements Serializable { private static final long serialVersionUID = -2241346447352903470L; public enum State {DEMAND, ESTIMATED, PAYED, PENDING, PRODUCED, SENT, DELIVERED}; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column (name="id") private int id; @Column (name="person") private int person; @Column (name="state", columnDefinition="smallint") private State state; @Column (name="labor_expense") private float laborExpense=0; @Column (name="travel_expense") private float travelExpense=0; @Column (name="validity_date") private Date validityDate; @Column (name="demand_date") private Date demandDate; @Column (name="estimate_date") private Date estimateDate; @Column (name="order_date") private Date orderDate=null; @Column (name="modification", columnDefinition="TEXT") private String modification; @Column (name="delivery", columnDefinition = "BIT", length = 1) private Boolean delivery=true; @OneToMany(mappedBy="order3d", cascade=CascadeType.ALL) private Set&lt;DrawFile&gt; myDraws=new HashSet&lt;DrawFile&gt;(5); public void addDrawFile(DrawFile df) { df.setOrder3d(this); myDraws.add(df); } } @Entity @Table (name="draw") public class DrawFile implements Serializable { private static final long serialVersionUID = -9024754876558087847L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column (name="id") private int id; @Column (name="hashname", columnDefinition="CHA…
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21403602
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32284360
score: 2
tagged with: java
tagged with: hibernate
has title: How to cascade insert
type: Question
downvote count: 0
tagged with: foreign-key-relationship
linked to: http://stackoverflow.com/q/4496548
has comment: http://stackoverflow.com/comment/32286942

http://stackoverflow.com/comment/32451404
has text: I think p.waitFor() is not really needed in this case, but strange is that I use it and never saw any problem with it...
type: Comment
comment on: http://stackoverflow.com/a/21453623
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32410057
type: Comment
comment on: http://stackoverflow.com/a/21473416
has text: Thanks a lot. This is way more efficient than what I was doing. I'm going to try and switch your if try to an if else. I haven't really used if try.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32475019
has text: I'm perfectly aware what 200000000L is, technically. But if I see it in code, I do not know what the *meaning* of it is. Is it 2 seconds? 0.2 seconds? 20 seconds? 0.02seconds? I have to count the zeroes, probably miscount them twice and then need to think how many nanoseconds there are in a second... how is this intuitive?
type: AnswerComment
comment on: http://stackoverflow.com/a/21509721
score: 0
type: Comment

apache
tag name: apache
tags question: http://stackoverflow.com/q/21437180
tags question: http://stackoverflow.com/q/21425049
tags question: http://stackoverflow.com/q/21364271
tags question: http://stackoverflow.com/q/21485744
tags question: http://stackoverflow.com/q/21385728
tags question: http://stackoverflow.com/q/21392522
tags question: http://stackoverflow.com/q/21417601
tags question: http://stackoverflow.com/q/21512164
tags question: http://stackoverflow.com/q/21425505
tags question: http://stackoverflow.com/q/21365929
type: Tag
tags question: http://stackoverflow.com/q/21373047
tags question: http://stackoverflow.com/q/21448546
tags question: http://stackoverflow.com/q/21380501
tags question: http://stackoverflow.com/q/21498367

http://stackoverflow.com/comment/32230368
type: AnswerComment
score: 0
type: Comment
has text: How does this demonstrate super()?
comment on: http://stackoverflow.com/a/21372594

http://stackoverflow.com/comment/32418433
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21477699
has text: Count size while reading stream. Use for example http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/CountingInputStream.html
score: 0

http://stackoverflow.com/q/21389079
possible better answer: http://stackoverflow.com/a/21389156
has comment: http://stackoverflow.com/comment/32260731
type: AnsweredQuestion
tagged with: java
downvote count: 3
tagged with: mysql
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/21390598
has comment: http://stackoverflow.com/comment/32260851
has title: java.lang.NullPointerException ... Initializing the JDBC MYSQL connection
has comment: http://stackoverflow.com/comment/32261039
has comment: http://stackoverflow.com/comment/32262866
has comment: http://stackoverflow.com/comment/32259957
has comment: http://stackoverflow.com/comment/32259956
has comment: http://stackoverflow.com/comment/32262757
has answer: http://stackoverflow.com/a/21389156
has answer: http://stackoverflow.com/a/21390598
has answer: http://stackoverflow.com/a/21389932
answer count: 3
upvote count: 0
favorite count: 0
has body: Please don't suggest me to use InternalFrame or Dialogs. I can't start the project from beginning. Theme: I'm building a GUI program to display mark-sheet. I've taken 3 JFrames &amp; 1 simple class... Frame1.java It's having 1 JTextField to enter roll_no. &amp; 2 buttons to feedData in DB &amp; showResult. feedData button calls Frame2 &amp; showResult button calls Frame3. Frame2.java For feeding data have several JTextFields &amp; Buttons that transfer content to mySQL DB. Frame3.java is a result window that fetches content from DB. Support.java Contains static variables &amp; getter-setter methods for them ..... .....//contains in Support.java public boolean add() { query = "Insert into table1 (enroll,Sname,Fname,sub1,sub2,sub3,sub4,sub5 )values(?,?,?,?,?)"; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, enroll); psmt.setString(2, Sname); psmt.setString(3, Fname); psmt.setInt(4, sub1); psmt.setInt(5, sub2); psmt.setInt(6, sub3); psmt.setInt(7, sub4); psmt.setInt(8, sub5); int y = 0; y = psmt.executeUpdate(); if (y == 0) { return false; } } catch (Exception e) { e.printStackTrace(); return false; } return true; } add() is called on pressing save button in Frame2.java . . . If catch block is executing, why println(query) printing NULL
score: -3

http://stackoverflow.com/comment/32260675
type: Comment
score: 0
type: AnswerComment
has text: query isn't NULL anymore... But still I'm getting NullPointerException & obviously catch() is executing.. Plz Help..
comment on: http://stackoverflow.com/a/21389156

http://stackoverflow.com/a/21412156
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21412116
type: Answer
accepted answer of: http://stackoverflow.com/q/21412116
upvote count: 3
has body: You want the instanceof keyword, then a cast: if(jLayeredPane2.getComponent(j) instanceof JLabel) { JLabel label = (JLabel)jLayeredPane2.getComponent(j); String text = label.getText(); //...Then do whatever you want to do with said text. }
score: 3

http://stackoverflow.com/a/21509398
upvote count: 8
answers question: http://stackoverflow.com/q/21509383
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21509383
score: 8
has body: 'a' is char "a" is String In order to use String: String[] abcCyr = {"a", "б","в"}

http://stackoverflow.com/q/21436157
has comment: http://stackoverflow.com/comment/32342558
type: Question
possible better answer: http://stackoverflow.com/a/21436322
tagged with: arrays
has title: using class as array in another class
tagged with: class
has comment: http://stackoverflow.com/comment/32342439
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32342512
has answer: http://stackoverflow.com/a/21436294
has answer: http://stackoverflow.com/a/21436346
has body: I am trying to do the following 1 - I need to create a class like this public class base { int a; String b; public base() { a = 0; b = ""; } } 2 - I need to create a class that creates an array of "base" and sets some values public class arrayBase { public base[] ab = new base[2]; public arrayBase() { ab[0].a = 1; ab[0].b = "test1"; ab[1].a = 2; ab[1].b = "test2"; } } 3 - I need to use "arrayBase" in another class public class test{ public static void main(String[] args) { arrayBase p = new arrayBase(); System.out.println(p.ab[0].a); } } When I try this it gives an error Exception in thread "main" java.lang.NullPointerException. How can I solve that problem?
accepted answer: http://stackoverflow.com/a/21436294
has comment: http://stackoverflow.com/comment/32342437
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32342712
tagged with: java
has answer: http://stackoverflow.com/a/21436322

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/21407607
tags question: http://stackoverflow.com/q/21380084
tag name: restful-architecture

http://stackoverflow.com/a/21503325
answers question: http://stackoverflow.com/q/21503160
has body: This is the interesting part of the String. FLIGHT FROM TO DEPART ARRIVE STATUS, FR 9083 Bournemouth Alicante 10:10 13:35 Landed 19:00, And to me it seems like a job for a HashMap wrapped up in an Object. Example private Map&lt;String, String&gt; fields; public Flight(String input) { // Input is currently equal to the value above. fields = new HashMap&lt;String, String&gt;(); parseInput(); } private void parseInput(String input) { // First split up each section. String[] tokens = input.split(","); // Next, split the headers up. String[] headers = tokens[0].split(" "); // And the values. String[] values = tokens[1].split(" "); for(int x = 0; x &lt; headers.length; x++) { // Map each header to it's respective value. fields.put(headers[x], values[x]); } } public String toString() { // Output the object as a string. StringBuilder builder = new StringBuilder(); for(String key : fields.getKeySet()) { builder.append(key + ":" + fields.get(key) + " "); } return builder.toString(); } With this code, you pass in the String, starting with the field headers, and you call the toString method on the resulting Flight object, and it'll output your String in the desired format.
score: 0
type: Answer

touchpad
tags question: http://stackoverflow.com/q/21487418
tag name: touchpad
type: Tag

http://stackoverflow.com/q/21493913
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: android-imageview
has title: Why does the value of X does not go all the way to the edge of the layout
tagged with: java
has comment: http://stackoverflow.com/comment/32447659
type: Question
has body: palette2 drawable which is used as a background: esquare drawable (resized using @dimen and used as a thumb): XML: &lt;LinearLayout android:id="@+id/llColorSpect" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_alignParentBottom="true" &gt; &lt;RelativeLayout android:id="@+id/rlColorSpect" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/palette2" &gt; &lt;ImageView android:id="@+id/ivSquare" android:layout_width="@dimen/title_text_pad" android:layout_height="@dimen/title_text_pad" android:layout_alignParentBottom="true" android:scaleType="fitXY" android:src="@drawable/esquare" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; Java: llColors = (RelativeLayout) findViewById(R.id.rlColorSpect); llColors.setOnTouchListener(llTouch); bitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.palette2); llColors.setBackground(getResources().getDrawable(R.drawable.palette2)); w = bitmap.getWidth(); h = bitmap.getHeight(); Log.i("PALETTE WIDTH", "width" +w); Log.i("PALETTE HEIGHT", "height" +h); observer = llColors.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { width = llColors.getWidth(); height = llColors.getHeight(); Log.i("LAYOUT WIDTH", "width" +width); Log.i("LAYOUT HEIGHT", "height" +height); //in here, place the code that requires you to know the dimensions. //Place your code here } }); View.OnTouchListener llTouch = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { x = (int)event.getX(); y = (int)event.getY(); if (x&lt;0) { ivTouch.setX(0); ivTouch.setY(y); x=0; Toast.makeText(getApplicationContext(), "x=0", 2000).show(); } if (y&lt;0) { ivTouch.setY(0); ivTouch.setX(x); y=0; Toast.makeText(getApplicationContext(), "y=0", 2000).show(); } if (x&gt;bitmap.getWidth()) { ivTouch.setX(bitmap.getWidth()); x=bitma…
answer count: 1
has answer: http://stackoverflow.com/a/21507510
has comment: http://stackoverflow.com/comment/32448238
score: 0
tagged with: android

http://stackoverflow.com/a/21488487
upvote count: 1
downvote count: 1
has body: Apache has a nice library that should meet your requirements. Look into http://poi.apache.org/ Hope this helps.
answers question: http://stackoverflow.com/q/21488419
score: 0
type: Answer

http://stackoverflow.com/a/21435730
score: 5
has body: It is a new Spring Feature: Spring now treats generic types as a form of qualifier when injecting Beans - or in other words: autowire pay attention to the generic type! You have BasicRunTest implements RunTest&lt;Integer&gt; (Integer) and ask spring for @Autowire prive RunTest&lt;Number&gt; runTest; (Number) - that is not compatible! try private RunTest&lt;? extends Number&gt; runTest; (That it worked with Spring 3.x, is more or less a bug, because your code break the generic constraint)
downvote count: 0
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/21435549
has comment: http://stackoverflow.com/comment/32370161

http://stackoverflow.com/a/21572320
downvote count: 1
has comment: http://stackoverflow.com/comment/34527104
has comment: http://stackoverflow.com/comment/41566726
has body: Several of the operations done on currentString are expensive, especially as the size of currentString grows. The statement: currentString = currentString + c; loops through all chars in the string and makes a copy of the full string + the new char. The line: if (!codes.containsKey(currentString)) makes use of the hash code of currentString. As currentString is a new string each time, the hash code needs to be calculated by looping through the full string (kind of nullifies the usefulness of the hash if you need to calculate it each time). And finally the line: currentString = currentString.substring(0, currentString.length() - 1); also needs to loop through the full string and makes a new copy of it. If you want to get this program to run fast, you need to eliminate the need for looping through the same data all the time. Don't create new String's each time you want to add or remove a char, instead use a buffer of some sort where you can add and remove chars at both ends. Also consider an alternative hash code scheme, so you don't need to recalculate the full hash (by looping over the full string) just because you extended currentString with a char.
has comment: http://stackoverflow.com/comment/41562888
answers question: http://stackoverflow.com/q/21493826
has comment: http://stackoverflow.com/comment/41567563
score: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/32372518
type: QuestionComment
has text: possible duplicate of [mongodb get distinct records](http://stackoverflow.com/questions/5089162/mongodb-get-distinct-records)
comment on: http://stackoverflow.com/q/21452674
score: 0
type: Comment

http://stackoverflow.com/q/21416912
has title: @PostConstruct method isn't being called during application server initalitization
accepted answer: http://stackoverflow.com/a/21418561
answer count: 2
tagged with: ejb
possible better answer: http://stackoverflow.com/a/21417202
has answer: http://stackoverflow.com/a/21417202
has answer: http://stackoverflow.com/a/21418561
score: 0
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
has body: I've just been assigned to fix a Java EE application and I'm somewhat new to this. I have the following bean: @Named @ApplicationScoped public class Configuration implements Serializable { public Configuration() { } @PostConstruct public void loadParams() { // inserted break point in next line SAXBuilder builder = new SAXBuilder(); URL resourceUrl = ResourceLocator.getResource(ARCHIVO_CONFIGURACION); // More code... } } I understand this bean will be initialized when the container is started (in this case jboss 7) and the loadParams method will be called once all dependences are injected. But after debugging I realized that neither the contructor nor the method are being called. What am I missing? Is there another configuration file for this task that I'm not taking into consideration? Thank you.

http://stackoverflow.com/comment/32420165
comment on: http://stackoverflow.com/q/21479971
has text: i removed createNewFile().. still i get directory
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21388673
has comment: http://stackoverflow.com/comment/32267283
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21408238
has comment: http://stackoverflow.com/comment/32269520
has comment: http://stackoverflow.com/comment/32269383
has comment: http://stackoverflow.com/comment/32261808
has comment: http://stackoverflow.com/comment/32269544
has comment: http://stackoverflow.com/comment/32267171
has comment: http://stackoverflow.com/comment/32269301
has answer: http://stackoverflow.com/a/21394119
has title: How Do I Sort an Array of Objects using Insertion Sort?
accepted answer: http://stackoverflow.com/a/21408238
has comment: http://stackoverflow.com/comment/32270429
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/21394119
type: Question
has body: Can someone please shed some light on why my insertion sort is not working? You don't have to write the code for me. Just lead me in the direction I need to go. import java.util.Random; public class Storage { private Node[] id; private int counter; public Storage(int size) { id = new Node [size]; counter = 0; } public void addTo(int number, long time) { for (int i = 0; i &lt; id.length; i++) { id[i] = new Node(number, time); } } public String toString() { String output = id [counter] + "\t"; return output; } public int myRand() { int r; Random gen = new Random(); return r = gen.nextInt(201); } public long tellTime() { long clock; return clock = System.nanoTime(); } public void sortNode() //InerstionSort { int j; Node temp; for (int i = 1; i &lt; id.length; i++) { j = i; temp = id[i]; while (j != 0 &amp;&amp; id[j-1].getNumber() &gt; temp.getNumber()) { id[j] = id[j-1]; j--; } id[j] = temp; } } } } public class Node { private int number; private long time; public Node(int n, long t) { number = n; time = t; } public String toString() { String output = number + "\t\t" + time + "\n"; return output; } public int getNumber() { return number; } public long getTime() { return time; } } public class Driver { static Storage storage = new Storage(50); static Storage store = new Storage(50); static int num; static long tim; static Node[] id; public static void main (String [] args) { System.out.println("\nThe Original List:"); System.out.println("-------------------\n"); for (int i = 0; i &lt; 50; i++) { num = storage.myRand(); tim = storage.tellTime(); storage.addTo(num, tim); System.out.println(storage); } System.out.println("\n\n"); System.out.println("The Sorted List:"); System.out.println("-------------------\n"); for (int i = 0; i &lt; 50; i++) { storage.sortNode(); System.out.println(storage); } } } My Output: The Original List: ------------------- 185 1390857365431247000 170 1390857365431449000 190 1390857365431511000 157 1390857365431581000 26 1390857365431644000 111 1…
has comment: http://stackoverflow.com/comment/32268914
has comment: http://stackoverflow.com/comment/32264140
tagged with: algorithm
tagged with: arrays
has comment: http://stackoverflow.com/comment/32259214
has comment: http://stackoverflow.com/comment/32266069
tagged with: sorting
has comment: http://stackoverflow.com/comment/32293830
answer count: 2

http://stackoverflow.com/comment/32315115
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21411761
has text: @user1694073 Ok, and what constructor should you define?
score: 0

http://stackoverflow.com/q/21466619
type: UnansweredQuestion
has title: Is there a method to overwrite the content of a JLabel
tagged with: swing
has body: I want to know if there is a way of overwriting the text placed into a JLabel with new text. The code I currently have just creates new labels every time yet does not replace the previously made one. In relation to my code I want to change the text held in the JLabel from each of the arrays of strings based on which button is pushed. Have uploaded the code for my action listener. @Override public void actionPerformed(ActionEvent event) { ImageIcon gws = new ImageIcon("src\\myGui\\sharke.jpg"); ImageIcon gib = new ImageIcon("src\\myGui\\gibbone.jpg"); ImageIcon croc = new ImageIcon("src\\myGui\\croce.jpg"); ImageIcon cat = new ImageIcon("src\\myGui\\cheetahe.jpg"); String gw[] = {"Shark", "fast", "water", "sea", "a", "b"}; String gbn[] = {"Gibbon", "climb", "tree", "grass", "a", "b"}; String crc[] = {"Croc", "scale", "teeth", "river", "a", "b"}; String cht[] = {"Cheetah", "run", "fur", "sand", "a", "b"}; for (int i = 0; i &lt; field1.length; i++) { field1[i] = new JTextField(i); panel6.add(field1[i]); } if (event.getSource() == quit) { System.exit(0); } else if (event.getSource() == reset) { pic1.setIcon(null); pic1.setBorder(null); } else if (event.getActionCommand().equalsIgnoreCase("shark")) { pic1.setIcon(gws); pic1.setBorder(BorderFactory.createEtchedBorder(Color.black, Color.blue)); for (int i = 0; i &lt; field1.length; i++) { field1[i] = new JTextField(gw[i]); panel6.add(field1[i]); } } else if (event.getActionCommand().equalsIgnoreCase("gibbon")) { pic1.setIcon(gib); pic1.setBorder(BorderFactory.createEtchedBorder(Color.black, Color.orange)); } else if (event.getActionCommand().equalsIgnoreCase("crocodile")) { pic1.setIcon(croc); pic1.setBorder(BorderFactory.createEtchedBorder(Color.black, Color.green)); } else if (event.getActionCommand().equalsIgnoreCase("cheetah")) { pic1.setIcon(cat); pic1.setBorder(BorderFactory.createEtchedBorder(Color.black, Color.yellow)); } }
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/21516541
upvote count: 1
answer count: 1
tagged with: user-interface
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/q/21420046
favorite count: 0
accepted answer: http://stackoverflow.com/a/21584852
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
tagged with: java
has title: Subclassing Button
type: Question
has answer: http://stackoverflow.com/a/21584852
has comment: http://stackoverflow.com/comment/32314749
has comment: http://stackoverflow.com/comment/32314641
has body: I get a ClassCastException when I tried to extend the Button class after trying to make a MusicButton subclass. I am not trying to override the background, only add a few additional methods. I am sure I extended that class correctly so this must be something specific with interacting with Android UI components. Why is this occurring? Here is the line where I get the ClassCastException: bMusic = (MusicButton) findViewById(R.id.musicButton); Here is the MusicButton class: public class MusicButton extends Button implements MusicObserver { MusicService musicService; public MusicButton(Context context) { super(context); } /** * Because we use findViewById to obtain view elements, the service instance * variable has to be initialized here instead of constructor. * * @param service */ public void setMusicService(MusicService musicService) { this.musicService = musicService; update(); } public void update() { /** setMusicService should have been called */ Assert.assertNotNull(musicService); if (musicService.isMusicPlaying()) { this.setText("Stop Music"); } else { this.setText("Play Music"); } } /** * This function does not update the text of the button even though it knows * the status of the music player becuase I want all music observers to be * updated consistently, regardless if they are the ones forcing the * notification to occurr */ public void buttonPressed() { Assert.assertNotNull(musicService); if (musicService.isMusicPlaying()) { musicService.pauseMusic(); } else { musicService.playMusic(); } } }
has comment: http://stackoverflow.com/comment/32315554
downvote count: 0
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/32314761

http://stackoverflow.com/comment/32473346
comment on: http://stackoverflow.com/q/21509622
has text: Please use a better title. _Infinite variable loop_ A variable can't loop.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21434077
score: 2
answers question: http://stackoverflow.com/q/21433232
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21433232
has body: super.paintComponet should go right after the method signature. you set the button opacity to false, so it won't be seen. Run your program from the Event Dispatch Thread. public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable(){ public void run() { new StartWindow().CreateStartWindow(); } }); } In your method, you're making the frame visible before adding anything. Leave that out in the method Don't set the size of the frame. Instead override the getPrefereedSize() of the JPanel and call pack() on the frame. IMO, I see no use at all for this so-called helper method. I would toss it out the window You should load your image as an embedded resource, and not from the file system. img = ImageIO.read(StartWindow.class.getResource(path_img)); import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit; import java.awt.event.ActionListener; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class StartWindow { JFrame frame; private JButton button; private JButton button2; final String button_start = "img/start.png"; ImageIcon start = new ImageIcon(button_start); public void CreateStartWindow() throws IOException { frame = Window.createwindow(); Container container = frame.getContentPane(); JpanelStart panel = new JpanelStart(); container.add(panel); this.button = new JButton(start); button.setActionCommand("start"); button.setHideActionText(true); button.setOpaque(false); button.setFocusPainted(false); button.setBorderPainted(false); button.setContentAreaFilled(false); this.button2 = new JButton("Classifica"); panel.add(button); panel.add(button2); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public st…
upvote count: 2
type: Answer

http://stackoverflow.com/comment/42809282
score: 0
has text: db.setProfilingLevel( ) logs server side. The question is about client side logging...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21364495

http://stackoverflow.com/comment/32340916
type: AnswerComment
has text: In your snippet you do not correctly inspect Type 0 fonts (aka composite fonts): If the font you inspect indeed is `instanceof PDType0Font`, you should inspect its descendant font (retrievable via `getDescendantFont()`). For the test indicated in my answer you have the `PDFont.getBaseFont()` and the `PDFontDescriptor.getFontName()` methods.
score: 0
comment on: http://stackoverflow.com/a/21400047
type: Comment

http://stackoverflow.com/a/21519917
answers question: http://stackoverflow.com/q/21503640
type: Answer
upvote count: 1
score: 1
has body: Because , of session is expires after 30 minutes that's why it is giving null value. you can also increase the session Time out value from your web.xml file. by default it is 30 min.
downvote count: 0

http://stackoverflow.com/q/21425346
accepted answer: http://stackoverflow.com/a/21425852
has comment: http://stackoverflow.com/comment/32323679
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32323883
tagged with: combinations
score: 5
tagged with: algorithm
upvote count: 5
has title: Generate all unique combinations of Items
has answer: http://stackoverflow.com/a/21426275
has answer: http://stackoverflow.com/a/21426285
answer count: 3
has comment: http://stackoverflow.com/comment/32324246
has answer: http://stackoverflow.com/a/21425852
downvote count: 0
tagged with: unique
favorite count: 0
possible better answer: http://stackoverflow.com/a/21426285
has body: I trying to generate all possible unique combination of items. Ex: item1, item2, item3 Combinations: item1+item2+item3 item1+item2 item1+item3 item2+item3 item1 item2 item3 I am unable to get an idea on how to solve this? for(int i=0;i&lt;size;i++){ for(int j=i+1;j&lt;size;j++){ System.out.println(list.item(i)+list.item(j)); } } The above code certainly works for all unique combination of two elements. But not for 3 element pair and more..
type: AnsweredQuestion

http://stackoverflow.com/comment/32452630
comment on: http://stackoverflow.com/a/21497659
has text: @suresh thanks,but the problem is the newuser related java code is in one class(named:newuser.java),and introducer_table related jdbc code is in one class(named:introducer.java).then how can I do this?pls explain me...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21441770
type: Answer
answers question: http://stackoverflow.com/q/21423858
has body: Have been fiddling around a while without any success. As a final resort I finished it using the following code: @FXML private AnchorPane ap; Stage stage = new Stage(); Parent root = FXMLLoader.load(EbooksdownloaderController.class.getResource("about.fxml")); stage.setScene(new Scene(root)); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(ap.getScene().getWindow()); stage.show(); Not really the way I would prefer. But it works.
score: 0

http://stackoverflow.com/comment/32435662
has text: This is very helpful, you cleared my doubts. And you added some hidden pitfalls of not doing it the recommended way, which is exactly the thing I can't ask about specifically but still need to know. Even if I end up doing it the recommended way I'll know what's happening and what my options are.
type: AnswerComment
comment on: http://stackoverflow.com/a/21483664
type: Comment
score: 0

http://stackoverflow.com/comment/32343928
type: Comment
type: QuestionComment
has text: @piyukr I have `n` coins. One of the coins weighs more or less then the others. If I have `n/2` balances, I can put one coin on each side of each balance (using `n` coins), only one should be out of balance; and that's the one that weighs more (or less).
score: 0
comment on: http://stackoverflow.com/q/21436392

http://stackoverflow.com/a/21460333
has comment: http://stackoverflow.com/comment/32388017
has comment: http://stackoverflow.com/comment/32389805
has comment: http://stackoverflow.com/comment/32387947
type: Answer
has comment: http://stackoverflow.com/comment/32386848
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32386734
upvote count: 2
has comment: http://stackoverflow.com/comment/32389041
answers question: http://stackoverflow.com/q/21460218
has body: Get the URL and read the page with an HTTP client class. i.e. Apache Commons HTTPGet. For more information, read here: http://hc.apache.org/httpclient-3.x/tutorial.html

http://stackoverflow.com/comment/32431283
type: AnswerComment
has text: I can not change the code according to your suggestion. Can you help me? Thanks
type: Comment
comment on: http://stackoverflow.com/a/21474929
score: 0

http://stackoverflow.com/q/21447308
has answer: http://stackoverflow.com/a/21447445
type: Question
has comment: http://stackoverflow.com/comment/32363373
has answer: http://stackoverflow.com/a/21447480
answer count: 6
has comment: http://stackoverflow.com/comment/32363359
has comment: http://stackoverflow.com/comment/32363405
has answer: http://stackoverflow.com/a/21447573
has answer: http://stackoverflow.com/a/21447553
tagged with: validation
has comment: http://stackoverflow.com/comment/32363375
has comment: http://stackoverflow.com/comment/32363861
accepted answer: http://stackoverflow.com/a/21447573
has title: Can't verify data on Java
possible better answer: http://stackoverflow.com/a/21447553
has comment: http://stackoverflow.com/comment/32363604
score: 0
has comment: http://stackoverflow.com/comment/32363381
has answer: http://stackoverflow.com/a/21447367
has comment: http://stackoverflow.com/comment/32364276
has comment: http://stackoverflow.com/comment/32363394
type: AnsweredQuestion
has body: I have a problem in Java. I'm trying to check if the input provided only contains decimal number (Number and a ".") This code, provided by my professor, its not really evaluating. And I really can't figure out what is wrong. import javax.swing.JOptionPane; public class MoneyCount { public static void check(String s) { boolean decimalPoint = false; for (int i = 0; i &lt; s.length(); i++) { if (s.charAt(i) == '.') { if (!decimalPoint) { decimalPoint = true; } } else { JOptionPane.showMessageDialog(null, "You must enter an integer value"); System.exit(0); } } } public static void main(String[] args) { //retrieve amount due String moneyd = JOptionPane.showInputDialog("Enter the amount due"); check(moneyd); double amountd = Double.parseDouble(moneyd) * 100; String moneyr = JOptionPane.showInputDialog("Enter amount you would like to pay"); check(moneyr); double amountr = Double.parseDouble(moneyr) * 100; } }
has comment: http://stackoverflow.com/comment/32363428
has comment: http://stackoverflow.com/comment/32363425
has comment: http://stackoverflow.com/comment/32363386
tagged with: java
has answer: http://stackoverflow.com/a/21447709
has comment: http://stackoverflow.com/comment/32363416
has comment: http://stackoverflow.com/comment/32363329
has comment: http://stackoverflow.com/comment/32363357
has comment: http://stackoverflow.com/comment/32363835

http://stackoverflow.com/a/21397632
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21397586
upvote count: 5
answers question: http://stackoverflow.com/q/21397586
type: Answer
downvote count: 0
score: 5
has body: "baseball, and" splits into "baseball" "" "and" because ", " is two delimiters. Your + quantifiers only allow runs of a single kind of delimiter. If you want to split on runs of different delimiters, put + around the whole thing rather than the parts: a.split("(\\.|\\s|\\*|\\,|\\!|\"|\\-|/|\\:)+");

stringbuilder
tags question: http://stackoverflow.com/q/21408401
tags question: http://stackoverflow.com/q/21480071
tags question: http://stackoverflow.com/q/21359251
tags question: http://stackoverflow.com/q/21498429
type: Tag
tag name: stringbuilder

http://stackoverflow.com/comment/32297919
has text: Yeah, I realized the title was misleading as soon as I posted the question, sorry about that! Regarding the commit issue, you're right, I forgot to commit, but that is not the "important" data (the one that updates with the json information), that data is in the onPostExecute method of cargarJson.java. I added the commit, thanks.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21410411
type: Comment

http://stackoverflow.com/comment/32460414
has text: While it works, it's a bad idea, you've exposed to much information to a portion of the application that doesn't need to know it. This provides the ability for the panel to change the frame in ways it shouldn't be allowed to ... Like remove everything from the frame. While its a personal project, I'd always encourage the use of best practices
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21492821

http://stackoverflow.com/comment/32236599
type: QuestionComment
comment on: http://stackoverflow.com/q/21376055
has text: (Although frustratingly the accepted answer talks about using the builder pattern for a method, but without explaining how)
score: 0
type: Comment

http://stackoverflow.com/q/21461130
accepted answer: http://stackoverflow.com/a/21461322
tagged with: arrays
answer count: 1
has body: import java.util.*; import java.text.*; public class dateTimeArr { static Scanner input = new Scanner(System.in).useDelimiter("\r\n"); static String[] now=new String[10]; static String[] later=new String[10]; static int a,b; static String[] dateTimeArr = new String[20]; static Date theDate = new Date(); static String currentDateTime = (theDate.getDate() + "/" + (theDate.getMonth() + 1) + "/" + (theDate.getYear() + 1900) + " " + theDate.getHours() + ":" + theDate.getMinutes() + ":" + theDate .getSeconds()); public static void main(String[] args) { dateTimeArr[a]=currentDateTime; System.out.println("What are you doing now?"); now[a]=input.next(); System.out.println("You are doing " +now[a]+ " at " + dateTimeArr[a]); a++; dateTimeArr[b]=currentDateTime; System.out.println("What are you doing later?"); later[b]=input.next(); System.out.println("You are doing " +now[b]+ " at " + dateTimeArr[b]); b++; } } Help me on this. the time just dont want to change. Thanks in advance. Need help on this. really appreaciate the help though. sorry for the ugly post as i'm new in here. for example my problem is as follows: "I wake up at 7:30:15am" and "I get up from bed at 7:30:15am" I want it to be like : "I wake up at 7:30:15am" and "I get up from bed at 7:31:35am"
has comment: http://stackoverflow.com/comment/32387095
tagged with: datetime
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32387002
has title: Need help for my array of current timing
type: Question
has comment: http://stackoverflow.com/comment/32387231
has comment: http://stackoverflow.com/comment/32387391
tagged with: java
has answer: http://stackoverflow.com/a/21461322
has comment: http://stackoverflow.com/comment/32387486
score: 0

http://stackoverflow.com/comment/32328605
has text: `buckets = (SLLNode<MapEntry<K, E>>[]) new SLLNode[m];` - which part of that confuses you? Can you point to specific syntax you don't understand, or possibly a specific reason you would expect this not to work?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21428139

http://stackoverflow.com/q/21435549
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32345911
has body: I have the following source example which works in Spring 3.2.6 but doesn't work in 4.0.1 public interface RunTest&lt;T extends Number&gt; { void run(T number); } public class BasicRunTest implements RunTest&lt;Integer&gt;{ @Override public void run(Integer number) { } } @Component public class BeanTest { @Autowired private RunTest&lt;Number&gt; runTest; } If I run the application I get the exception: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.test.RunTest] 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)}
has answer: http://stackoverflow.com/a/21435730
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/32341419
type: UnansweredQuestion
tagged with: spring
tagged with: inversion-of-control
score: 1
tagged with: java
has title: Autowiring doesn't work in Spring 4

http://stackoverflow.com/comment/32221560
type: QuestionComment
score: 0
has text: Change `public void signUp(Student inStudent()) {` to `public void signUp(Student inStudent) {` - that will take away that error. Of course, your code has many other problems.
type: Comment
comment on: http://stackoverflow.com/q/21367778

http://stackoverflow.com/comment/32518748
type: Comment
has text: Thanks CommonsWare, U means for this, i have to download the Android Sourece Code & make local setup on my system, than i am able to add some standard permission & make some other changes ?.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21492798

http://stackoverflow.com/a/33121380
answers question: http://stackoverflow.com/q/21422684
score: 0
has body: public class RotateThread implements Runnable { private View view; private double duration; private static final float ROTATE_FROM = 0.0f; private static final float ROTATE_TO = -10.0f * 90.0f; public RotateThread(final View view, final double duration) { this.view = view; this.duration = duration; } @Override public void run() { RotateAnimation r; // = new RotateAnimation(ROTATE_FROM, ROTATE_TO); r = new RotateAnimation(ROTATE_FROM, ROTATE_TO, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); r.setDuration((long) duration); r.setRepeatCount(0); try { Thread.sleep(500); this.view.startAnimation(r); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }}
type: Answer

http://stackoverflow.com/comment/32219985
has text: the task was to create both, so I'm struggling with the serialized one now
comment on: http://stackoverflow.com/a/21366107
type: AnswerComment
score: 0
type: Comment

authentication
tags question: http://stackoverflow.com/q/21509812
tags question: http://stackoverflow.com/q/21456897
tags question: http://stackoverflow.com/q/21469794
tags question: http://stackoverflow.com/q/21387920
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/21439887
tags question: http://stackoverflow.com/q/21444200
tags question: http://stackoverflow.com/q/21417256
tags question: http://stackoverflow.com/q/21466215
tags question: http://stackoverflow.com/q/21387935
tags question: http://stackoverflow.com/q/21442412
tags question: http://stackoverflow.com/q/21474128
tags question: http://stackoverflow.com/q/21513172
tags question: http://stackoverflow.com/q/21487643
tags question: http://stackoverflow.com/q/21423638

http://stackoverflow.com/a/27246948
downvote count: 0
score: 18
type: Answer
answers question: http://stackoverflow.com/q/21404252
upvote count: 18
has body: You can use this code for connect and request using http and json try { URL url = new URL("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet" + "&key="+key + "&access_token=" + access_token); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); String input = "{ \"snippet\": {\"playlistId\": \"WL\",\"resourceId\": {\"videoId\": \""+videoId+"\",\"kind\": \"youtube#video\"},\"position\": 0}}"; OutputStream os = conn.getOutputStream(); os.write(input.getBytes()); os.flush(); if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }

android-4.4-kitkat
tags question: http://stackoverflow.com/q/21437270
tag name: android-4.4-kitkat
type: Tag

http://stackoverflow.com/a/21473598
score: 25
has comment: http://stackoverflow.com/comment/35548709
has comment: http://stackoverflow.com/comment/35534994
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21473568
has body: Effectively final means that it is never changed after getting the initial value. A simple example: public void myMethod() { int a = 1; System.out.println("My effectively final variable has value: " + a); } Here, a is not declared final, but it is considered effectively final since it is never changed. Starting with Java 8, this can be used in the following way: public void myMethod() { int a = 1; Runnable r = new Runnable() { @Override public void run() { System.out.println("My effectively final variable has value: " + a); } }; } In Java 7 and earlier versions, a had to be declared final to be able to be used in an local class like this, but from Java 8 it is enough that it is effectively final.
upvote count: 25
accepted answer of: http://stackoverflow.com/q/21473568
type: Answer

http://stackoverflow.com/comment/32329530
type: QuestionComment
has text: I'm not totally sure of what you are really trying to achieve - load the class by the parent ("generic one") ClassLoader but let `getClass()` return the child-URLClassLoader instead? This is not possible as the returned class will always return the class-loader which defined its bytes. For the loading of `@Foo`, as `A.class.getClassLoader()` returns a reference to URLClassLoader, on trying to load `Foo` it looksup its local cache, then asks his ancestors if they know the class-definition for it and only if non knew it it tries to define it itself.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21428015

http://stackoverflow.com/a/21401995
answers question: http://stackoverflow.com/q/21401912
has comment: http://stackoverflow.com/comment/32284080
type: AcceptedAnswer
has body: // send where details is object ClassName details = new ClassName(); Intent i = new Intent(context, EditActivity.class); i.putExtra("Editing", details); startActivity(i); //receive ClassName model = (ClassName) getIntent().getSerializableExtra("Editing"); And Class ClassName implements Serializable { } Source How to send an object from one Android Activity to another using Intents?
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32283330
accepted answer of: http://stackoverflow.com/q/21401912

http://stackoverflow.com/comment/32468335
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21505943
has text: Cheers, I did exactly this. Rookie mistake I know, one of those things I completely missed then became obvious one I discovered my mistake.
type: Comment

http://stackoverflow.com/comment/32465931
type: Comment
type: QuestionComment
has text: Did you mean: `int num= (int)(Math.random() % (numFish-1));` ?
score: 0
comment on: http://stackoverflow.com/q/21505312

http://stackoverflow.com/a/21512988
has comment: http://stackoverflow.com/comment/32499415
upvote count: 1
has comment: http://stackoverflow.com/comment/32502532
answers question: http://stackoverflow.com/q/21508789
score: 1
has comment: http://stackoverflow.com/comment/32485886
downvote count: 0
has body: Not a complete example but have you looked at http://www.gwtproject.org/javadoc/latest/com/google/gwt/editor/ui/client/ValueBoxEditorDecorator.html for showing the error? I think we found it hard to extends so copy and pasted it, shame and us, and changed for our needs. It is a nice pattern though, we also encapsulated the HTML for labels, mandatory indicators, help text etc in a similar way.
type: Answer
has comment: http://stackoverflow.com/comment/32496620

http://stackoverflow.com/comment/32237495
type: AnswerComment
comment on: http://stackoverflow.com/a/21375499
score: 0
type: Comment
has text: percentage 70 percent scale image

http://stackoverflow.com/q/21397149
downvote count: 0
has body: Is it possible and/or easy to find out how many incoming references an arbitrary object has? That is, how many objects are referring to it. Thanks in advance...
has comment: http://stackoverflow.com/comment/32274829
answer count: 4
tagged with: jvm
favorite count: 0
tagged with: reference
accepted answer: http://stackoverflow.com/a/21397219
has answer: http://stackoverflow.com/a/21397300
has title: How do I find out how many references an object has?
duplicate of: http://stackoverflow.com/q/5334137
has answer: http://stackoverflow.com/a/21397293
possible better answer: http://stackoverflow.com/a/21397286
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21397286
tagged with: java
score: 10
upvote count: 10
tagged with: memory
type: Question
linked to: http://stackoverflow.com/q/5334137
has answer: http://stackoverflow.com/a/21397219

methods
tags question: http://stackoverflow.com/q/21447418
tags question: http://stackoverflow.com/q/21511973
tags question: http://stackoverflow.com/q/21391683
tags question: http://stackoverflow.com/q/21372192
tags question: http://stackoverflow.com/q/21434078
tags question: http://stackoverflow.com/q/21492086
tags question: http://stackoverflow.com/q/21502742
tag name: methods
tags question: http://stackoverflow.com/q/21483942
tags question: http://stackoverflow.com/q/21411801
tags question: http://stackoverflow.com/q/21390040
tags question: http://stackoverflow.com/q/21440902
tags question: http://stackoverflow.com/q/21497184
tags question: http://stackoverflow.com/q/21357941
tags question: http://stackoverflow.com/q/21491288
type: Tag
tags question: http://stackoverflow.com/q/21425997
tags question: http://stackoverflow.com/q/21366225
tags question: http://stackoverflow.com/q/21470474
tags question: http://stackoverflow.com/q/21504760
tags question: http://stackoverflow.com/q/21507555
tags question: http://stackoverflow.com/q/21463674
tags question: http://stackoverflow.com/q/21403054
tags question: http://stackoverflow.com/q/21505534
tags question: http://stackoverflow.com/q/21365098
tags question: http://stackoverflow.com/q/21492208
tags question: http://stackoverflow.com/q/21390340
tags question: http://stackoverflow.com/q/21419911
tags question: http://stackoverflow.com/q/21411198
tags question: http://stackoverflow.com/q/21367554
tags question: http://stackoverflow.com/q/21512282
tags question: http://stackoverflow.com/q/21360244
tags question: http://stackoverflow.com/q/21465227
tags question: http://stackoverflow.com/q/21380442
tags question: http://stackoverflow.com/q/21387669
tags question: http://stackoverflow.com/q/21500912
tags question: http://stackoverflow.com/q/21367778
tags question: http://stackoverflow.com/q/21481316
tags question: http://stackoverflow.com/q/21469599
tags question: http://stackoverflow.com/q/21502667
tags question: http://stackoverflow.com/q/21412815

http://stackoverflow.com/comment/32374884
has text: @ColinAlworth so what does it mean for IE11 is there no permutation?
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21443274

http://stackoverflow.com/q/21500965
type: Question
has title: Finding fourth largest & fourth smallest number in an array
has answer: http://stackoverflow.com/a/21501114
tagged with: sorting
answer count: 6
score: -1
has comment: http://stackoverflow.com/comment/32457930
linked to: http://stackoverflow.com/q/251781
upvote count: 0
possible better answer: http://stackoverflow.com/a/21500999
tagged with: arrays
has body: I have tried the following method to find second largest &amp; smallest number and it works : class Test { static void main()throws IOException { Scanner sc = new Scanner(System.in); System.out.println("Enter"); int a[] = {45,79,2,5,74,4,19,56,2,888}; int small= a[0]; int big=a[0]; int s=0,b=0; for(int i=0;i&lt;10;i++) { if(small&gt;a[i]) { small=a[i]; } if(big&lt;a[i]) { big=a[i]; } } int small2=a[0],big2=a[0]; for(int i=0;i&lt;10;i++) { if(small2&gt;a[i]&amp;&amp;a[i]!=small) { small2=a[i]; } if(big2&lt;a[i]&amp;&amp;a[i]!=big) { big2=a[i]; } } System.out.println("second biggest = "+big2); System.out.println("second smallest = "+small2); } } Now I want to find the fourth greatest and lowest. in this case i need to use 4 loops probably. but i want to do it in a shorter, smarter way. Can somebody help ?
favorite count: 0
has comment: http://stackoverflow.com/comment/32458027
has answer: http://stackoverflow.com/a/21501119
has answer: http://stackoverflow.com/a/21501219
has comment: http://stackoverflow.com/comment/63757159
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21501136
accepted answer: http://stackoverflow.com/a/21501136
tagged with: java
has answer: http://stackoverflow.com/a/21500999
has answer: http://stackoverflow.com/a/21502042
downvote count: 1

http://stackoverflow.com/comment/83293562
comment on: http://stackoverflow.com/q/21503142
score: 0
type: Comment
type: QuestionComment
has text: Did you find a solution to this problem? The bug report is marked obsolete yet I just faced with this problem. Amazing :)

http://stackoverflow.com/comment/32326180
type: AnswerComment
comment on: http://stackoverflow.com/a/21426731
type: Comment
has text: Can one put an example for head recursion ? Because in my mind, having the first line of a method immediatly calling the recursion makes an infinite loop, no ? like int recurCall(int number) { int res = recurCall(number -1); ...process...; return res; }.
score: 2

http://stackoverflow.com/comment/32273729
score: 0
type: AnswerComment
has text: Thanks for the response. Will test this out tomorrow and let you know if it works.
type: Comment
comment on: http://stackoverflow.com/a/21395354

http://stackoverflow.com/comment/129602616
comment on: http://stackoverflow.com/a/54793761
has text: @hakima maarouf: I thougt support for positional paramerters was removed in Hibernate 5.3 - but this is not 100% correct, they removed only HQL-style positional parameters (just `?`) but not the JPA Style positional parameters `?1` (https://hibernate.atlassian.net/browse/HHH-12101) - so you can use it - but I still recommend to use named parameters for better readability
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21447345
has title: Finding Eclipse Plugin Wizard
score: 0
answer count: 2
tagged with: eclipse-plugin
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21447379
accepted answer: http://stackoverflow.com/a/21447379
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/21450257
has answer: http://stackoverflow.com/a/21450257
has body: I have the following version of Eclipse: Eclipse IDE for Java Developers Version: Kepler Service Release 1 Build id: 20130919-0819 I am trying to use the Plug-In wizard, but when I try to open a new project, this wizard is not one of the options. I downloaded this standard version of eclipse from http://www.eclipse.org/downloads/ Is there something else I have to download or was I supposed to download a different version? Thanks in advance!

http://stackoverflow.com/a/21404217
type: Answer
has comment: http://stackoverflow.com/comment/32287650
has comment: http://stackoverflow.com/comment/32287406
has comment: http://stackoverflow.com/comment/32287762
has comment: http://stackoverflow.com/comment/32288426
has comment: http://stackoverflow.com/comment/32286730
has comment: http://stackoverflow.com/comment/32287308
accepted answer of: http://stackoverflow.com/q/21403992
has comment: http://stackoverflow.com/comment/32287380
answers question: http://stackoverflow.com/q/21403992
has comment: http://stackoverflow.com/comment/32287857
type: AcceptedAnswer
has body: // create a class for saving latitude and longitude under any package private class Cordinate { double lati,longi; public Cordinate(double la,louble lo) { lati=la; longi=lo; } // set getters and setters for this two variables public double getLati() { return lati; } public void setLati(double lati) { this.lati = lati; } public double getLongi() { return longi; } public void setLongi(double longi) { this.longi = longi; } } //define array list for saving the latitude and longitude List&lt;Cordinate&gt; cordinateList = new ArrayList&lt;Cordinate&gt;(); // then inside your functn for (Route route : allRoute) { Log.d("Car: ", route.getDate()); cordinateList.add(new Cordinate(route.getLattitude,rout.getLongitude)); for (int i = 0; i &lt; lat.size(); i++) {//and this is where I cant find a solution. String element = lat.get(i); double value = Double.parseDouble(element); } // then call the method CalculateDistance () by passing variables // You can use cordinate variables for setting the location object // for ex: loc.setLatitude(cordinateList(i).getLati()); // loc.setLatitude(cordinateList(i).getLongi()); // method for find distance CalculateDistance(Location loc1,Location dest) { double distance=DistanceCalculator.getDistance(loc, dest); distance=Math.round(distance * 100.0) / 100.0; }
has comment: http://stackoverflow.com/comment/32288269
has comment: http://stackoverflow.com/comment/32287467
has comment: http://stackoverflow.com/comment/32286710
has comment: http://stackoverflow.com/comment/32287935
has comment: http://stackoverflow.com/comment/32286947
has comment: http://stackoverflow.com/comment/32288677
score: 0

http://stackoverflow.com/a/21363756
type: Answer
has body: In your for loops conditions you are checking if entire String has length greater or equal 3 instead of checking only part from i till end. Try maybe with str.length() - i &gt;= 3 instead of str.length() &gt;= 3
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32214107
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21363644
has comment: http://stackoverflow.com/comment/32214164
has comment: http://stackoverflow.com/comment/32213979
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21363644
has comment: http://stackoverflow.com/comment/32214040

http://stackoverflow.com/comment/32427348
type: Comment
type: QuestionComment
has text: the OP could also use `List<Object> arrl = new ArrayList<Object>(); arrl.add("Tim"); arrl.add(new Integer(23));` -- depends what the OP is after I suppose.
score: 0
comment on: http://stackoverflow.com/q/21483942

http://stackoverflow.com/comment/32394269
comment on: http://stackoverflow.com/q/21465169
score: 0
type: Comment
type: QuestionComment
has text: But lines number is not fixed, you can't use array[][].

http://stackoverflow.com/q/21513124
has title: The part interface is not working with JBoss Weld in Tomcat 7?
has comment: http://stackoverflow.com/comment/32516078
tagged with: tomcat
has comment: http://stackoverflow.com/comment/32517850
has comment: http://stackoverflow.com/comment/32487098
answer count: 1
has comment: http://stackoverflow.com/comment/32582336
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21513739
tagged with: jboss-weld
tagged with: java
tagged with: servlets
has body: I wrote code to get part data from a Servlet request for file upload, but the part list returns zero size. I use JBoss Weld in the JEE project. But if I remove the Weld configuration from the web.xml file, then it's working fine. The web.xml configuration is: org.jboss.weld.environment.servlet.Listener Object factory for the CDI Bean Manager BeanManager javax.enterprise.inject.spi.BeanManager The server-side code in the Servlet: @WebServlet("/upload") @MultipartConfig public class UploadServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Collection<Part> parts = request.getParts(); System.out.println(parts.size()); } } The client-side JavaScript: $('#input-file').change(function(e) { var obj = { "name" : "samik" }; var file = e.target.files[0]; var formData = new FormData(); formData.append('file', file); formData.append('other', JSON.stringify(obj)); $.ajax({ url : "upload", type : "POST", data : formData, contentType : false, processData : false, dataType : "json", success : function() { } }); });
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/21428874
linked to: http://stackoverflow.com/q/3791103
has comment: http://stackoverflow.com/comment/32329645
has comment: http://stackoverflow.com/comment/32534864
has comment: http://stackoverflow.com/comment/32329672
tagged with: file-io
has body: I am new to Java. I am supposed to read an ever growing file for new data being appended to it. On googling I could find out a solution using RandomAccessFile, is that the best way? Can you suggest an optimal way that would maintain the balance between speed/performance and accuracy? I am not expecting ready to use code, but suggestion from you experts out there.
has comment: http://stackoverflow.com/comment/32580077
downvote count: 0
has comment: http://stackoverflow.com/comment/32329648
favorite count: 0
has comment: http://stackoverflow.com/comment/32335409
has comment: http://stackoverflow.com/comment/32534802
has comment: http://stackoverflow.com/comment/32329620
answer count: 0
has comment: http://stackoverflow.com/comment/32329879
type: UnansweredQuestion
score: 1
tagged with: java
has title: What is the optimal way of reading a dynamically growing file in java? RandomAccessFile?
upvote count: 1
has comment: http://stackoverflow.com/comment/32366488
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/32534779

http://stackoverflow.com/q/21394804
has comment: http://stackoverflow.com/comment/32270691
has comment: http://stackoverflow.com/comment/32273240
has title: How can I have an object wrap around screen?
has answer: http://stackoverflow.com/a/21396154
type: AnsweredQuestion
has body: I'm working on a program that takes a ship object and it moves it. The trouble I am having is that if it goes past a side, then it is supposed to wrap back around on the other side. Any help would be great :) Here is my ship Class: The move method is what I need help with. The code I have doesnt work :/ import java.awt.Dimension; import java.awt.Graphics; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import junit.framework.TestCase; public class Ship { private BufferedImage _image; private static final int WIDTH = 50; private Point location; private Vector speed = new Vector(); private double facing; /** * Generate ship at the given starting location and currently stopped * * @param starting * location to copy for this ship */ public Ship(Point starting) { try { // Use the RunConfigurations &gt;&gt; Arguments &gt; Working Directory tab so // that this works. Don't just place the nave.png file in the bin // directory! _image = ImageIO.read(new File("nave.png")); } catch (IOException e) { System.err.println("Cannot find ship _image: " + e.getMessage()); } location = starting.clone(); facing = Math.PI; } public void accelerate(double force) { // TODO change the speed (velocity, really) by force in the direction // the ship is facing. // add a vector of appropriate magnitude by the facing direction Vector acc = new Vector(facing); acc = acc.scale(force); speed = speed.add(acc); } public void rotate(double angle) { // TODO change the direction the ship is facing. Can accept any angle // as a parameter but should store it as in [0,2*pi) while (angle &lt;= 0.0f) { angle += (Math.PI * 2); } while (angle &gt;= Math.PI) { angle -= (Math.PI * 2); } facing += angle; } public void move(Dimension bounds) { // TODO Move the ship its speed. The ship should wrap around // within its box. (Hint: move the ship by the size of the // boundi…
accepted answer: http://stackoverflow.com/a/21396154
tagged with: java
has comment: http://stackoverflow.com/comment/32270666
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/32270649
score: 0
tagged with: coordinate-transformation

http://stackoverflow.com/comment/32330178
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21429137
type: Comment
has text: where this all literal defined? where can i found it? in oracle's site sorry because i am asking out of topic(just near to it?)

http://stackoverflow.com/q/21501841
tagged with: eclipse
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6165502
accepted answer: http://stackoverflow.com/a/21502036
score: 1
favorite count: 0
type: Question
tagged with: sockets
has body: I am trying to create a java socket server listener on Mac 10.6. iOS client will be accessing it through socket connection. I don't know, how to create and run such socket server on Mac. I got sample source from Java tutorials, i want to use the same code as it is to create new java socket server program on Mac. Java socket server tutorial I have Eclipse installed. How do I create and run a java socket program using the java tutorial code mentioned in the above link on a mac machine? I am new to this and not getting the basic steps involved on this. Please help. Another sample link
has title: Java-Server: Create and run Java socket server on Mac?
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21502036
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/32356397
score: 0
has text: @user3249541 Can you please be more specific about your problem? Most likely you accidentally deleted or changed something when you updated the code. I would suggest comparing what you had before with your new code and see where the differences are.
type: Comment
comment on: http://stackoverflow.com/a/21436747
type: AnswerComment

http://stackoverflow.com/q/21396082
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/21396180
score: 1
tagged with: java
has body: I'm currently working on an app for a website/class. Currently, it pulls the RSS feed of the site, parses it appropriately, and when an item is clicked, it launches a new Activity with a WebView to display the page. My current problem is that on smaller devices, such as the HTC One or Samsung Stratosphere, it defaults to showing the mobile version of the site. This is precisely what I want to happen across all devices, but on my Samsung Galaxy Note 8, it defaults to loading the desktop version of the page. Is anyone familiar with WordPress and Android and can help me force the WebView on the Galaxy (and, therefore, other devices) to load the mobile page by default? Thank you!
tagged with: wordpress
type: Question
tagged with: mobile
tagged with: adt
has title: Displaying Mobile WordPress in Android
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21396180
tagged with: android

http://stackoverflow.com/comment/32299424
score: 3
has text: Is there any reason not to just try this for yourself?
type: QuestionComment
comment on: http://stackoverflow.com/q/21411492
type: Comment

http://stackoverflow.com/q/21382041
has answer: http://stackoverflow.com/a/21382151
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/pdf
tagged with: pdf-generation
tagged with: html-to-pdf
downvote count: 1
has comment: http://stackoverflow.com/comment/32247668
type: Question
has comment: http://stackoverflow.com/comment/32247455
has comment: http://stackoverflow.com/comment/32247550
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32247771
upvote count: 0
answer count: 1
has title: how to convert html to pdf without tag check
has comment: http://stackoverflow.com/comment/32246909
favorite count: 0
has comment: http://stackoverflow.com/comment/32247867
has body: I have a HTML page and I can see this page with my browser without any error. Problem is when I try to convert this HTML to PDF with iText or any other programs, these programs gives hundreds of error. Is there a way to convert HTML file to PDF file without tag checking? I mean I want to get what I see from my web browser as PDF. EDIT: My html page is a little big so I can't write it here. Here is the first error I am getting with iText line; &lt;table style="border-color:blue; " border="0" cellspacing="0px" width="700" cellpadding="0px"&gt; error; Exception in thread "main" java.lang.NumberFormatException: For input string: "0px"

http://stackoverflow.com/comment/32412473
type: Comment
type: QuestionComment
has text: Yes, I can install Gson manually, then it works. But I've got the same issue for several other jars. And I would like to automate the installation process.
comment on: http://stackoverflow.com/q/21439690
score: 0

http://stackoverflow.com/comment/32227351
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21370927
has text: The code is right, the output was from a pre-final version. Sorry about that. Fixed.

http://stackoverflow.com/comment/32321576
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/21424313
type: Comment
has text: Debug your code for easier and better life.

http://stackoverflow.com/comment/32433670
has text: That's correct. Or make `inner` and `a` both static.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21487609

http://stackoverflow.com/comment/32211976
score: 0
type: AnswerComment
has text: check what values are being stored inside the variables on obj reference, i think, this time values are going wrong.
type: Comment
comment on: http://stackoverflow.com/a/21355398

http://stackoverflow.com/a/37146836
has body: You need to optimize it. Maybe you are drawing circles at the same coordinates. Each circle you draw is a memory allocation, so try to see if the onLocationChanged is called with the same locations some times.
score: 0
answers question: http://stackoverflow.com/q/21372519
type: Answer

http://stackoverflow.com/comment/32265562
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21391921
has text: Got, thanks for the tip!
score: 0

http://stackoverflow.com/q/21485651
has body: The float targetVolume in created in a public void method, but cannot be resolved in another public void method... scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { float x = (float) Math.random(); if (x &lt; 0.5){ float targetVolume = 0; } else { float targetVolume = 1; } scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { if (targetVolume.equals (1)){ mp.setVolume(startingVolume+volumeIncrement, startingVolume+volumeIncrement); } else { mp.setVolume(startingVolume-volumeIncrement, startingVolume-volumeIncrement); } } }, 0, 1, TimeUnit.SECONDS); } }, 0, 5, TimeUnit.SECONDS); How can I fix this? EDIT: I can solve the problem by adding the final modifier to the float: scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { float x = (float) Math.random(); final float targetVolume=(x &lt; 0.5)?0:1; scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() { if (targetVolume &gt;startingVolume){ startingVolume = startingVolume+volumeIncrement; mp.setVolume((startingVolume), (startingVolume)); } else if (targetVolume &lt; startingVolume){ startingVolume = startingVolume-volumeIncrement; mp.setVolume((startingVolume), (startingVolume)); } } }, 0, 1, TimeUnit.SECONDS); } }, 0, 5, TimeUnit.SECONDS); However, does the final float targetVolume now hold the same value (a zero or a 1) each time the task is run? I need this value to change randomly...
tagged with: android
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2088299
accepted answer: http://stackoverflow.com/a/21485694
type: Question
has comment: http://stackoverflow.com/comment/32430431
tagged with: scope
score: 0
answer count: 2
tagged with: public
has comment: http://stackoverflow.com/comment/32430012
has title: variable not available despite public method
possible better answer: http://stackoverflow.com/a/21486497
has answer: http://stackoverflow.com/a/21486497
has answer: http://stackoverflow.com/a/21485694

http://stackoverflow.com/comment/32399013
comment on: http://stackoverflow.com/a/21467385
type: AnswerComment
has text: So, I cannot get type safety guarantee by the compiler because I am using the generic. Nevertheless, the type safety is guarantee at run time by parameter passed in the constructor?
type: Comment
score: 0

http://stackoverflow.com/a/21436518
upvote count: 1
downvote count: 0
has body: Put this line inside ui thread like that as you can't modify in the ui thread from another thread runOnUiThread(new Runnable() { @Override public void run() { layout.setBackgroundResource(setImg[i]); } }); And I think that the right way to do it is using alarm . Refer to this link Android alarms Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/21435953
has comment: http://stackoverflow.com/comment/32408153
score: 1

http://stackoverflow.com/comment/32449835
type: Comment
comment on: http://stackoverflow.com/a/21496122
score: 0
type: AnswerComment
has text: @DavidWallace totally misread the question. Should be close now.

http://stackoverflow.com/a/21480282
type: Answer
score: 2
upvote count: 2
has body: Yes you can do it. One Way You need to get data from JTable using getValueAt(row,column) and them you can add that value to JComboBox using addItem(value) like: comboBox.addItem(table.getValueAt(row,column).toString()); Second Way As you are using mysql resultset to get fill the jtable, you can use that resultset to set the combobox value too like: You can use a loadcombo() to load your combobox with database values. void loadcombo() { try { // Your database connections rs= st.executeQuery("select Column from Table"); while(rs.next()){ jComboBox.addItem(rs.getString(1)); } con.close(); } catch(Exception e) { System.out.println("Error"+e); } } I suggest you to use second way
accepted answer of: http://stackoverflow.com/q/21466391
answers question: http://stackoverflow.com/q/21466391
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32442954
comment on: http://stackoverflow.com/q/21491550
type: Comment
type: QuestionComment
score: 1
has text: @gedr The documentation states that `null` is returned if the resource can't be found. Check that the path is correct. Maybe [this answer](http://stackoverflow.com/a/19388209/2088822) is of help. If the problems persist, consider posting another question with your new issues, since this question is about running a jar with a double click.

http://stackoverflow.com/q/21433218
accepted answer: http://stackoverflow.com/a/21433410
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/32337100
has title: NetBeans 7.3.1 suddenly won't start at all
tagged with: java
has comment: http://stackoverflow.com/comment/32337048
score: 2
has answer: http://stackoverflow.com/a/21433410
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/24803500
type: AnsweredQuestion
has body: Okay, so I've been working in NetBeans for the past year or so, and everything went fine until today, three days before big exam, I can't start NetBeans at all. As mentioned in the title i'm running NetBeans 7.3.1 and when I click on the shortcut everything the loading window shows up and then blank screen in the top left corner. ! I've googled this problem for the past few hours, and only found one solution: deleting lock file, but i can't seem to find them in my user dir. I'd really appreciate your help !! Thanks
favorite count: 0
possible better answer: http://stackoverflow.com/a/24803500
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32337111

http://stackoverflow.com/q/21369587
has title: Map Creation Error Java
answer count: 1
tagged with: java
downvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32224828
favorite count: 0
has comment: http://stackoverflow.com/comment/32224814
type: Question
has answer: http://stackoverflow.com/a/21369610
score: -1
upvote count: 2
has body: When I am trying to create a map in java, I type the following code: Map &lt;String, Integer&gt; m = new HashMap&lt;String, Integer&gt;(); I get an error saying Map and Hashmap cannot be resolved to a type, any help?

http://stackoverflow.com/q/21482682
type: Question
has answer: http://stackoverflow.com/a/21482897
answer count: 8
linked to: http://stackoverflow.com/q/12861807
has comment: http://stackoverflow.com/comment/32581286
has comment: http://stackoverflow.com/comment/32426317
downvote count: 0
tagged with: encapsulation
has comment: http://stackoverflow.com/comment/32763984
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/21635906
has comment: http://stackoverflow.com/comment/32795938
has answer: http://stackoverflow.com/a/21661956
has answer: http://stackoverflow.com/a/21488828
has title: Keep out of reach of Children: Removing protected fields from inheritance
has comment: http://stackoverflow.com/comment/32734792
has comment: http://stackoverflow.com/comment/32590435
has answer: http://stackoverflow.com/a/21536244
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21571857
has comment: http://stackoverflow.com/comment/32505888
has body: In the spirit of well designed OO, a certain class I am extending has marked one of its fields protected. This class has also generously provided a public setter, yet no getter. I am extending this class with a base class that is in turn extended by several children. How can I restrict access to the protected variable from my children while still being able to manipulate it privately and set it publicly? See example below: public abstract class ThirdPartyClass { protected Map propertyMap; public void setPropertyMap(Map propertyMap){ this.propertyMap= propertyMap; } // Other methods that use propertyMap. } public abstract class MyBaseClass extends ThirdPartyClass{ // Accessor methods for entries in propertyMap. public getFoo(){ propertyMap.get("Foo"); } public getBar(){ propertyMap.get("Bar"); } // etc... } public class OneOfManyChildren extends MyBaseClass { // Should only access propertyMap via methods in MyBaseClass. } I have already found that I can revoke access by making the field private final in MyBaseClass. However that also hinders using the setter provided by the super class. I am able to circumvent that limitation with the "cleverness" below yet it also results in maintaining two copies of the same map as well as an O(n) operation to copy over every element. public abstract class MyBaseClass extends ThirdPartyClass{ private final Map propertyMap = new HashMap(); // Revokes access for children. /** Sets parent &amp; grandparent maps. */ @Override public final void setPropertyMap(Map propertyMap){ super.setPropertyMap(propertyMap); this.propertyMap.clear(); this.propertyMap.putAll(propertyMap); } } Are there any better ways of accomplishing this? Note: This is only one example of the real question: How to restrict access to protected fields without maintaining multiple copies? Note: I also know that if the field were made private in the first place with a protected accessor, this would be a non-issue. Sadly I have no control over that. Note: IS-A relatonshi…
upvote count: 7
has comment: http://stackoverflow.com/comment/32567498
has comment: http://stackoverflow.com/comment/32537636
has answer: http://stackoverflow.com/a/21483796
has answer: http://stackoverflow.com/a/21572163
score: 7
tagged with: java

http://stackoverflow.com/a/21375652
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21375485
has body: Alternatively, you might try connection.getMetaData(). This would give you a DatabaseMetaData object, from which you could call getURL(). (JavaDoc)
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/32235805
answers question: http://stackoverflow.com/q/21375485

size
type: Tag
tags question: http://stackoverflow.com/q/21509640
tag name: size
tags question: http://stackoverflow.com/q/21429889

http://stackoverflow.com/comment/32236222
type: Comment
comment on: http://stackoverflow.com/q/21375069
has text: Have you tried installing in mobile instead of AVD?
score: 0
type: QuestionComment

http://stackoverflow.com/q/21395992
favorite count: 0
has comment: http://stackoverflow.com/comment/32272828
type: UnansweredQuestion
has body: having this code block: String x = new String("xyz"); String y = "abc"; x = x + y; how many string objects are being created on the JVM?
answer count: 0
has comment: http://stackoverflow.com/comment/32272925
upvote count: 1
duplicate of: http://stackoverflow.com/q/11180866
downvote count: 1
has comment: http://stackoverflow.com/comment/32272898
type: Question
tagged with: java
score: 0
linked to: http://stackoverflow.com/q/11180866
tagged with: string
has title: how many string objects are being created in new String(" ");

http://stackoverflow.com/comment/32397802
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21466671
has text: What is the error you get? Please copy and paste it into the question.

weblogic9.x
tags question: http://stackoverflow.com/q/21509788
type: Tag
tag name: weblogic9.x

http://stackoverflow.com/a/21489230
has comment: http://stackoverflow.com/comment/32445374
accepted answer of: http://stackoverflow.com/q/21488985
answers question: http://stackoverflow.com/q/21488985
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32441682
has body: You want to either flush the PrintWriter to make sure the changes in its buffer are written out first, before you set the RandomAccessFile's length to 0, or close it and re-open a new PrintWriter to write the last line (Text to be written...). Preferably the former: if (clearCondition) { writer.flush(); new RandomAccessFile("temp","rw").setLength(0);
type: Answer

http://stackoverflow.com/q/21436604
has title: GUI interfaces for computationally heavy programs
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21437967
has comment: http://stackoverflow.com/comment/32343720
has answer: http://stackoverflow.com/a/21444599
tagged with: http://stackoverflow.com/tag/r
has body: I'm exploring options for the best way to achieve the following. I have a computationally heavy model built in R (it uses MLE at its core) and I'd like to provide a front end GUI to use this model. The input to the model is especially simple, just two lists of numbers, and the model spits out various parameters. Essentially, the GUI component will be a single window that the user can upload a file, fill in a few text boxes, and indicate some preferences (e.g., maybe a checkbox or two). I know Java well and my first thought was to somehow link up a Java GUI with the R code, via console or some other method. I've compiled a list of options I thought of, but know very little about. What do you think would be most feasible and/or easiest for achieving this? Here were my ideas include actual R code within Java (not sure if this is possible) include actual Java GUI code within R (not sure if this is possible) implement the actual MLE model in Java (really don't want to do this, as the R code works great and I love the parameters it spits back out to me, such as liklihoods and confidence intervals) rewrite the MLE model in Matlab, and include Java GUI code within Matlab use native R GUI (does this even exist), and then make an R executable of some type The overarching goal is to let the user run this complex R code via a nice GUI window such that they don't need to tweak parameters at the top of the R file (e.g., file paths).
score: 0
has comment: http://stackoverflow.com/comment/32343519
answer count: 3
has comment: http://stackoverflow.com/comment/32343364
tagged with: user-interface
tagged with: mle
favorite count: 0
has comment: http://stackoverflow.com/comment/32346750
has comment: http://stackoverflow.com/comment/32343691
has answer: http://stackoverflow.com/a/21438201
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32343276
upvote count: 1
tagged with: matlab
tagged with: java

http://stackoverflow.com/comment/32274829
has text: can you explain more your question?
comment on: http://stackoverflow.com/q/21397149
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21406946
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21406970
has comment: http://stackoverflow.com/comment/32291384
has title: how to detect popup call in java?
tagged with: javascript
has comment: http://stackoverflow.com/comment/32291350
has comment: http://stackoverflow.com/comment/32291308
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21406970
possible better answer: http://stackoverflow.com/a/21412557
has answer: http://stackoverflow.com/a/21412557
tagged with: web-applications
has body: i am making the call to my servlet from javascript with window.open window.open('myServlet','window','window Params') i want to detect in myservlet whether call is coming from popup or not without passing any paramater alongwith servlet. Can we detect it in servlet?
type: AnsweredQuestion
tagged with: popup

http://stackoverflow.com/q/21360377
has comment: http://stackoverflow.com/comment/32208256
has comment: http://stackoverflow.com/comment/32214105
has title: JSONObject keys order reverse
has comment: http://stackoverflow.com/comment/32208128
has answer: http://stackoverflow.com/a/21360756
has comment: http://stackoverflow.com/comment/32208294
has comment: http://stackoverflow.com/comment/32208209
has comment: http://stackoverflow.com/comment/32208155
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/17229418
has comment: http://stackoverflow.com/comment/32208202
tagged with: org.json
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32208263
score: 2
has comment: http://stackoverflow.com/comment/32208154
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32208314
has comment: http://stackoverflow.com/comment/32208144
has body: I searched across many sources but could not find the answer to this one.. Its a know fact that a JSONObject keys are returned in reverse order. Is there any way to recurse through a JSONObject in the correct order as appearing in JSON String json; JSONObject obj = new JSONObject(json) Iterator&lt;String&gt; keys = json.keys() ---&gt; order is reversed I understand JSONObject is unordered, perhaps there is a way to order it???? JSON is of type below..and the keys start getting recursed from the bottom most styleHint tag "sections": { "1": { "1": { "1": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "2": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" }, "2": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "2": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } }, "anchor":"xxx" }, "3": { "1": { "title": "xxx", "text": "xxx", "tags": { "audience": { "tag": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "tag": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxxx" } }, "styleHint": { "1": { "name": "xx", "title": "xxx", "id": "xxxx" } } } } }
has comment: http://stackoverflow.com/comment/32208218
type: Question
has comment: http://stackoverflow.com/comment/32208135

http://stackoverflow.com/comment/32418994
type: AnswerComment
has text: you cannot define an array like that
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21479059

xsd
tags question: http://stackoverflow.com/q/21406457
tags question: http://stackoverflow.com/q/21456532
tags question: http://stackoverflow.com/q/21453203
tags question: http://stackoverflow.com/q/21447416
tags question: http://stackoverflow.com/q/21384895
tag name: xsd
tags question: http://stackoverflow.com/q/21387170
tags question: http://stackoverflow.com/q/21407573
tags question: http://stackoverflow.com/q/21483342
tags question: http://stackoverflow.com/q/21469791
tags question: http://stackoverflow.com/q/21472583
type: Tag
tags question: http://stackoverflow.com/q/21490230
tags question: http://stackoverflow.com/q/21480625
tags question: http://stackoverflow.com/q/21395334

http://stackoverflow.com/a/21501152
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32458219
downvote count: 0
has body: The best way to do it is using the factory pattern. In your case you have a factory that receives a file extension and returns an object that implements a file parsing interface. This way you can add more parsers later without changing the code and you have one single point where to ask for file parsing capabilities. IFileparser parser = ParseFactory.getParser("text") IContent content = parser.parseFile(file) You can augment the factory to return the supported file extensions, sinch the factory knows all implementationn it holds.
has comment: http://stackoverflow.com/comment/32458156
has comment: http://stackoverflow.com/comment/32458120
type: Answer
answers question: http://stackoverflow.com/q/21501021

http://stackoverflow.com/comment/32264600
has text: I get "illegal start of expression warning" error on the line "array = {1,1,1,1,1,1}; when I try to do it that way. Is there something keeping it from accessing the array declared in the class, or is there a formatting issue?
type: AnswerComment
comment on: http://stackoverflow.com/a/21390811
score: 0
type: Comment

http://stackoverflow.com/comment/32488917
type: Comment
has text: Sorry, I meant to say: "The *presentation* task is being performed in `onPostExecute()`..."
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21516147

http://stackoverflow.com/q/21360528
downvote count: 0
answer count: 1
favorite count: 0
tagged with: tabs
has title: Adding a tab replaces tab (Java)
has body: Im new to java and need a little bit of help. That being said im sure my code is sloppy. Im using NetBeans for the GUI builder, and am learning swing in the process. I have a SSCC here but because im using NetBeans its fairly long. public class tabtest extends javax.swing.JFrame { public tabtest() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { addTabDialog = new javax.swing.JDialog(); titleTextBox = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); addTabConfirmButton = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); tabPane = new javax.swing.JTabbedPane(); addTabButton = new javax.swing.JButton(); addTabDialog.setBounds(new java.awt.Rectangle(0, 0, 400, 400)); titleTextBox.setText("New Tab"); jLabel1.setText("Tab Title"); addTabConfirmButton.setText("Confirm"); addTabConfirmButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addTabConfirmButtonActionPerformed(evt); } }); javax.swing.GroupLayout addTabDialogLayout = new javax.swing.GroupLayout(addTabDialog.getContentPane()); addTabDialog.getContentPane().setLayout(addTabDialogLayout); addTabDialogLayout.setHorizontalGroup( addTabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(addTabDialogLayout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(addTabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(addTabConfirmButton) .addComponent(titleTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(211, Short.MAX_VALUE)) ); addTabDialogLayout.setVerticalGroup( addTabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(addTabDialogLayout.createSequentialGroup() .addGap(77, 77, 77) .addGroup(addTabDialogLay…
score: 2
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21360595
accepted answer: http://stackoverflow.com/a/21360595
upvote count: 2

http://stackoverflow.com/comment/32324805
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21426093
type: Comment
has text: see also http://stackoverflow.com/questions/15281428/java-relative-path-of-text-file-in-main

http://stackoverflow.com/comment/32378803
comment on: http://stackoverflow.com/q/21455646
has text: @EJP what can I wait for? I should wait for getValueOfQueue() returns a value != null but how can I do that?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21476472
has comment: http://stackoverflow.com/comment/76982699
has comment: http://stackoverflow.com/comment/53933761
score: 6
has body: Create a file, and set as the out of the System class. File file = new File("out.txt"); //Your file FileOutputStream fos = new FileOutputStream(file); PrintStream ps = new PrintStream(fos); System.setOut(ps); System.out.println("This goes to out.txt");
answers question: http://stackoverflow.com/q/21476423
downvote count: 0
has comment: http://stackoverflow.com/comment/68121198
has comment: http://stackoverflow.com/comment/64676706
type: Answer
upvote count: 6

http://stackoverflow.com/q/21509944
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21509958
has body: I tried to call a constructor in the fragment class. However it shows an error. This is the constructor code: public CameraPreview(Context fragment, Camera camera, PreviewCallback previewCb, AutoFocusCallback autoFocusCb) { super(fragment); mCamera = camera; previewCallback = previewCb; autoFocusCallback = autoFocusCb; // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = getHolder(); mHolder.addCallback(this); // deprecated setting, but required on Android versions prior to 3.0 mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } Then I try to access is within another fragment class: mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB); FrameLayout preview = (FrameLayout) getView().findViewById(R.id.cameraPreview); preview.addView(mPreview); I noticed the problem was "this". How I should solve it? thanks.
type: Question
tagged with: android-fragments
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/21509958
answer count: 1
has title: fail accessing constructor public CameraPreview(Context fragment, Camera camera, PreviewCallback previewCb, AutoFocusCallback autoFocusCb) in fragment

http://stackoverflow.com/comment/32474547
has text: So everyone can instantly understand what 200000000L is? I don't think so. And it is for sure less efficient than using the deltaTime which is provided anyway.
type: Comment
comment on: http://stackoverflow.com/a/21509721
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32340666
has text: Check the answer of https://stackoverflow.com/questions/251298/why-is-someclass-super-t-not-equivalent-to-someclasst-in-java-generic-types
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21435069

http://stackoverflow.com/comment/32462262
has text: Can you not just debug it?
comment on: http://stackoverflow.com/q/21503367
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32269062
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21392344
has text: I've already proven to myself that doing it through `cmd` works faster; this is several million files across several extended drives; we're hitting each one with 100 deletes, and then after all deletes are done, folder removal commences.

css
tags question: http://stackoverflow.com/q/21509788
tags question: http://stackoverflow.com/q/21441098
tags question: http://stackoverflow.com/q/21502292
tags question: http://stackoverflow.com/q/21449995
tags question: http://stackoverflow.com/q/21470849
type: Tag
tags question: http://stackoverflow.com/q/21493634
tags question: http://stackoverflow.com/q/21394436
tags question: http://stackoverflow.com/q/21493225
tag name: css

http://stackoverflow.com/a/22108814
answers question: http://stackoverflow.com/q/21414009
type: Answer
has comment: http://stackoverflow.com/comment/33628228
has body: Jersey has a registry relating the MIME type in the @Produces with the Java type the method is declared to return and the handler that processes the object to produce the payload of the response. It has a handler that converts Iterable and List to a JSON Array. It also has a handler that converts Map to a JSON Object. The problem with the Java interface Collection is that there is no indication as to whether it should be represented as a sequential collection (JSON Array) or an unordered collection of named items (JSON Object). Thus there is no handler registered by default for converting Collection to application/json. This is what the message in the exception logged on your application server indicates.
score: 0

http://stackoverflow.com/comment/32266969
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21392412
has text: no, only one. 39 is a target host, 49 is client so this are source ports. Sock5 rfc is talking about destination ports only, nothing about source.

http://stackoverflow.com/comment/32266976
score: 2
comment on: http://stackoverflow.com/a/21392579
has text: If someone asked me this on an interview, I would point out that the cost of writing a `hashCode` -- about 2 seconds with a modern IDE, 10 if you want to clean up the generated code a bit -- is well worth the benefit of avoiding problems down the road.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21439764
has comment: http://stackoverflow.com/comment/32357552
upvote count: 6
has body: In order to facilitate unsigned bytes above 0x7F this takes place. The int will be silently narrowed to be written. In fact, the code does that with a (byte) cast. As Ingo states: A possible reason could be that the byte to write will most often be the result of some operation that automatically converts its operands to int[, like] some bit operations. Hence, the code would be littered with casts to byte, that add nothing to understanding.
answers question: http://stackoverflow.com/q/21439695
has comment: http://stackoverflow.com/comment/32349377
downvote count: 0
has comment: http://stackoverflow.com/comment/32349493
has comment: http://stackoverflow.com/comment/32349333
has comment: http://stackoverflow.com/comment/32357418
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/32349539
has comment: http://stackoverflow.com/comment/32349509
has comment: http://stackoverflow.com/comment/32351025
has comment: http://stackoverflow.com/comment/32349416
has comment: http://stackoverflow.com/comment/32350212

http://stackoverflow.com/comment/32354864
comment on: http://stackoverflow.com/a/21442555
has text: @IanMcLaird : Oh allright. I just asked because that could be sometimes of a case & I need to make sure i get the right output.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21387486
has body: I have made test WebService which starts Thread, which writes to file timestamp every 10 second. I intentionally don't have Thread stop mehanism. Now, if I stop test WebService, and even delete it, the Thread live in Jboss forever (needs JBoss restart). Is this normal that JBoss isn't aware of Threads made within WebService context ? Within JVM, when app shuts down, all threads are killed, but here is JVM owned by Jboss, which dynamically loads classes. Is this a "feature" or bug ? I am asking this, cause we have 3rd party application doing threading, and I noticed they're not shutted down on WebService destructor, so after re-publish, we have an issue.
has answer: http://stackoverflow.com/a/21409456
has title: Jboss WS and Threads
type: AnsweredQuestion
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/21409456
has answer: http://stackoverflow.com/a/21408848
type: Question
linked to: http://stackoverflow.com/q/533783
tagged with: java
tagged with: jboss
linked to: http://stackoverflow.com/q/19189312
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3212255
accepted answer: http://stackoverflow.com/a/21408848

http://stackoverflow.com/q/21398650
has comment: http://stackoverflow.com/comment/32277052
favorite count: 0
has body: I tried to search for the basic skills required for starting to learn android application development and many suggested that you need to be familiar with Java , c++ , pearl or php script , xml along with knowledge about usage of graphic resources. My problem is I know nothing about above languages except for c++ which I've been learning for 2 years in my school. Now what I want to know is, should I go ahead with learning android application development or is it waste of time to start without learning the other languages mentioned above ?
tagged with: android
tagged with: php
tagged with: http://stackoverflow.com/tag/xml
tagged with: c++
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25590109
tagged with: java
downvote count: 2
type: Question
has title: Sufficient prerequisites for android application development
has answer: http://stackoverflow.com/a/21398851
accepted answer: http://stackoverflow.com/a/21398851
upvote count: 2
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32277191
has answer: http://stackoverflow.com/a/25590109
has comment: http://stackoverflow.com/comment/32277168
has comment: http://stackoverflow.com/comment/32277124

http://stackoverflow.com/comment/32358727
comment on: http://stackoverflow.com/a/21444740
score: 0
type: Comment
has text: That may be true in other languages. Another note, varargs makes the args entirely optional... so `execute (opcode, m);` is also valid.
type: AnswerComment

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/21389628

http://stackoverflow.com/comment/32461967
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21503213
score: 0
has text: *How* doesn't it work?

http://stackoverflow.com/q/21379193
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32241756
has answer: http://stackoverflow.com/a/21379392
has title: Get the timestamps in java
tagged with: timestamp
type: Question
tagged with: java
tagged with: gregorian-calendar
upvote count: 1
answer count: 1
has body: I want to get the actuel timestamp and add 5 seconds to it . I tried this code java.util.Calendar cal = new java.util.GregorianCalendar(2007, 9 - 1, 23); // Current time would be.... java.util.Calendar cal2 = java.util.Calendar.getInstance(); System.out.println("Instance before : "+ cal2.getTimeInMillis()); cal2.add(java.util.Calendar.SECOND, 5); System.out.println("Instance after : "+ cal2.getTimeInMillis()); Output Instance before : 1390785186301 Instance after : 1390785191301 I don't think that this output is a correct timestamp. I tried the two result in an online website and it work only if I delete the last 3 numbers 1390785186 , and the second one is +5 milliseconds
score: 0

http://stackoverflow.com/q/21443740
possible better answer: http://stackoverflow.com/a/21444746
tagged with: bigdecimal
tagged with: significant-digits
has answer: http://stackoverflow.com/a/53442953
answer count: 3
has answer: http://stackoverflow.com/a/21443880
accepted answer: http://stackoverflow.com/a/21443880
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/21444746
has body: I do not want to limit the number of significant digits in a BigDecimal. I only want to find the number of significant digits that number has. Is there a way to do this without converting the number to string and count the number characters?
has title: Neat way to find the number of significant digits in a BigDecimal?
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: java
type: Question

http://stackoverflow.com/q/21401103
upvote count: 0
tagged with: this
favorite count: 0
has answer: http://stackoverflow.com/a/21401270
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/21401248
tagged with: object
has title: How does the special variable "this" know exactly which Object to refer to in a program in JAVA?
has answer: http://stackoverflow.com/a/21401166
tagged with: oop
linked to: http://stackoverflow.com/q/577575
has answer: http://stackoverflow.com/a/21401123
tagged with: java
has answer: http://stackoverflow.com/a/21401227
has answer: http://stackoverflow.com/a/21401186
type: Question
has body: If the special variable this refers to an Object in a variable/method that is being used. How does it know exactly which object it must refer to out of various objects in a program?
answer count: 6
tagged with: variables
duplicate of: http://stackoverflow.com/q/577575
downvote count: 4

http://stackoverflow.com/q/21381951
tagged with: user-input
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32246827
has body: I need help making this switch statement, taking a user input in order to pick (in this case) the month that will be printed. Instead of just always printing august, how would I take a user input and let them choose the month? import java.util.Scanner; public class SwitchDemo { public static void main(String[] args) { int UsrIn; UsrIn = input.nextInt(); int month = UsrIn; String monthString; switch (month) { case 1: monthString = "January"; break; case 2: monthString = "February"; break; case 3: monthString = "March"; break; case 4: monthString = "April"; break; case 5: monthString = "May"; break; case 6: monthString = "June"; break; case 7: monthString = "July"; break; case 8: monthString = "August"; break; case 9: monthString = "September"; break; case 10: monthString = "October"; break; case 11: monthString = "November"; break; case 12: monthString = "December"; break; default: monthString = "Invalid month"; break; } System.out.println(monthString); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/32246757
downvote count: 1
has comment: http://stackoverflow.com/comment/32246645
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32246745
accepted answer: http://stackoverflow.com/a/21382244
has comment: http://stackoverflow.com/comment/32246854
tagged with: switch-statement
score: 0
has title: Taking user input in a switch statement in java
has comment: http://stackoverflow.com/comment/32247689
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32246739
has comment: http://stackoverflow.com/comment/32246705
has comment: http://stackoverflow.com/comment/32246795
has comment: http://stackoverflow.com/comment/32246864
has answer: http://stackoverflow.com/a/21382244

http://stackoverflow.com/q/21463827
score: 3
tagged with: stack
tagged with: java
answer count: 2
has title: Why does my prefix operation program not work when I enter more than 2 integers in a row?
has answer: http://stackoverflow.com/a/21464533
tagged with: prefix-operator
upvote count: 3
has body: My program works properly when I only enter 1 or 2 integers in a row such as: + 13 24 or * 4 - 165 235. But if I enter % * 5 12 8 it does not give me the right answer. How can I change my loops so that it works when there is a longer string of integers in a row. Given the order of operations and format of prefix notation? *My stack class and its methods do work properly. import java.util.*; public class part1Main { public static void main(String[] args) { // Reference variables String temp2; int num, num1, num2, ch; char op; @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); PrefixStack&lt;Character&gt; operands = new PrefixStack&lt;Character&gt;(); PrefixStack&lt;Integer&gt; S = new PrefixStack&lt;Integer&gt;(); System.out.print("Do you want to perform a prefix operation?"); System.out.print(" 1 for yes or 0 to quit: "); ch = keyboard.nextInt(); temp2 = keyboard.nextLine(); while(ch != 0){ System.out.print('\n'+ "Enter the operation with a space between " + "each character. End your operation with a period: "); while(keyboard.hasNext()){ if (keyboard.hasNextInt()){ num = keyboard.nextInt(); S.push(num);} else{ temp2 = keyboard.next(); switch(temp2.charAt(0)){ case '+': operands.push('+'); break; case '-': operands.push('-'); break; case '/': operands.push('/'); break; case '*': operands.push('*'); break; case '%': operands.push('%'); break; } } if(temp2.charAt(0) == '.') break; } while(S.size &gt; 1){ op = operands.pop(); num2 = S.pop(); num1 = S.pop(); switch(op){ case '+': S.push(num1 + num2);; break; case '-': S.push(num1 - num2);; break; case '/': S.push(num1 / num2);; break; case '*': S.push(num1 * num2);; break; case '%': S.push(num1 % num2); break; } } System.out.println("Your operation = " + S.pop()); System.out.print('\n'+"Do you want to perform another operation?"); System.out.print(" 1 for yes or 0 to quit: "); ch = keyboard.nextInt(); } } }
has comment: http://stackoverflow.com/comment/32392636
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21464489
type: Question

http://stackoverflow.com/comment/32310114
type: Comment
comment on: http://stackoverflow.com/q/21417489
has text: @Selman22 Both follow IEEE specs for int operations, not their own specs
score: 1
type: QuestionComment

http://stackoverflow.com/comment/32448270
type: QuestionComment
type: Comment
has text: my css,javascript and images are not loaded.. please help
comment on: http://stackoverflow.com/q/21494762
score: 0

http://stackoverflow.com/q/21458834
has title: Java: packaging class files
has answer: http://stackoverflow.com/a/21458883
accepted answer: http://stackoverflow.com/a/21458883
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/21458998
score: 1
tagged with: java
answer count: 2
tagged with: java-package
upvote count: 1
downvote count: 0
has body: I have learned Java package. Unfortunately I don't understand why compiling these .java files causes the compile error. I have the following 3 java files: Node.java, InvertedFile.java, and Postings.java, all of which are in the directory /Users/tracking/Desktop/implementation/mytree on Mac OS X. package mytree; import java.util.*; // Node.java public class Node { private int label; // unique integer identifier of this tree. private Node parent; private List&lt;Integer&gt; leaves; // the leaf value that this tree contains. private List&lt;Node&gt; children; // internal nodes. public Node(int uniqueID) { this.parent = null; this.label = uniqueID; this.children = new ArrayList&lt;Node&gt;(); this.leaves = new ArrayList&lt;Integer&gt;(); } public void add_leafnode(int data) { leaves.add(data); } public void add_internalnode(Node ChildNode) { children.add(ChildNode); } // print all leaves, print all children node identifier methods. public void print_all_leaves() { Iterator iter = leaves.iterator(); while( iter.hasNext() ) { Integer element = (Integer)iter.next(); System.out.println(element); } } public List&lt;Node&gt; Get_children() { return children; } } package mytree; import java.util.*; // Postings.java class Postings { private int parentID; private List&lt;Node&gt; siblings; // internal nodes. public Postings(int parentID, List&lt;Node&gt; siblings) { this.parentID = parentID; this.siblings = siblings; } public void print() { System.out.println(parentID); Iterator iter = siblings.iterator(); while( iter.hasNext() ) { Integer element = (Integer)iter.next(); System.out.println(element); } } } package mytree; import java.util.*; // InvertedFile.java class InvertedFile { private HashMap IF; public InvertedFile() { IF = new HashMap(); } public void Add_Posting(int InvertedList, Postings posting) { IF.put(InvertedList, posting); } } The problem is that java compiler don't know where the Node.java, which actually is in ~/Desktop/implementation/mytree, is. The compile err…
favorite count: 0
has answer: http://stackoverflow.com/a/21458998

http://stackoverflow.com/comment/32403355
has text: Thanks so much, that makes alot more sense to use the while loop then to try and test individual values.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21467337

http://stackoverflow.com/q/21468239
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21469593
type: Question
tagged with: mongodb
score: 0
has title: Fetching referenced mongodb documents in another collection using Morphia
answer count: 1
tagged with: morphia
has answer: http://stackoverflow.com/a/21469593
has body: I've been trying to wrap around my head around this... I have the following referenced documents in a users and groups collection. group documents { "_id" : ObjectId("52eabc9914cc8d6cc1e6f723"), "className" : "org.xxxxxx.sms.core.domain.Group", "name" : "CE Play group", "description" : "CE Play group", "creationdate" : ISODate("2014-01-30T20:56:57.848Z"), "user" : DBRef("users", ObjectId("52ea69c714ccd207329b2476")) } { "_id" : ObjectId("52ea69c714ccd207329b2477"), "className" : "org.xxxxxx.sms.core.domain.Group", "name" : "Default", "description" : "Default sms group", "creationdate" : ISODate("2014-01-30T15:03:35.916Z"), "user" : DBRef("users", ObjectId("52ea69c714ccd207329b2476")) } users document { "_id" : ObjectId("52ea69c714ccd207329b2476"), "className" : "org.xxxxxx.core.domain.User", "username" : "jomski2009", "firstname" : "Jome", "lastname" : "Akpoduado", "email" : "jomea@example.com", "active" : true, "usergroups" : [ DBRef("groups", ObjectId("52ea69c714ccd207329b2477")), DBRef("groups", ObjectId("52eabc9914cc8d6cc1e6f723")) ] } I have a Morphia Datastore singleton object which has been set up in a class to retrieve a user group and perform some manipulations on. Say I wanted to fetch the group named "Default" with a supplied username "jomski2009" , how would I achieve this in Morphia without fetching the usergroups as a list and iterating over the list of groups just to find the group I want? Thanks.

http://stackoverflow.com/q/21443268
has comment: http://stackoverflow.com/comment/32356827
type: Question
tagged with: mongodb
accepted answer: http://stackoverflow.com/a/21443868
answer count: 1
has comment: http://stackoverflow.com/comment/32356168
has comment: http://stackoverflow.com/comment/32356643
downvote count: 0
has comment: http://stackoverflow.com/comment/32356055
has comment: http://stackoverflow.com/comment/32356477
has comment: http://stackoverflow.com/comment/32356361
has comment: http://stackoverflow.com/comment/32356924
favorite count: 0
has title: Mongodb First insert slower than rest
has body: I have a Java web app that creates sets of mongodb documents in a loop and bulk inserts them using Spring's MongoTemplate. Strangely the performance on the first insert is far worse than subsequent inserts. Here's an example of the performance with 3 sets of documents: insert 15 documents 3.1 seconds insert 10 documents 16 ms insert 20 documents 19 ms This is very consistent. Re-running the same junit over and over results in the same performance characteristics. Any ideas of how to eliminate that first insert slowness or what might be causing it? Thanks
has comment: http://stackoverflow.com/comment/32356382
has answer: http://stackoverflow.com/a/21443868
tagged with: spring
has comment: http://stackoverflow.com/comment/32356502
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/32356331
has comment: http://stackoverflow.com/comment/32356413
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32356577

http://stackoverflow.com/a/21364600
has body: In future if you need to switch to another PF it will require major change in the application.So you can use JPA right now so later you need to do small change in the application code.
answers question: http://stackoverflow.com/q/21364547
score: 0
type: Answer

http://stackoverflow.com/comment/32235952
has text: You have the result in your `ByteArrayOutputStream out`. You merely need to put that result somewhere. Thus please clarify, where do you want the PDF with the stamped additions to go? Shall it be saved in some file locally?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21374006
score: 0

http://stackoverflow.com/q/21381231
has comment: http://stackoverflow.com/comment/32245365
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/32246073
upvote count: 1
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/32245500
has comment: http://stackoverflow.com/comment/32245669
has comment: http://stackoverflow.com/comment/32245490
has body: I have a RelativeLayout and a Button in my Activity I want to run a code when I click on the Button, so I wrote the following code: &lt;ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:src="@drawable/flashlight" android:onClick="NightSwitch" /&gt; and then I have the following in my Activity.java public void NightSwitch(View v){ String One = "1"; //states day String Zero = "0"; //states night int color1 = getResources().getColor(R.color.darkblue); int color2 = getResources().getColor(R.color.white); RelativeLayout rele = (RelativeLayout) findViewById(R.id.RelativeLayout1); String state = getString(R.string.night_switch); if(state.equals(One)){ rele.setBackgroundColor(color1); } if(state.equals(Zero)){ rele.setBackgroundColor(color2); } } Everything is ok, but setBackgroundColor() does not work and causes a crash. also, how can I debug program in a VB style? Is it even possible? Logcat : 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.view.View$1.onClick(View.java:3838) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.view.View.performClick(View.java:4475) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.view.View$PerformClick.run(View.java:18786) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.os.Handler.handleCallback(Handler.java:730) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.os.Handler.dispatchMessage(Handler.java:92) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.os.Looper.loop(Looper.java:137) 01-27 17:38:45.606: E/AndroidRuntime(21427): at android.app.ActivityThread.main(ActivityThread.java:5493) 01-27 17:38:45.606: E/AndroidRuntime(21427): at java.lang.reflect.Method.invokeNative(Native Method) 01-27 17:38:45.606: E/AndroidRuntime(21427): at java.lang.reflect.Method.invoke(Method.java:525) 01-27 17:38:45.606: E/AndroidRuntime(21427): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(…
has answer: http://stackoverflow.com/a/21381539
has title: setBackgroundColor() doesn't seem to work
score: -1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21381436

http://stackoverflow.com/a/21377220
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: I suspect that the problem is that your application is "leaking" connections; i.e. it is opening lots of connections to the MongoDB server and neglecting to close them. This is causing something (the OS kernel?) to run out of buffer space. The fix is to modify your code so that all connections are closed once they are finished with. The recommend way to do this is: Java 7 and later - use "try with resource" Java 6 and earlier - use "try ... finally" and explicitly close the resource in the finally block. It is also possible that your application is trying to send too many requests to MongoDB simultaneously; i.e. with a swarm of request threads. If you are doing that ... don't.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21376862
score: 3
answers question: http://stackoverflow.com/q/21376862

http://stackoverflow.com/comment/32369188
has text: @owlstead Yup, I've voted by going to http://stackoverflow.com/tags/encryption/synonyms and hitting the up-vote button. Good call. Race you to 20k :-) A little strange that [tag:decryption] and [tag:decrypt] are synonyms of [tag:encryption] already...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21426437
type: Comment

exe
tags question: http://stackoverflow.com/q/21422466
type: Tag
tag name: exe

http://stackoverflow.com/comment/48363197
type: Comment
has text: for me, using **/** as file separator works **always** (when working with File-Object)...also when using windows....
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21361988

http://stackoverflow.com/a/24089840
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: This exceptions may happen with mismatched jar files : I have Icefaces 3.2 and trying to use jsf 2.2.0 jar files and got the same error. Upgraded Icefaces to 3.3 and the error went away.
answers question: http://stackoverflow.com/q/21384909

paint
tags question: http://stackoverflow.com/q/21408620
tags question: http://stackoverflow.com/q/21421150
tags question: http://stackoverflow.com/q/21399996
tags question: http://stackoverflow.com/q/21502083
tags question: http://stackoverflow.com/q/21352455
tags question: http://stackoverflow.com/q/21495156
tags question: http://stackoverflow.com/q/21359095
tags question: http://stackoverflow.com/q/21396233
tags question: http://stackoverflow.com/q/21395952
tags question: http://stackoverflow.com/q/21478993
tag name: paint
tags question: http://stackoverflow.com/q/21362278
tags question: http://stackoverflow.com/q/21459528
type: Tag
tags question: http://stackoverflow.com/q/21355769
tags question: http://stackoverflow.com/q/21431122

http://stackoverflow.com/comment/32237529
has text: I think that if in debugging your code run the rows of clear, set and notify everything must works well. Just make attenction that the line code _groupListView.invalidateViews(); i unusless and you must prevent the use of the getActivity() in the method onCreateView(). This callback can be fired before the activity is finish to create and the getActivity can be null.
score: 0
comment on: http://stackoverflow.com/q/21376472
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32397108
has text: Now with the issue of now sound playing, would I be correct to assume, that there is more to that code, and I would need to open a audio channel to play the given sound?
comment on: http://stackoverflow.com/a/21446928
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21395646
has comment: http://stackoverflow.com/comment/32272183
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21395900
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21395665
linked to: http://stackoverflow.com/q/3481828
tagged with: string
has answer: http://stackoverflow.com/a/44383488
possible better answer: http://stackoverflow.com/a/21395689
has body: i have problem to split string with 'split_', it seem my java netbean cant split when 'split_' is used. any idea how we can overcame this? i refer to this solution but it can only split without the used of '*'. How to split a string in Java String echoPHP= "test*split_*test2"; String[] strArray = echoPHP.split("*split_*"); String part1 = strArray2[0]; // 004 String part2 = strArray2[1]; // 034556 System.out.println(strArray[0]); System.out.println(strArray[1]); error is: Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0 *split_* output supposed to be: test test2
has comment: http://stackoverflow.com/comment/32272169
has title: How to split a '*' String in Java
answer count: 4
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32272210
has answer: http://stackoverflow.com/a/21395689
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21395665

http://stackoverflow.com/q/21413927
has comment: http://stackoverflow.com/comment/32303653
has comment: http://stackoverflow.com/comment/32303606
has comment: http://stackoverflow.com/comment/32303630
score: 0
tagged with: java
downvote count: 1
answer count: 0
has body: I was reading a tutorial on Vogella, and I noticed the notation String... being used in a method declaration. I tried googling it without success. Can somebody explain what it is? protected String doInBackground(String... urls) { String response = ""; for (String url : urls) { DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { response += s; } } catch (Exception e) { e.printStackTrace(); } } return response; }
type: UnansweredQuestion
has title: String... in Java
has comment: http://stackoverflow.com/comment/32303719
has comment: http://stackoverflow.com/comment/32303654
linked to: http://stackoverflow.com/q/1656901
linked to: http://stackoverflow.com/q/9048744
favorite count: 0
has comment: http://stackoverflow.com/comment/32303840
type: Question
duplicate of: http://stackoverflow.com/q/1656901
has comment: http://stackoverflow.com/comment/32303713
tagged with: android
duplicate of: http://stackoverflow.com/q/9048744
upvote count: 1
has comment: http://stackoverflow.com/comment/32345317

http://stackoverflow.com/q/21463287
favorite count: 0
tagged with: aggregate
has title: Camel Aggregator completionSize vs correlationExpression?
has body: Given the following Camel Aggregator (via Spring XML): ${header.id} == 1 <to uri="bean:postProcessor?method=process" /> What is the relationship between completionSize, correlationExpression and when the myAggregationStrategy#aggregate method gets called? Does aggregate get called when 3 messages have arrived at the aggregator? Does correlationExpression act as some sort of filter? How do they all work with each other?
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21463849
upvote count: 2
tagged with: java
type: Question
tagged with: apache-camel
tagged with: routes
accepted answer: http://stackoverflow.com/a/21463849
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/32222687
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21368324
has text: There must be something in the LogCat.

http://stackoverflow.com/a/21364734
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: Changing the persistence framework is always a big effort, but you can use the DAO pattern to insulate the UI and business model of your system from those changes, and reduce the amount of code required for a rewrite.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21364547
answers question: http://stackoverflow.com/q/21364547

http://stackoverflow.com/comment/32421884
score: 0
has text: This is the same as `<xsd:element name="FirstName">` since the default value of `minOccurs`is already 1.
type: AnswerComment
comment on: http://stackoverflow.com/a/21480789
type: Comment

http://stackoverflow.com/comment/32322255
type: QuestionComment
has text: Not following you here. The other test runs successfully.
score: 0
comment on: http://stackoverflow.com/q/21424424
type: Comment

http://stackoverflow.com/comment/32247651
comment on: http://stackoverflow.com/a/21366377
has text: @nmxprime "Perhaps you meant" is a polite wording. Reread your code. The answer is indeed `jclass inDataClass = (*env)->GetObjectClass(env,inData);`
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32282550
type: Comment
comment on: http://stackoverflow.com/q/21401851
has text: You may wish to look at [Returning a Collection<ChildType> from a method that specifies that it returns Collection<ParentType>](http://stackoverflow.com/questions/17384015/returning-a-collectionchildtype-from-a-method-that-specifies-that-it-returns-c)
score: 0
type: QuestionComment

http://stackoverflow.com/a/21382151
type: Answer
has comment: http://stackoverflow.com/comment/32247119
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/32249343
has body: You have this error: Exception in thread "main" java.lang.NumberFormatException: For input string: "0px" That error is because the program is seeing the "0px" as string, so you can make a new varible with datatype int For example:`int textSize= 0; and complete the process normally`
answers question: http://stackoverflow.com/q/21382041

http://stackoverflow.com/q/21405619
has answer: http://stackoverflow.com/a/21406311
possible better answer: http://stackoverflow.com/a/21405717
has body: I am working on a program that counts the number of t-shirts of different colours in a shop and it can't be in an ArrayList. For each delivery we save the colour of the t-shirt in a .txt file like this: red yellow red white white So, the program will count how many red, yellow and white tshirts there are. In this case we have 2 red tshirts, 1 yellow tshirt and 2 white tshirts. Actually, the program is about blood donations ant bloods types. But instead of colourful tshirts it's with a blood type, B blood type, O blood type and finally AB blood type. But the algorythim and code it's the same We have already in the design a button for each type of blood and when an action is performed it shows the number of packs of that type of blood is in stock. We have this from user2469133 int count; count=StringUtils.countMatches("C://sangue.txt", "O"); //where text file should be a string System.out.println("number of white T-shirts = "+count); We have been searching but it appears code for arrays or hashmaps and we didin't studied the last one. we would really appreciate help
favorite count: 0
accepted answer: http://stackoverflow.com/a/21406311
has answer: http://stackoverflow.com/a/21405717
score: -4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32298249
has comment: http://stackoverflow.com/comment/32288780
has title: How to count a number of each distinct words repeated in a txt.file
tagged with: java
type: Question
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/32288750
has comment: http://stackoverflow.com/comment/32288768

exception
tags question: http://stackoverflow.com/q/21458104
tags question: http://stackoverflow.com/q/21368097
tags question: http://stackoverflow.com/q/21471993
tags question: http://stackoverflow.com/q/21417907
tags question: http://stackoverflow.com/q/21472507
tags question: http://stackoverflow.com/q/21431177
tags question: http://stackoverflow.com/q/21455699
tags question: http://stackoverflow.com/q/21452581
tags question: http://stackoverflow.com/q/21480273
tags question: http://stackoverflow.com/q/21399429
tags question: http://stackoverflow.com/q/21432481
tags question: http://stackoverflow.com/q/21498293
tags question: http://stackoverflow.com/q/21472055
tags question: http://stackoverflow.com/q/21449399
tags question: http://stackoverflow.com/q/21385200
tags question: http://stackoverflow.com/q/21415948
tags question: http://stackoverflow.com/q/21440127
tags question: http://stackoverflow.com/q/21507119
tags question: http://stackoverflow.com/q/21398516
type: Tag
tags question: http://stackoverflow.com/q/21430723
tags question: http://stackoverflow.com/q/21365222
tags question: http://stackoverflow.com/q/21374282
tags question: http://stackoverflow.com/q/21361504
tags question: http://stackoverflow.com/q/21458749
tags question: http://stackoverflow.com/q/21501294
tags question: http://stackoverflow.com/q/21447959
tags question: http://stackoverflow.com/q/21376640
tags question: http://stackoverflow.com/q/21488297
tags question: http://stackoverflow.com/q/21400342
tags question: http://stackoverflow.com/q/21457355
tags question: http://stackoverflow.com/q/21511390
tags question: http://stackoverflow.com/q/21363423
tags question: http://stackoverflow.com/q/21351764
tags question: http://stackoverflow.com/q/21394399
tags question: http://stackoverflow.com/q/21465629
tags question: http://stackoverflow.com/q/21429269
tags question: http://stackoverflow.com/q/21506079
tags question: http://stackoverflow.com/q/21446609
tags question: http://stackoverflow.com/q/21472063
tags question: http://stackoverflow.com/q/21433499
tags question: http://stackoverflow.com/q/21498112
tag name: exception
tags question: http://stackoverflow.com/q/21457491
tags question: http://stackoverflow.com/q/21457058
tags question: http://stackoverflow.com/q/21458345
tags question: http://stackoverflow.com/q/21430586
tags question: http://stackoverflow.com/q/21419177
tags question: http://stackoverflow.com/q/21508058
tags question: http://stackoverflow.com/q/21511876
tags question: http://stackoverflow.com/q/21456396
tags question: http://stackoverflow.com/q/21433374
tags question: http://stackoverflow.com/q/21431448
tags question: http://stackoverflow.com/q/21433559
tags question: http://stackoverflow.com/q/21432369

http://stackoverflow.com/comment/32470647
type: Comment
has text: The synchronized ones are, err, synchronized. There is no such thing as 'ASynchronized'.
type: QuestionComment
comment on: http://stackoverflow.com/q/21507858
score: 0

http://stackoverflow.com/comment/32245500
type: Comment
type: QuestionComment
has text: Need logcat, the entire xml layout and the definition of the color1 and color2
comment on: http://stackoverflow.com/q/21381231
score: 0

http://stackoverflow.com/comment/32260775
score: 0
has text: @user3241040 You can format the result : `System.out.println(String.format("%.1f",doubleValue));`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21386500

http://stackoverflow.com/comment/32440539
type: Comment
score: 1
type: QuestionComment
has text: The code doesn't even compile. What's the point in reasoning about what it does?
comment on: http://stackoverflow.com/q/21491004

http://stackoverflow.com/comment/32454986
type: Comment
comment on: http://stackoverflow.com/a/21499313
score: 0
has text: Almost there. However, the MessageDialog still appears when I entered an integer.
type: AnswerComment

http://stackoverflow.com/comment/32324699
comment on: http://stackoverflow.com/q/21418001
score: 0
type: Comment
type: QuestionComment
has text: How about using a dedicated framework for scheduling? This might be an overkill for just one usecase but there might be others waiting... [Quartz](http://terracotta.org/products/quartz-scheduler) by Terracotta has been used successfully with wicket applications

http://stackoverflow.com/q/21452150
has title: Missing some value in Unmarshal XML via JAXB
answer count: 2
tagged with: unmarshalling
tagged with: http://stackoverflow.com/tag/xml
has body: I had a XML string and i want to unmarshal into Java Bean using JAXB API. Below is XML : <?xml version="1.0" encoding="UTF-8"?> <ns0:TEST_REQ xmlns:ns0="http://Test.com"> MyKey1 MyKey2 <messageid>000000123<messageid/> Successfully Done. 1 </ns0:TEST_REQ> I want unmarshal this XML to below Java Bean : @XmlRootElement(name = "TEST_REQ", namespace = "http://Test.com") @XmlAccessorType(XmlAccessType.FIELD) public class ResponseKeysBean { @XmlElement(name="messageid") private String messageId; @XmlElement(name="statuscode") private Integer statusCode; @XmlElement(name="statusmessage") private String statusMessage; @XmlElement(name="key") private String key; @XmlElementWrapper(name="keys") @XmlElement(name="item") private List<ResponseKeysBean> keysList; //Getter and Setter method } I am Unmarshal this XML using below code : JAXBContext jaxbContext = JAXBContext.newInstance(ResponseKeysBean.class); Unmarshaller um = jaxbContext.createUnmarshaller(); ResponseKeysBean keyObj = (ResponseKeysBean) um.unmarshal(new StringReader(xmlStr)); When i unmarshal above XML i got the key list in keysList object but i am not getting other parameter in my object like messageId or other which are under element. How can i get those value in my bean variable. Please help me to resolve this.
has answer: http://stackoverflow.com/a/21453481
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21453481
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21456029
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/32375297
possible better answer: http://stackoverflow.com/a/21456029

http://stackoverflow.com/comment/32501844
type: Comment
comment on: http://stackoverflow.com/a/21457899
has text: Hi @Nun Chai. Thank you very much for responding. I like the handler method that you have suggested but struggling to implement it. How you addressed my answer is exactly what i am after. I would be grateful if you could expand on this method. Cheers
score: 0
type: AnswerComment

atomic
type: Tag
tags question: http://stackoverflow.com/q/21354409
tag name: atomic
tags question: http://stackoverflow.com/q/21390342

http://stackoverflow.com/comment/32275167
type: Comment
type: QuestionComment
score: 2
has text: Nobody can answer you until you describe your problem clearly with some code. But What have you tried to solve this issue. This is simple error message that can be resolved If you see it once.
comment on: http://stackoverflow.com/q/21397388

http://stackoverflow.com/a/21490392
type: Answer
answers question: http://stackoverflow.com/q/21490239
score: 1
upvote count: 1
has body: If your array is sorted then you have to use binary search it will be very helpful and fast in execution with time complexity of O(logn) and in case array you have to call Arrays.binarySearch() and in case of any collection it might be the list or set you have to call Collections binarySearch method
downvote count: 0

http://stackoverflow.com/a/21399562
upvote count: 51
has comment: http://stackoverflow.com/comment/61910269
has comment: http://stackoverflow.com/comment/61911193
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21399561
has comment: http://stackoverflow.com/comment/63838956
score: 51
has comment: http://stackoverflow.com/comment/77443497
type: Answer
has body: The below SFTP Utility gives an example of Upload, Exist, Download, Move and Delete operations. I have used this in several of my projects. The below code uses api calls from Apache Commons VFS library only. Please make sure that you put the following JAR's in your project's build path: commons-logging-1.1.3.jar commons-vfs2-2.0.jar hamcrest-core-1.3.jar jsch-0.1.50.jar Any other compatible versions would do as well. import java.io.File; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemOptions; import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.impl.StandardFileSystemManager; import org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder; /** * The class SFTPUtil containing uploading, downloading, checking if file exists * and deleting functionality using Apache Commons VFS (Virtual File System) * Library * * @author Ashok * */ public class SFTPUtility { public static void main(String[] args) { String hostName = "PutYourHostNameHere"; String username = "PutYourUserNameForHostHere"; String password = "PutYourPasswordForHostHere"; String localFilePath = "C:\\FakePath\\FakeFile.txt"; String remoteFilePath = "/FakeRemotePath/FakeRemoteFile.txt"; String remoteTempFilePath = "/FakeRemoteTempPath/FakeRemoteTempFile.txt"; upload(hostName, username, password, localFilePath, remoteFilePath); exist(hostName, username, password, remoteFilePath); download(hostName, username, password, localFilePath,remoteFilePath); move(hostName, username, password, remoteFilePath, remoteTempFilePath); delete(hostName, username, password, remoteFilePath); } /** * Method to upload a file in Remote server * * @param hostName * HostName of the server * @param username * UserName to login * @param password * Password to login * @param localFilePath * LocalFilePath. Should contain the entire local file path - * Directory and Filename with \\ as separator * @param remoteFilePath * rem…
has comment: http://stackoverflow.com/comment/63840428
has comment: http://stackoverflow.com/comment/63840385
has comment: http://stackoverflow.com/comment/61911765
has comment: http://stackoverflow.com/comment/48062924
has comment: http://stackoverflow.com/comment/63839475
has comment: http://stackoverflow.com/comment/61910903
has comment: http://stackoverflow.com/comment/77634854
has comment: http://stackoverflow.com/comment/38750676
has comment: http://stackoverflow.com/comment/61911759
has comment: http://stackoverflow.com/comment/61911590
has comment: http://stackoverflow.com/comment/48318536
has comment: http://stackoverflow.com/comment/38751935
has comment: http://stackoverflow.com/comment/48270258
has comment: http://stackoverflow.com/comment/63838833
has comment: http://stackoverflow.com/comment/126921666
has comment: http://stackoverflow.com/comment/61910844
accepted answer of: http://stackoverflow.com/q/21399561
has comment: http://stackoverflow.com/comment/61910620
has comment: http://stackoverflow.com/comment/126921108

http://stackoverflow.com/comment/32231682
type: QuestionComment
comment on: http://stackoverflow.com/q/21373351
has text: Try this one Use replaceAll("|", " ");
score: 0
type: Comment

http://stackoverflow.com/comment/32308818
has text: And if this can help, I'm using an array initialised like this: int[] arr = {2, 15, 14, 10, 15, 21, 18};
comment on: http://stackoverflow.com/a/21416357
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21417448
has body: Both your copy loops are incorrect. The canonical way to copy between streams in Java is: while ((count = in.read(buffer)) &gt; 0) { out.write(buffer, 0, count); } At present you are doing extra reads and ignoring read() results and all kinds of other strange things. Use this code at both ends, with any buffer size greater than zero.
answers question: http://stackoverflow.com/q/21417214
score: 4
has comment: http://stackoverflow.com/comment/32311365
has comment: http://stackoverflow.com/comment/32314824
type: Answer
upvote count: 4
downvote count: 0

generics
tags question: http://stackoverflow.com/q/21511973
tags question: http://stackoverflow.com/q/21395684
tags question: http://stackoverflow.com/q/21473114
tags question: http://stackoverflow.com/q/21461402
tags question: http://stackoverflow.com/q/21391145
tags question: http://stackoverflow.com/q/21407780
tags question: http://stackoverflow.com/q/21505855
tags question: http://stackoverflow.com/q/21435409
tags question: http://stackoverflow.com/q/21412701
tags question: http://stackoverflow.com/q/21383139
tags question: http://stackoverflow.com/q/21390685
tags question: http://stackoverflow.com/q/21461240
tags question: http://stackoverflow.com/q/21471663
tags question: http://stackoverflow.com/q/21432483
tags question: http://stackoverflow.com/q/21510453
tags question: http://stackoverflow.com/q/21365135
tags question: http://stackoverflow.com/q/21354286
tags question: http://stackoverflow.com/q/21409802
tags question: http://stackoverflow.com/q/21393371
type: Tag
tags question: http://stackoverflow.com/q/21358412
tags question: http://stackoverflow.com/q/21391264
tags question: http://stackoverflow.com/q/21414662
tags question: http://stackoverflow.com/q/21452966
tags question: http://stackoverflow.com/q/21470984
tags question: http://stackoverflow.com/q/21389464
tags question: http://stackoverflow.com/q/21399617
tags question: http://stackoverflow.com/q/21394621
tags question: http://stackoverflow.com/q/21414076
tags question: http://stackoverflow.com/q/21416108
tags question: http://stackoverflow.com/q/21461231
tags question: http://stackoverflow.com/q/21507053
tags question: http://stackoverflow.com/q/21437808
tags question: http://stackoverflow.com/q/21472141
tags question: http://stackoverflow.com/q/21392717
tags question: http://stackoverflow.com/q/21473614
tags question: http://stackoverflow.com/q/21457226
tags question: http://stackoverflow.com/q/21366556
tags question: http://stackoverflow.com/q/21467332
tags question: http://stackoverflow.com/q/21358608
tags question: http://stackoverflow.com/q/21387600
tags question: http://stackoverflow.com/q/21365058
tag name: generics
tags question: http://stackoverflow.com/q/21435549
tags question: http://stackoverflow.com/q/21484524
tags question: http://stackoverflow.com/q/21370662
tags question: http://stackoverflow.com/q/21435069
tags question: http://stackoverflow.com/q/21467364

http://stackoverflow.com/a/21358792
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21358740
answers question: http://stackoverflow.com/q/21358740
type: Answer
has body: WHat you need is the following: public static void main(String[] args) { ArrayList&lt;ArrayList&lt;String&gt;&gt; couples = family(); for (ArrayList&lt;String&gt; couple : couples) { for (String person : couple) { System.out.println(person); } } } Basically, you were storing the results from your call to familiy() in an ArrayList of unknown type. It was automatically getting boxed to Object, and for-each doesn't work for Objects.
score: 4

http://stackoverflow.com/comment/32257944
comment on: http://stackoverflow.com/a/21388017
type: Comment
has text: @MxyL In the second expression, the right hand side is evaluated as a whole before the `+` is applied. That result is a `char` that is the sum of the two.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32347316
score: 0
comment on: http://stackoverflow.com/q/21438701
type: Comment
type: QuestionComment
has text: Use javascript onsubmit and if empty fields stay there.

http://stackoverflow.com/comment/32308441
has text: Sorry but I get an error when running: java.lang.NumberFormatException: For input string: "2151410152118"
type: AnswerComment
comment on: http://stackoverflow.com/a/21416380
score: 0
type: Comment

http://stackoverflow.com/comment/32477470
has text: a close statement - `pen.close();`
comment on: http://stackoverflow.com/q/21511968
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32223669
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21368316
has text: JPA coesn't care about equals(). It uses the ID of the entity to uniquely identify it among the other ones. Use find() or getReference() to get an existing Product having a given ID.

http://stackoverflow.com/a/21397869
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21397125
downvote count: 0
type: Answer
has body: The link you posted does not mention about lock_type reference. See this. Apart from reference to class(8 bytes), it will have reference to lock_type. Also check 'Memory Usage' section here.

http://stackoverflow.com/q/21404562
has comment: http://stackoverflow.com/comment/32293246
has comment: http://stackoverflow.com/comment/32287439
has title: BitmapFactory.Options not working as expected
has answer: http://stackoverflow.com/a/21404683
type: UnansweredQuestion
tagged with: android
answer count: 4
has comment: http://stackoverflow.com/comment/32287106
has comment: http://stackoverflow.com/comment/32288484
tagged with: java
has body: I have a ArrayList with two columns and I display a image with text below. I am using high quality images and need to display those images in the grid view with a decent quality for which I am using BitmapFactory.Options. I am using the same code from google but that still throws me an OutOfMemory error. CODE : BitmapFactory.Options obj = new BitmapFactory.Options(); obj.inPurgeable = true; obj.inJustDecodeBounds = true; BitmapFactory.decodeResource(getResources(), R.drawable.car, obj); BitmapFactory.decodeResource(getResources(), R.drawable.nature, obj); obj.inSampleSize = 4; obj.inJustDecodeBounds = false; Bitmap homeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.car,obj); Bitmap userIcon = BitmapFactory.decodeResource(getResources(), R.drawable.nature,obj); gridArray.add(new Item(homeIcon,"Home")); gridArray.add(new Item(userIcon,"User")); gridArray.add(new Item(homeIcon,"House")); gridArray.add(new Item(userIcon,"Friend")); gridArray.add(new Item(homeIcon,"Home")); gridArray.add(new Item(userIcon,"Personal")); gridArray.add(new Item(homeIcon,"Home")); gridArray.add(new Item(userIcon,"User")); gridArray.add(new Item(homeIcon,"Building")); gridArray.add(new Item(userIcon,"User")); gridArray.add(new Item(homeIcon,"Home")); gridArray.add(new Item(userIcon,"xyz")); UPDATE : Item.java : public class Item { Bitmap image; String title; public Item(Bitmap image, String title) { super(); this.image = image; this.title = title; } public Bitmap getImage() { return image; } public void setImage(Bitmap image) { this.image = image; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } This is the code and I have another class name Item which has a constructor with arguments as Bitmap and String. While executing this, it throws me an OutOfMemoryError. I am not sure whether I should add any other extras in these code. Any help will be appreciated guys.
type: Question
has answer: http://stackoverflow.com/a/21404741
has answer: http://stackoverflow.com/a/21451272
has comment: http://stackoverflow.com/comment/32287529
has answer: http://stackoverflow.com/a/21404804
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/32288322

http://stackoverflow.com/q/21464840
has comment: http://stackoverflow.com/comment/32393652
has comment: http://stackoverflow.com/comment/32393580
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21465066
has comment: http://stackoverflow.com/comment/32394136
tagged with: java
has answer: http://stackoverflow.com/a/21464949
type: Question
score: 0
downvote count: 4
has comment: http://stackoverflow.com/comment/32393989
has answer: http://stackoverflow.com/a/21464977
favorite count: 0
has comment: http://stackoverflow.com/comment/32393591
has answer: http://stackoverflow.com/a/21464887
accepted answer: http://stackoverflow.com/a/21464887
possible better answer: http://stackoverflow.com/a/21465066
upvote count: 4
has title: What's most efficient; creating a new instance or changing a value in an existing one?
has body: I'm trying to write an application that keeps track of movies, as a way to get better at Java. For this I use a class "Movie" for the movies themselves, and classes such as "Title", "Year", "Director", etc. for what you might expect, that are all set through the "Movie" constructor. Now say I want to change the director of a movie, what would be the most efficient way of doing so from the "Movie" class? I boiled it down to either creating a new instance, or changing the old, i.e. public void setYear(int year) { this.year = new Year(year); } or public void setYear(int year) { this.year.setYear(year); } Most of all, I'm just not sure if the second one is proper coding practice? I just recently started learning Java, so I apologize for any confusion in my question.
answer count: 4

http://stackoverflow.com/q/21369102
has answer: http://stackoverflow.com/a/21369216
downvote count: 2
has answer: http://stackoverflow.com/a/23887891
has answer: http://stackoverflow.com/a/61392892
upvote count: 23
has answer: http://stackoverflow.com/a/21369178
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/84685200
score: 21
has answer: http://stackoverflow.com/a/33959081
tagged with: java
has answer: http://stackoverflow.com/a/47327072
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/84685167
has title: Hadoop command not found
answer count: 7
has body: I have installed and configured hadoop in a linux machine .Now i am trying to run a sample MR job.I have started the hadoop via the command /usr/local/hadoop/bin/start-all.sh and the output is namenode running as process 7876. Stop it first. localhost: datanode running as process 8083. Stop it first. localhost: secondarynamenode running as process 8304. Stop it first. jobtracker running as process 8398. Stop it first. localhost: tasktracker running as process 8612. Stop it first. so i think that my hadoop is configured successfully.But when i am tryinh to run below command it is giving jeet@jeet-Vostro-2520:~$ hadoop fs -put gettysburg.txt /user/jeet/getty/gettysburg.txt hadoop: command not found i am new in hadoop.somebody please help .I am also posting the screenshot of what i am trying
accepted answer: http://stackoverflow.com/a/21369178
has answer: http://stackoverflow.com/a/70816544
favorite count: 0
possible better answer: http://stackoverflow.com/a/21369216

http://stackoverflow.com/comment/32310125
comment on: http://stackoverflow.com/q/21416611
has text: @GregBurghardt the first machine where it works has OpenCV installed as a native library via homebrew, but I was under the impression that this should not be a problem as I included the whole of OpenCV including libopencv_core.dylib and libopencvcore.2.4.dylib in the eclipse project and they are visible in eclipse (at lib/opencv/2.4.7.1/lib/ in the project - check out the repo on github).
type: Comment
type: QuestionComment
score: 0

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/21427301
tags question: http://stackoverflow.com/q/21378128
tags question: http://stackoverflow.com/q/21399355
type: Tag
tags question: http://stackoverflow.com/q/21479266

http://stackoverflow.com/q/21484383
has answer: http://stackoverflow.com/a/21484425
has answer: http://stackoverflow.com/a/21484418
linked to: http://stackoverflow.com/q/125367
has comment: http://stackoverflow.com/comment/32427900
tagged with: object
has answer: http://stackoverflow.com/a/21484423
tagged with: java
type: UnansweredQuestion
score: -4
linked to: http://stackoverflow.com/q/21270862
answer count: 4
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/21484417
has title: use different types, or use Object?
favorite count: 0
has comment: http://stackoverflow.com/comment/32427938
has comment: http://stackoverflow.com/comment/32427820
has comment: http://stackoverflow.com/comment/32427807
type: Question
has body: Sorry for noobish question, but why we even use String, int and others, if we can just use Object as a type? I mean use Object one; instead of String one;
has comment: http://stackoverflow.com/comment/32428069
has comment: http://stackoverflow.com/comment/32428233
has comment: http://stackoverflow.com/comment/32428202

http://stackoverflow.com/a/21352312
has comment: http://stackoverflow.com/comment/32193823
answers question: http://stackoverflow.com/q/21351767
has comment: http://stackoverflow.com/comment/32194259
has comment: http://stackoverflow.com/comment/32193609
has comment: http://stackoverflow.com/comment/32193573
has comment: http://stackoverflow.com/comment/32193753
score: 0
type: Answer
has body: I've written and tried the below regex in Perl and it passes all the test cases you specified. Hope, the same would work in Java also. (?=.*5.*)(?=.*3.*)(?=.*1.*)|(?=.*2.*)(?=.*7.*)(?=.*9.*)

http://stackoverflow.com/q/21485242
has answer: http://stackoverflow.com/a/21485765
has title: Remove inner vertical borders in a JTable
type: AnsweredQuestion
has body: I want to remove the inner borders in a JTable. I've researched the question and found that I could remove all vertical borders so the JTable would look like: --------------------- +-------+-------+-------+ (0,0) (0,1) (0,2) | (0,0) | (0,1) | (0,2) | --------------------- +-------+-------+-------+ (1,0) (1,1) (1,2) instead of | (1,0) | (1,1) | (1,2) | --------------------- +-------+-------+-------+ (2,0) (2,1) (2,2) | (2,0) | (2,1) | (2,2) | --------------------- +-------+-------+-------+ However what I want is this: +-----------------------+ | (0,0) (0,1) (0,2) | +-----------------------+ | (1,0) (1,1) (1,2) | +-----------------------+ | (2,0) (2,1) (2,2) | +-----------------------+ Any help would be very much appreciated!
tagged with: swing
accepted answer: http://stackoverflow.com/a/21486023
type: Question
tagged with: java
tagged with: jtable
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/21486023
possible better answer: http://stackoverflow.com/a/21485765

http://stackoverflow.com/comment/32267717
type: Comment
score: 1
has text: That is not correct. Yes, you will avoid exception. But you will read only every 2nd line. E.g. if there are 10 lines, you will fill only 5 elements in the array. @Shane Hart: Print out the array and check: you have only every 2nd line, not all.
comment on: http://stackoverflow.com/a/21393131
type: AnswerComment

http://stackoverflow.com/a/21361722
score: 0
type: Answer
has body: Try this code: import org.apache.poi.hssf.usermodel.HSSFSheet; import java.io.FileInputStream; import java.io.File; import java.io.FileNotFoundException; public class ReadFromExcel { public static void main(String[] args) throws FileNotFoundException { File f=new File("C:"+File.separator+"Personal"+File.separator+"test.xlsx"); FileInputStream file=null; if(f.exists()) { file = new FileInputStream(f); //rest of code } else{ System.out.println("The file does not exist!Please enter correct filename!"); } } } I have 3 things to point out: Firstly you have not added a try/catch block.My IDE simply does not let it compile! Using File.separator is the more recommended way instead of using "\" or "/" if you are using file paths as they depend on OS.They make your code more portable. Checking that the file whether exists or not using f.exists() would let you know if actually the file you are trying to pass as parameter to FileInputStream exists. Sure that would help!!
answers question: http://stackoverflow.com/q/21361504
accepted answer of: http://stackoverflow.com/q/21361504
has comment: http://stackoverflow.com/comment/32210498
has comment: http://stackoverflow.com/comment/32210522
type: AcceptedAnswer

http://stackoverflow.com/q/21474908
has answer: http://stackoverflow.com/a/21493544
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
has title: SignalR Invoke issue
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21484074
has body: I use the signalR android implementation : https://github.com/erizet/SignalA and I have some problem to use it. I initialize my HubConnection like this: String url = "http://www.myurl.com"; con = new HubConnection(url, getActivity(), new LongPollingTransport()) { @Override public void OnStateChanged(StateBase oldState, StateBase newState) { switch(newState.getState()) { case Connected: ArrayList&lt;String&gt; test = new ArrayList&lt;String&gt;(); test.add("header"); test.add("0"); test.add("data"); test.add("pleyh"); hub.Invoke("SendConnection", test, new HubInvokeCallback() { @Override public void OnResult(boolean arg0, String arg1) { Log.i("HubConnection", "On result: arg0 = " + arg0 + " arg1 = " + arg1); } @Override public void OnError(Exception arg0) { Log.i("HubConnection", "On error: arg0 = " + arg0.getMessage()); } }); break; case Disconnected: Log.i("HubConnection", "Disconnected"); stopSignalA(); break; default: break; } } After that, I initialize my HubProxy and start the connection: try { hub = con.CreateHubProxy("GameManager"); } catch (OperationApplicationException e) { e.printStackTrace(); } hub.On("addNewMessageToPage", new HubOnDataCallback() { @Override public void OnReceived(JSONArray args) { Log.i("HubConnection", "OnReceived " + args.toString()); for(int i=0; i&lt;args.length(); i++) { Log.i("HubConnection", "OnReceived -&gt; addNewMessageToPage = " + args.opt(i).toString()); } } }); con.Start(); It seems that everything is working properly because the negotiate succeed and I received a JSON with a ConnectionToken. The problem is when I do an invoke when I received an OnStateChanged, when I know I am connected, I received this error: {"I":"0","E":"'SendConnection' method could not be resolved.","T":" at Microsoft.AspNet.SignalR.Hubs.NullMethodDescriptor.b_0(IHub emptyHub, Object[] emptyParameters)\r\n at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.Incoming(IHubIncomingInvokerContext context)\r\n--- End of stack trace from previous location where …
answer count: 2
upvote count: 1
tagged with: c#
tagged with: java
tagged with: signalr

http://stackoverflow.com/q/21361931
upvote count: 1
tagged with: resources
type: Question
linked to: http://stackoverflow.com/q/941754
downvote count: 0
tagged with: jar
tagged with: onejar
favorite count: 0
has title: How to get an URL for a resource directory when using OneJar?
type: UnansweredQuestion
has body: I need to pass the root "something" to a piece of code working with resources. I know that this "something" can't be a file, since this doesn't work in a JAR. So I'm passing an URL. Before I started with OneJar I transformed an URL like file:/some/path!/foo/bar/MyUrlSupplier.class into file:/some/path!/foo/images/ and used this as the root URL. With OneJar I'm getting onejar:foo.bar.MyUrlSupplier.class and transforming it into onejar:foo.images but whatever I do with this URL, nothing works. The best I get is this stacktrace caused by loading new ImageIcon(url): Uncaught error fetching image: java.lang.ClassCastException: sun.misc.Launcher$AppClassLoader cannot be cast to com.simontuffs.onejar.JarClassLoader at com.simontuffs.onejar.JarClassLoader.getByteStream(JarClassLoader.java:753) at com.simontuffs.onejar.Handler$1.getInputStream(Handler.java:50) at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:126) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:263) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169)
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/32208255
has text: if i understand correctly, you mean throwing unavailable exception is enough. no need to provide fallback logic in-case resource is required and not available?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21360358
type: AnswerComment

http://stackoverflow.com/q/21449502
has answer: http://stackoverflow.com/a/21450589
has answer: http://stackoverflow.com/a/21468973
tagged with: jpanel
has body: I have one outer panel, in the outer panel I have another jPanel placed on it. if i do a right click on the inner panel, outer panel's right click action should happen. if i do left click on the inner panel, its own inner panel's click action should happen. Is it possible to pass click event from one panel to another panel?
has comment: http://stackoverflow.com/comment/32367710
tagged with: mouseevent
type: AnsweredQuestion
has title: Passing the click event on one jPanel to another JPanel
accepted answer: http://stackoverflow.com/a/21468973
has comment: http://stackoverflow.com/comment/32367219
type: Question
tagged with: swing
has answer: http://stackoverflow.com/a/21472865
score: 0
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/21450589

http://stackoverflow.com/comment/32216267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21364402
score: 2
has text: this warning is actually from `schemagen` executable and not from the `jaxb2-maven-plugin`

http://stackoverflow.com/q/21444573
has answer: http://stackoverflow.com/a/62684046
answer count: 7
tagged with: swap
score: 0
has answer: http://stackoverflow.com/a/36506582
tagged with: linked-list
has answer: http://stackoverflow.com/a/44323240
possible better answer: http://stackoverflow.com/a/21444663
has body: Here is a question that I found on website for problems using LinkedList: Write a method shift that rearranges the elements of a list of integers by moving to the end of the list all values that are in odd-numbered positions and otherwise preserving list order. For example, suppose a variable list stores the following values: [0, 1, 2, 3, 4, 5, 6, 7] The call of list.shift(); should rearrange the list to be: [0, 2, 4, 6, 1, 3, 5, 7] In this example the values in the original list were equal to their positions and there were an even number of elements, but that won't necessarily be the case. For example, if list had instead stored the following: [4, 17, 29, 3, 8, 2, 28, 5, 7] Then after the call list.shift(); the list would store: [4, 29, 8, 28, 7, 17, 3, 2, 5] Notice that it doesn't matter whether the value itself is odd or even. What matters is whether the value appears in an odd index (index 1, 3, 5, etc). Also notice that the original order of the list is otherwise preserved. You may not construct any new nodes and you may not use any auxiliary data structure to solve this problem (no array, ArrayList, stack, queue, String, etc). You also may not change any data fields of the nodes; you must solve this problem by rearranging the links of the list. I am having difficulty understanding this first. In the first example, [0, 1, 2, 3, 4, 5, 6, 7] move(index 1) will give [0,2,3,4,5,6,7,1] move(index 3) will give [0,2,3,5,6,7,1,4] I have already broken the shift that is expected. I do not understand the problem clearly. Tips on this problem and how to approach this would be very helpful. Update: implemented this from understanding the answer below: public void shift() { if (front==null) return; ListNode curr = front; ListNode temp = curr.next; while (curr.next!=null &amp;&amp; curr.next.next != null) { curr.next = curr.next.next; curr = curr.next; temp.next = curr.next; } curr.next = temp; temp.next = null; } input: [3, 3, 3, 3, 4] expected output: front -&gt; [3] -&gt;…
has answer: http://stackoverflow.com/a/28624500
has answer: http://stackoverflow.com/a/21444663
has answer: http://stackoverflow.com/a/21452387
has answer: http://stackoverflow.com/a/21768585
type: AnsweredQuestion
tagged with: algorithm
has title: Rearrange nodes of linked list such as odd numbered index-nodes appear last
tagged with: java
accepted answer: http://stackoverflow.com/a/21768585
type: Question

http://stackoverflow.com/comment/32465834
comment on: http://stackoverflow.com/a/21505187
type: AnswerComment
has text: @MChan A `String` does not have an ISO 8601 format, a date does. You can parse a `DateTime` from a `String` and format that `DateTime` into the ISO format. The step of parsing into a `DateTime` object will have to use some other format that is not ISO 8601.
score: 0
type: Comment

http://stackoverflow.com/comment/32219853
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21366901
has text: Yes, of course. I needed just a little time testing the matter. And yes indeed you were right. I must have overlooked that and it solved my problem perfectly. I am sorry for bothering you and thankful for the quick solution.
score: 0

http://stackoverflow.com/a/21365035
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21364904
accepted answer of: http://stackoverflow.com/q/21364904
type: Answer
downvote count: 0
has body: You can use getIdentifier: protected void pickRandomButton() { // TODO Auto-generated method stub randomButtonId = ""; Random randomGenerator = new Random(); // construct a new random number generator int randomNumber = randomGenerator.nextInt(3); randomButtonId = "button" + (randomNumber +1); Log.d(TAG, randomButtonId, null); int buttonId = getResources().getIdentifier(randomButtonId, "id", getPackageName()); Button activeMole = (Button) findViewById(buttonId); activeMole.setBackgroundResource(color.red); } For the color, define your own color in a file named colors.xml in the values folder and load it to use setBackgroundResource or you can use activeMole.setBackgroundColor(Color.RED);.
score: 2
upvote count: 2

http://stackoverflow.com/comment/32212837
comment on: http://stackoverflow.com/a/21361799
type: AnswerComment
score: 0
type: Comment
has text: a null layout/setXXSize _are errors_ - but seeing your point: walking the OP through the generated code is quite a task :-)

http://stackoverflow.com/comment/32226432
comment on: http://stackoverflow.com/q/21370179
type: Comment
type: QuestionComment
has text: Casting only changes a reference. I am not sure what the author is talking about there. You can't change an object's class at runtime. I think you're misunderstanding what a cast actually does. Casting doesn't change the type of an object, only the type of a reference.
score: 0

http://stackoverflow.com/comment/32440821
has text: IOException when reset is called occurs when the stream is closed or when something other happnes. Have you tried deleting reset method and leaving only fis.getChannel().position(0); and fos.getChannel().position(0); ? These statements should go after FileInputStream fis = new FileInputStream(f); and after FileInputStream fos = new FileInputStream(newFile); If this doesnt help I have no idea then :) I had similar problem in Java SE and also in android but the set position and rest worked in SE and set position worked in android hm
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21489817
type: Comment

http://stackoverflow.com/a/21405058
answers question: http://stackoverflow.com/q/21401573
type: Answer
upvote count: 33
has body: Use CategoryPlot plot = chart.getCategoryPlot(); Font font3 = new Font("Dialog", Font.PLAIN, 25); plot.getDomainAxis().setLabelFont(font3); plot.getRangeAxis().setLabelFont(font3);
score: 33
accepted answer of: http://stackoverflow.com/q/21401573
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21414237
tagged with: xpath
type: UnansweredQuestion
tagged with: selenium
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21721245
score: 0
has comment: http://stackoverflow.com/comment/32312863
answer count: 1
has body: I am new in selenium. I have similar links on the page with similar xpaths (let's say links 1 to 30). I need to verify that all of them are present on the page (I want selenium to print something like this "element 1 is present" for each element) and all of them are clickable(new page will opens). So far I have this code to click on all links one by one and print their titles: driver.get("http://anysite.com"); String part1=".//*[@id='footer']/div/div[1]/div[2]/ul/li["; String part2="]/a"; for (int i=1;i&lt;=30;i++){ String text = driver.findElement(By.xpath(part1+i+part2)).getText(); System.out.println(text); driver.findElement(By.xpath(part1+i+part2)).click(); System.out.println(driver.getTitle()); driver.get("http://anysite.com"); Also I have this code to verify presence of each individual link separately (if I have 30 links I have to duplicate this code 30 times): if(driver.findElements(By.xpath(".//*[@id='footer']/div/div[1]/div[2]/ul/li[1]/a")).size() != 0){ System.out.println("Element Link 1 is Present"); }else{ System.out.println("Element Link 1 is Absent"); } So far I have two test cases, is there is any way to combine this two pieces together in one nice piece? Thank you!
has title: How to verify links and click on them in Selenium webdriver Java

http://stackoverflow.com/comment/32260282
comment on: http://stackoverflow.com/a/21389029
type: AnswerComment
score: 0
type: Comment
has text: you have list and empty textview or you don't have list at all? if your textview is empty, you need to override toString() in your custom class mostrar_alumnos

http://stackoverflow.com/comment/32410407
has text: @user2573071 So, reduce the rectangle to a single line...height = 1?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21473534
type: Comment

http://stackoverflow.com/a/21490469
answers question: http://stackoverflow.com/q/21482494
has body: Thanks for all your suggestions. I tried it all without success. Tried removing imports, clean+rebuild project, looking for errors in code/xml files (none), checked package names, restarted Eclipse many times in the process... all seemed ok. Mysteriously after a while the error went away. I know this sounds lame, but I'm blaming this on a buggy Eclipse.
has comment: http://stackoverflow.com/comment/32439312
has comment: http://stackoverflow.com/comment/32453603
score: 0
type: Answer

http://stackoverflow.com/a/21484482
has comment: http://stackoverflow.com/comment/32428492
answers question: http://stackoverflow.com/q/21484152
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/32428689
downvote count: 0
has body: Why code it yourself? There are many thirdtpaty alternatives: exp4j JEval ExpressionOasis etc.
type: Answer
has comment: http://stackoverflow.com/comment/32429220

http://stackoverflow.com/q/21363394
tagged with: garbage-collection
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: swt
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21364101
has body: I have the following code: final Canvas canvas = new Canvas(mainshell, SWT.NO_REDRAW_RESIZE); canvas.setBounds(0, 0, mainshell.getSize().x, mainshell.getSize().y); canvas.setBackgroundImage( new Image(display, "BlueBack.jpg" )); canvas.setFont(font); GC gc = new GC(canvas); gc.drawText("Test", 0, 0, true); gc.dispose(); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawText("String", 170, 30, true); e.gc.drawText("Another Unimportant String", 80, 90, true); int I = 140; int i = 1; String[] strings = Stuff.getUnimportantStringArray(); if(strings != null) for(String string : strings){ e.gc.drawText( i + " " + string , 120, I, true); I += 50; i++; } } }); The code that I am having the problem with is this: GC gc = new GC(canvas); gc.drawText("Test", 0, 0, true); gc.dispose(); The gc.drawText(); is not drawing the String "Test" on the canvas as I expected it would. Here is my Question: Why is the gc.drawText("Test", 0, 0, true"); not working, but the e.gc.drawText("String", 170, 30, true); inside the PaintListeneris working ?
has comment: http://stackoverflow.com/comment/32214587
tagged with: canvas
tagged with: drawtext
answer count: 1
downvote count: 0
has title: Java SWT GC not drawing text on Canvas
favorite count: 0
has answer: http://stackoverflow.com/a/21364101

http://stackoverflow.com/comment/32235612
type: Comment
has text: Thank you. Your examples are using the Joda time library, right? I am pretty sure but just making sure.
comment on: http://stackoverflow.com/a/21371293
type: AnswerComment
score: 0

http://stackoverflow.com/q/21358240
tagged with: swing
tagged with: jcheckbox
has body: Probably a noob question, but im new to java. I have a need for a checkbox list which I found is not supported in swing, but I found this custom control here http://www.devx.com/tips/Tip/5342 So I created a class file named CheckBoxList, and copied the code from the link into it: import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class CheckBoxList extends JList { protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); public CheckBoxList() { setCellRenderer(new CellRenderer()); addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { int index = locationToIndex(e.getPoint()); if (index != -1) { JCheckBox checkbox = (JCheckBox) getModel().getElementAt(index); checkbox.setSelected( !checkbox.isSelected()); repaint(); } } } ); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } protected class CellRenderer implements ListCellRenderer { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager.getBorder( "List.focusCellHighlightBorder") : noFocusBorder); return checkbox; } } } The problem is I don't know how to implement it in my GUI file. I tried a lot of code, but they never showed an example. Just To use the class, simply instantiate it, then pass it an array of JCheckBox objects (or subclasses of JCheckBox objects) by calling setListData So does that mean that I will not see the control in the Graphical Design view? My client wants to be able to edit it himself and add stuff so I want it to be easy and graphical if possible. If someone could…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6270351
has comment: http://stackoverflow.com/comment/32204410
linked to: http://stackoverflow.com/q/19766
has title: How to implement checkbox list java
type: Question
linked to: http://stackoverflow.com/q/13915081
has answer: http://stackoverflow.com/a/21362665
has answer: http://stackoverflow.com/a/21358953
has comment: http://stackoverflow.com/comment/38485471
has comment: http://stackoverflow.com/comment/32204478
has comment: http://stackoverflow.com/comment/32205201
score: 0
tagged with: java
answer count: 2
tagged with: checkboxlist

http://stackoverflow.com/q/21508770
has body: I'm trying to make some radio buttons appear the same way the normal buttons appear,but it seems like what I used for the normal buttons isn't working for the radio buttons.Graduate Student and Phd Student should appear under the Add new student but they appear as below,how can I make them a single nice column? public class Menu extends JPanel implements ActionListener{ static JPanel p =new JPanel(new GridBagLayout()); public static void Butty(){ JButton bAdd, bDelete; bAdd= new JButton("Add a new student"); bAdd.setPreferredSize(new Dimension(200,30)); bDelete= new JButton("Delete till geek"); bDelete.setPreferredSize(new Dimension(200,30)); JRadioButtonMenuItem jAdd1,jAdd2,jAdd3; ButtonGroup group = new ButtonGroup(); jAdd2= new JRadioButtonMenuItem("Graduate Student"); jAdd2.setPreferredSize(new Dimension(200,30)); group.add(jAdd2); jAdd3= new JRadioButtonMenuItem("Phd Student"); jAdd3.setPreferredSize(new Dimension(200,30)); group.add(jAdd3); p.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; p.add(bAdd,gbc); gbc.gridy++; p.add(jAdd2); gbc.gridy++; p.add(jAdd3); gbc.gridy++; p.add(bDelete,gbc); gbc.gridy++; } private static void createAndShowGUI() { JFrame frame = new JFrame("Something"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel cp2=new JPanel(new BorderLayout()); JPanel main=new JPanel(new GridLayout(1, 0)); cp2.setOpaque(true); Butty(); cp2.add(p); main.add(cp2); frame.setContentPane(main); frame.pack(); frame.setVisible(true); } }
has comment: http://stackoverflow.com/comment/32473774
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32472550
downvote count: 0
tagged with: layout-manager
favorite count: 0
type: Question
has title: Radio buttons position
has answer: http://stackoverflow.com/a/21508898
has comment: http://stackoverflow.com/comment/32473153
upvote count: 2
tagged with: java
tagged with: swing
answer count: 1
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/32472021
accepted answer: http://stackoverflow.com/a/21508898
has comment: http://stackoverflow.com/comment/32471897
has comment: http://stackoverflow.com/comment/32472405

http://stackoverflow.com/q/21474847
answer count: 1
tagged with: java
tagged with: ssl
type: UnansweredQuestion
tagged with: sslhandshakeexception
has body: I have the server root cert in my truststore and I after setting -Djavax.net.debug=all, I can see that the truststore is initialized and the trusted cert is there: trustStore is: test.truststore trustStore type is : jks trustStore provider is : init truststore adding as trusted cert: Subject: CN=Test Root, OU=test, O=test, C=us Issuer: CN=Test Root, OU=test, O=test, C=us Algorithm: RSA; Serial number: 0x1 Valid from Thu Sep 05 14:49:45 GMT+00:00 2013 until Sun Sep 05 14:49:45 GMT+00:00 2021 Next I can see in the server certificate chain, the trusted cert: chain [2] = [ [ Version: V3 Subject: CN=Test Root, OU=test, O=test, C=us Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5 Key: Sun RSA public key, 2048 bits modulus: 259491476017...{etc} public exponent: 65537 Validity: [From: Thu Sep 05 14:49:45 GMT+00:00 2013, To: Sun Sep 05 14:49:45 GMT+00:00 2021] Issuer: CN=Test Root, OU=test, O=test, C=us SerialNumber: [ 01] But for some reason, the handshake still fails: %% Invalidated: [Session-1, TLS_RSA_WITH_AES_256_CBC_SHA] Thread-2, SEND TLSv1 ALERT: fatal, description = certificate_unknown Thread-2, WRITE: TLSv1 Alert, length = 2 [Raw write]: length = 7 0000: 15 03 01 00 02 02 2E ....... Thread-2, called closeSocket() Thread-2, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: non-null policy tree required and policy tree is null Thread-2, IOException in getSession(): javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: non-null policy tree required and policy tree is null What does that "non-null policy tree required and policy tree is null" mean?
downvote count: 0
has comment: http://stackoverflow.com/comment/32411628
favorite count: 0
tagged with: security
type: Question
has title: SSLHandshakeException - java.security.cert.CertPathValidatorException: non-null policy tree required and policy tree is null
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/62474996

http://stackoverflow.com/a/21481113
accepted answer of: http://stackoverflow.com/q/21481073
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21481073
has body: You are assigning values wrong way. You should use array1[i]=input; instead of input = array1[i];.See below. for (int i = 0; i &lt; array1.length; i++){ System.out.println(i+1 + ": "); input = TextIO.getlnDouble(); // Retrieves input array1[i] = input; } System.out.println("Please enter the first number in the 2nd set: "); for (int i = 0; i &lt; array2.length; i++){ System.out.println("Number: "); input = TextIO.getlnDouble(); // Retrieves input array2[i] = input; }

http://stackoverflow.com/comment/32374497
score: 0
type: Comment
type: QuestionComment
has text: String s1= driver.findElement(By.xpath("//div[@class='fb-like fb_edge_widget_with_comment fb_iframe_widget']//iframe")).getAttribute("id"); driver.switchTo().frame(s1); System.out.println("Switched to "+s1); Thread.sleep(5000); driver.findElement(By.xpath("//*[@id='u_0_1']/div/div[1]")); This is clicking on Like button, but new pop up window is not populating
comment on: http://stackoverflow.com/q/21453634

http://stackoverflow.com/a/52817996
has body: Adding this before you call getConnection. ... DriverManager.setLoginTimeout(2); DriverManager.getConnection(connectString); ... Worked in my case.
type: Answer
answers question: http://stackoverflow.com/q/21351002
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/21364235
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21363926
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21363926
type: Answer
has comment: http://stackoverflow.com/comment/32216002
has comment: http://stackoverflow.com/comment/32216499
score: 2
has body: Refactor the condition into an interface: public interface ProductAccepter { public boolean accept(Product product); } public List&lt;Product&gt; searchItem(ListProduct list, ProductAccepter accepter) { List&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); for (Product prod : list.productList) { if (accepter.accept(prod)) products.add(prod); } } return products; } Then to call it, you can use an anonymous class: final String name = "foo"; List&lt;Product&gt; products = searchItem(list, new ProductAccepter() { public boolean accept(Product product) { return product.getName().toLowerCase().contains(name.toLowerCase()); } });

http://stackoverflow.com/comment/79589370
type: Comment
has text: It should be `org.slf4j.Logger.ROOT_LOGGER_NAME` as @BrendanLong mentioned however this will only set the root logger level
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/30979525

http://stackoverflow.com/comment/32242585
has text: Ask a new question, I'll try to answer there because it is a new question.
comment on: http://stackoverflow.com/a/21372849
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21409879
has comment: http://stackoverflow.com/comment/32322755
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21407190
answers question: http://stackoverflow.com/q/21407190
type: Answer
score: 2
upvote count: 2
has body: This compiles fine (b119): List&lt;String&gt; personList = Arrays.asList("a", "b"); List&lt;Function&lt;List&lt;String&gt;, Stream&lt;String&gt;&gt;&gt; streams = new ArrayList&lt;&gt;(); streams.add(List::stream); streams.add(List::parallelStream); You may be using an old build of the jdk or IntelliJ is messing with you!
has comment: http://stackoverflow.com/comment/53572747

http://stackoverflow.com/q/21355718
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/63885517
has title: TrayIcon Custom Notification balloon java
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: trayicon
has body: I did search but couldn't find anything. Okay, so I wanted to have a custom "balloon" look for TrayIcon.displayMessage(args). I was wondering if this is possible using pre-defined functions/methods? Or would I just create a new undecorated frame for a set amount of time then dispose of it? This obviously is not the best way of doing it. If anyone knows of anything about the TrayIcon notification balloon, could you post?
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32440004
has text: http://pastebin.com/YdbMrHiu
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21490714
type: AnswerComment

http://stackoverflow.com/q/21454825
tagged with: ms-project
score: 0
has title: MS Project Server 2010 Java API
accepted answer: http://stackoverflow.com/a/21462536
type: AnsweredQuestion
tagged with: java
has body: I'm looking for a way to write a Java application interacting with an MS Project Server 2010. I've read that a web API exists for MS Project Server, but could find no documentation on it. All the examples I've found so far use some C# library hiding all the API calls. I'll be thankful for your advice on what tech to use to make this interaction possible.
type: Question
has answer: http://stackoverflow.com/a/21462536
answer count: 1

http://stackoverflow.com/a/21460724
downvote count: 0
answers question: http://stackoverflow.com/q/21459902
type: Answer
score: 2
upvote count: 2
has body: In Java you can't extend multiple classes, and for a good reason. Take for example what you are trying to accomplish by extending MainActivity and ListActivity. In your new class, when you call: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... } Which onCreate() are you overriding? The one from ListActivity, or the one from MainActivity? What the link you posted is saying is that instead of inheriting from another object, you compose your new object of the one you are trying to use. For example: public class NewClass extends OldClass1 { private OldClass2 mOldClass2 = new OldClass2(); @Override public methodFromOldClass1() { } public methodFromOldClass2() { mOldClass2.methodFromOldClass2(); } } The problem with this approach is that the methods from MainActivity and ListActivity are still going to have the same name, which although you can work around, it will become a headache quickly. So the problem is a result of how you designed your class hierarchy. You will need to think about what functions you need from MainActivity, and what functions from ListActivity and choose how to reimplement your objects. My Suggestion, since ListActivity only makes it slightly easier to work with lists (not that much easier) you can just skip it and implement the code related to the list on your own, and that way you can just extend MainActivity

http://stackoverflow.com/comment/32291677
score: 0
has text: Is there a `.Project` file in the Folder?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21407097

http://stackoverflow.com/q/21482979
has comment: http://stackoverflow.com/comment/32432068
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/32432161
has comment: http://stackoverflow.com/comment/32425306
downvote count: 0
favorite count: 0
tagged with: pattern-matching
type: UnansweredQuestion
has title: Scala parse a JSON into a Map alternatives
answer count: 0
tagged with: scala
score: 1
has body: I'm looking for alternatives to scala JSON.parseFull(jsonString). I'm using scala JSON to convert jsonString to a Map[String,Any] but sometimes it takes too long to convert it to a map, and build a java object from it. jsonString is a long json response. Do you know fastest ways to convert a jsonString to a map[String, Any] so I can do patternMatching after that? here goes some code with JSON.parseFull(): override def parse(in: String): ResponseObject = { val json: Option[Any] = JSON.parseFull(in) json match { case Some(value) =&gt; val map: Map[String, Any] = value.asInstanceOf[Map[String, Any]] //json root val data: Map[String, Any] = map.get("data").get.asInstanceOf[Map[String, Any]] //populate PsmSearchResponse val response: ResponseObject = new ResponseObject //mapping base properties response.setHash(data.get("hash").get.asInstanceOf[String]) //call "transformToPsmItem" function to map each Searchitem val items: List[ResponseObjectItem] = data.get("items").get.asInstanceOf[List[Any]] map { itemParser.transformToResponseObjectItemItem } response.setItems(new ArrayList(items.asJavaCollection)) //return complete PsmSearchResponse response case (None) =&gt; null } I have also tried this with lift-json but as I'm using scala 2.10 I cant make it work. val record = json.JsonParser.parse(json) val json : Option[Any] = record.values.asInstanceOf[Map[String, Any]] I'm getting an error about incompatibility of my scala version (2.10) and json-lift version. I would like to know if is worth trying libraries and dealing with their problems just to get a little time improvement... so if anybody knows the fastes way please tell me. Thanks !
upvote count: 1
has comment: http://stackoverflow.com/comment/32432106
type: Question

http://stackoverflow.com/comment/32274093
type: AnswerComment
comment on: http://stackoverflow.com/a/21396356
type: Comment
has text: well, just include some hints on what he is failing logically and how he could solve this and you deserve the answer. I'm not greedy or something like that, but an answer should contain a bit more ... quality in my opinion ;)
score: 0

http://stackoverflow.com/a/21491407
has comment: http://stackoverflow.com/comment/32442900
score: 4
has comment: http://stackoverflow.com/comment/32441086
downvote count: 1
upvote count: 5
has body: Take a list lst1 of all the directories in the first directory and a list lst2 of all the directories in the second directory. Check if the two lists contain same counts and names of directories (A). If (A) is false, return false. Take a list of all regular files (not directories) in the two directories (which you're comparing), check if they contain the same counts and names (B) of files. If (B) is false, return false. OK, assume (A) and (B) are both true here. Now, just call your algorithm/method recursively on each directory d1 from lst1 and each corresponding directory (with the same name) d2 from lst2. If all these comparison calls return true, return true from your method, otherwise return false.
has comment: http://stackoverflow.com/comment/32441077
answers question: http://stackoverflow.com/q/21491361
has comment: http://stackoverflow.com/comment/32442936
type: Answer

http://stackoverflow.com/comment/32236645
type: Comment
comment on: http://stackoverflow.com/q/21374285
score: 0
type: QuestionComment
has text: @Jk1, I'm curious though, how did you know that `getItemViewType()` was not going to work? It is because you saw I had an array?

http://stackoverflow.com/a/21504615
has body: You were close. You omiited the positional operator from the update. Edit your code as shown. DBObject data=new BasicDBObject("$set",new BasicDBObject("eidlist.$.score",100));
type: Answer
has comment: http://stackoverflow.com/comment/32470897
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21502620
answers question: http://stackoverflow.com/q/21502620
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32470712

http://stackoverflow.com/comment/32379705
comment on: http://stackoverflow.com/q/21436446
has text: @AlexK, no its'nt, is a code of a web application.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21502214
has comment: http://stackoverflow.com/comment/32461679
has comment: http://stackoverflow.com/comment/32461126
has comment: http://stackoverflow.com/comment/32460656
downvote count: 0
answers question: http://stackoverflow.com/q/21502149
has comment: http://stackoverflow.com/comment/32461123
score: 10
has comment: http://stackoverflow.com/comment/32460614
has comment: http://stackoverflow.com/comment/32461381
has body: Try this request.getRequestDispatcher("/view/electrics.jsp").forward(req,res);
has comment: http://stackoverflow.com/comment/32461059
has comment: http://stackoverflow.com/comment/32461699
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/32461142

http://stackoverflow.com/a/27167803
accepted answer of: http://stackoverflow.com/q/21376572
score: 5
has body: After the brilliant comments here i changed the controller to the following, and it now works :) CustomerControllerTest.java import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration public class CustomerControllerTest { @Autowired CustomerController customerController; private MockMvc mockMvc; @Autowired WebApplicationContext wac; @Before public void setup(){ // Process mock annotations MockitoAnnotations.initMocks(this); // Setup Spring test in webapp-mode (same config as spring-boot) this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); } @Test public void testLoadCustomerPage() throws Exception{ this.mockMvc.perform(get("/customer")).andExpect(status().isOk()); } }
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/71808016
has comment: http://stackoverflow.com/comment/71806125
answers question: http://stackoverflow.com/q/21376572
downvote count: 0

android-ndk
tags question: http://stackoverflow.com/q/21413158
type: Tag
tags question: http://stackoverflow.com/q/21350297
tag name: android-ndk
tags question: http://stackoverflow.com/q/21443297
tags question: http://stackoverflow.com/q/21480457
tags question: http://stackoverflow.com/q/21382994

http://stackoverflow.com/q/21475207
has answer: http://stackoverflow.com/a/21475580
tagged with: java
has body: I use OpenJPA 2.1.1 on WebSphere Application Server 8. I want to create object from SELECT query using constructor expression: String queryString = "SELECT NEW mypackage.StatisticDataObject(c.source, " + "SUM(CASE WHEN (c.validTo &lt;= CURRENT_TIMESTAMP AND c.expireNoProblem LIKE 'N') THEN 1 ELSE 0 END ), " + "SUM(CASE WHEN (c.validTo &lt;= CURRENT_TIMESTAMP AND c.expireNoProblem LIKE 'Y') THEN 1 ELSE 0 END ), " + "SUM(CASE WHEN (c.validTo &gt; :timestamp30 ) THEN 1 ELSE 0 END ), " + "SUM(CASE WHEN (c.validTo &gt; :timestamp10 AND c.validTo &lt;= :timestamp30 ) THEN 1 ELSE 0 END ), " + "SUM(CASE WHEN (c.validTo &gt; CURRENT_TIMESTAMP AND c.validTo &lt;= :timestamp10 ) THEN 1 ELSE 0 END ) )" + "FROM MYTABLE c GROUP BY c.source"; TypedQuery&lt;StatisticDataObject&gt; q = em.createQuery(queryString, StatisticDataObject.class); q.setParameter("timestamp30", getTimestampIn(30)); q.setParameter("timestamp10", getTimestampIn(10)); Constructor: public StatisticDataObject(String name, Integer expired, Integer expiredButOK, Integer expireIn10Days, Integer expireIn30Days, Integer expireGT30Days) { this.name = name; this.expired = expired; this.expiredButOK = expiredButOK; this.expireIn10Days = expireIn10Days; this.expireIn30Days = expireIn30Days; this.expireGT30Days = expireGT30Days; } But I get the following exception: Caused by: &lt;openjpa-2.1.1-SNAPSHOT-r422266:1141200 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: Query "SELECT NEW mypackage StatisticDataObject(c.source, ... at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:872) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794) at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:315) at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331) ... Caused by: java.lang.RuntimeException: Es wurde kein Konstruktor für "class mypackage.StatisticDataObject" mit d…
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has title: JPA 2 Constructor Expression cannot use constructor
tagged with: jpa-2.0
score: 2
tagged with: constructor
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/21475037
has body: Pattern p = Pattern.compile("\\p{InHebrew}"); Matcher m = p.matcher(input);
upvote count: 3
has comment: http://stackoverflow.com/comment/32411788
score: 3
accepted answer of: http://stackoverflow.com/q/21474975
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21474975

http://stackoverflow.com/comment/32605184
score: 1
comment on: http://stackoverflow.com/q/21501343
has text: @peeskillet ID3 tag is part of every MP3 file,it is info about Artist,Song title,album,etc... On the double click,the song that is represented by that specific table cell will be played,also on right click there will be some menu shown(remove,...). I was first using a JList ,but in some examples on this site i found that the JTable will be bether solution,because of TableCellRenderer ,so i can render custom table cell
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21370215
score: 1
tagged with: java
has body: I have this code: final EditText edC = (EditText) findViewById(R.id.etC); final String creditsS = edC.getText().toString().trim(); final TextView tvD = (TextView) findViewById(R.id.tvDisplay); tvD.setText("Enter amount of credits"); edC.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { int credits = Integer.parseInt(creditsS); if (actionId == EditorInfo.IME_ACTION_DONE) { tvD.setText("Your amount of credits" + credits); return true; } return false; } }); and when I click the "Done" button, the app crashes. I don't understand where is the problem. Please help? Thanks!!!
has comment: http://stackoverflow.com/comment/32226029
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has title: The app crashes when I click on the "Done" button on numeric keyboard
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21370236
has comment: http://stackoverflow.com/comment/32226033
downvote count: 0

http://stackoverflow.com/comment/32395280
type: QuestionComment
has text: Have the class that creates the linked list also have the `isHealthy()` method. Then you can call `isHealthy()` on your fully created list. You can iterate through in the class you have now by using the `next` variable in your list, but the counter will not match up to the total count if you are calling `isHealthy()` from one of the middle elements in the list
type: Comment
comment on: http://stackoverflow.com/q/21465574
score: 0

http://stackoverflow.com/a/21498611
answers question: http://stackoverflow.com/q/21498563
has comment: http://stackoverflow.com/comment/32453584
type: Answer
has body: Math.log(9 / 60) equals Math.log(0), which is -Infinity. You can try Math.log(9.0/60) instead.
has comment: http://stackoverflow.com/comment/32453574
downvote count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32453616
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21498563

http://stackoverflow.com/comment/32287180
score: 0
type: Comment
type: QuestionComment
has text: Hi. Its not a duplicate my friend. My question is, my application is running without any issue in WInodws Xp with stack size of 256k. But in Windows 7, its giving me stack overflow error with same stack size 256k. Increasing stack size in Windows 7 by -Xss will solve the problem. But strange thing, why its not working in windows 7 with same stack size??
comment on: http://stackoverflow.com/q/21404616

http://stackoverflow.com/q/21399854
has comment: http://stackoverflow.com/comment/32280774
answer count: 1
has comment: http://stackoverflow.com/comment/32279729
tagged with: java
type: UnansweredQuestion
has body: I have a method that is hibernate one through which I am receiving the list as shown below.. List&lt;abcObject&gt; aaList= session.createCriteria(abcObject.class) now upon inspecting I have found that list type is of object type since criteria api return us the list of object type Now the list am receiving is that in following fashion that is .. t_id value 11 3 12 20 14 60 15 17 -------&gt;(3+20+60+17 =100),here min =11 &amp; max =15 18 40 22 20 33 40 45 20 ----------&gt;(40+20+40+20 =100),here min =18 &amp; max =45 Now folks please advise as I have to iterate the list in such a fashion such that if count of value reaches to 100 then then there should be a seprate map get created which key would be min and value would be of max , now the map is of string type min max 11 15 18 45 and also care need to be taken such that this parameter on which division is done that is 100 should be configurable sometimes it can be set to 60 also so this division parameter is need to be configurable so at last I want to create another map which is type of string such that min and max is of type string in that list and is stored in this fashion as shown below.. min max 11 15 18 45 Please advise how to achieve this in java as the list is of object type . I have tried some what this but it is not correct.. final int BARRIER = 100; //I am going to assume there are getter methods in you abcObject and //that all values are greater than 0 List&lt;abcObject&gt; minMaxs = new List&lt;abcObject&gt;(); int sum = 0; int min = 0; for (abcObject obj: aaList) { if (sum == 0) { //start over, remember min min = obj.getT_id(); } //add value to sum sum += obj.getValue(); if (sum &gt;= BARRIER) { //now we need to start again, remember what we got minMaxs.add(new abcObject(min, obj.getT_id())); //reset min = 0; sum = 0; } }
upvote count: 4
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21442187
type: Question
has title: iterating over the list which is of object type
tagged with: dictionary
has comment: http://stackoverflow.com/comment/32279124
score: 4
tagged with: list

http://stackoverflow.com/comment/32455514
type: Comment
comment on: http://stackoverflow.com/a/21499470
score: 0
has text: @aliteralmind I guess that is why they call it a pattern ;)
type: AnswerComment

http://stackoverflow.com/comment/32302033
type: Comment
has text: I answered a similar question here http://stackoverflow.com/a/21365915/2855515
comment on: http://stackoverflow.com/q/21412242
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32338249
type: Comment
has text: or, as the case may be... mvn -Dtest=TimeScaleUpdTest integration-test
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21432612

http://stackoverflow.com/comment/32454522
comment on: http://stackoverflow.com/q/21499062
score: 1
type: QuestionComment
has text: Collections.copy does a shallow copy, what you want is called a deep copy.
type: Comment

http://stackoverflow.com/comment/32435015
type: AnswerComment
score: 0
has text: I don't know, how to use firstname and lastname fields in hashmap, can you please help me!! I m beginners in java please help me!! Thank in advanced!!
type: Comment
comment on: http://stackoverflow.com/a/21488168

integer-programming
tags question: http://stackoverflow.com/q/21489938
tag name: integer-programming
type: Tag

http://stackoverflow.com/a/61295182
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21403782
has body: Here is my try: public static boolean isPalindrome(String s) { int index1 = 0; int index2 = s.length() -1; while (index1 &lt; index2) { if(s.charAt(index1) != s.charAt(index2)) { return false; } index1 ++; index2 --; } return true; }
downvote count: 0

http://stackoverflow.com/comment/32464365
type: Comment
comment on: http://stackoverflow.com/q/21469716
type: QuestionComment
has text: @RandallSchulz Thanks ! English is not my native. I will remember this word.
score: 0

http://stackoverflow.com/q/21389765
tagged with: multithreading
has body: I'm studying a course on Operating systems and I reached a part where it discusses processes and threads. I know a CPU can only run a single process at a time, so there are several scheduling algorithms out there to priorities the processes in the Ready queue. Now when I moved to threads things started to get somewhat confusing. Since a process may consist of several threads will the scheduling be for each single thread or for each process? For example: I'm on Windows. I double click a song to start it in VLC then double click MS Word to start writing a report and finally open Chrome to check my mail. Lets assume the following to simplify things: VLC process has only a single thread. MS Word has 5 threads in its process. Chrome creates a thread for each tab I open in the browser. All these programs are written in Java and all threads in these programs are created using the Thread class. Now which of these is a User thread and which is a Kernel thread? Will scheduling be on the processes or on the threads? Will the processes with higher number of threads run longer or is the operating system ignorant of the number of threads in each process?
has comment: http://stackoverflow.com/comment/32261270
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: process
upvote count: 1
type: Question
has title: Process and threads scheduling in an operating system
accepted answer: http://stackoverflow.com/a/21389979
tagged with: operating-system
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21389979
tagged with: kernel
favorite count: 0

http://stackoverflow.com/comment/32419881
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21479730
has text: Just disable the button while the dialog is open.

http://stackoverflow.com/comment/32259483
comment on: http://stackoverflow.com/a/21388690
score: 0
type: Comment
type: AnswerComment
has text: Good to know. I'm stuck with 6 at the moment, but I'll keep that in mind.

http://stackoverflow.com/comment/32261462
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21389812
has text: What's wrong with the nested maps solution? (And if you're asking us to educate you in how to build and maintain tree structures, I'd recommend that you go looking for a basic programming class.)
score: 0

http://stackoverflow.com/q/21407097
has comment: http://stackoverflow.com/comment/32291677
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21407214
answer count: 4
has answer: http://stackoverflow.com/a/24114638
has comment: http://stackoverflow.com/comment/32291618
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32292295
tagged with: eclipse
downvote count: 1
tagged with: import
type: Question
has comment: http://stackoverflow.com/comment/32291946
has comment: http://stackoverflow.com/comment/32291622
tagged with: project
has answer: http://stackoverflow.com/a/21407208
has comment: http://stackoverflow.com/comment/32291792
has title: Eclipse - Android Project from existing Code does not work
has comment: http://stackoverflow.com/comment/32291867
has comment: http://stackoverflow.com/comment/32291889
has body: i'm trying to import a folder with an existing project in Eclipse, but it wont't work. CTRL + N --> Android Project from existing code --> give folder directory --> Finish Once i try that, nothing happens. Nothing loads, Eclipse doesn't give me an error output, just nothing. Odd thing is that it just happens like that on one single project. When i try to import other projects, everything works just fine. I am a 100% certain that my project is not corrupted or anything. I just removed it from the Package Explorer and now it won't work anymore. Thank for your help :)
has answer: http://stackoverflow.com/a/21612305
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/21467364
has comment: http://stackoverflow.com/comment/32398560
has answer: http://stackoverflow.com/a/21467402
score: 1
has comment: http://stackoverflow.com/comment/32398708
has answer: http://stackoverflow.com/a/21467496
upvote count: 1
type: Question
has title: Deleting duplicate elements in an ArrayList Java
tagged with: java
tagged with: duplicates
answer count: 6
has answer: http://stackoverflow.com/a/21468489
has answer: http://stackoverflow.com/a/21467421
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/21467476
favorite count: 0
tagged with: arraylist
has body: Hi and thanks for reading! I'm currently studying Generics in Java and this is what I'm trying to accomplish: I need to delete duplicate elements from an ArrayList. Currently, the ArrayList contains integers. I want to first print the original list, and then print the resulting list after removing the duplicates. This is what I have so far. Any help is appreciated! public static void main(String[] args) { ArrayList&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;(); list1.add(1); list1.add(1); list1.add(1); list1.add(2); list1.add(2); list1.add(2); list1.add(3); list1.add(3); list1.add(3); removeDuplicates(list1); System.out.println("Original List with Duplicates: \n" + list1); System.out.println(); //System.out.println("After removing duplicates: \n" + list2); } public static &lt;E&gt; ArrayList&lt;E&gt; removeDuplicates(ArrayList&lt;E&gt; list2){ for(int i = 0; i &lt; list2.size(); i++){ //logic to remove duplicates } return list2; }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21467445

http://stackoverflow.com/a/21412329
answers question: http://stackoverflow.com/q/21412015
has comment: http://stackoverflow.com/comment/34245402
has comment: http://stackoverflow.com/comment/32302537
has comment: http://stackoverflow.com/comment/32302081
type: Answer
has comment: http://stackoverflow.com/comment/32343579
has comment: http://stackoverflow.com/comment/32343536
has comment: http://stackoverflow.com/comment/32301951
has comment: http://stackoverflow.com/comment/32343685
downvote count: 0
has comment: http://stackoverflow.com/comment/32302666
has comment: http://stackoverflow.com/comment/32301997
score: 1
has comment: http://stackoverflow.com/comment/32342312
has comment: http://stackoverflow.com/comment/32302125
has comment: http://stackoverflow.com/comment/32342497
has comment: http://stackoverflow.com/comment/32342297
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32341360
has comment: http://stackoverflow.com/comment/32301998
has comment: http://stackoverflow.com/comment/32343746
has comment: http://stackoverflow.com/comment/32303002
has body: You have String[] values = new String[q.size()]; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, values); But where do you populate items to values array. I don't see that in your code. You can use Custom ListView with a Custom Adapter ArrayList&lt;GS&gt; q = db.getData(); ListView lv = (ListView) findViewById(R.id.listView); lv.setAdapter(new CustomAdapter(MainActivity.this,q)); CustomAdapter class CustomAdapter extends ArrayAdapter&lt;GS&gt; { ArrayList&lt;GS&gt; list; LayoutInfalter mInfalter; public CustomAdapter(Context context, ArrayList&lt;GS&gt; list) { super(context,R.layout.customlayout,list); this.list= list mInfalter = LayoutInfalter.from(context); } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView==null) { convertView = mInflater.inflate(R.layout.customlayout,parent,false); holder = new ViewHolder(); holder.tv1 = (TextView)convertView.findViewById(R.id.textView1); convertView.setTag(holder); }else{ holder = (ViewHolder)convertVire.getTag(); } holder.tv1.setText(list.get(postion).getAS_name()); return convertVIew; } static class ViewHolder { TextView tv1; } } Have a TextView with id textview1 in customlayout.xml. Or Using SimpleCursorAdapter would be appropriate in this case.
has comment: http://stackoverflow.com/comment/32342234
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21412015

http://stackoverflow.com/comment/32404388
type: Comment
comment on: http://stackoverflow.com/a/21469940
type: AnswerComment
has text: Are you using Eclipse as an IDE? If you are, you should be able to either right click a line and set a breakpoint, or click to the left of the line to set one. If you are not using Eclipse, you should read up on debugging for your IDE. Once you set a breakpoint in the `checkX/Y` loop, you will be able to see the values of your relevant variables.
score: 0

http://stackoverflow.com/comment/32332288
has text: http://stackoverflow.com/questions/17654738/regex-split-text-document-into-sentences
comment on: http://stackoverflow.com/q/21430447
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21486463
has comment: http://stackoverflow.com/comment/32431509
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21485590
has comment: http://stackoverflow.com/comment/32434354
has comment: http://stackoverflow.com/comment/32434770
downvote count: 0
has body: I finally solved declaring vote as instance variable (private) in the main class.

http://stackoverflow.com/a/21377844
has body: Hopefully, you are in need of matching 19 digit number and it too be the beginning and end of line it seems. So for that you can use (^(\d{19})$)* - as it matches only the sentence containing 19 digits or an empty line (without any digits or characters).
answers question: http://stackoverflow.com/q/21377521
score: 0
type: Answer

http://stackoverflow.com/comment/32241277
type: Comment
has text: Just noticed the accessor mode. Instead of putting it on the field put it on the getter/setter of employee.
score: 0
comment on: http://stackoverflow.com/q/21378375
type: QuestionComment

http://stackoverflow.com/comment/32288128
type: Comment
type: QuestionComment
has text: Yes that is line 371 but I have already initialized the array from the FileIO class
comment on: http://stackoverflow.com/q/21405134
score: 0

http://stackoverflow.com/a/21352633
has comment: http://stackoverflow.com/comment/32195142
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32195255
has comment: http://stackoverflow.com/comment/32195330
has comment: http://stackoverflow.com/comment/32195177
has comment: http://stackoverflow.com/comment/32195038
accepted answer of: http://stackoverflow.com/q/21352488
has comment: http://stackoverflow.com/comment/32195490
has comment: http://stackoverflow.com/comment/32194902
answers question: http://stackoverflow.com/q/21352488
has body: This is where the Callback or ActionListener coding pattern shows it's strength. In your MyTask class add this after the class declaration: public interface MyTaskActionListener{ public void didFinish(String result); } Add a member to your MyTask class: private MyTaskActionListener listener; Now, add a method setActionListener to MyTask: public void setActionListener(MyTaskActionListener l){ listener = l; } Next, before starting the MyTask, set the listener: MyTask task = new MyTask(); task.setActionListener(new MyTaskActionListener(){ public void didFinish(String result){ yoirTextView.setText(result); } }); Last but not least, call didFinish() in MyTask's onPostExecute: protected void onPostExecute(String result){ listener.didFinish(result); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32194751
has comment: http://stackoverflow.com/comment/32195305

android-broadcast
tag name: android-broadcast
type: Tag
tags question: http://stackoverflow.com/q/21498381

jms
tags question: http://stackoverflow.com/q/21398613
tags question: http://stackoverflow.com/q/21443173
tags question: http://stackoverflow.com/q/21462204
tags question: http://stackoverflow.com/q/21453577
tags question: http://stackoverflow.com/q/21409508
tag name: jms
tags question: http://stackoverflow.com/q/21437596
tags question: http://stackoverflow.com/q/21490522
tags question: http://stackoverflow.com/q/21442813
tags question: http://stackoverflow.com/q/21373635
tags question: http://stackoverflow.com/q/21460324
tags question: http://stackoverflow.com/q/21416462
type: Tag
tags question: http://stackoverflow.com/q/21470045
tags question: http://stackoverflow.com/q/21491129
tags question: http://stackoverflow.com/q/21365508
tags question: http://stackoverflow.com/q/21511588
tags question: http://stackoverflow.com/q/21477139

http://stackoverflow.com/comment/32249453
has text: I need to use replaceAll() since there can be more `\\r` in string, i have posted a test string for keeping the question to the point.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21383227
type: Comment

http://stackoverflow.com/comment/32390305
comment on: http://stackoverflow.com/a/21462924
has text: yes, but I truly need to verify that person1 is person1, pereson1 age is 20
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21396765
has answer: http://stackoverflow.com/a/21417758
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32277455
has title: "ORA-01754: A table may contain only one column of type LONG" with only one Long type
tagged with: java
tagged with: hibernate
tagged with: database
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/32281387
score: 0
has body: I am using hibernate with Oracle and tables are updated using hbm2ddl option at runtime before service starts. Today, I started facing a weird issue where I came to know that table T has two long columns which is not supported in the Oracle. @Table(name="table_t") @Entity public class T extends BaseEntity{ @Id Long id; @Column(name="col1") Long col1; @Column(name="col2") Integer col2; } After facing the issue, I changed datatype of col1 to Integer(tables were not created in the DB) and tried re-running the application but it still fails with the same error. Current schema appears like this: @Table(name="table_t") @Entity public class T extends BaseEntity{ @Id Long id; @Column(name="col1") Integer col1; @Column(name="col2") Integer col2; } Why is it happening? I tried cleaning, rebuilding and all. Is meta info already stored somewhere? Or I am missing something else? Thanks,
tagged with: oracle-database
linked to: http://stackoverflow.com/q/2625600
has comment: http://stackoverflow.com/comment/32281935

http://stackoverflow.com/a/21372588
upvote count: 1
score: 0
answers question: http://stackoverflow.com/q/21372559
downvote count: 1
type: Answer
has body: From Java Language Specification, Array components are unnamed variables that are created and initialized to default values (§4.12.5) whenever a new object that is an array is created... Your object array is declared in first case Card[] arr = new Card[2]; and is initialized with null. Since the array is not populated with Card type objects, it is actually pointing to default null value and when you try to print it, a NullPointerException is thrown. In the second case Card[] arr = {a, b}; you have created new Card type objects and populated the array with those objects and when you try to print it, the value is returned and displayed.
has comment: http://stackoverflow.com/comment/32230367

http://stackoverflow.com/q/21511133
has body: I've tried "\n\n" and "\r" and everything else, including replaceAll("\r\n", "n") and I still do not understand why it doesn't work. I've also tried "\w", "\n", "\n+" - I've basically tried everything under "My split("\n") doesn't work" on Google search. I'm trying to split a word with a lot of "\n". I basically have two different classes. One generates this word, and via the other class constructor object transfers it into the split("\n") method. But whatever I do, the array still stays empty. I've also tried word.split(System.getProperty("line.separator")) even though I didn't have a clue as to what it meant, but it also came up under one of the solutions to this problem. Here's my Code: //in Class A public String getWord() { word = word +"\n" + horizontal; return word; } //in Class B classA a = new classA(); String grid = a.getWord(); String [] lines = grid.split("\n"); EDIT: Sorry, typo mistake, I'll just ask again later. I did actually put grid.split("\n") in my code. What now? The array really is empty. I did System.out.println(array.length) and it was 0. Also, I typed System.out.println("array is " + array) and it only gave me "array is" as output. I know I'm making a stupid mistake somewhere, and I know I can't expect people to answer my question if I don't know what info to provide. I also wanted to add some stuff in the comments section here for the comfort of those sitting in front of their laptops... word and horizontal is a string. It's actually a crossword puzzle together. See? Look! LONDONPYVRAOMNDDEFSG GCPZVBATHYXAZXEZIMOZ NKDGBERLINCHPLTMHMSM ZMUKPGCHRKDTYGIMRLHO TVRWBXPRETORIAJBVKWT OGIVSDFULULHQHAHEJNV PNWEJHBAKBJZNBPARIS PHKCZCYGTXEEXDUCPMXF QIMQMABRASILIALJOFJQ GXNXKTAHIQMMIFPSYDLI CAIROYKZYSWEFPUZPKRG BTNAUNIDQAYVYAPGWWIN QXZMQSZBTCBEIJINGBSD QWQRYTBPTKRBCJUOMJTV SODHAMSTERDAMEMSLVAM YQHEVNXQQJXCDZKEYQVT NAIROBISVDNTCFJNYDEG AKXVOIGYTZTJHGIAFIKZ BAGHDADSADJTWOOMVRYT YCPOBXQQMQKBTDMYPYWT It's city names. At the end of this, I'm supposed to show …
has comment: http://stackoverflow.com/comment/32482549
has comment: http://stackoverflow.com/comment/32475942
answer count: 3
has comment: http://stackoverflow.com/comment/32476650
has comment: http://stackoverflow.com/comment/32475982
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32482546
has comment: http://stackoverflow.com/comment/32482342
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32475951
upvote count: 1
has comment: http://stackoverflow.com/comment/32475981
has answer: http://stackoverflow.com/a/21511191
linked to: http://stackoverflow.com/q/5518451
has comment: http://stackoverflow.com/comment/32476003
has answer: http://stackoverflow.com/a/21511179
has answer: http://stackoverflow.com/a/21511345
tagged with: java
downvote count: 3
type: Question
has title: How come my split("\n") isn't working
score: -2

http://stackoverflow.com/q/21513099
has answer: http://stackoverflow.com/a/21513253
has answer: http://stackoverflow.com/a/21514297
tagged with: jbutton
type: AnsweredQuestion
downvote count: 0
has title: Clicking a JButton consecutively
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32479567
has body: Is there a way to know if a JButton was clicked consecutively? Consider my code. public void actionPerformed(ActionEvent arg0) { String bucky[] = new String[2]; String firstclick = null, secondclick = null; clicks++; if (clicks == 1) { bucky[0] = firstclick; } else if(clicks == 2) { bucky[1] = secondclick; if (bucky[0] == bucky[1]) { //This JButton was clicked twice in a row. } } This code checks the entire number of times my JButton was clicked and displays the message "This button was clicked twice in a row". What I want is to compare two clicks from that button and see if they come one after the other rather than counting the number of clicks made. Or is there a built-in function that does this?
type: Question
has answer: http://stackoverflow.com/a/21513199
has comment: http://stackoverflow.com/comment/32479745
has comment: http://stackoverflow.com/comment/32479820
accepted answer: http://stackoverflow.com/a/21514297
answer count: 3
upvote count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/32479722
possible better answer: http://stackoverflow.com/a/21513253
favorite count: 0

http://stackoverflow.com/comment/32309137
comment on: http://stackoverflow.com/q/21409774
type: Comment
type: QuestionComment
has text: See: http://stackoverflow.com/questions/9606585/liquibase-using-maven-with-two-databases-does-not-work/9609848#9609848
score: 1

http://stackoverflow.com/q/21497119
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/7143287
answer count: 2
has body: Im having trouble with adding substance look and feel, this is my first time trying it, i want to add the graphite glass one but it doesn't work heres my code: package loader; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Frame; import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JWindow; import javax.swing.SwingConstants; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import org.pushingpixels.substance.api.SubstanceLookAndFeel; import org.pushingpixels.substance.api.skin.GraphiteGlassSkin; import org.pushingpixels.substance.api.skin.GraphiteSkin; import org.pushingpixels.substance.api.skin.SubstanceGraphiteGlassLookAndFeel; import org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel; import org.pushingpixels.substance.api.skin.SubstanceRavenLookAndFeel; import org.pushingpixels.substance.api.skin.TwilightSkin; public class Loader extends JWindow implements ActionListener { private static URLClassLoader classLoader; private static int downloaded; // number of bytes downloaded // to // splash // image private final static String FRAME_IMAGE = "http://i.imgur.com/UW5ZfQ5.jpg"; // icon // for // the // frame private final static String JAR_URL = "http://chefJones.com/play/client.jar"; // link // to // jar final static Loader l…
possible better answer: http://stackoverflow.com/a/47356413
downvote count: 0
has answer: http://stackoverflow.com/a/21497178
accepted answer: http://stackoverflow.com/a/21497178
favorite count: 0
tagged with: event-dispatch-thread
has title: Substance look and feel
tagged with: substance
type: AnsweredQuestion
score: 1
tagged with: look-and-feel
has answer: http://stackoverflow.com/a/47356413
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/21490123
answer count: 1
has body: I am new to netty. I have to use static pipelines (because the project manager prefers it). And it is a little bit difficult, because I have to handle RTP and RTSP protocols on the same line. Althought it almost works, but there is memory leak. I guess the fault in my splitter class. Moreover I think the error might be near bypass method (because the developers of netty - in order the avoide infinitive loop - do not allow to leave ByteBuf unchanged that is why I had to create the bypass method.) If you have any idea, please help me! (Thanks in advance!) Here is my code: import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.MessageList; import io.netty.handler.codec.ByteToMessageDecoder; import java.util.ArrayList; import java.util.List; public class Splitter extends ByteToMessageDecoder { private ByteBuf bb = Unpooled.buffer(); final RtspClientHandler rtspClientHandler; final RtpClientHandler rtpClientHandler; public Splitter(RtspClientHandler rtspClientHandler, RtpClientHandler rtpClientHandler) { this.rtspClientHandler = rtspClientHandler; this.rtpClientHandler = rtpClientHandler; } protected void bypass(ByteBuf in, MessageList&lt;Object&gt; out) { bb.writeBytes(in); in.discardReadBytes(); bb.retain(); out.add(bb); } @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, MessageList&lt;Object&gt; out) throws Exception { if (rtspClientHandler.getRTSPstate() == RtspClientHandler.RTSP_CLIENT_STATE.READY) { if (in.getByte(0) == 0x24 &amp;&amp; in.readableBytes() &gt; 4) { int lengthToRead = in.getUnsignedShort(2); if (in.readableBytes() &gt;= (lengthToRead + 4)) { in.skipBytes(4); if (in.getByte(16) == 0x67 || in.getByte(16) == 0x68) { final byte bytes[] = new byte[lengthToRead]; in.readBytes(bytes); in.discardReadBytes(); SPSPPSbuffer spspps = new SPSPPSbuffer(); spspps.setSPSPPS(bytes); out.add(spspps); } else { final byte packetArray[] = new byte[lengthToRead];// copy …
has comment: http://stackoverflow.com/comment/32438629
tagged with: red5
tagged with: netty
has comment: http://stackoverflow.com/comment/32438817
has comment: http://stackoverflow.com/comment/32439168
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21527035
type: Question
has comment: http://stackoverflow.com/comment/32439054
has answer: http://stackoverflow.com/a/21527035
score: 0
has title: Memory leak in my ByteToMessageDecoder class

http://stackoverflow.com/a/21527674
answers question: http://stackoverflow.com/q/21478692
has body: If you're after an order-independent comparison then ElementQualifier would help: http://xmlunit.sourceforge.net/userguide/html/ar01s03.html In some cases the order of elements in two pieces of XML may not be significant. If this is true, the DifferenceEngine needs help to determine which Elements to compare. This is the job of an ElementQualifier (see Section 3.4, “ElementQualifier”). Specifically, ElementNameAndAttributeQualifier seems to match your requirements: Only Elements with the same name - and Namespace URI if present - as well as the same values for all attributes given in ElementNameAndAttributeQualifier's constructor qualify.
type: Answer
score: 0

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/21364402
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/21411472
has comment: http://stackoverflow.com/comment/32299641
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32299609
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21410506
has body: "However, when i execute clean and build, the image does not appear when i execute the jar file. What seems to be the problem and where should I put the image file?" This is the reason you don't load from a file. You want to load it as an embedded resources from your class path with a URL Your image should be in a package somewhere in the src during development. When you build, the IDE with copy that image for you into the class path, and add it to the jar Then to load from the class path in your code. Class.getResource(..) return a URL, so you want to do this ImageIcon icon = new ImageIcon(MyClass.class.getResource("/images/logo.gif"));
has comment: http://stackoverflow.com/comment/32299788
type: Answer
accepted answer of: http://stackoverflow.com/q/21410506

ntdll
type: Tag
tag name: ntdll
tags question: http://stackoverflow.com/q/21445990

http://stackoverflow.com/comment/32497487
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21495312
has text: Thanks for your Help Really. and Yes all client gonna use same values. and i solved my problem using this great concept.. 1) http://www.journaldev.com/1945/servlet-listener-example-servletcontextlistener-httpsessionlistener-and-servletrequestlistener...... 2) http://www.mkyong.com/servlet/what-is-listener-servletcontextlistener-example/

http://stackoverflow.com/q/21376875
tagged with: java
tagged with: queue
type: Question
has title: Check size of sun.misc.Queue
answer count: 2
has comment: http://stackoverflow.com/comment/32238148
has answer: http://stackoverflow.com/a/21377298
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21376920
has comment: http://stackoverflow.com/comment/32237861
has body: My project is using a Queue by extending sun.misc.Queue and I need to know size of this queue every second. As sun.misc.Queue does not provide size method API. I tried to add toString method to my class extending sun.misc.queue, and calling the toString in a seprate thread dedicated for printing the queue every second. public String toString() { int count = 0; Enumeration er = null; synchronized (this) { er = myQ.elements(); while (er.hasMoreElements()) { count++; } } return "" + count ; } myQ is field in this class. But this ain't working too. After I add this code, complete system goes for toss. Can anybody help in identifying if I am doing something wrong.

http://stackoverflow.com/a/21512166
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21512056
type: Answer
has body: You can split the two strings with the comma first, but then you will have to be a little more cunning to get {@, !, #, $, %, ^} and {1, 2, 3}. String[] s1 = "@!#$%^, 123".split(","); //after this line, s1 will have two elements char[] a = s1[0].toCharArray(); // this converts a string to a char array char[] b = s1[1].toCharArray(); After the code executes, a will contain {'@', '!', '#', '$', '%', '^'}, notice that the elements are all character literals instead of strings. Array b will contain {'1', '2', '3'}, also character literals.

http://stackoverflow.com/comment/32510695
comment on: http://stackoverflow.com/a/21487891
type: Comment
score: 0
type: AnswerComment
has text: @AntoineWils Edited following your suggestion. Thanks.

http://stackoverflow.com/comment/32286043
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21402187
has text: Sure, it would add additional info to the answer.

http://stackoverflow.com/comment/32231703
score: 0
type: Comment
has text: can i get an emage from that url of image?
type: AnswerComment
comment on: http://stackoverflow.com/a/21372950

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/21421860
tags question: http://stackoverflow.com/q/21444455
type: Tag

http://stackoverflow.com/q/21467735
score: -1
type: Question
tagged with: jakarta-mail
upvote count: 0
answer count: 1
favorite count: 0
has body: Any ideas why this isn't getting interpreted? I use a StringBuilder.append() to construct email & send it off, it's displaying as text. Here's a snippet. notificationEmail.append("Mr. " +salesOpsInfo[1]+ " " + salesOpsInfo[2] + '\n'); notificationEmail.append(salesOpsInfo[0] + '\n'); notificationEmail.append( "\n\n"); notificationEmail.append("Dear Mr. "+ salesOpsInfo[2] + "," + "\n"); notificationEmail.append("" + '\n'); notificationEmail.append(EndOfLicenseRenewal.eolTextBeforeTable()); NotificationUtil.**sendMail**(salesOps_email_list, attachmentList, subject, salesOpsEmail.toString(), "eolnotification@DOMAIN.com", "mail.MYSERVER.com", false); sendMail is the standard way of sending .. try { MimeMessage msg = new MimeMessage(session); if ((from != null) && (!from.equalsIgnoreCase(" "))) { msg.setFrom(new InternetAddress(from)); } InternetAddress[] address = new InternetAddress[recipients.size()]; for (int i = 0; i < recipients.size(); i++) { String rec = (String)recipients.get(i); if ((rec != null) && (!rec.equalsIgnoreCase(""))) { address[i] = new InternetAddress((String)recipients.get(i)); } } msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(subject); MimeBodyPart mbpMessage = new MimeBodyPart(); **mbpMessage.setContent(message, "text/html");** mbpMessage.setHeader("Content-ID", "<memememe>"); Multipart mp = new MimeMultipart(); mp.addBodyPart(mbpMessage); if (attachments != null) { for (int i = 0; i < attachments.size(); i++) { MimeBodyPart mbp = new MimeBodyPart(); FileDataSource fds = new FileDataSource((String)attachments.get(i)); mbp.setDataHandler(new DataHandler(fds)); mbp.setFileName(fds.getName()); mbp.setHeader("Content-ID", "<memememe>"); mp.addBodyPart(mbp); } } msg.setContent(mp); msg.setSentDate(new Date()); Transport.send(msg); As i understand it (text/html) should properly send it how i want.. instead in the email i get you may contact our dedicated team at eolnotification@DOMAIN.com EDIT : just tried and they don't work eith…
tagged with: http://stackoverflow.com/tag/html
has title: HTML won't render using Javax
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/21467788
tagged with: java

http://stackoverflow.com/comment/32436024
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21465942
type: AnswerComment
has text: I already gave you the Java part. I now removed the C# part to make it less confusing for you. And your question is about the behaviour of `optional` fields in Thrift `struct`s.

http://stackoverflow.com/a/21374769
score: 0
type: Answer
has body: I wouldn't necessarily use Java as a backend, but the easiest way I can think to do that would be to connect them up internally over a socket. For PHP: http://www.php.net/manual/en/book.sockets.php For Java: http://docs.oracle.com/javase/tutorial/networking/sockets/
answers question: http://stackoverflow.com/q/21374732

http://stackoverflow.com/q/21417689
has body: I have filtered tweets based on location using q.location(bbox); If i have further check whether these tweets have set of keywords I used q.track("game") My tweets either have the location or the words not both the conditions are met. Are my statements correct? Where did I go wrong?
downvote count: 1
favorite count: 0
score: 2
has title: filtering tweets based on two condition twitter API
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21427072
type: Question
has answer: http://stackoverflow.com/a/21417775
tagged with: twitter4j
tagged with: java
tagged with: twitter
has answer: http://stackoverflow.com/a/21418859
tagged with: search
upvote count: 3
tagged with: filter
answer count: 3

http://stackoverflow.com/comment/32289759
has text: This worked! I dropped "console" appender-ref from my log4jconfig.xml for logger.com.opensymphony.xwork2.* while still keeping the loglevel to VERBOSE so that I can see the logs in log file but not app server console. Thanks
type: Comment
comment on: http://stackoverflow.com/a/21402187
score: 1
type: AnswerComment

communication
tag name: communication
tags question: http://stackoverflow.com/q/21351264
type: Tag
tags question: http://stackoverflow.com/q/21505019

http://stackoverflow.com/q/21359251
type: Question
score: 0
has answer: http://stackoverflow.com/a/21359370
answer count: 2
accepted answer: http://stackoverflow.com/a/21359370
tagged with: stringbuilder
tagged with: java
possible better answer: http://stackoverflow.com/a/21359337
has answer: http://stackoverflow.com/a/21359337
type: AnsweredQuestion
has title: Adding Spaces between words and making every word except the first lowercase in java
tagged with: string
has body: I'll go ahead and let you know that yes, this is homework. I have hit a brick wall in completing it however and desperately need help. I'm also pretty new to Java and am still learning the language. Okay, I am trying to write a program that asks the user to enter a sentence with no spaces but have them capitalize the first letter of each word. The program should then add spaces between the words and have only the first word capitalized, the rest should start with a lowercase. I can get the space inserted between the words, but I cannot get the first letter of each word lower-cased. I have tried several different ways, and the latest one is giving me this error message: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind ex out of range: 72 at java.lang.AbstractStringBuilder.setCharAt(Unknown Source) at java.lang.StringBuilder.setCharAt(Unknown Source) at renfroKristinCh9PC14.main(renfroKristinCh9PC14.java:45) I'm posting up my code and any and all help you can give me will be very much appreciated. Thanks. /* This program will ask the user to enter a sentence without whitespaces, but with the first letter of each word capitilized. It will then separate the words and have only the first word of the sentence capitalized. */ import java.util.*; public class renfroKristinCh9PC14 { public static void main(String[] args) { //a string variable to hold the user's input and a variable to hold the modified sentence String input = ""; //variable to hold a character char index; //create an instance of the scanner class for input Scanner keyboard = new Scanner(System.in); //welcome the user and explain the program userWelcome(); //get the sentence from the user System.out.println("\n Please enter a sentence without spaces but with the\n"); System.out.println(" first letter of each word capitalized.\n"); System.out.print(" Example: BatmanIsTheBestSuperheroEver! "); input = keyboard.nextLine(); //create an instance of the StringBuilder class StringBuil…

http://stackoverflow.com/comment/32239141
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/21377521
has text: Are empty values "ok" or not ? If it's not what you want then remove `|`. It means "or". Since you have nothing after it, it will validate empty string

http://stackoverflow.com/a/21411688
answers question: http://stackoverflow.com/q/21411630
type: Answer
upvote count: 2
score: 2
has body: There is no runtime performance impact at all. Use which ever one suits you best. (Personally I prefer not to use wildcards as you tend to get lots of name collisions if you have multiple wildcard imports).
downvote count: 0

http://stackoverflow.com/a/21480528
downvote count: 0
answers question: http://stackoverflow.com/q/21480365
type: Answer
score: 1
upvote count: 1
has body: its a illegal forward reference.. you can not use gettext() in declaration portion.. So write like this., public void addMovie() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:odbc:movieDSN"; con=DriverManager.getConnection(url); st=con.createStatement(); String tmpairDate=airDate.getText(); sql="INSERT INTO movieTime (MovieName,AirDate) VALUES ( '"+tmpMovieName+"','"+tmpairDate+"' ) "; }catch(Exception sqlex) { System.out.println(sqlex); } } Thanks...

http://stackoverflow.com/a/21537170
downvote count: 0
answers question: http://stackoverflow.com/q/21508462
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36189413
has body: You might need to follow the steps outlined in our blog to export the libraries for use in an Android application.

http://stackoverflow.com/a/21502044
has comment: http://stackoverflow.com/comment/32470069
score: 0
has comment: http://stackoverflow.com/comment/32539637
has body: Your questions seem to be fairly straight-forward and could be better understood with a brief review of the Menu guide on d.android.com. You could inflate the same menu resource in all activities you desire the menu to appear in. If you want to keep the logic handling onOptionsItemSelected() in one place, you could consider introducing a super class or delegating the handling of some actions. As per the documentation: If necessary, you can re-order the menu items with the android:orderInCategory attribute in each you need to move. You have already done so with android:showAsAction="never". Note that some devices use a hardware menu key; you should observe the device's preferred behavior to conceal overflow menus on these devices for a consistent user experience.
has comment: http://stackoverflow.com/comment/32462380
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32538764
has comment: http://stackoverflow.com/comment/32480044
has comment: http://stackoverflow.com/comment/32525650
type: Answer
has comment: http://stackoverflow.com/comment/32462441
has comment: http://stackoverflow.com/comment/32466050
answers question: http://stackoverflow.com/q/21501629
accepted answer of: http://stackoverflow.com/q/21501629
has comment: http://stackoverflow.com/comment/32528617

http://stackoverflow.com/comment/32311186
score: 0
type: AnswerComment
has text: JDBC driver is added. check the screenshot please. Or maybe its added wrong?
type: Comment
comment on: http://stackoverflow.com/a/21416789

http://stackoverflow.com/comment/32450771
comment on: http://stackoverflow.com/a/21496314
has text: Actually you can get the JSON response from the controller using .andReturn()
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21420766
favorite count: 0
has comment: http://stackoverflow.com/comment/32320451
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21702968
has comment: http://stackoverflow.com/comment/32359467
has answer: http://stackoverflow.com/a/21439340
tagged with: java
has comment: http://stackoverflow.com/comment/32366710
tagged with: amazon-dynamodb
has comment: http://stackoverflow.com/comment/32320992
type: Question
score: 3
tagged with: amazon-web-services
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/32317610
downvote count: 0
has comment: http://stackoverflow.com/comment/32317388
has title: How to improve speed of DynamoDB requests
has body: I've been testing out DynamoDB as a potential option for a scalable and steady throughput database for a site that will be hit pretty frequently and requires a very fast response time (&lt; 50ms). I'm seeing pretty slow responses (both locally and on an EC2 instance) for the following code: public static void main(String[] args) { try { AWSCredentials credentials = new PropertiesCredentials(new File("aws_credentials.properties")); long start = System.currentTimeMillis(); AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials); System.out.println((System.currentTimeMillis() - start) + " (ms) to connect"); DynamoDBMapper mapper = new DynamoDBMapper(client); start = System.currentTimeMillis(); Model model = mapper.load(Model.class, "hashkey1", "rangekey1"); System.out.println((System.currentTimeMillis() - start) + " (ms) to load Model"); } catch (Exception e) { e.printStackTrace(); } } The connection to the DB alone takes about 800 (ms) on average and the loading using the mapper takes an additional 200 (ms). According to Amazon's page about DynamoDB we should expect "Average service-side latencies...typically single-digit milliseconds." I wouldn't expect the full round-trip HTTP request to add that much overhead. Are these expected numbers even on an EC2 instance?

http://stackoverflow.com/q/21482494
upvote count: 1
has answer: http://stackoverflow.com/a/21482822
has comment: http://stackoverflow.com/comment/32427000
has title: Eclipse can't find generated ids from R.java
tagged with: java
has comment: http://stackoverflow.com/comment/32439172
has comment: http://stackoverflow.com/comment/32424498
has comment: http://stackoverflow.com/comment/32424632
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16995402
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32427020
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32424869
favorite count: 0
has comment: http://stackoverflow.com/comment/32424546
type: Question
tagged with: android
has body: I have strange problems with Eclipse (Kepler) and the R.java file. The symptom is that often (but not always), Eclipse either doesn't generate the R.java file at all, or if it does generate it, it marks some of the IDs as not resolvable in my source. Even though those IDs show up in the R.java file. I've been using Project > Clean for a million times now, but this behaviour just keeps coming back. Obvious things as restarting Eclipse do not seem to change anything. Here's an example: (GameActivity.java) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game); // "game" is marked as not resolvable } (R.java) public final class R { public static final class layout { public static final int game=0x7f030000; public static final int main=0x7f030001; } } Any ideas what is going on here?
has answer: http://stackoverflow.com/a/21490469
has answer: http://stackoverflow.com/a/21482609
linked to: http://stackoverflow.com/q/885009
answer count: 3

http://stackoverflow.com/comment/32349363
type: QuestionComment
score: 0
has text: Have you tried to extend from JLabel ?
type: Comment
comment on: http://stackoverflow.com/q/21439223

http://stackoverflow.com/comment/105828823
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21397393
has text: is my answer accepted?

http://stackoverflow.com/comment/32477190
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21511540
type: Comment
has text: @user3043278: It all depends on what you are adding your button panel to, and what layout it uses. If you're adding it to the JFrame (its contentPane really), understand that it uses a BorderLayout, and so you'll want to read the BorderLayout tutorial to see how it works.

http://stackoverflow.com/a/21483070
has body: You need export your project like Runnable JAR file (File > export > Java / Runnable JAR file). After this, you can execute via command line java -jar app.jar
type: Answer
answers question: http://stackoverflow.com/q/21482920
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/21481899
tags question: http://stackoverflow.com/q/21371849
tags question: http://stackoverflow.com/q/21497658
tags question: http://stackoverflow.com/q/21422998
tag name: tcp

http://stackoverflow.com/a/21425230
accepted answer of: http://stackoverflow.com/q/21415391
type: Answer
answers question: http://stackoverflow.com/q/21415391
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: The only way to return a Boolean would be to block the calling thread until that reply arrives which would be a bad (tm) thing. The good option (which might seem bad at first look at it) is to let the asynchronosity leak out through your layers. So, you make your controller async and you let your service layer return F.Promise. That way you can let your controller method be fully async and react on the boolean arriving and at that point create a http reply.

http://stackoverflow.com/comment/32318687
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21421660
type: AnswerComment
has text: Certainly some businesses do so, just as some are willing to accept a charge without a signature. Check with your processing company and/or bank to find out what additional risks you accept by operating in that less-secure mode... and whether they'll permit you to do it at all.

http://stackoverflow.com/comment/32448693
score: 0
comment on: http://stackoverflow.com/q/21495637
type: Comment
type: QuestionComment
has text: when I insert sid,name in the newuser table,that sid value must be inserted in the sid column of my introducer_table.And this sid can be obtained by using last_insert_id()@nikas tyagi.

http://stackoverflow.com/comment/32405194
has text: still gives same result.
score: 0
comment on: http://stackoverflow.com/a/21470847
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32237865
score: 0
comment on: http://stackoverflow.com/q/21376798
has text: @SilviuBurcea Yes. exactly but i cant for the world understand how to not make it negative :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32445002
has text: It is for a school assignment, and I cannot import the collections package.
comment on: http://stackoverflow.com/q/21493497
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21501828
upvote count: 1
has body: As the accepted answer suggests, looks like a circular reference causing a memory leak.. For anyone who hits similar errors, there's a great Google IO video that does in to a great detail on how to debug and get to the bottom of memory errors. This should give you the tools to get to the bottom of any memory leaks that can't be solved on SO.
downvote count: 0
answers question: http://stackoverflow.com/q/21500213
score: 1
type: Answer

http://stackoverflow.com/q/21387457
tagged with: java
has answer: http://stackoverflow.com/a/21387668
type: Question
tagged with: arrays
has title: iterating dynamically over the list
score: 0
has body: I have a method as shown below: List&lt;AbcObject&gt; aaList= session.createCriteria(AbcObject.class) aaList contains elements like so: t_id value 11 3 12 20 14 60 15 27 -------&gt;(3+20+60+27=100), here min=11 &amp; max=15 18 40 22 20 33 40 45 20 --------&gt;(40+20+40+20=100), here min=18 &amp; max=45 I have to iterate the list such that if the running total of value reaches 100, then an element will be added to another list like so: min max 11 15 18 45 Note that the 100 value on which division is done needs to be configurable. It can also happen that the value of the first element itself is 100. In that case min and max would have the same value. I have come up with the below approach: final int BARRIER = 100; //I am going to assume there are getter methods in your AbcObject and //that all values are greater than 0 List&lt;int[]&gt; minMaxs = new List&lt;int[]&gt;(); int sum = 0; int min = 0; for (AbcObject obj: aaList) { if (sum == 0) { //start over, remember min min = obj.getT_id(); } //add value to sum sum += obj.getValue(); if (sum &gt;= BARRIER) { //now we need to start again, remember what we got minMaxs.add(new int[]{min, obj.getT_id()}); //reset min = 0; sum = 0; } } A different approach I have found is: final int BARRIER = 100; //I am going to assume there are getter methods in your AbcObject and //that all values are greater than 0 List&lt;AbcObject&gt; minMaxs = new List&lt;AbcObject&gt;(); int sum = 0; int min = 0; for (AbcObject obj: aaList) { if (sum == 0) { //start over, remember min min = obj.getT_id(); } //add value to sum sum += obj.getValue(); if (sum &gt;= BARRIER) { //now we need to start again, remember what we got minMaxs.add(new AbcObject(min, obj.getT_id())); //reset min = 0; sum = 0; } } Is there a better approach?
answer count: 1
has comment: http://stackoverflow.com/comment/32259115
has comment: http://stackoverflow.com/comment/32257316
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/32257370
tagged with: list

http://stackoverflow.com/q/21497648
has answer: http://stackoverflow.com/a/21497684
has comment: http://stackoverflow.com/comment/32451950
tagged with: java
has title: Method not returning int
type: Question
downvote count: 0
has body: I don't understand why this method compiles correctly. public int doIt() throws Exception{ //code that does not include a return int statement throw new Exception("something"); } We declared a return type of int so why am I not recieving a warning like: "This method must return a result of type int"?
has answer: http://stackoverflow.com/a/21497667
favorite count: 0
has comment: http://stackoverflow.com/comment/32451922
answer count: 3
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32451953
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21497678

http://stackoverflow.com/a/21492257
score: 2
downvote count: 0
has body: When you have a reference variable of type ExampleInterface, there is no knowledge that it's really an ExampleClass, so there is no guarantee that there is a myOwnMethod to call. You can create another class, SillyExampleClass that implements ExampleInterface, but you don't define a myOwnMethod method there. That's why you can't call myOwnMethod, it may not be there on the actual implementation. If you want to call myOwnMethod() on a reference variable of the ExampleInterface interface, then you include myOwnMethod in the interface definition, because the interface definition specifies what must be in any implementation of the interface.
upvote count: 2
answers question: http://stackoverflow.com/q/21492208
type: Answer

http://stackoverflow.com/q/21421860
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21423197
tagged with: java
has comment: http://stackoverflow.com/comment/32319439
has comment: http://stackoverflow.com/comment/32317792
tagged with: andengine
type: Question
has comment: http://stackoverflow.com/comment/32319491
accepted answer: http://stackoverflow.com/a/21423197
has title: Android AndEngine Tower of Hanoi pop "Game Over" when rings reach 3rd tower
score: 0
answer count: 1
tagged with: towers-of-hanoi
has body: I am unable to successfully output a "Game Over!" when the rings reach the 3rd tower. May I ask your opinion as to how to do this? I followed the tutorials of "http://www.raywenderlich.com/12065/how-to-create-a-simple-android-game" which doesn't include a "Game Over" in it and I'm finding it hard to add one since I'm new to android programming. private void checkForCollisionsWithTowers(Ring ring) { Stack&lt;Ring&gt; stack = null; Sprite tower = null; if(ring.collidesWith(mTower1) &amp;&amp; (mStack1.size() == 0 || ring.getmWeight() &lt; mStack1.peek().getmWeight())) { stack = mStack1; tower = mTower1; } else if(ring.collidesWith(mTower2) &amp;&amp; (mStack2.size() == 0 || ring.getmWeight() &lt; mStack2.peek().getmWeight())) { stack = mStack2; tower = mTower2; } else if(ring.collidesWith(mTower3) &amp;&amp; (mStack3.size() == 0 || ring.getmWeight() &lt; mStack3.peek().getmWeight())) { stack = mStack3; tower = mTower3; } else { stack = ring.getmStack(); tower = ring.getmTower(); } ring.getmStack().remove(ring); if(stack != null &amp;&amp; tower !=null &amp;&amp; stack.size() == 0) { ring.setPosition(tower.getX() + tower.getWidth()/2 - ring.getWidth()/2, tower.getY() + tower.getHeight() - ring.getHeight()); } else if(stack != null &amp;&amp; tower !=null &amp;&amp; stack.size() &gt; 0) { ring.setPosition(tower.getX() + tower.getWidth()/2 - ring.getWidth()/2, stack.peek().getY() - ring.getHeight()); } stack.add(ring); ring.setmStack(stack); ring.setmTower(tower); } }
tagged with: opengl-es-2.0
tagged with: android

http://stackoverflow.com/comment/32568249
type: Comment
comment on: http://stackoverflow.com/a/21418228
score: 0
type: AnswerComment
has text: I believe you have to remove either the `FetchType.EAGER` on `signs`, or the one on `videos`, yes.

http://stackoverflow.com/comment/32248902
type: Comment
type: QuestionComment
has text: @FD_, not really, if the method is inside an Activity or any other class that has valid context.
score: 0
comment on: http://stackoverflow.com/q/21382932

http://stackoverflow.com/a/21377689
has body: You're talking about variable variable name. They're a native feature in PHP, but not in Java, however you can achieve similar functionality using a HashMap, or using Reflection. I'm going to show you the HashMap option, because frankly Reflection is the work of Satan. Example Now the way to implement this is like this: public void someMethod(String name, String value) { values.put(name, value); } And you can retrieve them with public void getValue(String name) { return values.get(name); } I won't write the code for you, because it's a simple transformation to get this to work in your use case. A hint because I'm feeling nice You can replace all of your String variables with a Map implementation. Then simply add the values to the Map, as and when the need arises.
upvote count: 1
has comment: http://stackoverflow.com/comment/32239614
type: Answer
accepted answer of: http://stackoverflow.com/q/21377561
answers question: http://stackoverflow.com/q/21377561
has comment: http://stackoverflow.com/comment/32239726
score: 1
has comment: http://stackoverflow.com/comment/32239645
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21465183
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: java
has comment: http://stackoverflow.com/comment/32434864
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/21476823
has body: I have a simple library which contains this file: import java.util.Date; public class DateUtils { public static Date addDays(Date date, int days) { assert date != null : "Date cannont be null"; return new Date(date.getYear(), date.getMonth(), date.getDate() + days); } } This is run a with gwt. I call this function in the server and in the client. It works perfectly in development mode. When I upload it to gae it only works on the client side. Error log says org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: com/mt/utilities/shared/DateUtils pom.xml added <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mt.ba basicapp 1.0-SNAPSHOT war GWTP Basic with GXT Basic GWTP application with the GXT library <gxt.version>3.0.1</gxt.version> <gwt.version>2.5.1</gwt.version> <gwtp.version>1.1.1</gwtp.version> <gin.version>2.0.0</gin.version> <guice.version>3.0</guice.version> <resteasy.version>3.0.2.Final</resteasy.version> <arcbees.version>1.1.1</arcbees.version> <junit.version>4.11</junit.version> <!-- <jukito.version>1.3</jukito.version> --> <gwt-maven-plugin.version>2.5.1</gwt-maven-plugin.version> <maven-surefire-plugin.version>2.6</maven-surefire-plugin.version> <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version> <maven-resources-plugin.version>2.5</maven-resources-plugin.version> <maven-processor-plugin.version>2.0.5</maven-processor-plugin.version> <maven-build-helper-plugin.version>1.7</maven-build-helper-plugin.version> <target.jdk>1.7</target.jdk> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> ${project.build.directory}/${project.build.finalName} <gae.version>1.8.8</gae.version> <gae.home>${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}</gae.home> <mt.rest>0.3.1</mt.rest> <mt.utilities>0.1.3</mt.utilities> ${webappDirectory}/WEB-INF/classes com.google.appengine appengi…
has comment: http://stackoverflow.com/comment/32417586
has title: LIbrary not loading in gae serverside
score: 0
answer count: 1

http://stackoverflow.com/a/21692841
score: 8
answers question: http://stackoverflow.com/q/21466716
has body: I hit similar problems. I think that part of the problem is trying to live in both worlds. The JBoss Drools eclipse plugin world and the maven world. I have Eclipse 4.3.1 (Kepler) with various Jboss/Drools plugins installed. I took a working eclipse example and made sure I could run it in maven. Created a demo drools project File->New->Other..->Drools->Drools Project Ensured you could run the test programs DroolsTest Converted project to maven project - Configure->Convert To Maven Project (This will create a pom.xml file with many dependencies. These can be prunes) Removed the Drools Library from the build path - in the project properties Build Path -> Libraries - select Drools Library and click Remove Disable the Drools builder - in project properties Builders -> uncheck Drools Builder Comment out dependancy jsr94 from the pom.xml(not retrievable) Run maven from the command line "mvm clean install". This should give you a project that builds and runs entirely from Maven. Add to your pom.xml org.codehaus.mojo exec-maven-plugin 1.2.1 And org.slf4j slf4j-simple 1.7.2 runtime Try: mvn -e exec:java -Dexec.mainClass="com.sample.DroolsTest" It should produce: ... [com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found kmodule: file:/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes/META-INF/kmodule.xml [com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added:FileKieModule[ ReleaseId=x:x:1.0file=/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes] [com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found kmodule: file:/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes/META-INF/kmodule.xml [com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added:FileKieModule[ ReleaseId=x:x:1.0file=/Users/davidbernard/Projects/action-deducing-di…
has comment: http://stackoverflow.com/comment/38673193
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21466716
upvote count: 8
has comment: http://stackoverflow.com/comment/87304038
type: Answer

http://stackoverflow.com/comment/32469850
type: AnswerComment
comment on: http://stackoverflow.com/a/21506088
score: 0
type: Comment
has text: What is that?,how can I try that?

http://stackoverflow.com/comment/32470487
score: 0
type: QuestionComment
type: Comment
has text: Prakash: Where i put these lines?
comment on: http://stackoverflow.com/q/21507813

http://stackoverflow.com/a/21398725
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21398571
has body: Please see java.util.concurrent.CountDownLatch api to achieve this effectively in Java. You can go through this sample article on CountDownLatch to get a gist of its usage.

http://stackoverflow.com/a/21489771
score: 1
answers question: http://stackoverflow.com/q/21489725
has comment: http://stackoverflow.com/comment/32449986
has body: Why would you need to create an actual file? And why would JSON vs XML make a difference? Just write a handler which queries the datastore returns the data directly, in whichever format you need.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32454451
downvote count: 0
has comment: http://stackoverflow.com/comment/32438098

http://stackoverflow.com/q/21402225
has answer: http://stackoverflow.com/a/21404495
score: 0
tagged with: android
has body: I'm learning about HTML and parsing data with XML DOM. For this, I've created an App that reads the Wheater from Yahoo's wheater API. When executing the app, shows an error in the logcat that says: java.lang.RuntimeException: Can't create handler inside thread that has not caller Looper.prepare(). I don't know what this means, or if the code is right. This is the link to the XML file of Yahoo's wheater API: http://weather.yahooapis.com/forecastrss?w=766273&amp;u=c And this is my code: public class WeatherActivity extends Activity { private static final String WEATHER_URL = "http://weather.yahooapis.com/forecastjson?w="; private static final String MADRID_CODE = "766273"; private static final String LOCATION_NAME = "location"; private static final String CITY_NAME = "city"; private static final String CONDITION_NAME = "condition"; private static final String TEMPERATURE_NAME = "temperature"; private static final String FORECAST_NAME = "forecast"; private static final String DAY_NAME = "day"; private static final String HIGH_TEMPERATURE_NAME = "high_temperature"; private static final String LOW_TEMPERATURE_NAME = "low_temperature"; private static final String TODAY = "Today"; private static final String TOMORROW = "Tomorrow"; private Button mButton; private TextView mCity; private TextView mToday; private TextView mTomorrow; private class WeatherInfo { String city; int temperatureNow; int lowTemperature; int highTemperature; int lowTemperatureTomorrow; int highTemperatureTomorrow; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mCity = (TextView) findViewById(R.id.city); mToday = (TextView) findViewById(R.id.today); mTomorrow = (TextView) findViewById(R.id.tomorrow); mButton = (Button) findViewById(R.id.button); mButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { launch(); } }); } private void launch(){ try { new WeatherAsyncTask().execute(MADRID_CODE…
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/21402397
accepted answer: http://stackoverflow.com/a/21402397
type: AnsweredQuestion
tagged with: java
has title: Looper in AsyncTask
tagged with: dom
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21404495

http://stackoverflow.com/q/21387557
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21387849
tagged with: numbers
tagged with: algorithm
tagged with: binaryformatter
tagged with: java
has comment: http://stackoverflow.com/comment/32262981
has comment: http://stackoverflow.com/comment/32266406
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32258271
has answer: http://stackoverflow.com/a/21387849
type: Question
has title: Manually convert float point number into binary format
has comment: http://stackoverflow.com/comment/32260617
score: 1
tagged with: binary
has body: Hi I have following float point value in base 10: 0.625. I need to convert this value in base 10 to binary format which is: 0.101. Algorithm I found is below. It works, but I am not understanding why this works. Could someone please explain to be why the code below works? I am aware that numbers after the decimal point is computed in the manner such that 1/2^n where n is count from the decimal point. Thanks. To clarify, I need to know the reasoning behind the mathematical formula. Not stepping through the code. private static String floatToBinaryString( double n ) { String val = "0."; while ( n &gt; 0 ) { double r = n * 2; if( r &gt;= 1 ) { val += "1"; n = r - 1; }else{ val += "0"; n = r; } } return val; }

http://stackoverflow.com/comment/32422645
comment on: http://stackoverflow.com/q/21481490
score: 1
type: Comment
type: QuestionComment
has text: You're going to have to provide a lot more information. For instance, what does getM(), getC() and getB() return? Was equals() overridden for whatever these functions return?

http://stackoverflow.com/comment/32394586
score: 0
type: AnswerComment
has text: giving an error on the regex. some character is not properly escaped.
type: Comment
comment on: http://stackoverflow.com/a/21465266

http://stackoverflow.com/q/21501690
tagged with: android
tagged with: uuid
score: 0
has answer: http://stackoverflow.com/a/21502265
has comment: http://stackoverflow.com/comment/32459209
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: Send post notification to specific UUID android device
has body: I'm trying to find some ways to send a post notification to specific android device using its UUID , so I will do the following : 1 : login screen on android and then get UUID number from the device 2 : send this UUID to online database linked to userID 3 : I want to know how to send post notification to a specific UUID which I get from my database ?
tagged with: notifications
type: Question

http://stackoverflow.com/a/21429854
has comment: http://stackoverflow.com/comment/32332988
has comment: http://stackoverflow.com/comment/32331869
answers question: http://stackoverflow.com/q/21429749
score: 0
has body: Yes, you need a loop. Try this code below. Also note the presence of console.nextLine(); after console.nextDouble(); and console.nextInt();. public static void main(String[] args) { String firstName, lastName; double payRate; int hoursWorked; double netPay; double grossPay; String formatNet; while (true){ System.out.println("Please enter the employee's name. (Enter a -1 when finished): "); firstName = console.nextLine(); if ("-1".equals(firstName.trim())) break; lastName = console.nextLine(); System.out.println("Please enter the employee's pay rate. "); payRate = console.nextDouble(); console.nextLine(); System.out.println("Please enter the employee's hours worked. "); hoursWorked = console.nextInt(); console.nextLine(); if (hoursWorked &gt; 40) { grossPay = payRate * hoursWorked * 1.5; } else { grossPay = payRate * hoursWorked; } netPay = grossPay - (grossPay * .15); formatNet = String.format("%.2f", netPay); System.out.println(firstName + " " + lastName + "'s net pay is " + formatNet); } }
has comment: http://stackoverflow.com/comment/32332393
has comment: http://stackoverflow.com/comment/32332791
type: Answer
has comment: http://stackoverflow.com/comment/32332136

http://stackoverflow.com/a/21482182
answers question: http://stackoverflow.com/q/21482093
downvote count: 1
has comment: http://stackoverflow.com/comment/70057284
has comment: http://stackoverflow.com/comment/70072899
has body: Check the 'host' request header. Most client add that header to indicate the host they're trying to contact. This is the same header that's used for VirtualHosts, so it's pretty standard. It's also obligatory in HTTP1.1 requests. In fact, you cannot get the value purely from the server side, since it's possible that the user has defined its own hostname for your server. request.getHeader("Host") If your server is behind an apache reserve proxy, use the ProxyPreserveHost directive to make sure the Host header is kept intact. I'm sure other reverse proxies have similar options.
has comment: http://stackoverflow.com/comment/32472409
upvote count: 8
has comment: http://stackoverflow.com/comment/94562481
type: Answer
has comment: http://stackoverflow.com/comment/94758843
has comment: http://stackoverflow.com/comment/32426257
score: 7

http://stackoverflow.com/a/61618504
type: Answer
has body: If you need to get the last N number of elements. Closure can be used. The below code maintains an external queue of fixed size until, the stream reaches the end. final Queue&lt;Integer&gt; queue = new LinkedList&lt;&gt;(); final int N=5; list.stream().peek((z) -&gt; { queue.offer(z); if (queue.size() &gt; N) queue.poll(); }).count(); Another option could be to use reduce operation using identity as a Queue. final int lastN=3; Queue&lt;Integer&gt; reduce1 = list.stream() .reduce( (Queue&lt;Integer&gt;)new LinkedList&lt;Integer&gt;(), (m, n) -&gt; { m.offer(n); if (m.size() &gt; lastN) m.poll(); return m; }, (m, n) -&gt; m); System.out.println("reduce1 = " + reduce1);
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/21426843
upvote count: 0

http://stackoverflow.com/comment/32414131
comment on: http://stackoverflow.com/a/21472728
has text: You still need to add that new image to the JPanel like you are with the other images. Please edit your question so it has your newest code.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32418467
comment on: http://stackoverflow.com/q/21478873
has text: @user3044181 So basically you want to match them and put them in an array and do nothing with the input (variable `a` in this case) ? I think you should just check out the manual or fire some queries to your favorite search engine and use `\\d+(?=!)` as your pattern. Note that in Java you need to escape the backslash.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32411782
has text: @epoch Oops, my mistake on the naming sloppiness. Thanks for pointing that out.
score: 0
comment on: http://stackoverflow.com/q/21475002
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32280656
comment on: http://stackoverflow.com/q/21400515
has text: Firstly i would say to add the facebook sdk in your project as library and do not add the support library explicitly in your project just remove it if you have added. And then after adding sdk clean and build your project. In this way do you get any error ? @InnocentKiller
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32306629
comment on: http://stackoverflow.com/a/21414920
type: AnswerComment
score: 0
has text: is the same as yours!
type: Comment

http://stackoverflow.com/q/21452282
has answer: http://stackoverflow.com/a/21454251
answer count: 2
has comment: http://stackoverflow.com/comment/32372130
has comment: http://stackoverflow.com/comment/32371822
upvote count: 1
has comment: http://stackoverflow.com/comment/32371978
downvote count: 0
tagged with: string
linked to: http://stackoverflow.com/q/1311037
tagged with: parsing
favorite count: 0
has title: Parsing escaped space in java
has answer: http://stackoverflow.com/a/21453618
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32371764
tagged with: regex
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34871284
type: Question
has comment: http://stackoverflow.com/comment/32372073
has body: I need to mimic the operation of a terminal. So for example, if I have "a quoted string" anotherParam I want to get ["a quoted string", "anotherParam"] test\ folder somethingElse shoould become ["test folder", somethingElse] How can I do it? I have been trying regex but cant seem to get it right ... the main problem being differenciating spaces, indicating next parameter, and escaped spaces which should become the same parameter By the way, I can't use libraries only java provided classes The current code uses [^\s]+ So it considers anything thats not space a token, is it possible to include escaped spaces? Or perhaps theres a better way around this?
has comment: http://stackoverflow.com/comment/32372151

http://stackoverflow.com/comment/32214130
score: 0
type: Comment
type: QuestionComment
has text: @dasblinkenlight: Having such a method is fine, but the naming is very misleading. Let's forget it and use Guava's [Splitter](http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/base/Splitter.html).
comment on: http://stackoverflow.com/q/21359403

http://stackoverflow.com/q/21497934
has answer: http://stackoverflow.com/a/21497939
accepted answer: http://stackoverflow.com/a/21497939
has title: <Identifier> Expected- Having major difficulty, New to coding
score: 0
possible better answer: http://stackoverflow.com/a/21497970
has body: class Maths{ // Attributes of maths private int num1; private int num2; //Constructor public Maths ***- This is where the error is*** { add = a; subtract = s; multiply = m; divide = d; } //Get me some Accessors public String getAdd() { return add; } public string getSubtract() { return subtract; } public String getMultiply() { return multiply; } public String getDivide() { return divide; } } } Alright so I'm new to programming, Absolutely newborn. I'm really not sure what to do for this. I need to "Write a class called Maths. It has 2 attributes called num1 and num2. It has a constructor. It will have methods called Add(), subtract(), multiply() and divide().(Hint: integer division use modulus operator). Most of these methods return the result. Write all the getters and setters and a toString() method."
has comment: http://stackoverflow.com/comment/32452432
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21497970
type: Question
answer count: 2

http://stackoverflow.com/q/21392550
has body: Consider the class Foo. public class Foo { private double size; public double getSize() { return this.size; // Always O(1) } } Foo has a property called size, which is frequently accessed, but never modified, by a given method. I've always cached a property in a variable whenever it is accessed more than once in any method, because "someone told me so" without giving it much thought. i.e. public void test(Foo foo) { double size = foo.getSize(); // Cache it or not? // size will be referenced in several places later on. } Is this worth it, or an overkill? If I don't cache it, are modern compilers smart enough to cache it themselves?
score: 12
type: Question
possible better answer: http://stackoverflow.com/a/21392620
accepted answer: http://stackoverflow.com/a/21393851
has answer: http://stackoverflow.com/a/21392620
upvote count: 13
answer count: 6
tagged with: coding-style
has comment: http://stackoverflow.com/comment/32266634
tagged with: java
has comment: http://stackoverflow.com/comment/32266767
downvote count: 1
has answer: http://stackoverflow.com/a/21610556
has title: Do You Cache Properties in Local Variables?
tagged with: caching
has comment: http://stackoverflow.com/comment/32266675
has answer: http://stackoverflow.com/a/21393851
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21530185
has answer: http://stackoverflow.com/a/21490470
has answer: http://stackoverflow.com/a/21518893
favorite count: 0

http://stackoverflow.com/comment/32324540
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21425008
has text: If i have a the dbconnection and exception management code in the Servlet(Controller). I could configure my web.xml to redirect to some error page. I have this under model class.

http://stackoverflow.com/q/21362562
type: Question
has answer: http://stackoverflow.com/a/21362600
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/32212489
score: 0
answer count: 2
has title: How to close a Database connection with a button
has body: I would like to know how I can close a database connection after I have finished using it with a push of a button (key binding). Here's what I got: public static void main(String[] argv) { System.out.println("-------- MySQL JDBC Connection Testing ------------"); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); return; } System.out.println("MySQL JDBC Driver Registered!"); Connection connection = null; try { connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_test14", "root", "password"); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } if (connection != null) { System.out.println("Connection to DB Success!"); } else { System.out.println("Failed to make connection!"); } System.out.println("\n" + "----------- Database Results ------------" + "\n"); try { Statement stmt = connection.createStatement(); String sql = "SELECT * FROM first_table"; ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { int id_col = rs.getInt("id"); String name = rs.getString("name"); String address = rs.getString("address"); String p = id_col + " " + name + " " + address; System.out.println(p); } } catch (SQLException e) { e.printStackTrace(); } } } Do I have to add in the close connection after my query statements? Would appreciate some help on this.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32211939
has answer: http://stackoverflow.com/a/21363006
tagged with: database-connection

http://stackoverflow.com/comment/32349215
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21439619
type: QuestionComment
has text: not variable width collumns. If you changed it since it is n by m grid it would change the orientation which wouldn't be desirable

http://stackoverflow.com/comment/32346333
has text: Thanks a lot, but what base url should I use if my Apps name is NeverEver and the package is com.example.nevereversecond. If I use: view.loadDataWithBaseURL("nevereversecond://com.example.nevereversecond/", content, null, "UTF-8", null); I get the same error as the previous.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21437359

http://stackoverflow.com/comment/32215950
comment on: http://stackoverflow.com/a/21364101
type: AnswerComment
score: 0
type: Comment
has text: I think you should still put the drawing code in the `PaintListener`, and work out how to get it to draw what you want in the logic of your code. For example, if what needs to be drawn depends on a boolean value, you can check it from `paintControl()` and draw the appropriate content.

http://stackoverflow.com/a/21417564
answers question: http://stackoverflow.com/q/21417407
has body: These three lines cause the error: while (in.read()!= -1); // this reads until EOF seller = in.readLine(); // this gets a null-pointer since we're behind EOF price = Double.parseDouble(in.readLine()); // same as above, This is the printed error. That should probably be: seller = in.readLine(); // first line: seller price = Double.parseDouble(in.readLine()); // second line: price This can be improved: seller = in.readLine(); // first line: seller String sPrice = in.readLine(); // second line: price if ( sPrice != null ) price = Double.parseDouble(sPrice);
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/21417407
has comment: http://stackoverflow.com/comment/32311431

http://stackoverflow.com/q/21367875
has comment: http://stackoverflow.com/comment/32221550
has answer: http://stackoverflow.com/a/21368057
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21368215
accepted answer: http://stackoverflow.com/a/21368215
possible better answer: http://stackoverflow.com/a/21368057
score: -1
downvote count: 2
upvote count: 1
has title: How long the activity was open?
tagged with: android-activity
has comment: http://stackoverflow.com/comment/32221697
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/32221624
tagged with: time
tagged with: android
has body: I'm new in android programming and I'm making a very simple app. I only have one text view and one button, and when I click the button I want to show in the text view a value that represents how long the activity was open. this is my xml file: &lt;Button android:id = "@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Button" /&gt; &lt;TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button" android:layout_centerHorizontal="true" android:text=" " /&gt; &lt;/RelativeLayout&gt; and this is my java file: package com.diogoc.teste; 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.TextView; public class MainActivity extends Activity { TextView textView; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.textView); button = (Button) findViewById(R.id.button); button.setOnClickListener(Listener); } @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 OnClickListener Listener = new OnClickListener() { public void onClick(View v) { //It's here textView.setText("You take"); } }; } Thank you.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/32332059
has text: Simply create a wrapper class that contains your expected data and two more: a boolean that signals success download and a String, fail reason. When you're making the request construct this wrapper object. If the response is successful set the data to what you received and the flag to true. If request failed, set the flag to false and the fail message to something meaningful. In `onLoadFinished` you would check first what is the value of the flag and then decide: get the data and show it or show the fail message. Makes sense?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21425042

http://stackoverflow.com/comment/32313028
has text: Though the true answer to this question may be one only the Java designers can give. ; )
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21418802

http://stackoverflow.com/comment/32386429
comment on: http://stackoverflow.com/a/21454294
type: Comment
has text: Could you please give more details on the usage of 'clearProperties()' method ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32347785
comment on: http://stackoverflow.com/a/21438891
has text: For smaller numbers, the difference in efficiency is likely to be invisible. Given a library with access to a square root function, it will be easier to check for the square root than the prime. If you are doing something more advanced where efficiency matters and you are providing your own libraries, you could look into using a sieve of eratosthenes that you compute at startup and then checking for prime becomes O(1).
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/99792566
type: AnswerComment
type: Comment
has text: This should be an accepted answer
comment on: http://stackoverflow.com/a/56028497
score: 1

http://stackoverflow.com/q/21407876
has body: I am learning Android development using a lynda video tutorial. i am adding the Google-Play-servies to create a maps. i did according to the tutorial, eclipse didn't show any errors but when i try to run it on my emulator and my device. it gives an error unfortunately Mymaps has stopped. i have added the error and my code below. can anyone tell me how to over come this error. Thank you. error is 01-28 14:04:55.650: D/AndroidRuntime(1045): Shutting down VM 01-28 14:04:55.693: W/dalvikvm(1045): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 01-28 14:04:55.730: E/AndroidRuntime(1045): FATAL EXCEPTION: main 01-28 14:04:55.730: E/AndroidRuntime(1045): java.lang.RuntimeException: Unable to start activity ComponentInfo{lk.adspace.jaffnatemples/lk.adspace.jaffnatemples.MainActivity}: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 0. You must have the following declaration within the element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.app.ActivityThread.access$600(ActivityThread.java:141) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.os.Handler.dispatchMessage(Handler.java:99) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.os.Looper.loop(Looper.java:137) 01-28 14:04:55.730: E/AndroidRuntime(1045): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-28 14:04:55.730: E/AndroidRuntime(1045): at java.lang.reflect.Method.invokeNative(Native Method) 01-28 14:0…
has comment: http://stackoverflow.com/comment/32293014
linked to: http://stackoverflow.com/q/19723811
type: Question
answer count: 1
favorite count: 0
tagged with: android
upvote count: 2
score: 1
has title: unfortunately my maps has stopped working. Android
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32343612
tagged with: java
has answer: http://stackoverflow.com/a/21407987
accepted answer: http://stackoverflow.com/a/21407987

http://stackoverflow.com/comment/54271267
score: 0
has text: @SaravanaKumarChinnaraj Thanks for spell/grammar checking for me shows you have a lot of time on your hands. Wish I could say the same! user1736258 I think your post was the only helpful one everyone else seemed to be more concerned how its too "broad". Cause its broad I was in the design stage not knowing how im going to solve the issue yet. That's what programming is about. So when someone asks you to create a system but doesn't give enough detail and their too "broad" then lets see if you keep your job..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21480591

http://stackoverflow.com/a/21463849
accepted answer of: http://stackoverflow.com/q/21463287
answers question: http://stackoverflow.com/q/21463287
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: AggregationStrategy::aggregate() is called for every exchange that matches your correlation expression. The correlation expression is used to, well, correlate incoming messages. I.e. to determine what bigger entity the incoming message is a part of. If the pieces of the bigger entity come in interspersed, then you might be assembling multiple entities in parallel and the correlation expression will keep them apart. The completion size is one way to tell the aggregator that the bigger entity you are assembling is complete and that it should continue the aggregated exchange along the route. See chapter "About completion" on this page. AggregationStrategy::aggregate() is called for every incoming message that matches your correlation expression. Also have a look at this example.
type: AcceptedAnswer

http://stackoverflow.com/a/21499553
type: Answer
answers question: http://stackoverflow.com/q/21499424
has body: You are not instantiate your NoteDao object. please update your code like this: public NotesDao datasource=new NotesDao();
score: 0

http://stackoverflow.com/a/21497353
downvote count: 0
has comment: http://stackoverflow.com/comment/32457727
has comment: http://stackoverflow.com/comment/32459557
accepted answer of: http://stackoverflow.com/q/21497120
answers question: http://stackoverflow.com/q/21497120
has comment: http://stackoverflow.com/comment/32456905
has comment: http://stackoverflow.com/comment/32458834
has comment: http://stackoverflow.com/comment/32459340
upvote count: 2
has comment: http://stackoverflow.com/comment/32459802
has comment: http://stackoverflow.com/comment/32459378
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32459530
has comment: http://stackoverflow.com/comment/32456328
has body: More context would be nice, but you can easily make a way to track what buttons has been pressed storing the information you need (last button pressed instance, a counter of how many times was pressed, or an array with the last events...). Something like: private JButton _lastButtonPressed; void actionPerformed(ActionEvent event) { JButton buttonPressed = (JButton) event.getSource(); if (_lastButtonPressed == buttonPressed) { //The same button was clicked two+ times in a row } else { //code for handling single button presses } _lastButtonPressed = buttonPressed; } UPDATE Here's a simple executable program that makes use of the code above. The actionListener is able to know how many times in a row a Button has been pressed. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; public class ButtonTestFrame implements ActionListener { public static final void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new ButtonTestFrame(); } }); } public ButtonTestFrame() { _frame = new JFrame(); _frame.setTitle("Button test frame"); _textArea = new JTextArea("Press some buttons:\n"); _textArea.setEditable(false); _frame.add(new JScrollPane(_textArea)); JPanel buttonsPanel = new JPanel(new GridLayout(1, 3, 1, 1)); _buttonA = new JButton("Button A"); _buttonA.addActionListener(this); _buttonB = new JButton("Button B"); _buttonB.addActionListener(this); _buttonC = new JButton("Button C"); _buttonC.addActionListener(this); buttonsPanel.add(_buttonA); buttonsPanel.add(_buttonB); buttonsPanel.add(_buttonC); _frame.add(buttonsPanel, BorderLayout.SOUTH); _frame.setPreferredSize(new Dimension(600,400)); _frame.pack(); _frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE…
has comment: http://stackoverflow.com/comment/32459746
type: Answer
has comment: http://stackoverflow.com/comment/32459474
score: 2

http://stackoverflow.com/a/21480263
score: 3
has comment: http://stackoverflow.com/comment/50517329
upvote count: 4
has body: Use this: ImageButton image1 = (ImageButton) solo.getView("pf_topbarCalender"); solo.clickOnImageButton(image1); or View view = solo.getView("pf_topbarCalender"); solo.clickOnView(view);
answers question: http://stackoverflow.com/q/21479646
type: Answer
downvote count: 1

http://stackoverflow.com/comment/32216620
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21365248
has text: lol..nice reply ;) so that means its not possible.
score: 0

http://stackoverflow.com/a/21478361
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21478285
has body: You cannot use the runas /user:administrator approach, as that requires a password input which you cannot provide from an external source (such as a Java application) for security reasons. I had a similar issue to you in the past, and I solved it using PsExec, running the process on localhost with an administrator username and password allowed me to execute external applications as an administrator. Using your example you could run: PsExec.exe \\\\127.0.0.1 /accepteula -u USER -p PASSWORD notepad.exe The "/accepteula" flag prevents the requirement to accept the EULA interactively when run on a machine for the first time. This approach may require a bit of tweaking to get working with your setup, but hope it gives you a starting point.
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/21460800
type: Question
has title: compare 2 strings, see if they are containing common items or not
possible better answer: http://stackoverflow.com/a/21461184
tagged with: list
has answer: http://stackoverflow.com/a/21461184
score: 0
has body: say i have 2 strings, Boolean hasName = false; String employeeNames = "lee,anne,peter,sam,paul"; String managerNames = "ken,lee,sue,tim,alex"; so, what s the best way to iterate through 2 strings and find out both strings contains "lee", then i can set hasName = true; these are just a simple sample.. i dont want answer such as employeeNames.contains("lee") or something like that, because my data in real product are all dynamic and can be very long string...i wont know what i am getting, but as soon as i received 2 strings, i need to find out they r contianning at least one common item or not... what is the best way to this algrothoim? one more thing , the items in string all separete by "," so is there anything i can do ? thanks
tagged with: java
has answer: http://stackoverflow.com/a/21460968
has comment: http://stackoverflow.com/comment/32386475
has answer: http://stackoverflow.com/a/21461266
has answer: http://stackoverflow.com/a/21461250
answer count: 5
tagged with: boolean
has comment: http://stackoverflow.com/comment/32386303
type: AnsweredQuestion
tagged with: compare
accepted answer: http://stackoverflow.com/a/21460968
linked to: http://stackoverflow.com/q/7574311
has comment: http://stackoverflow.com/comment/32386301
tagged with: string
has answer: http://stackoverflow.com/a/21461044

http://stackoverflow.com/a/21482322
answers question: http://stackoverflow.com/q/21482078
has body: A simple TreeSet (assuming you have distinct dates) using a Comparator comparing the dateTime.getMillis() of each date for instance would do the trick. And better, why not use directly this "out-of-the-box" Comparator ;) Up to you to implement the exact logic you want. (ascendant, descendant, whatever)
score: 0
type: Answer

http://stackoverflow.com/comment/32386232
score: 0
type: Comment
type: QuestionComment
has text: Yes. The main problem is "InitialContext cannot be resolved to a type".
comment on: http://stackoverflow.com/q/21460527

http://stackoverflow.com/comment/32365927
type: AnswerComment
score: 0
type: Comment
has text: And yes - I mixed up the ArrayList names. It should be: ArrayList fib = new ArrayList();
comment on: http://stackoverflow.com/a/21448734

http://stackoverflow.com/q/21469108
tagged with: java
has comment: http://stackoverflow.com/comment/32401947
type: Question
possible better answer: http://stackoverflow.com/a/21469272
answer count: 2
has body: Okay so I have a shape arraylist containing a rectangle. How would i obtain the x coordinate of that rectangle from the arraylist? I think i didn't make it clear so here it is: So here is the arraylist: ArrayList&lt;Shape&gt; shapes = new ArrayList&lt;Shape&gt;() ; Creating the shape: Shape rec1 = new Rectangle(100,100,200,200); shapes.add(rec1); now how can i get the x coordinate? I tried: Shape j = (Shape)shapes.get(i); j.getX() But that didn't work.. error: cannot find symbol
has answer: http://stackoverflow.com/a/21469383
score: 0
has comment: http://stackoverflow.com/comment/32402151
has comment: http://stackoverflow.com/comment/32402000
has comment: http://stackoverflow.com/comment/32401949
has comment: http://stackoverflow.com/comment/32402061
tagged with: shapes
accepted answer: http://stackoverflow.com/a/21469383
has comment: http://stackoverflow.com/comment/32402030
has comment: http://stackoverflow.com/comment/32402104
has comment: http://stackoverflow.com/comment/32401961
has title: How would i getX() from a rectangle in a shape array list
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21469272

http://stackoverflow.com/a/21434255
type: Answer
has body: Although it's legal to overload methods in WSLD, but WS-I basic profile disallows this feature. AXIS, JAX-WS, CXF, Spring and some other frameworks claims to be compliant with basic profile. Whoever created this WSDL probably doesn't work with java/BP compliant web services, if you're stuck with these frameworks you'll have to modify WSDL.
answers question: http://stackoverflow.com/q/21409574
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21409574
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32250152
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21383649
has text: If you think about what the difference would be in interpreting 0 as octal or deciaml or binary or whatever, you have answered your question.

http://stackoverflow.com/a/23743411
type: Answer
answers question: http://stackoverflow.com/q/21383139
score: 0
has body: Yes in case of List&lt;? extends Number&gt; this is just a reference, may be the actual object will be List&lt;Integer&gt; so you should not be allowed to add new Double(5.0) in a list of Integer.

http://stackoverflow.com/comment/32373679
type: AnswerComment
score: 0
type: Comment
has text: @Kamlesh Can you please explain about it?
comment on: http://stackoverflow.com/a/21453477

http://stackoverflow.com/q/21443320
type: Question
has answer: http://stackoverflow.com/a/21443353
linked to: http://stackoverflow.com/q/4235487
has comment: http://stackoverflow.com/comment/32356021
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21443353
favorite count: 0
tagged with: multithreading
has body: public static void main(String[] args) throws Exception { new Thread(new Runnable() { public void run() { while(true) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Hello"); } } }).run(); System.out.println("Bye"); } In the main thead, I create a new thread, which will print "hello" every second. Why the final "Bye" never got print? In the other word, why the child thread blocks the main thread?
has title: child thread blocks parent thread in java
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/32442578
comment on: http://stackoverflow.com/a/21491817
type: Comment
has text: Yep, that's the functionality I was missing. I didn't know about lookaheads or look behinds. It's been a few years since I worked with regex and Im not sure I ever used those! But thanks very much!
score: 0
type: AnswerComment

http://stackoverflow.com/q/21477908
favorite count: 0
linked to: http://stackoverflow.com/q/6784463
has comment: http://stackoverflow.com/comment/32416794
has comment: http://stackoverflow.com/comment/32416796
has comment: http://stackoverflow.com/comment/32416754
has answer: http://stackoverflow.com/a/21478156
accepted answer: http://stackoverflow.com/a/21478156
type: AnsweredQuestion
downvote count: 0
has body: I need to connect to a URL over HTTPS using Java. I don't have any experience with SSL certificates, and most of the questions here assume some basic knowledge. I was hoping someone here could get me started on the basics. When I put the URL in my browser, it connects just fine. When I do it using Java: new URL("https://mysite.com/").openStream() it throws 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 This question shows how to ignore the whole certificate thing, but that doesn't feel right. I simply want to use the same certificate my browser does. I've already tried adding the -Djavax.net.ssl.trustStore=cacerts property, which changes the exception to javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty, which I've taken from this question to mean it can't find the trust store called cacerts. I'm not sure what else to specify, though.
score: 1
tagged with: java
tagged with: ssl
type: Question
has title: Connecting via SSL with Java: The basics
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/13022717

http://stackoverflow.com/q/21428050
linked to: http://stackoverflow.com/q/70198536
has title: Load random Image from a directory using javafx
accepted answer: http://stackoverflow.com/a/21441955
tagged with: random
answer count: 3
has body: How can I load a random image from a directory using javafx, (the files located in the directory have different names) Currently I am using the following to load a specific file String image = JavaFXApplication4.class.getResource("/Images/Blue-Wallpaper.jpg").toExternalForm();
has answer: http://stackoverflow.com/a/21441955
has answer: http://stackoverflow.com/a/21433888
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21433849
score: 0
tagged with: java
tagged with: javafx
type: Question
possible better answer: http://stackoverflow.com/a/21433849

http://stackoverflow.com/a/21406600
accepted answer of: http://stackoverflow.com/q/21406265
score: 183
has comment: http://stackoverflow.com/comment/95097373
has body: The -P flag is for gradle properties, and the -D flag is for JVM properties. Because the test may be forked in a new JVM, the -D argument passed to gradle will not be propagated to the test - it sounds like that is the behavior you are seeing. You can use the systemProperty in your test block as you have done but base it on the incoming gradle property by passing it with it -P: test { systemProperty "cassandra.ip", project.getProperty("cassandra.ip") } or alternatively, if you are passing it in via -D test { systemProperty "cassandra.ip", System.getProperty("cassandra.ip") }
has comment: http://stackoverflow.com/comment/91369884
has comment: http://stackoverflow.com/comment/89485521
type: Answer
upvote count: 183
has comment: http://stackoverflow.com/comment/95151814
downvote count: 0
has comment: http://stackoverflow.com/comment/90190226
answers question: http://stackoverflow.com/q/21406265
type: AcceptedAnswer

http://stackoverflow.com/comment/32428097
has text: What's wrong with what you have? You're just delegating.
comment on: http://stackoverflow.com/q/21484584
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21385327
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/21384601
type: Answer
answers question: http://stackoverflow.com/q/21384601
has body: Here should be the approach - strToEncrypt = the file content (lets suppose) You should use the cipher.getOutputSize(strToEncrypt.getBytes().length) to get output estimate of the file. Now this is tricky - and you should run some sample codes to determine the file size when some number of bytes are written. Windows can give a different estimate of file size whereas UNIX will give your the correct file size (in terms of byte length you get from this code) Once you get the estimate of the byte array size - you can use java.io.File to get the size and calculate the % out of it.

http://stackoverflow.com/comment/32317359
comment on: http://stackoverflow.com/a/21421550
type: Comment
has text: @DavidWallace: This sounds like the opposite problem - too much space for elements, and you have to print out everything but the stuff that isn't there.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32268979
type: AnswerComment
has text: can't use date either.
type: Comment
comment on: http://stackoverflow.com/a/21393796
score: 0

http://stackoverflow.com/comment/32323587
type: Comment
comment on: http://stackoverflow.com/a/21425360
score: 0
type: AnswerComment
has text: can you explain it a bit please why we use \\w+ and what is $1 and *(\\w+)

http://stackoverflow.com/comment/32280454
type: QuestionComment
type: Comment
has text: please read the question i have mentioned what i have tried and where i am facing the issue. Thanks.
comment on: http://stackoverflow.com/q/21400661
score: 0

http://stackoverflow.com/a/78910441
answers question: http://stackoverflow.com/q/21429269
score: 1
upvote count: 1
has body: The ref to StringBuilder is NOT still on the operand stack nor would be anything else pushed in this method; catching an exception clears the operand stack before pushing only the exception (reference). See e.g. for Java 8 which was current in 2014, but this is the same in other versions. It applies equally to methods which may be called with values 'hanging about' on the operand stack, as constructors always are; to extend your example (and make the output more obvious): public class SO21429269 { public static void main(String[] args) { StringBuilder sb = null; try { sb = new StringBuilder(null); } catch (NullPointerException t) { System.out.println(t); } System.out.println(sb); one(); two(); } public static void one () { for( int i = 0; i <= 2; i++ ) try{ System.out.println( i + 0 * "\2\4".charAt(i) ); }catch (IndexOutOfBoundsException e){ System.out.println ( i + ":" + e ); } } public static void two () { for( int i = 0; i <= 2; i++ ) try{ System.out.println( "foobar".substring( "\2\4".charAt(i) ) ); }catch (IndexOutOfBoundsException e){ System.out.println ( i + ":" + e ); } } } gives in javap -c -p public static void main(java.lang.String[]); Code: 0: aconst_null 1: astore_1 2: new #2 // class java/lang/StringBuilder 5: dup 6: aconst_null 7: invokespecial #3 // Method java/lang/StringBuilder."<init>":(Ljava/lang/String;)V 10: astore_1 11: goto 22 14: astore_2 15: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream; 18: aload_2 19: invokevirtual #6 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V 22: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream; 25: aload_1 26: invokevirtual #6 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V 29: invokestatic #7 // Method one:()V 32: invokestatic #8 // Method two:()V 35: return Exception table: from to target type 2 11 14 Class java/lang/NullPointerException public static void one(); Code: 0: iconst_0 1: istore_0 2: iload_0 3: iconst_2 4: if_icmpgt 62 7: getstatic #5 // Field j…
type: Answer
downvote count: 0

http://stackoverflow.com/a/21509840
type: Answer
accepted answer of: http://stackoverflow.com/q/21509751
answers question: http://stackoverflow.com/q/21509751
has body: String is immutable, so you can't change any text in it. So you can use StringBuilder to store result. See below code. public static String belrusToEngTranlit (String text){ char[] abcCyr = {'a','б','в','г','д','ё','ж','з','и','к','л','м','н','п','р','с','т','у','ў','ф','х','ц','ш','щ','ы','э','ю','я'}; String[] abcLat = {"a","b","v","g","d","jo","zh","z","i","k","l","m","n","p","r","s","t","u","w","f","h","ts","sh","sch","","e","ju","ja"}; StringBuilder builder = new StringBuilder(); for (int i = 0; i &lt; text.length(); i++) { for(int x = 0; x &lt; abcCyr.length; x++ ) if (text.charAt(i) == abcCyr[x]) { builder.append(abcLat[x]); } } return builder.toString(); }
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32210453
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21361694
has text: That allows nothing but dots.
score: 0

http://stackoverflow.com/q/21363205
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: An Optimal way to send huge text data across the network
type: Question
has comment: http://stackoverflow.com/comment/32232607
tagged with: network-programming
tagged with: javascript
has body: I have built a GUI which works through the browser. It has drag-n-drop facilities and it prepares an XML when all the attributes have to initialized to it. I can relate the system similar to this online drawing tool available : https://www.draw.io Its working perfectly as of now, but there is a problem while saving the XML. As of now, I am dynamically creating a form through Javascript and sending the information in the form of an HTTPRequest. It works well when the XML is small (around 5-6 Mb in size). Off late, the XML size has increased several folds (around 80-100 Mb) and the GUI hangs frequently due to this. It takes 8-10 minutes to send the data across the network and sometimes the browser shuts down automatically after being unresponsive for long duration, thereby thwarting the efforts that the user has put in to create the XML in GUI. I am using Java in the controller's end. When the user saves the XML, it is passed through the dynamically created HTML form to the backend which is accessed by a Java Controller. I require a better mechanism since sending the entire 80 Mb XML data as an HTTPRequest is becoming extremely cumbersome. Any suggestions to improve it will be welcome. Thanks a lot..
has comment: http://stackoverflow.com/comment/32214026
score: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/32260477

http://stackoverflow.com/a/21399323
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21399247
downvote count: 0
score: 1
has body: Java API says that a waiting thread can be interrupted by another thread. What Java API is always true. All JVM implementations must comply what it says.

http://stackoverflow.com/q/21507978
score: 5
has comment: http://stackoverflow.com/comment/32471286
has comment: http://stackoverflow.com/comment/33073856
answer count: 1
tagged with: java
has title: Defining the same class twice using a ClassLoader
linked to: http://stackoverflow.com/q/9804601
has answer: http://stackoverflow.com/a/22029175
upvote count: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/22029175
type: AnsweredQuestion
favorite count: 0
has body: I am working a project which involves reading all of the classes in a given JAR file, modifying some of these classes (at the bytecode level, using ASM), and creating a ClassLoader of these modified classes. Currently, after modifying the classes, I create a custom instance of the ClassLoader class which makes defineMethod(String, byte[]) visible. Here is the code for the custom ClassLoader (it is a nested class): private static class ExposingClassLoader extends ClassLoader { private ExposingClassLoader(JarFile jar) throws MalformedURLException { super(new URLClassLoader(new URL[] { new URL("jar:" + new File(jar.getName()).toURI().toURL() + "!/") })); } private void defineClass(String name, byte[] data) { defineClass(name, data, 0, data.length); } } You may have noticed that I made the parent class loader a URLClassLoader. When I construct the custom class loader, I make the URLClassLoader refer to the JAR that contains the unmodified class files. After modification of some of the class files, I iterate through them and invoke defineMethod(String, byte[]) for each one. Some of the modified classes depend on each other, that is, class A may be the superclass of class B, or class C may implement class D, or class E may contain references to class F, et cetera. For my tests, I am using two classes. The first is named fn and the second is named fi, and fi extends fn and contains multiple fields of type fi. Both of these classes are present in the JAR file that is used to construct the ClassLoader, the only difference is that they are unmodified. For some reason, if I define class fn it works fine (which it should not? The class fn already exists in the JAR file). However, if I try to define fi, which, again, refers to fn multiple times, I get this exception: Exception in thread "main" java.lang.LinkageError: loader (instance of Injector$ExposingClassLoader): attempted duplicate class definition for name: "fn" On the line: defineClass(name, data, 0, data.length); And I a…
type: Question
tagged with: classloader

http://stackoverflow.com/q/21360169
upvote count: 1
has comment: http://stackoverflow.com/comment/32207907
favorite count: 0
tagged with: binary-search-tree
has title: Run time for inserting a binary search tree is n^2?
has comment: http://stackoverflow.com/comment/32207813
has answer: http://stackoverflow.com/a/21361669
has answer: http://stackoverflow.com/a/21360183
accepted answer: http://stackoverflow.com/a/21360183
has comment: http://stackoverflow.com/comment/32207909
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32207834
downvote count: 1
type: Question
answer count: 2
tagged with: algorithm
tagged with: runtime
possible better answer: http://stackoverflow.com/a/21361669
has body: The book says the worst run time of inserting a binary search tree is n^2 I don't really get it. I mean if you have 1, 2, 3, 4, 5, 6, 7, 8, 9 which is the worst case, isn't the worst case run time is O(n)? (if value &lt; node.data, go to left, if > node.data go right) Can anyone explain? I would really appreciate that! I think I got the answer now! because you need to go back to find if the new number is greater or smaller from the beginning. But I have another question now, whats the worst case run time of building a AVL tree? The book says build and sort a binary search tree is n(log n) the worst depth of a AVL tree is log n it never said what's the inserting time of a entire AVL tree. anyone knows?
score: 0

http://stackoverflow.com/q/21349994
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21350126
has comment: http://stackoverflow.com/comment/32189765
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21350057
has comment: http://stackoverflow.com/comment/32189815
has comment: http://stackoverflow.com/comment/32189787
answer count: 3
has title: Java calling method on all objects of specific type
has answer: http://stackoverflow.com/a/21350035
downvote count: 0
has comment: http://stackoverflow.com/comment/32189776
favorite count: 0
has body: Okay, the title is a little bit cryptic, an example will show better what I mean, suppose the following structure: interface I { methodCall(); } class A implements I { } class B implements I { } class C implements I { } class Main { private A a; private B b; private C c; //other interesting stuff void doSomeMainMethod() { a.methodCall(); b.methodCall(); c.methodCall(); } } This code has been heavily simplified, the classes A, B and C implement methodCall() obviously, but there is no need to explicitely show that in the code. What I want to ask is the following: Is there a way to tell Java to generate my doSomeMainMethod method? I want to tell Java to call methodCall() on all objects of type I in class Main. Preferably without the use of reflection, because with reflection I think it is possible or if reflection is needed, is there a way to wrap it up such that it at least looks non-hackish? Ofcourse it needs to be safe (as safe as possible) aswell.

http://stackoverflow.com/q/21392057
tagged with: return
has answer: http://stackoverflow.com/a/21392101
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21392087
type: Question
has body: How do you use a array that has been returned, further on in a method? I am trying to use an array created in ArrayCreator.Create() method (which returns the array) as the Array input for ArrayCreator.Sort(*array here*) method. Is there a way of naming the returned array in the main method, and then just using it for ArrayCreator.Sort(*array here*) method? I have tried using ArrayCreator.Sort(Create().Unsorted) public void main(String args[]) { Scanner scan; scan = new Scanner(System.in); ArrayCreator.Create(); System.out.println("Do you want to sort the Array (y/n)"); char sort = scan.next().charAt(0); if (sort == 'y' || sort == 'Y') { ArrayCreator.Sort(); System.out.println("Array has been sorted"); } // .. }
tagged with: java
has title: Using a Returned Array in a Main Method
answer count: 2
tagged with: arrays
score: 0

http://stackoverflow.com/a/37929975
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: I faced a similar issue while trying out the JBoss Examples at: 4.2.6.1. Default KieSession http://docs.jboss.org/drools/release/6.4.0.Final/drools-docs/html/ch04.html#KIEExamplesSection I was getting the following exception on trying out the default KieSession example: org.drools.compiler.kie.builder.impl.ClasspathKieProject - Unable to build index of kmodule.xml url=file:/C:/Repo/Git/temp/drools-examples/drools-examples/drools-examples-service/target/classes/META-INF/kmodule.xml org.xml.sax.SAXParseException; systemId: file:/C:/Repo/Git/temp/drools-examples/drools-examples/drools-examples-service/target/classes/META-INF/kmodule.xml; lineNumber: 1; columnNumber: 52; cvc-elt.1.a: Cannot find the declaration of element 'kmodule'. 10:29:18.243 [main] ERROR org.drools.compiler.kie.builder.impl.KieContainerImpl - Unknown KieSession name: testsession I realised that the issue was due to the xmlns used in the default kiession example from Jboss Docs: From JBoss Docs - HAS ISSUE: kmodule xmlns="http://www.drools.org/xsd/kmodule" &lt;/kmodule&gt; What I used - WORKS WITHOUT ISSUE: kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" &lt;/kmodule&gt;
answers question: http://stackoverflow.com/q/21466716

http://stackoverflow.com/a/21493800
answers question: http://stackoverflow.com/q/21493634
score: 1
upvote count: 1
has body: Are you using scene builder? I tried the same css you use and everything works fine, maybe it's a bug in your version. I tested it for text-area and text-field.
downvote count: 0
has comment: http://stackoverflow.com/comment/32662698
type: Answer

http://stackoverflow.com/q/21370687
score: 1
tagged with: java
tagged with: jpanel
has body: So i have two classes: public class TimeServer extends JPanel implements TimeVariables { public TimeServer() { JTextArea serverLog = new JTextArea(); // Create a scroll pane to hold text area JScrollPane scrollPane = new JScrollPane(serverLog); JPanel serverWin = new JPanel(); serverWin.add(scrollPane); } and another class that has: private JPanel mainWin = new JPanel(); private JPanel gridArea = new JPanel(); //hold cells TimeServer serverWin = new TimeServer(); public class TimClient extends JFrame implements Runnable, TimeVariables { his.add(mainWin, BorderLayout.CENTER); mainWin.setLayout(new BorderLayout()); // mainWin.setLayout(new GridLayout(1,2)); //Create Grid gridArea.setLayout(new GridLayout(10, 10, 2, 2)); for (int i = 0; i &lt; 10; i++) for (int j = 0; j &lt; 10; j++) gridArea.add(cell[i][j] = new Cell(i, j, this)); gridArea.setBorder(new LineBorder(Color.black, 1)); jlblTitle.setHorizontalAlignment(JLabel.CENTER); jlblTitle.setFont(new Font("SansSerif", Font.BOLD, 16)); jlblTitle.setBorder(new LineBorder(Color.black, 1)); jlblStatus.setBorder(new LineBorder(Color.black, 1)); mainWin.add(gridArea, BorderLayout.CENTER); mainWin.add(serverWin, BorderLayout.PAGE_END); // Place the panel and the labels to the frame setLayout(new BorderLayout()); // implicit anyway add(jlblTitle, BorderLayout.NORTH); add(mainWin, BorderLayout.CENTER); add(jlblStatus, BorderLayout.SOUTH); } public static void main(String[] args) { // Create a frame TimClient frame = new TimClient("Time Client"); //frame.getContentPane().add(BorderLayout) // Display the frame frame.setSize(620, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } all i want to do is keep the server log and grid in the JPanel next to one another, could you explain how? also how do i add the JPanel in the server class to the one in client? Here's a sketch of how i'd like it to look:
type: Question
has comment: http://stackoverflow.com/comment/32272089
tagged with: jtextarea
upvote count: 1
has title: JTextArea & JPanel different classes one window...is it possible?
answer count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/21370738
accepted answer: http://stackoverflow.com/a/21370738
favorite count: 0
downvote count: 0
linked to: http://stackoverflow.com/q/20646015
type: AnsweredQuestion

http://stackoverflow.com/comment/32200303
has text: Where did you define your `GetData` class?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21356065
type: Comment

http://stackoverflow.com/comment/32460969
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21502588
score: 0
has text: I have to added threading that do no reflect iterations at real time but any ways what could be the solution for this?

http://stackoverflow.com/a/21391351
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21369864
answers question: http://stackoverflow.com/q/21369864
score: 0
has body: OK I found this video that explains how to use it : http://www.youtube.com/watch?v=LCLa-rgR_MA it works with this code: //in create effect = new ParticleEffect(); FileHandle fileDir = Gdx.files.internal("data"); effect.load(Gdx.files.internal("data/myParticleTxtFile"), fileDir); effect.start(); //in render effect.draw(batch, Gdx.graphics.getDeltaTime()); batch.end();

http://stackoverflow.com/comment/32259627
comment on: http://stackoverflow.com/a/21388654
has text: yes, they are very advanced tool to use. however, i"m still beginner in Java, and we didn't learn them yet.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32481955
has text: okay, so you are right, http://en.wikipedia.org/wiki/Join_(SQL)#Inner_join I have to read a little bit more about joins. I think I have to change the join type (no more inner join)
comment on: http://stackoverflow.com/a/21513785
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21484670
type: Answer
has comment: http://stackoverflow.com/comment/32433827
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21481290
has comment: http://stackoverflow.com/comment/32432219
answers question: http://stackoverflow.com/q/21481290
score: 1
has body: Only test methods (annotated with @Test in JUnit or TestNG) support mock parameters, so the only choice here is to declare a mock field at the test class level. Even if not used in any test method, I think it's better than having it declared in a setup method (using @Before, @BeforeMethod, etc.). If it were to be possible, the mock would still have to apply to all tests, because of the nature of setup methods; having a mock field of the test class makes it clear what the scope of the mock is.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32862487
type: AnswerComment
comment on: http://stackoverflow.com/a/21561640
score: 0
has text: @BabulMirdha See https://gist.github.com/luksprog/8956228 , your correct code updates the String in the transfer tab but you never refresh the view to actually show the text. Also, please start new questions, you're out of the scope of the current question.
type: Comment

http://stackoverflow.com/a/21734291
type: Answer
downvote count: 0
score: 1
has body: I'd recommend using a DocumentFilter to listen for updates to the JTextArea. From there you can veto changes, or insert them only at the end of the document. Also, it'll notify you when updates are made to the document so you can send them to your program. This should simplify your life. I would strongly advise against using a KeyListener - they're very finicky with things like focus. Here's an example of adding a DocumentFilter final Document d = textArea.getDocument(); if(d instanceof AbstractDocument){ ((AbstractDocument)d).setDocumentFilter(new DocumentFilter(){ @Override public void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException{ //Only allow edits at end (yours will be more complicated) System.out.println("Called replace"); if(offset == d.getLength()){ //Edit only goes through if the filter bypass is used fb.replace(offset, length, text, attrs); } } }); }
upvote count: 1
answers question: http://stackoverflow.com/q/21514372

http://stackoverflow.com/q/21505301
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/32481355
has body: I'm starting a Primefaces/Spring/Hibernate project and I'm still learning how to handle those components properly. But at this right moment, I'm facing a problem related to spring dependency injection that is freaking me out. I've been look for an answer for two days over the web and couldn't find what is wrong with my code. I've tried both approaches to autowire (@Autowire ans @Inject). Could someone take a look at my code and check what's going wrong ? My code is below. Here is the error log during deployment: 21:29:14,419 INFO [org.springframework.web.context.support.XmlWebApplicationContext] Bean 'entityManagerFactory' of type [class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 21:29:14,441 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@68a0d2d2: defining beans [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.Local…
accepted answer: http://stackoverflow.com/a/21505357
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/32465946
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21505357
upvote count: 2
tagged with: spring
tagged with: autowired
has title: Spring dependency injection issue during deployment

http://stackoverflow.com/comment/32199103
type: QuestionComment
has text: `enableSMD=true` used for [JSON-RPC](http://en.wikipedia.org/wiki/JSON-RPC) requests. It allows to pass objects to the action to execute methods and return results, so the same object could be used on the client and on the server, everything seems transparent.
score: 0
comment on: http://stackoverflow.com/q/21354429
type: Comment

http://stackoverflow.com/q/21511981
tagged with: java
type: Question
has title: Upload a file to an URL?
has comment: http://stackoverflow.com/comment/32477808
has comment: http://stackoverflow.com/comment/32477981
has answer: http://stackoverflow.com/a/21513158
possible better answer: http://stackoverflow.com/a/21512841
accepted answer: http://stackoverflow.com/a/21513158
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21512841
tagged with: android
has comment: http://stackoverflow.com/comment/32477537
has comment: http://stackoverflow.com/comment/32477714
has comment: http://stackoverflow.com/comment/32477916
has comment: http://stackoverflow.com/comment/32477529
linked to: http://stackoverflow.com/q/8965022
has comment: http://stackoverflow.com/comment/32477673
has body: I need to modify my java Class to allow me to successfully upload a file to the URL within. I want to use the web browser's built-in file upload mechanism. This is what I have done so far:- import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.webkit.WebView; public class MainActivity extends Activity { WebView web; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); web=(WebView)findViewById(R.id.web); web.getSettings().setJavaScriptEnabled(true); web.loadUrl("http://encodable.com/uploaddemo/"); } @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; } }
type: AnsweredQuestion

http://stackoverflow.com/a/21433627
answers question: http://stackoverflow.com/q/21433559
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/32454666
has comment: http://stackoverflow.com/comment/32338229
type: Answer
downvote count: 0
has body: How do I return false if there ISNT "list" in class Person? Class.getDeclaredFields() throws a NoSuchFieldExeption if the field does not exist, so you need to catch the NoSuchFieldException: public static void main(String[]args) { boolean has = false; try { Person.class.getDeclaredField("list"); has = true; } catch (NoSuchFieldException nsfe) { // intentionally ignored } System.out.println(has); } It is usually a bad idea to simply ignore a thrown exception (the catch block should at least contain something like nsfe.printStackTrace()), but in this case it should be fine. If the varible exists, how can I make it into an object? I am not 100% sure what you mean by this, but you can get a reference to the desired attribute through the return value of getDeclaredField(), which is a java.lang.reflect.Field - in that case, I would avoid the boolean and restructure the code slightly, e.g.: // @param Person object which has a "list" member public void printListField(Object p) throws IllegalArgumentException, IllegalAccessException { Field listField = null; try { listField = Person.class.getDeclaredField("list"); } catch (NoSuchFieldException nsfe) { // intentionally ignored } if (listField != null) { Object l = listField.get(p); System.out.println("list is " + l); } else { System.out.println("No list member available!"); } } Note that you need a reference to an actual object of class Person in order to retrieve a reference to an instance variable.

tiled
tags question: http://stackoverflow.com/q/21375972
tag name: tiled
type: Tag

http://stackoverflow.com/a/21435793
answers question: http://stackoverflow.com/q/21431537
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21431537
type: AcceptedAnswer
score: 4
has body: Your JSON is not valid. Let assume that JSON looks like this: { "propertyName":{ "1":[ { "1":"value1", "2":"value2", "3":false } ] } } The simplest way is to create POJO classes which fit to your JSON. For example: class Root { private Map&lt;String, List&lt;MyHolder&gt;&gt; propertyName; //getters,setters,toString } class MyHolder { @JsonProperty("1") private String name; @JsonProperty("2") private String age; @JsonProperty("3") private boolean female; //getters,setters,toString } Now we can easily deserialize it in this way: ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.readValue("{.. json ...}", Root.class)); Above program prints: Root [propertyName={1=[MyHolder [name=value1, age=value2, female=false]]}] If we do not want to see Map in our POJO class we have to write custom converter: class MapMyHolderConverter implements Converter&lt;Map&lt;String, List&lt;Map&lt;String, Object&gt;&gt;&gt;, List&lt;MyHolder&gt;&gt; { @Override public JavaType getInputType(TypeFactory typeFactory) { return typeFactory.constructMapType(Map.class, String.class, List.class); } @Override public JavaType getOutputType(TypeFactory typeFactory) { return typeFactory.constructCollectionType(List.class, MyHolder.class); } @Override public List&lt;MyHolder&gt; convert(Map&lt;String, List&lt;Map&lt;String, Object&gt;&gt;&gt; map) { Collection&lt;List&lt;Map&lt;String, Object&gt;&gt;&gt; values = map.values(); if (values.isEmpty()) { return Collections.emptyList(); } List&lt;MyHolder&gt; result = new ArrayList&lt;&gt;(); for (Map&lt;String, Object&gt; item : values.iterator().next()) { MyHolder holder = new MyHolder(); holder.setName(item.get("1").toString()); holder.setAge(item.get("2").toString()); holder.setFemale((Boolean) item.get("3")); result.add(holder); } return result; } } Your POJO classes could look like this now: class Root { @JsonDeserialize(converter = MapMyHolderConverter.class) private List&lt;MyHolder&gt; propertyName; //getters,setters,toString } class…
type: Answer
upvote count: 4

http://stackoverflow.com/a/21381058
has body: FirstDTO firstDTO = new FirstDTO(); List&lt;studentTransactionDTO&gt; list = firstDTO.getStudentTransactionDTOList(); for(int i = 0; i &lt; list.size(); i++){ String age = list.get(i).getAge(); }
downvote count: 0
answers question: http://stackoverflow.com/q/21380973
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/32276171
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21397090
has text: Are you compiling and running the code on the same machine? Some Windows viewers might show LF as a question mark, so if the file is generated on a unix box, then viewed on a Windows box, a question mark might be shown. Have you run the test with more than one XYZVO in the Vector? Is there a question mark between the output XYZVOs?
score: 0

http://stackoverflow.com/a/21483000
has body: There's actually one check which can boost you performance by a large factor. If you're crazy enough to write very long methods, the JIT simply gives up and you end up with a non-optimized code. I've seen a speedup factor of 8 after fixing MethodLength (it wasn't checkstyle, it was me who said that the method was too long).
answers question: http://stackoverflow.com/q/21481989
downvote count: 0
has comment: http://stackoverflow.com/comment/32433698
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32431256
score: 1

http://stackoverflow.com/comment/32343995
comment on: http://stackoverflow.com/a/21436853
score: 0
has text: Well, what's done is done. Time to open up paint.net.. Thanks for the answer sir.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21393657
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21391130
has body: You can use the java.util.Date and java.util.Calendar classes bundled with Java. But they are notoriously troublesome. Joda-Time For years now the Joda-Time third-party open-source library has been a popular substitute. If you are sure you want just the date alone, without time and time zones use Joda-Time’s LocalDate class. Example… LocalDate localDate = new LocalDate( 2013, 6, 1 ).plusDays( 45 ); System.out.println( "localDate " + localDate ); Search StackOverflow Search around StackOverflow.com. These basic date and time questions have already been asked and answered.
upvote count: 1
type: Answer

http://stackoverflow.com/a/21409701
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32339803
answers question: http://stackoverflow.com/q/21409271
has comment: http://stackoverflow.com/comment/32296407
accepted answer of: http://stackoverflow.com/q/21409271
type: AcceptedAnswer
downvote count: 0
has body: I wish to use Stream&lt;Drawable&gt; as input, however does passing in a Collection&lt;Drawable&gt; or List&lt;Drawable&gt; even work then? No, streams are not part of the Collection class hierarchy, so if your method expects a Stream&lt;e&gt; it can't accept a Collection/List&lt;E&gt;. Also note that passing streams around does not necessarily add so much benefit in your case because streams can only be consumed once. For example this would not work: Stream&lt;E&gt; s = ...; putAllDate(s); countDataSize(s); //IllegalStateException The last statement would cause a java.lang.IllegalStateException: stream has already been operated upon or closed.
type: Answer
has comment: http://stackoverflow.com/comment/32296498

http://stackoverflow.com/comment/32468061
has text: You also need to cast the second one...
comment on: http://stackoverflow.com/a/21506514
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/32458612
type: QuestionComment
has text: What you posted doesn't look like a hibernate config file to me, but to a spring config file. What's the content of database/hibernate.cfg.xml?
score: 0
comment on: http://stackoverflow.com/q/21500750
type: Comment

http://stackoverflow.com/comment/32470968
has text: iam not able to select it, tried the wait for it's not selecting. new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#availability input.facetoption"))).click(); (or) or using this driver.findElement(By.xpath("//li[@title='Exclude Out of Stock']/a")).click();
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21508106
type: Comment

http://stackoverflow.com/comment/32455689
score: 2
has text: You're asking us to guess what is wrong without enough code or information. Without a [minimal runnable example](http://stackoverflow.com/help/mcve), one that shows what ***layout managers*** your container JPanel is using (and is my bet for the reason for your problem), it's hard to see where you're making your mistake, but I will say that it sounds like you really want to use a JList on the left side, not a JPanel with a bunch of other panels.
type: Comment
comment on: http://stackoverflow.com/q/21499820
type: QuestionComment

http://stackoverflow.com/a/21513739
has comment: http://stackoverflow.com/comment/32481237
has comment: http://stackoverflow.com/comment/32481370
has comment: http://stackoverflow.com/comment/32482760
has comment: http://stackoverflow.com/comment/32481299
answers question: http://stackoverflow.com/q/21513124
has body: The &lt;listener&gt; and the &lt;resource-env-ref&gt; entries in your web.xml appear to be correct; however, because the Tomcat JNDI is read-only, there is an additional configuration you must include. Assuming that you are deploying a WAR to Tomcat, you must include a file named: context.xml in the META-INF directory within your WAR that contains the following entry: &lt;Context&gt; &lt;Resource name="BeanManager" auth="Container" type="javax.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory" /&gt; &lt;/Context&gt; Without this entry in the META-INF/context.xml included in your WAR, JBoss Weld will be unable to automatically bind the BeanManager extension into JNDI.
score: 0
has comment: http://stackoverflow.com/comment/32481025
type: Answer

http://stackoverflow.com/q/21375069
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/35797240
score: 1
has comment: http://stackoverflow.com/comment/32238056
tagged with: java
tagged with: eclipse
tagged with: android-emulator
type: Question
has body: This is the background of my setup. Eclipse version Indigo. Windows 7 Since of two days I am failing to launch my applications on the emulator. I get the below error on DDMS Console. [2014-01-27 12:36:11 - NVProductManager] New emulator found: emulator-5554 [2014-01-27 12:36:11 - NVProductManager] Waiting for HOME ('android.process.acore') to be launched... [2014-01-27 12:36:57 - NVProductManager] HOME is up on device 'emulator-5554' [2014-01-27 12:36:57 - NVProductManager] Uploading NVProductManager.apk onto device 'emulator-5554' [2014-01-27 12:37:07 - NVProductManager] Installing NVProductManager.apk... [2014-01-27 12:39:19 - NVProductManager] Failed to install NVProductManager.apk on device 'emulator-5554! [2014-01-27 12:39:19 - NVProductManager] (null) [2014-01-27 12:40:19 - NVProductManager] Failed to install NVProductManager.apk on device 'emulator-5554': null [2014-01-27 12:40:19 - NVProductManager] com.android.ddmlib.InstallException [2014-01-27 12:40:19 - NVProductManager] Launch canceled! I have cleaned my projects, restarted eclipse and increased the ADB timeout to 60000,killed the adb.exe,tried setting a new device in AVD but still haven't found the culprit. Any help is greatly appreciated.
tagged with: eclipse-indigo
downvote count: 0
has title: Android Emulator Fails To Launch :: Failed to install apk on device 'emulator-5554': null
has answer: http://stackoverflow.com/a/21375568
has comment: http://stackoverflow.com/comment/32236222
answer count: 3
has answer: http://stackoverflow.com/a/21399353
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/32432674
type: Comment
has text: Sounds reasonable. I'm surprised why JPA spec guys did not anticipate this scenario.
comment on: http://stackoverflow.com/a/21487008
type: AnswerComment
score: 0

http://stackoverflow.com/a/21506197
has body: Simplest answer: Replace your if(i == next || i &lt; 0) with if(data[i].getName().compareToIgnoreCase(targetListing) != 0) -- in other words, check that you've actually found a match rather than simply having narrowed down to a single possibility.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21506047
accepted answer of: http://stackoverflow.com/q/21506047
type: AcceptedAnswer

jstl
tags question: http://stackoverflow.com/q/21420145
tags question: http://stackoverflow.com/q/21496836
tags question: http://stackoverflow.com/q/21432039
type: Tag
tag name: jstl
tags question: http://stackoverflow.com/q/21427593
tags question: http://stackoverflow.com/q/21425965
tags question: http://stackoverflow.com/q/21459178
tags question: http://stackoverflow.com/q/21484727
tags question: http://stackoverflow.com/q/21377981
tags question: http://stackoverflow.com/q/21480040
tags question: http://stackoverflow.com/q/21478886
tags question: http://stackoverflow.com/q/21433288
tags question: http://stackoverflow.com/q/21454857

http://stackoverflow.com/q/21510524
accepted answer: http://stackoverflow.com/a/21510659
upvote count: 5
tagged with: java
has title: JTable getting values of specific column
type: Question
tagged with: jtable
score: 5
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21510659
has body: How could I get the values under specific column in JTable example : _________________________ | Column 1 | Column 2 | ________________________ | 1 | a | ________________________ | 2 | b | ________________________ | 3 | c | _________________________ How could I get the values under Column 1 that is [1, 2, 3] In the form of some data structure ( preferable array)?
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/32323894
score: 0
type: QuestionComment
has text: Could you elaborate? Perhaps post some code examples showing what you want to do (pseudo-code or code that won't compile would be ok if it show the intent)
type: Comment
comment on: http://stackoverflow.com/q/21425350

http://stackoverflow.com/comment/32404741
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/21470696
type: Comment
has text: Don't make your `num` and `denom` variables `static`.

http://stackoverflow.com/comment/32285244
has text: now it start working but now the scroll is too slow and the required textview comes in the middle i want it to be on the top?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21403487
type: Comment

http://stackoverflow.com/q/21463867
has answer: http://stackoverflow.com/a/26405032
downvote count: 1
tagged with: palindrome
favorite count: 0
has comment: http://stackoverflow.com/comment/32392731
has comment: http://stackoverflow.com/comment/32391921
has body: I'm trying to write a program which will output what Palindromes will work from entering in a string and how many there are. I keep getting a lot of errors and I'm still trying to get my head around some of the harder topics in Java! Here's what I have already, as always, all answers are greatly appreciated! public static boolean Palindrome(String text) { int index; int palindrome; System.out.println("Please enter your text "); text = EasyIn.getString(); for(index = 0; index &lt; amount.length() / 2; index++) { if(text.charAt(index) != text.charAt(text.length() - index - 1)) { return false; } } System.out.println("The number of valid palindrome(s) is " + amount); amount = EasyIn.getString(); }
has comment: http://stackoverflow.com/comment/32391933
answer count: 4
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/32392118
has comment: http://stackoverflow.com/comment/32392088
has comment: http://stackoverflow.com/comment/32392465
type: Question
has comment: http://stackoverflow.com/comment/32392105
has answer: http://stackoverflow.com/a/21583951
has comment: http://stackoverflow.com/comment/32392193
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/21464259
has comment: http://stackoverflow.com/comment/32392354
has answer: http://stackoverflow.com/a/21464259
has answer: http://stackoverflow.com/a/21463956
accepted answer: http://stackoverflow.com/a/21463956
has title: Palindrome Program
has comment: http://stackoverflow.com/comment/32391920

http://stackoverflow.com/a/21417335
type: Answer
has body: It doesn't block forever. It will throw an IOException: 'connection reset' eventually. 'Forever' implies a deadlock on your part. The 'while (!socket.isConnected());' loop is completely pointless: the socket is connected, by virtue of having been accepted. And if it wasn't, this is no way to handle it. You shouldn't flush the stream after writing the 0xff, but you should flush it in the constructor for Client. I don't see any reason for synchronization in Client, if it is running on its own thread, which it should be. You should be sending to all the clients simultaneously, not iteratively, so that they all get serviced at the same time, and so that errors or slowness in one doesn't affect the others.
score: 0
answers question: http://stackoverflow.com/q/21417101

http://stackoverflow.com/a/21482031
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21481693
has body: There is a fine solution proposed here using Jersy IntrospectionModeller. Solution shows how to develop service for listing all deployed resources that can be called with cURL command.
answers question: http://stackoverflow.com/q/21481693
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32427769

http://stackoverflow.com/comment/32401065
type: QuestionComment
has text: `hashCode` and `equals` are missing....
comment on: http://stackoverflow.com/q/21468595
score: 0
type: Comment

http://stackoverflow.com/a/21474810
type: Answer
answers question: http://stackoverflow.com/q/21474424
score: 0
has body: Your if condition should be like this //f1[2] = 1234 and f2[1] = 1234 if (f1[2].equals(f2[1])) { // Write your logic here }

http://stackoverflow.com/a/21471963
accepted answer of: http://stackoverflow.com/q/21471789
answers question: http://stackoverflow.com/q/21471789
has comment: http://stackoverflow.com/comment/32406944
has comment: http://stackoverflow.com/comment/32407025
has comment: http://stackoverflow.com/comment/32407040
has body: First of all, not sure why you are making an array (shape) at all, unless that is part of your assignment? If you use a for loop that steps from 0 to y inside one that steps from 0 to x instead of using the lengths of the array, you will get the same results without needing the array. As for the center, its location is x/2, y/2. If you change your inner loop to check your variables i and j to see if the current position is x/2, y/2 and print a space instead of an @ in that case, I think you will have the results you're looking for.
score: 0
has comment: http://stackoverflow.com/comment/32407057
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32407000
type: Answer

http://stackoverflow.com/a/29942642
has body: Hibernate is one of the first ORM framework became the market leader. There is no JPA specification defined for the ORM solutions when Hibernate was introduced in the market. After seeing the advantage of Hibernate APIs, Java community has created a common specifications known as JPA for all the problems in the persistence mechanism. Hibernate provides JPA implementation that is known as Hibernate JPA. What is different is that JPA implementations must compliant with the specifications but vendor solutions would have their own APIs (some times that would provide added valued to your application). It is always recommended to use the standard API like JPA for the future good. If you are looking for the integration approach, this article about Hibernate and Spring Integration may help.
answers question: http://stackoverflow.com/q/21472456
score: 0
type: Answer

http://stackoverflow.com/a/21461987
has comment: http://stackoverflow.com/comment/32487857
has body: Ah, now I see what you want to do. I'm afraid I have some bad news. The APIs that are exposed through ManagementFactory allow you to monitor only the JVM in which your code is running. To monitor other JVMs, you have to use the JMX Remoting API (javax.management.remote), and that introduces a whole new range of issues you have to deal with. It sounds like what you want to do is basically write your own management console using the stock APIs provided by out-of-the-box JDK. Short answer: you can't get there from here. Slightly longer answer: you can get there from here, but the road is long, winding, uphill (nearly) the entire way, and when you're done you will most likely wish you had gone a different route (read that: use a management console that has already been written). I recommend you use JConsole or some other management console to monitor your application(s). In my experience it is usually only important that a human (not a program) interpret the stats that are provided by the various MBeans whose references are obtainable through the ManagementFactory static methods. After all, if a program had access to, say, the amount of CPU used by some other process, what conceivable use would it have with that information (other than to provide it in some human-readable format)?
type: Answer
answers question: http://stackoverflow.com/q/21446955
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32407198
has comment: http://stackoverflow.com/comment/32389110
upvote count: 1
has comment: http://stackoverflow.com/comment/32791613

http://stackoverflow.com/comment/32400310
type: Comment
comment on: http://stackoverflow.com/a/21468236
has text: @PatGreens Everyone needs to start somewhere :). If you wanted uppercase Chars you add 65
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32450184
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21496634
has text: uhm, i should use prepared statements, it would be more efficient... Just get a row, and then insert that in other table in a loop.

http://stackoverflow.com/comment/32478335
score: 0
type: QuestionComment
has text: Yeah thats the static way for a fixed matrix size. I am almost finished with me recursive solution. But it will not be optimal. Since it is a math problem I thought there might be an algorithm already.
type: Comment
comment on: http://stackoverflow.com/q/21511539

http://stackoverflow.com/comment/32610842
comment on: http://stackoverflow.com/a/21393851
type: Comment
has text: Normally it is a good practice to cache on stack. Recursive calls will consume more memory on stack and it might be an issue for very specific cases but deep recursion itself should be avoided to avoid "stack overflow" errors.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/32391931
type: QuestionComment
comment on: http://stackoverflow.com/q/21463443
score: 0
has text: Pattern p = Pattern.compile("[\\.\\/ ADD name=]"); Matcher m = p.matcher(s); boolean b = m.matches(); ---- for some reason this is still not working. I must not have everything set up in the Pattern.compile correctly.
type: Comment

http://stackoverflow.com/comment/32439797
type: QuestionComment
has text: Have you read the javadoc of both classes, or read the official JDBC tutorial? Why do you think using a prepared statement would be useful in this case? And also, why do you use a `List` and not a `List<Person>`? Why don't you at least try to compile your code before posting it?
type: Comment
comment on: http://stackoverflow.com/q/21490733
score: 0

http://stackoverflow.com/comment/32395189
comment on: http://stackoverflow.com/q/21464967
score: 0
has text: I don't think there can be anything "missing" per se. I don't have any new project, I have a server project and a library project that existed before, and @Value annotations that existed before, and property files that existed before. There are PropertyPlaceholderConfigurer beans for both the server and library, and their "locations" property is set to the same two values.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32338564
comment on: http://stackoverflow.com/q/21434078
has text: Use correctly a do/while. May you can show your implementation using it?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32261255
score: 0
type: QuestionComment
type: Comment
has text: @maaartinus fair enough :)
comment on: http://stackoverflow.com/q/21389559

http://stackoverflow.com/comment/32354036
has text: Did you read my entire post? The goal is to help him eliminate errors....why would I not help him past the question he asked? Especially when the question he asked wasn't thorough enough to be answered. I'm just trying to help
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21442223
score: 0

http://stackoverflow.com/comment/32461234
has text: @guest-414 Then depending on what you're doing while you traverse that tree, `ForkJoinPool` could be exactly what you want. It's helpful when you have a map/reduce situation, and so if your traversal produces some summary function over the tree, a recursive fork/join would handle all the concurrency for you.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21502178

http://stackoverflow.com/comment/32276973
has text: we have 200 java files. Since there are already generators for junit, we just want to use that ... Just a basic structure for every class is fine, we would quickly write the test logic within the method.
comment on: http://stackoverflow.com/q/21398456
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21502317
score: 0
answer count: 1
has body: I'm trying to convert to convert an ArrayList<String> to JSON object. The problem is that I'm getting all the same values everywhere. Here is my code: Location l = new Location((long) 1,"u222","fdfgs","morococ","2dqrg","8drgf5","8dfg"); Location l2 = new Location((long) 1,"u222","fedsfsds","modfrococ","27","876gtfgfg85","8 25 98"); Location l3 = new Location((long) 1,"u222","fes","morococ","27","876fghfgh85","8 25 98"); List<Location> locs = new ArrayList<Location>();; locs.add(l); locs.add(l2); locs.add(l3); List<JsonValid> jsons = new ArrayList<JsonValid>(); JsonValid jsonV = new JsonValid(); //copying to another list to a valid format of json for(int i = 0 ; i<locs.size();i++) { jsonV.title = locs.get(i).city; jsonV.lat = locs.get(i).latitude; jsonV.lng = locs.get(i).longitude; jsons.add(jsonV); } System.out.println(jsons.size()); gson = new Gson(); String jsonStudents = gson.toJson(jsons); //Here i'm getting the same values System.out.println(jsonStudents); Here is the output: [{"title":"fes","lat":"27","lng":"876fghfgh85","description":"none"},{"title":"fes","lat":"27","lng":"876fghfgh85","description":"none"},{"title":"fes","lat":"27","lng":"876fghfgh85","description":"none"}] Which is not what I want! Am I missing something?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21502366
has title: How to convert an ArrayList to JSON not working
type: Question
has answer: http://stackoverflow.com/a/21502366

http://stackoverflow.com/comment/32481516
score: 0
type: QuestionComment
type: Comment
has text: Okay, then let's debug the code as I say: Please put Log inside the method private void grafico(String anno){} and say if the log get printed when you change spinner.
comment on: http://stackoverflow.com/q/21513256

http://stackoverflow.com/comment/32427060
type: Comment
has text: If it's .java then this is fail of the plugin. Since you put it in the repo from tortoise, just refresh your project and download it again. Sometimes the eclipse plugin doesn't work very well (I'm tired of using it). But in the trace looks like .class file, not .java.
comment on: http://stackoverflow.com/a/21483305
type: AnswerComment
score: 0

http://stackoverflow.com/a/21468255
score: 1
answers question: http://stackoverflow.com/q/21467794
has body: You are not calculating the recursive height for the top, bottom, left and right. You are only calculating the corners. You just need to add the "non-corner", ie. the top, bottom, left and right indicies of (x, y) to your recursive method. private void recursiveUpdate(final float[][] heightMapping, final boolean[][] traversed, final int x, final int z, final float startHeight, final boolean positive) { if (x &lt; 0 || x &gt;= width || z &lt; 0 || z &gt;= depth) { return; } if (traversed[x][z]) { return; } if ((positive &amp;&amp; startHeight &lt;= 0f) || (!positive &amp;&amp; startHeight &gt;= 0f)) { heightMapping[x][z] = 0f; return; } traversed[x][z] = true; heightMapping[x][z] = startHeight; //This will only calculate the corners of the (x,y point) recursiveUpdate(heightMapping, traversed, x - 1, z - 1, calculateNewStartHeight(startHeight, positive), positive); recursiveUpdate(heightMapping, traversed, x - 1, z + 1, calculateNewStartHeight(startHeight, positive), positive); recursiveUpdate(heightMapping, traversed, x + 1, z - 1, calculateNewStartHeight(startHeight, positive), positive); recursiveUpdate(heightMapping, traversed, x + 1, z + 1, calculateNewStartHeight(startHeight, positive), positive); //Add top, bottom, left and right indicies for (x,y) //bottom recursiveUpdate(heightMapping, traversed, x, z - 1, calculateNewStartHeight(startHeight, positive), positive); //top recursiveUpdate(heightMapping, traversed, x, z + 1, calculateNewStartHeight(startHeight, positive), positive); //right recursiveUpdate(heightMapping, traversed, x + 1, z, calculateNewStartHeight(startHeight, positive), positive); //left recursiveUpdate(heightMapping, traversed, x - 1, z, calculateNewStartHeight(startHeight, positive), positive); }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21467794
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/32416605
downvote count: 0

http://stackoverflow.com/q/21478252
possible better answer: http://stackoverflow.com/a/21944999
upvote count: 2
has comment: http://stackoverflow.com/comment/32417330
tagged with: maven
type: Question
tagged with: open-source
has answer: http://stackoverflow.com/a/21478922
has answer: http://stackoverflow.com/a/21944999
tagged with: java
tagged with: eclipse
has body: I am trying to run the AlgoTrader in Eclipse but I get two errors The only problem now is when I run the SimulationStarter class I get the following error: 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl initialized service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module market-data on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module current-values on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module trades on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module portfolio on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module performance on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module algo on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module ib-market-data on service provider: BASE 1989-12-31 23:00:00,000 DEBUG RuleServiceImpl deployed module ib-trades on service provider: BASE Exception in thread "main" com.algoTrader.service.SimulationServiceException: Error performing 'SimulationService.simulateWithCurrentParams()' --&gt; com.algoTrader.service.SimulationServiceException: Error performing 'SimulationService.runByUnderlayings()' --&gt; com.algoTrader.service.RuleServiceException: Error performing 'RuleService.initServiceProvider(String strategyName)' --&gt; com.espertech.esper.client.EPException: esper-mov.cfg.xml not found at com.algoTrader.service.SimulationServiceBase.simulateWithCurrentParams(SimulationServiceBase.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo…
answer count: 2
downvote count: 0
favorite count: 0
tagged with: plugins
has title: Run the AlgoTrader in Eclipse
accepted answer: http://stackoverflow.com/a/21478922
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/21506094
has comment: http://stackoverflow.com/comment/32467516
tagged with: serviceloader
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32467491
type: Question
has answer: http://stackoverflow.com/a/21506330
score: 0
has title: Service loader in java loading modules but can display loaded views properly
has body: So my application has a main project that loads all classes that implement IModule. Each Module has a view that extends AbstractView. Here is the sample code public abstract class AbstractView extends JPanel{ //Init panel } public Module implements IModule{ public AbstractView getView(){ return some class that extends AbstractView; } public String getModuleName(){ return "ModuleName"; } } public Application{ ServiceLoader&lt;IModules&gt; modules; //Loaded at start of application public void displayModule(String moduleName){ Iterator&lt;IModule&gt; moduleIterator = modules.iterator(); while (moduleIterator.hasNext()) { if (module.getModuleName() == moduleName) { display(module.getView()); } } public void display(AbstractView view){ displayPanel.add(view, Borderlayout.Center); displayPanel.repaint(); } } Its just simplified example but thats pretty much how it works. My problem is I cant display the plug in view. Im not sure why that doesnt work. When I print the loaded View I get the class that extended that AbstractView with its properties like type of layout etc. The classes that implemented interfaces that had no relation to UI seems to have no issues atm. I load plug ins from a folder that contains their respective jar files. EDIT In my META-INF/services I only have app.IModule file that contains the text plugin.Plugin. The plug in class is the class that implemented IModule. That is the only service I declared since it is the class that the service loader will load. Do I have to declare the class that extends AbstractView as well? Even without loading it in the service loader
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21506330

http://stackoverflow.com/comment/32263639
score: 0
type: AnswerComment
has text: Thanks a lot everyone... The problem was null connection. You gave me satisfactory solution & now everything is working fine
type: Comment
comment on: http://stackoverflow.com/a/21390598

http://stackoverflow.com/comment/32434722
comment on: http://stackoverflow.com/q/21487432
score: 0
has text: Whether your domain class having default constructor?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21396085
tagged with: observer-pattern
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21396122
has comment: http://stackoverflow.com/comment/32273034
has comment: http://stackoverflow.com/comment/32273048
has title: test if object X is an observer of Observable Y
accepted answer: http://stackoverflow.com/a/21396122
type: Question
has body: I am playing with some design patterns and i am able to add and remove Observer Drone object from an Observable Borg objects list of observers. I want to print an attribute of each of the Observable objects observers. Such as the the Observers Object ID attribute. A bit more explanation: I have a Borg class which extends Observable, I have a Drone class which implements Observer. Each drone has an ID attribute, in my program i have a list of drones and they are all registered as observers of my Borg object. I also have a list of Drones, which are all registered at first as Observers, i then remove some of these observers from the borgs observer list. I want to itterate through the Drone list and test if the drone is an observer of the observable borg object
score: 0
tagged with: java

http://stackoverflow.com/comment/48688926
has text: but If I want to show in grid wise because I have more than 20 component add in optionGroup ...How can I do it ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21382105

http://stackoverflow.com/comment/32318327
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21404782
has text: for each request it is throwing exception like bean creation exception, unable to get members of exception. etc. One page comes after some time but again click on that page throws exception. what should i need to do for that .? This issues is coming 2 day before. is this because of large database.? why spring initialize framework for each request.?
score: 0

http://stackoverflow.com/comment/32489549
type: Comment
type: QuestionComment
score: 1
has text: Well, since this is an interview question, I would certainly ask him to be more specific. There's a difference between a Java `Thread` and any old "task". It's of course possible to start new tasks and processes.
comment on: http://stackoverflow.com/q/21500772

http://stackoverflow.com/comment/32280729
type: QuestionComment
comment on: http://stackoverflow.com/q/21399975
score: 0
has text: Can you add the complete source of `Event` and the unit test, please :)?
type: Comment

http://stackoverflow.com/q/21472082
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 2
has body: I am designing an android app, and one thing I would like to happen is when the user clicks the page, I would like to find the distance between where they clicked and a TextView element on the page. So far, what I have done is set the TextView ID by using android:id="@+id/TableLayout01" I know I also need to use android:onTouch coordinates somehow, but I am not sure how to incorporate this into the coordinates of my TextView Thanks
upvote count: 3
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/21472150
type: Question
answer count: 1
has title: Find distance between touch and textview in android

http://stackoverflow.com/a/21406906
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21406785
downvote count: 0
has body: Java might not be the best tool for the job, try e.g. tail -n +2 input.txt &gt; output.txt instead.

http://stackoverflow.com/comment/32446796
score: 0
has text: Sorry under Availability, checkbox Exclude out of stock is there.
comment on: http://stackoverflow.com/q/21494093
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21456987
has comment: http://stackoverflow.com/comment/61124550
tagged with: leadtools-sdk
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
has title: Using LEADTOOLS with Java
has body: I'd like to manipulate images (e.g., change brightness, apply sepia filter) from my Java application using LEADTOOLS. The app is supposed to run on both Windows (>=7) and Mac OS. I know that Java is not officially supported but I've seen that there are workarounds and Android support. My question is: Has anybody used LEADTOOLS in recent times (with version 18 for example) in combination with Java? Thanks.
has comment: http://stackoverflow.com/comment/32379522
has comment: http://stackoverflow.com/comment/32379338
score: 2
downvote count: 0

http://stackoverflow.com/q/21483682
has comment: http://stackoverflow.com/comment/32426613
has comment: http://stackoverflow.com/comment/32426666
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32426703
type: Question
has body: I understand that the main purpose of labels is to use them with break and continue to alter the usual behaviour of the loop. But it's possible to label every statement that is not a declaration. int j = 0; LABEL1: j++; LABEL2: for (int i = 0; i &lt; 4 ; i++) { if (i == 3) break LABEL2; } Is there any purpose to labels like LABEL1 since it's not allowed to break LABEL1?
has comment: http://stackoverflow.com/comment/32427164
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/32426940
accepted answer: http://stackoverflow.com/a/21483879
has title: Why is it allowed to label almost every statement in Java?
has comment: http://stackoverflow.com/comment/32426777
has comment: http://stackoverflow.com/comment/32426717
downvote count: 2
has comment: http://stackoverflow.com/comment/32426741
has comment: http://stackoverflow.com/comment/32426924
has answer: http://stackoverflow.com/a/21483879
answer count: 1
has comment: http://stackoverflow.com/comment/32426632
favorite count: 0
upvote count: 9

http://stackoverflow.com/q/21370661
possible better answer: http://stackoverflow.com/a/21370807
score: 0
has comment: http://stackoverflow.com/comment/32226915
answer count: 2
upvote count: 1
has title: Java: If(comparing strings to integers)
has comment: http://stackoverflow.com/comment/32226983
favorite count: 0
has answer: http://stackoverflow.com/a/21370807
has comment: http://stackoverflow.com/comment/32226912
has answer: http://stackoverflow.com/a/21370927
accepted answer: http://stackoverflow.com/a/21370927
tagged with: java
has body: I am currently trying to write a simple input dialog program where user is prompted to enter their name. I want to create an if statement that if user enters any number or special char that the user is then prompted to use characters a-z and asked to re-enter name. here is my code so far and I am not sure how to even write the if statement, the error I am getting is incomparable data types Strings and integers. public class inputdialogbox { public static void main(String[] args) { Scanner user_input = new Scanner( System.in); String first_name; first_name = JOptionPane.showInputDialog(null, "Please enter your First Name", "User's Name",JOptionPane.QUESTION_MESSAGE); int intValue = Integer.parseInt(first_name); if (first_name == intValue);
downvote count: 1
has comment: http://stackoverflow.com/comment/32226935
type: Question
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/6827666
tagged with: if-statement
has comment: http://stackoverflow.com/comment/32227073
linked to: http://stackoverflow.com/q/6827666

http://stackoverflow.com/q/21478089
tagged with: regex
has answer: http://stackoverflow.com/a/21478187
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21478248
tagged with: java
downvote count: 2
has body: How can I remove substring between two characters(+ and @). Ex- bunny+12kl@funny.com should give bunny@funny.com Which regex I should use for this.
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/21478135
has title: Remove substring between two characters
has comment: http://stackoverflow.com/comment/32417153
score: 0
has answer: http://stackoverflow.com/a/21478294
has answer: http://stackoverflow.com/a/21478140
has answer: http://stackoverflow.com/a/21478549
favorite count: 0
possible better answer: http://stackoverflow.com/a/21478140
upvote count: 2
accepted answer: http://stackoverflow.com/a/21478135
has answer: http://stackoverflow.com/a/21478126
has answer: http://stackoverflow.com/a/21478253

http://stackoverflow.com/q/21421667
tagged with: eclipse
type: Question
tagged with: debugging
has body: How do I display variables in Scala methods while calling them from Java program in Eclipse debugger? I am debugging a Java program which calls methods in Scala libraries. I can put breakpoints there and the break-point works. But the debugger is unable to display the variables. I am using Eclipse. http://www.quora.com/How-do-I-display-variables-in-Scala-methods-while-calling-them-from-Java-program-in-Eclipse-debugger
answer count: 2
has answer: http://stackoverflow.com/a/21425113
downvote count: 0
has comment: http://stackoverflow.com/comment/32318124
favorite count: 0
has answer: http://stackoverflow.com/a/21428381
type: UnansweredQuestion
tagged with: scala
has title: Debugging methods in Scala library from Eclipse
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/32317552

http://stackoverflow.com/q/21353808
tagged with: java-bytecode-asm
has title: Speeding up Java clock (override how Date class/System.getCurrentTimeInMillis works)
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21354598
score: 2
tagged with: java
has body: We have an existing product that is very time sensitive. For example, statistics are published on a 5 min, 1 hour, 24 hour basis. This means testing is very slow in real world conditions (we actually don't test the 1 hour and 24 hour statistics because of this). What I want is to speed up the JVM clock.... I know I could create a dummy time class as I've seen others do. But the code base is huge so this would be a lot of retrofit work + third party libs would still use the normal Date Class/System.getCurrentTimeInMillis... What I'm really looking for is a way to override the Java time behavior (monkey patching in the ruby world). I'm guessing it should be possible to use byte code manipulation to do this. But I'm not sure where to start.... I can't find any libraries that do this or anyone who has solved this problem via byte code manipulation. question 1: is it possible to override the Date behavior? question 2: how would one do this? Perhaps an example of overriding another core java class? thanks for any thoughts
has answer: http://stackoverflow.com/a/21354276
type: Question
tagged with: bytecode
has answer: http://stackoverflow.com/a/21357959
answer count: 3
downvote count: 0

http://stackoverflow.com/q/21480429
has answer: http://stackoverflow.com/a/21481283
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/32432494
has comment: http://stackoverflow.com/comment/32430026
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/21481283
type: Question
answer count: 2
has title: How can i put my resources in the deployed WAR in a multi-module web project
possible better answer: http://stackoverflow.com/a/21480629
has comment: http://stackoverflow.com/comment/32429794
has answer: http://stackoverflow.com/a/21480629
tagged with: tomcat
score: 0
has body: Ok, so i have a multi-module web project (Spring, Hibernate and all that) consisting out of a WAR and 3 JARs. 2 of those JARs are optional extensions of the core WAR and JAR. The extentions are used by maven profiles which add them as dependencies or not. This all works fine. However while installing the project on a Tomcat server i noticed i coulden't edit the property files of the extension modules since they are packaged in a JAR file. So i'm looking for a way to have my property files moved from my extension JAR to my deployable WAR's resources folder when i package my project using maven. This means that the resources will ONLY be in the WEB resources folder when the extension is activated. How can i best do this? EDIT-01 Ok so i've tried using the build-helper-maven-plugin which qza suggested. test-war POM: ... org.apache.maven.plugins maven-war-plugin 2.1.1 false org.codehaus.mojo build-helper-maven-plugin 1.8 add-resource process-resources add-resource ../extTestA-jar/src/main/resources resources My project layout is as follows: <Parent> --><extTestA-jar> --><extTestB-jar> --><test-jar> --><test-war> With my resources in "src/main/resources" Can anyone spot the problem in this? I've tried with and without the targetPath but none seem to work. I've also tried to do it at the generate-resources phase but still no luck. I was thinking the path could be wrong so i tried some others aswel but still no luck.
has comment: http://stackoverflow.com/comment/32503731

http://stackoverflow.com/q/21371204
has body: I am new to this forum so please forgive me if this has been covered already. I have an assignment for class which covers the following: Create a 10 x 10 two dimensional array of int data type Load each index location in the array with the sum of it's row + column Create and algorithm that will add all the values in the diagonal indexes from 0,0 to 9,9 and print the total Create and algorithm that will add all the values in the diagonal indexes from 0,9 to 9,0 and print the total Print the addition of both diagonals I had no problem creating the array but I am stumped as to how to add the primary diagonals. It tried a solution that I saw on another post to this sit but I kept getting for the Return total value stating that it could not be type void. Anyway, here is the code that I have so far: import java.util.*; import java.io.*; import static java.lang.System.out; public class AddDiagonals2 { public static void main (String args[]) { int[][] numbers = new int [10][10]; row = 0; col = 0; int sum1 = 0, sum2 = 0; for (int row = 0; row &lt; numbers.length; row++) { for (int col = 0; col &lt; numbers[row].length; col++) { numbers[row][col] = row + col; out.print (numbers[row][col] +"\t"); } out.println(); } Here is what I tried to add from the other post to calculate the diagonals but it didn't work. for (int row = 0; row &lt; numbers.length; row++) { sum1 = sum1 + numbers[row][row]; } row = numbers.length-1; for (col = 0; col &lt; numbers.length; col++) { if (col &gt;= 0) { sum2 = sum2 + numbers[row][col]; col--; } out.println ("Sum of the Diagonal elements are : " + sum1 + " and " + sum2); } }
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21371262
tagged with: algorithm
tagged with: arrays
has title: Create algorithm to add values of primary diagonals in a java 2d array
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21371365
has comment: http://stackoverflow.com/comment/32227759

http://stackoverflow.com/a/21391252
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/21391174
has body: It derives from a C language optional compiling tool with the purpose of detecting 'suspicious' behaviors in your code. It has become a standard way to refer to this kind of static code analysis
answers question: http://stackoverflow.com/q/21391174
has comment: http://stackoverflow.com/comment/32264038

http://stackoverflow.com/q/21372088
has comment: http://stackoverflow.com/comment/32357707
has comment: http://stackoverflow.com/comment/32329405
has comment: http://stackoverflow.com/comment/32329874
tagged with: apache-tomee
has comment: http://stackoverflow.com/comment/32314600
has body: I have one project in Java EE, I use Apache TomEE 1.5.2 Server and NetBeans IDE 7.3.1 When I open project with my app and I choose "Run" option or "Deploy" (undeploy current file from server and deploy) option it last a few second (eg. (total time: 5 seconds)). But when I choose "Debug" option (undeploy current file from server, deploy and run app in debug mode) it last much more: 6 minute. How can you explain it? Note For NetBeans 8 Beta I get time 9 minute and for NetBeans 7.4 I get 7-8 minute, more then for 7.3 :(
answer count: 1
downvote count: 0
tagged with: netbeans-7
accepted answer: http://stackoverflow.com/a/22160246
favorite count: 0
has comment: http://stackoverflow.com/comment/32309551
has comment: http://stackoverflow.com/comment/33417242
tagged with: deployment
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/32322390
linked to: http://stackoverflow.com/q/1369487
upvote count: 1
has answer: http://stackoverflow.com/a/22160246
type: Question
has comment: http://stackoverflow.com/comment/33430711
score: 1
has title: Long time of deploy only before debug
tagged with: java

http://stackoverflow.com/comment/32284342
type: Comment
has text: Personally what I'd do is to temporarily store/sync a copy of the configurations in a database and then populate the newly adjusted/changed configurations when deploying the new release.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21402642

http://stackoverflow.com/comment/32329660
has text: Not sure if i understood you. What do you mean by Trash independent language.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21428507

http://stackoverflow.com/a/21753269
score: 3
answers question: http://stackoverflow.com/q/21480758
has body: Most likely you would have to add your own URL handler (like in this post javafx 2 webview custom url handler, don&#39;t work relative url) and retrieve/detect 404 messages and conditions yourself. This article (How to check if a URL exists or returns 404 with Java?) shows you how to detect a 404 condition. In the handler you have 2 choices, either create a HEAD request for a URL (and subsequently ignore HEAD requests so you don't get yourself into an infinite loop) or masquerade the returned URLConnection after checking for a 404. @Override protected URLConnection openConnection(URL u) throws IOException { // 1. Use Apache HTTPClient or something else to grab the url // 2. Read the resultCode and report if it's a 404 // 3. Return an object that subclasses URLConnection }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32904949
accepted answer of: http://stackoverflow.com/q/21480758
type: Answer
has comment: http://stackoverflow.com/comment/90275239
upvote count: 3

http://stackoverflow.com/comment/32286772
has text: All collections should have such a constructor, according to the `Collection` JavaDoc: >>>"All general-purpose Collection implementation classes ... should provide two "standard" constructors: a void (no arguments) constructor, ... and a constructor with a single argument of type Collection, which creates a new collection with the same elements as its argument."<<<.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21404352
type: Comment

http://stackoverflow.com/q/21368156
tagged with: java
has comment: http://stackoverflow.com/comment/32222155
tagged with: search
type: Question
tagged with: arrays
tagged with: runtime
answer count: 1
has answer: http://stackoverflow.com/a/21368216
has comment: http://stackoverflow.com/comment/32222092
score: 0
has comment: http://stackoverflow.com/comment/32222260
has title: Whats an efficient way to filter an array based on a logical condition?
accepted answer: http://stackoverflow.com/a/21368216
has comment: http://stackoverflow.com/comment/32222455
linked to: http://stackoverflow.com/q/9146224
tagged with: indexing
has comment: http://stackoverflow.com/comment/32222198
type: AnsweredQuestion
has body: let say i have a 3x6 array of doubles: double[][] arr = [1.2, 1, 1] [4.3, 1 , 1] [2.0, 1 , 1] [2.9, 1 , 1] [6.2, 1 , 1] [2.5, 1 , 1] i want to return an array based on a tolerance of say x&lt;3.0 for the first column only. Which will return the full array minus the rows that dont match the condition (x&lt;3.0): I.E. double[][] returnArr = [1.2, 1, 1] [2.0, 1 , 1] [2.9, 1 , 1] [2.5, 1 , 1] Whats an efficient way of accomplishing this (run time is a concern)???
has comment: http://stackoverflow.com/comment/32222100

http://stackoverflow.com/q/21364703
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32215537
score: 1
tagged with: java
upvote count: 1
has body: A simple question. I can't seem to find a function to convert a cosine to radiant or degree. In the following code public class angle{ public static void main (String[] args){ int a = 30; int b = 40; int y = 88; double c = Math.sqrt((a*a) + (b*b) - (2*a*b*Math.cos(Math.toRadians(y)))); System.out.println("C = " + c); double L = ((b*b) + (c*c) - (a*a))/(2*b*c); System.out.println("Cos Alpha = " + L); double B = ((a*a) + (c*c) - (b*b))/(2*a*c); System.out.println("Cos Beta = " + B); } } I have the L and B as cosine, but I need them as a Radiant of Degree. Anyone has any idea, what function should I use? Thanks in advance.
has answer: http://stackoverflow.com/a/21364735
type: Question
has title: Convert cosine/sine to degree in Java
has comment: http://stackoverflow.com/comment/32215601
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21364732

io
tags question: http://stackoverflow.com/q/21501187
tags question: http://stackoverflow.com/q/21442303
tags question: http://stackoverflow.com/q/21365046
tags question: http://stackoverflow.com/q/21400391
tag name: io
tags question: http://stackoverflow.com/q/21497720
tags question: http://stackoverflow.com/q/21438078
tags question: http://stackoverflow.com/q/21360791
tags question: http://stackoverflow.com/q/21459553
tags question: http://stackoverflow.com/q/21469472
tags question: http://stackoverflow.com/q/21397778
type: Tag
tags question: http://stackoverflow.com/q/21501330
tags question: http://stackoverflow.com/q/21423292
tags question: http://stackoverflow.com/q/21504299
tags question: http://stackoverflow.com/q/21396187
tags question: http://stackoverflow.com/q/21421487
tags question: http://stackoverflow.com/q/21387916
tags question: http://stackoverflow.com/q/21395935

http://stackoverflow.com/q/21469794
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
has title: How to accommodate concurrent authentication requests in LdapLoginModule
tagged with: java
tagged with: authentication
type: Question
tagged with: jaas
upvote count: 1
has body: I use com.sun.security.auth.module.LdapLoginModule to authenticate users against Active Directory using JAAS. But i noticed when multiple users try to authenticate concurrently, it appears to be authenticating one after the other. But When i use com.sun.jmx.remote.security.FileLoginModule it works concurrently. I would like to know is this a limitation in LdapLoginModule or is there a way to achieve this?
favorite count: 0

http://stackoverflow.com/q/21483254
linked to: http://stackoverflow.com/q/17816012
type: UnansweredQuestion
tagged with: plugins
has answer: http://stackoverflow.com/a/21483305
tagged with: svn
tagged with: java
tagged with: eclipse
type: Question
duplicate of: http://stackoverflow.com/q/17816012
answer count: 1
has title: Commit failed from eclipse plugin
has body: I try to use Eclipse SVN plugin. update action works correctly but when I execute commit I see following: Some of selected resources were not committed. Some of selected resources were not committed. svn: E200007: Commit failed (details follow): svn: E200007: Commit failed (details follow): svn: E200007: CHECKOUT can only be performed on a version resource [at this time]. svn: E175002: CHECKOUT request failed on '/dent-001/!svn/rvr/5126/#PATH_TO_CLASS# It is executes normally if I use tortoise SVN. How should I fix it?
tagged with: eclipse-plugin
score: 0

http://stackoverflow.com/a/21416489
has body: There is no effect on synchronization whether you extend Thread or implement Runnable. When you synchronize a method , you get a lock on the OBJECT and not the thread - so it really does not matter.There are many SO topics that discuss the distinction between these 2 approaches (extending thread vs implementing Runnable)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21416428

http://stackoverflow.com/q/21362631
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32212730
tagged with: mysql
has comment: http://stackoverflow.com/comment/32213077
has comment: http://stackoverflow.com/comment/32212831
downvote count: 0
score: 1
favorite count: 0
has title: How to add permission on MySQL Server on mac?
linked to: http://stackoverflow.com/q/6237860
has body: Can you please tell me how to add permissions on MySQL server for Mac? I am making a simple program for which I want to add a permission on MySQL server. From a search on Google, I found: In MySQL Workbench go to the "Server" menu heading and select "Users and Privileges". You can add a user here by clicking the"Add Account" button in the bottom left of the screen Actually I am getting the same error connect java to mysql using jdbc on osx But I am not using MAMP I just download mysql connector jar file and mysql-5.6.15-osx10.7-x86_64.dmg (mysql server) mysql-workbench-gpl-5.2.47-osx-i686(workbench). Where is the server option in Workbench?
tagged with: macos
has comment: http://stackoverflow.com/comment/32213053
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32249213
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21382726
has text: Have you tried to debug through your code? Your code looks like it should work... Are there no exceptions thrown?

http://stackoverflow.com/a/21501915
downvote count: 0
answers question: http://stackoverflow.com/q/21501875
type: Answer
has body: Use String.format: System.out.println("Found " + String.format("0x%02X", STX) + " at " + i);
score: 1
upvote count: 1

http://stackoverflow.com/comment/32310338
type: QuestionComment
comment on: http://stackoverflow.com/q/21417498
has text: Try right-clicking the JAR and running as administrator.
score: 0
type: Comment

http://stackoverflow.com/comment/121624313
type: Comment
has text: What if there are spaces at the end? It will creat problem...
type: AnswerComment
comment on: http://stackoverflow.com/a/21473542
score: 0

http://stackoverflow.com/a/21496102
has comment: http://stackoverflow.com/comment/32449274
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21495886
has comment: http://stackoverflow.com/comment/32449291
type: Answer
upvote count: 2
has body: Not "strictly" what you're asking, but start by taking How to use for attend text fields, for example... paymentField = new JFormattedTextField(NumberFormat.getCurrencyInstance()); paymentField.setValue(new Double(payment)); paymentField.setColumns(10); paymentField.setEditable(false); The problem with this is it's possible for the user to remove the $ sign and the validation is very strict, meaning that the text entered into the field MUST start with a $ Another possibility is to use the BuddySupport API from Swing Labs, SwingX library NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(2); paymentField = new JFormattedTextField(nf); paymentField.setValue(100d); paymentField.setColumns(10); paymentField.setEditable(false); BuddySupport.addLeft(new JLabel("$"), paymentField); This means that that $ is a separate component from the actual field and can't be removed by the user (but is contained within the field so it is not affected by the parent container's layout manager)

http://stackoverflow.com/a/21477741
has body: Move the dash - at the end of the character class: ^[_A-Za-z0-9.@-]+$ and ^[A-Za-z0-9\\s-]+$ Between two characters it means a range. Edit: You also need a + modifier to match one or more of the characters in the character class.
upvote count: 3
answers question: http://stackoverflow.com/q/21477682
type: Answer
has comment: http://stackoverflow.com/comment/32419068
has comment: http://stackoverflow.com/comment/32417015
has comment: http://stackoverflow.com/comment/32417098
downvote count: 0
score: 3

http://stackoverflow.com/q/21407463
has comment: http://stackoverflow.com/comment/32292294
has body: So I made two classes. Rectangle coloredRectangled extends Rectangle Than I made an array of Rectangles and inserted this check: if(tabel[i] instanceof coloredRectangle){} Netbeans tells me 'inconvertible types ,requiered coloredRectangle ,found Rectangle' I thought that with polymorphism it could work. What am i doing wrong? Code Rectangle: public class Rechthoek implements Printbaar { protected double lengte,breedte; private Rechthoek[] tabel; public Rechthoek(int lengte,int breedte){ this.lengte=lengte; this.breedte=breedte; } public String getInfo(){ return ("De lengte van de rechthoek is "+lengte+" en de breedte is "+breedte+" ."); } public void schrijfTabel(Rechthoek[] tabel){ for (int i = 0; i &lt; tabel.length; i++) { tabel[i].getInfo(); } } // faulty code is in the following method - Rechthoek = Rectangle and kleurRechthoek = coloredRectangle public boolean bevatKleur(Rechthoek[] tabel,String kleur){ for (int i = 0; i &lt; tabel.length; i++) { if(tabel[i] instanceof kleurRechthoek ){ return true; } } }
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32293053
has comment: http://stackoverflow.com/comment/32292223
possible better answer: http://stackoverflow.com/a/21407624
type: Question
has answer: http://stackoverflow.com/a/21407624
has answer: http://stackoverflow.com/a/21407543
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21407543
score: 0
has title: using instanceof to check if an arrayelement belongs to a certain class
answer count: 3
has comment: http://stackoverflow.com/comment/32292262
has answer: http://stackoverflow.com/a/21407825
tagged with: instanceof
has comment: http://stackoverflow.com/comment/32292260

http://stackoverflow.com/q/21453344
answer count: 1
tagged with: htmlspecialchars
accepted answer: http://stackoverflow.com/a/21453682
tagged with: xml-parsing
downvote count: 0
score: 1
favorite count: 0
has title: Parsing xml special chars issue
has comment: http://stackoverflow.com/comment/32373608
tagged with: android
upvote count: 1
has body: I'm parsing an XML got from webservice using SAX. One of the fields is a link, like the following &lt;link_site&gt; http://www.ownhosting.com/webservice_332.asp?id_user=21395&amp;amp;id_parent=33943 &lt;/link_site&gt; I have to get this link and save it, but it is saved like so: id_parent=33943. Parser snippet: //inside method startElement else if(localName.equals("link_site")){ this.in_link=true; } ... //inside method endElement else if(localName.equals("link_site"){ this.in_link=false; } Then, I get the content else if(this.in_link){ xmlparsing.setOrderLink(count, Html.fromHtml(new String(ch, start, length)).toString()); }//I get it and put in a HashMap&lt;Integer,String&gt; I know that this issue is due to the special characters encoding. What can I do?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21453682
tagged with: java
type: Question

http://stackoverflow.com/q/21501770
tagged with: java
tagged with: swing
type: Question
score: -2
tagged with: eclipse
upvote count: 2
has answer: http://stackoverflow.com/a/21502062
answer count: 1
tagged with: user-interface
favorite count: 0
type: UnansweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/32459324
has body: I'm currently working on a school project regarding school administration. In my project it is possible to create a school, education and students. I'm currently adding them all into the same JList(School), and it is giving me one problem. Whenever I'm adding for example a student it goes into the same line on the JList which makes it too long and I'm hoping for a way to do something like this on it: School 1 &nbsp;- Education 1 &nbsp;&nbsp;&nbsp;- Student 1 &nbsp;&nbsp;&nbsp;- Student 2 &nbsp;- Education 2 &nbsp;&nbsp;&nbsp;- Student 3 School 2 etc. etc. I've been reading about using cell renderer but I'm not sure that it works since I'm not creating a table. Please advice me about what to use. Regards Jakob Btw I don't want to use TextArea since I want to challenge myself.
has comment: http://stackoverflow.com/comment/32697082
has title: Multiple lines in JList java
downvote count: 4

http://stackoverflow.com/comment/32209492
score: 0
type: Comment
has text: Yes i forgot the division...but look at the edit now. Your line will horribly fail in case of 0 arguments. Anyway, good luck with your future assignments if it took all night to spot a missing division in an trivial average operation....
comment on: http://stackoverflow.com/a/21356724
type: AnswerComment

jtextarea
tags question: http://stackoverflow.com/q/21410591
type: Tag
tags question: http://stackoverflow.com/q/21395502
tags question: http://stackoverflow.com/q/21463498
tags question: http://stackoverflow.com/q/21395834
tags question: http://stackoverflow.com/q/21394894
tags question: http://stackoverflow.com/q/21493431
tags question: http://stackoverflow.com/q/21370687
tag name: jtextarea
tags question: http://stackoverflow.com/q/21418396
tags question: http://stackoverflow.com/q/21505343
tags question: http://stackoverflow.com/q/21505895

http://stackoverflow.com/q/21355710
tagged with: doubly-linked-list
type: UnansweredQuestion
tagged with: java
has body: private class Node{ int num; Node next; Node prev; Node (int num){ this.num=num; this.next=null; this.prev=null; } } Scanner sc = new Scanner(System.in); System.out.println("Enter file name"); String fileName = sc.next(); Scanner s = new Scanner (new File(fileName)); while(s.hasNextLine()){ //No idea } File example: //Skip this 3 6 2 a 3 b 8 2 3 4 I want to be able to go through each line of the file, skip everything in the comments, and put just the first two numbers of each line into a doubly linked list. I have been trying for awhile but I am new to doubly linked lists and I can't figure this out. Also I want to be able to do this without using ArrayList.
type: Question
has answer: http://stackoverflow.com/a/21355747
has title: Add to Doubly Linked List
has comment: http://stackoverflow.com/comment/32199500
score: 0
has comment: http://stackoverflow.com/comment/32199501
answer count: 1

http://stackoverflow.com/comment/32387449
type: QuestionComment
has text: But maybe you can use another trick
comment on: http://stackoverflow.com/q/21461402
score: 0
type: Comment

http://stackoverflow.com/a/21432198
has body: Here is a working code for your problem, just replace your xml file location in following code..... I have followed recursive approach here, so no need to know the tag name for parsing import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class domTest29jan { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); DocumentBuilder db = dbf.newDocumentBuilder(); // replace following path with your input xml path Document doc = db.parse(new FileInputStream(new File ("D:\\ambuj\\29jan.xml"))); // replace following path with your output xml path File OutputDOM = new File("D:\\ambuj\\29janoutapip1.txt"); FileOutputStream fostream = new FileOutputStream(OutputDOM); OutputStreamWriter oswriter = new OutputStreamWriter (fostream); BufferedWriter bwriter = new BufferedWriter(oswriter); // if file doesnt exists, then create it if (!OutputDOM.exists()) { OutputDOM.createNewFile();} visitRecursively(doc,bwriter); bwriter.close(); oswriter.close(); fostream.close(); System.out.println("Done"); } public static void visitRecursively(Node node, BufferedWriter bw) throws IOException{ // get all child nodes NodeList list = node.getChildNodes(); for (int i=0; i&lt;list.getLength(); i++) { // get child node Node childNode = list.item(i); if (childNode.getNodeType() == Node.TEXT_NODE ) { //System.out.println("Found Node: " + childNode.getNodeName() // + " - with value: " + childNode.getNodeValue()+" Node type:"+childNode.getNodeType()); String nodeValue= childNode.getNodeValue(); //System.out.println(childNode.getParentNode().getNodeName()); nodeValue=n…
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21428436

http://stackoverflow.com/comment/32402525
type: AnswerComment
has text: How would I map this in XML. Is there some way in the XML to specify "letter.info_id=info.info_id AND info.id=letter.registration_id" or similiar?
comment on: http://stackoverflow.com/a/21469377
score: 0
type: Comment

http://stackoverflow.com/comment/32240433
comment on: http://stackoverflow.com/a/21377298
type: AnswerComment
has text: By "goes for toss" I mean, system behavior is not as expected, and what is the behavior, that I can't explain here, because then I will have to explain domain.
score: 0
type: Comment

http://stackoverflow.com/a/21445471
type: AcceptedAnswer
downvote count: 0
has body: The question and code details are a bit vague and that makes it hard to understand very specifically what you are asking for and need help with but I'll try to infer. When an instance of your class Scripter is started (on Java thread), it will execute the code in the run() method (this is where the 'work' takes place) when the thread is allocated CPU resources. It runs like any other method and if it returns or completes, then the thread is finished and it will be cleaned up. Thus if the following code: if (stopscript) return; is called in run() method, then if that condition is true, the return terminates the run() method and the thread can terminate and clean up safely (presumably, correctness depends on what your program needs to do and how you are handling concurrency). If you just call stop() on the thread running the instance of Scripter, it stops it in whatever state it is in i.e. it could be half-way through a calculation or may not properly clean up its resources usage as detailed in the Javadoc you read. It essentially makes your program less predictable because the thread isn't allowed to terminate gracefully and that is (can be) problematic.
has comment: http://stackoverflow.com/comment/33805958
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21445303
answers question: http://stackoverflow.com/q/21445303

http://stackoverflow.com/q/21477513
tagged with: jsoup
has body: I have this html block as below after getting a web-page: &lt;td class="detail" id="ar-content-html"&gt; &lt;div style="float:right; padding: 10px"&gt; &lt;/div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;foo&lt;div style="padding: 20px"&gt;bar&lt;/div&gt; &lt;/td&gt; How can I get the content of the block after firstdiv tag? The required part: &lt;p&gt;&amp;nbsp;&lt;/p&gt;foo&lt;div style="padding: 20px"&gt;bar&lt;/div&gt;
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32416013
accepted answer: http://stackoverflow.com/a/21478421
possible better answer: http://stackoverflow.com/a/21477772
has answer: http://stackoverflow.com/a/21477772
has answer: http://stackoverflow.com/a/21479642
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32416127
tagged with: java
has answer: http://stackoverflow.com/a/21478421
type: Question
has title: Get content after a node

http://stackoverflow.com/a/21508645
type: Answer
answers question: http://stackoverflow.com/q/21502122
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21502122
upvote count: 2
type: AcceptedAnswer
has body: Please take a look at the examples of chapter 4 of my book, more specifically at the Zhang example. In this example, I have a table with four columns: (1) year, (2) movie title in English, (3) movie title in Chinese, and (4) run length. If you look at the resulting PDF, you will see that this table is split vertically. Achieving this requires more work then simply adding a table and allowing iText to decide how to split it in between rows. When you want to split in between columns, you need to organize the layout in your code. This is done using the writeSelectedRows()) method. In my simple book example, I use these lines: // draw the first two columns on one page table.writeSelectedRows(0, 2, 0, -1, 236, 806, canvas); document.newPage(); // draw the remaining two columns on the next page table.writeSelectedRows(2, -1, 0, -1, 36, 806, canvas); First I draw the columns from index 0 to index 2. The column with index 0 is the first column, the column with index 2 is the first column that isn't included, namely the third column. I draw the rows from index 0 (first row) until -1. Minus one means: draw all the remaining rows. You also see minus one on the next page, where I draw the column with index 2 (the third column) until the column with index -1 (meaning: the rest of the columns). The values (236, 806) and (36, 806) are coordinates: that's where you want the table to start. You can't define "end coordinates". If the table doesn't fit on the page, iText will just continue drawing the table, even if that means that some content exceeds the visible area of the page. This means that you'll have to be very careful when using this method: you'll need to calculate widths and heights of rows and columns before adding the table, otherwise you may end up with parts of the table that aren't visible.

http://stackoverflow.com/a/21425417
has body: this should work a = a.replaceAll("\\)(\\s)*([^*+/-])", ") * $2");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21424923

http://stackoverflow.com/q/21371871
tagged with: java
has answer: http://stackoverflow.com/a/21371946
type: Question
tagged with: indexof
tagged with: string
has answer: http://stackoverflow.com/a/21371936
score: 0
tagged with: char
answer count: 3
has comment: http://stackoverflow.com/comment/32229065
has body: I have a program for a hangman game and the indexof is not working for me? its on line 30. I have been trying to figure it out but I cannot.if (guessedWord.indexOf(letter) >= 0). I will keep trying to find out what I did wrong import java.io.PrintStream; import java.util.Scanner; public class Hangman { public static void main(String[] args) { String[] words = { "write", "program", "that", "receive", "positive" }; Scanner input = new Scanner(System.in); char anotherGame; do { int index = (int)(Math.random() * words.length); String hiddenWord = words[index]; StringBuilder guessedWord = new StringBuilder(); for (int i = 0; i &lt; hiddenWord.length(); i++) { guessedWord.append('*'); } int numberOfCorrectLettersGuessed = 0; int numberOfMisses = 0; while (numberOfCorrectLettersGuessed &lt; hiddenWord.length()) { System.out.print("(Guess) Enter a letter in word " + guessedWord + " &gt; "); String s = input.nextLine(); char letter = s.charAt(0); if (guessedWord.indexOf(letter) &gt;= 0) { System.out.println("\t" + letter + " is already in the word"); } else if (hiddenWord.indexOf(letter) &lt; 0) { System.out.println("\t" + letter + " is not in the word"); numberOfMisses++; } else { int k = hiddenWord.indexOf(letter); while (k &gt;= 0) { guessedWord.setCharAt(k, letter); numberOfCorrectLettersGuessed++; k = hiddenWord.indexOf(letter, k + 1); } } } System.out.println("The word is " + hiddenWord + ". You missed " + numberOfMisses + (numberOfMisses &lt;= 1 ? " time" : " times")); System.out.print("Do you want to guess for another word? Enter y or n&gt; "); anotherGame = input.nextLine().charAt(0); }while (anotherGame == 'y'); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21371933
has title: why is indexof not working?

http://stackoverflow.com/a/21372868
type: Answer
has comment: http://stackoverflow.com/comment/32232275
answers question: http://stackoverflow.com/q/21372717
has body: Just keep your functions inside the afterTextChanged and see what happens Sample Code seachbox.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub fillData(SEARCH_ORDER ,s.toString()); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub }); I hope it will work
score: 0
has comment: http://stackoverflow.com/comment/32230911

http://stackoverflow.com/q/21492107
has title: Adding elements to an array without arrayList
type: UnansweredQuestion
has body: I am trying to define a method called add() that adds an object Fish to an array fish[]. How would I got about this without using arrayList? I keep receiving the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 public class Pond { private Fish[] fish; private int numFish ; private int capacity; public Pond(int capacity){ this.capacity = capacity; } public int getNumFish(){ return numFish; } public boolean isFull(){//Ponds can only have so many fish boolean Full = false; if (numFish &gt;= capacity){ Full = true;} return Full; } public void add(Fish aFish) {// puts a fish in the pond--OR-- replaces a fish that has been temporarily removed if (numFish &lt; capacity){ fish[numFish++] = aFish;} }
tagged with: object
has comment: http://stackoverflow.com/comment/32442506
has comment: http://stackoverflow.com/comment/32442657
tagged with: java
has comment: http://stackoverflow.com/comment/32442770
type: Question
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/21492360
has comment: http://stackoverflow.com/comment/32442540
has comment: http://stackoverflow.com/comment/32442685
score: 0
has answer: http://stackoverflow.com/a/21492377

http://stackoverflow.com/q/21364133
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32217831
has comment: http://stackoverflow.com/comment/32217641
tagged with: transactions
tagged with: java
has comment: http://stackoverflow.com/comment/32217108
type: Question
score: 0
has title: why are these two successive reads executed in the same transaction?
has comment: http://stackoverflow.com/comment/32217845
has comment: http://stackoverflow.com/comment/32217822
tagged with: postgresql
tagged with: jdbc
has body: I have a separate thread inserting rows in a table, committing after each row. Then, on my main thread I do two successive reads on that table (SELECT COUNT(*)) with a sleep period of 1000 ms between the two reads. The two reads observe the same number of rows even though the reads should (?) happen in different transactions. The only way to get the two reads to return different values is to add a commit between the two reads (call the method with breakTransaction set to true). Otherwise they appear to be executed in the same transaction. The ds used in the code below is of type org.apache.commons.dbcp.BasicDataSource: public void readTwoCounts(boolean breakTransaction) throws SQLException { Connection conn = ds.getConnection(); conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); PreparedStatement ps1 = null; ResultSet rs1 = null; PreparedStatement ps2 = null; ResultSet rs2 = null; try { Integer count1 = null; Integer count2 = null; { // 1st READ ps1 = conn.prepareStatement("SELECT COUNT(*) FROM a"); rs1 = ps1.executeQuery(); rs1.next(); count1 = rs1.getInt("count"); } if (breakTransaction) conn.commit(); try {Thread.sleep(1000);} catch (InterruptedException ie) {} { // 2nd READ ps2 = conn.prepareStatement("SELECT COUNT(*) FROM a"); rs2 = ps2.executeQuery(); rs2.next(); count2 = rs2.getInt("count"); } System.out.printf("%d %d\n", count1, count2); } finally { DbUtils.closeQuietly(conn, ps1, rs1); DbUtils.closeQuietly(conn, ps2, rs2); } } My question is: When do successive reads on a Connection object happen on the same transaction and why do I have to explicitly call commit to ensure they happen in different transactions?
answer count: 0

http://stackoverflow.com/a/21487757
has body: Use the Guava Libraries Splitter object, specifically the fixedLength(...) method which does exactly what you're trying to do. Splitter splitter = Splitter.fixedLength(5); Iterable&lt;String&gt; tokens= splitter.split(myVeryLongString);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21486836

http://stackoverflow.com/comment/32311649
type: Comment
has text: hi, think you , i try it before , but I could not do it. can you please write all code ? ^_^
type: AnswerComment
comment on: http://stackoverflow.com/a/21413888
score: 1

http://stackoverflow.com/q/21439867
has answer: http://stackoverflow.com/a/21440239
score: 0
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/21440161
tagged with: conditional-statements
tagged with: java
type: Question
has title: getState() return value for java.util.concurrent.locks.Condition
answer count: 2
has body: The AbstractQueuedSynchronizer class, a base class for the java.util.concurrent.locks.Condition interface, has a function called getState() protected final int getState() Returns the current value of synchronization state. This operation has memory semantics of > a volatile read. Returns: current state value This function returns the current state of the Condition which I assume to be something like waiting, timed out waiting, aborted, signaled in int form. Does anyone know where I can find the integer definitions of the getState() function?

http://stackoverflow.com/comment/32476024
has text: I am loading entire data from table. Then how can I set the address to all students. without using any ID value
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21511090
type: Comment

http://stackoverflow.com/q/21490154
downvote count: 0
linked to: http://stackoverflow.com/q/3750538
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21490270
has comment: http://stackoverflow.com/comment/32439693
has title: Fastest way to batch query an ORACLE Database with Java
type: Question
tagged with: oracle-database
tagged with: sql
has comment: http://stackoverflow.com/comment/32439079
possible better answer: http://stackoverflow.com/a/21490313
has answer: http://stackoverflow.com/a/21490313
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21490270
tagged with: java
linked to: http://stackoverflow.com/q/3841441
linked to: http://stackoverflow.com/q/3147874
has body: In a project I am working on, I am given a list that contains a little under 1 million lines. The data maps all possible origins (000-999) to all possible destinations (000-999). For each combination, I need to be able to look at the database and determine if there exists a record with the same combination. If no record exists, then it will be added to the database. If the record does exist, then the record will be updated with the new information. The origin and destination are the primary key of the table, and are also indexes. This is all on an ORACLE database. Given that I have to do this 1 million times, what is the best possible solution? My current method is taking upwards of an hour to process all records. For actually inserting and updating the records, I am using a batch query process that doesn't take much time at all. The part that appears to be taking the most amount of time is querying the database for the count of existing records. public String batchUpdateModes(List records, String user) throws TransactionException { String message = ""; ArrayList updateList = new ArrayList(); ArrayList insertList = new ArrayList(); Connection conn = null; try { conn = getDao().getConnection(); } catch (SQLException e1) { e1.printStackTrace(); } for (int i = 0; i &lt; records.size(); i++) { BatchFileCommand record = (BatchFileCommand)records.get(i); String origin = record.getOrigZip().trim(); String dest = record.getDestZip().trim(); String pri = record.getPriMode().trim(); String fcm = record.getFcmMode().trim(); String per = record.getPerMode().trim(); String pkg = record.getPkgMode().trim(); String std = record.getStdMode().trim(); String effDate = record.getEffDate(); String discDate = ""; TransModeObj obj = new TransModeObj(origin, dest, pri, fcm, per, pkg, std, effDate, discDate); obj.setUserId(user); try { Statement stmt = null; String findExisting = "select count(*) from trans_mode where orig_zip = " + origin + " " + "and dest_zip = " + dest; stmt = conn.crea…
type: AnsweredQuestion

http://stackoverflow.com/a/21473512
has comment: http://stackoverflow.com/comment/32409345
answers question: http://stackoverflow.com/q/21473400
score: 0
type: Answer
has body: Do like this public static void main(String args[]){ String scan =" Hello World"; String scan1= scan.replaceAll("^\\s*",""); int count = scan.length()-scan1.length(); System.out.println("Number of Spaces removed at the begining"+count); }

http://stackoverflow.com/comment/32329454
type: QuestionComment
has text: Yes Duncan..u r right..
score: 0
comment on: http://stackoverflow.com/q/21428595
type: Comment

http://stackoverflow.com/a/21484289
type: Answer
accepted answer of: http://stackoverflow.com/q/21483446
answers question: http://stackoverflow.com/q/21483446
has body: String a = "sin(23)+cos(4)+2!+3!+44!"; Pattern number = Pattern.compile("\\d+!"); Matcher matcher = number.matcher(a); while (matcher.find()) { System.out.println(matcher.group()); }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/32318737
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21422431
has text: Don't compare string with `==`, it will not work. Use `.equals`.. `if("runserver".equals(str)){`
score: 0

http://stackoverflow.com/q/21492086
has comment: http://stackoverflow.com/comment/32442489
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/32442484
has answer: http://stackoverflow.com/a/21492394
has answer: http://stackoverflow.com/a/21492111
tagged with: methods
has title: Passing a value input from main method to a private variable
has comment: http://stackoverflow.com/comment/32442611
type: Question
answer count: 2
has body: I am trying to pass a value from the main method and set it to a private variable. Here is the main method that's pertinent: import java.util.*; public class Experiment{ private static Extension extension=new Extension(); public static void main(String[] ars);{ Scanner input=new Scanner(System.in); System.out.print("Enter the length: "); int length=input.nextInt; extension.messages(length); } } and here's what goes with it: public class Extension{ private int theLength; public void Extension(int length){ theLength=length; } public void setLength(int length){ theLength=length; } public int getLength() { return theLength } public void messages(int length){ System.out.println("theLength: "+theLength); System.out.println("Length: "+getLength(); } } I added the extra display because I wanted to see if the value was getting passed on correctly. When I run it, I realize that it's not; both theLength and length are set to zero despite having input different numbers. Can anyone see what I'm doing wrong? I would sincerely appreciate a thorough answer (since I am just starting out).
possible better answer: http://stackoverflow.com/a/21492394
tagged with: argument-passing
tagged with: getter
has comment: http://stackoverflow.com/comment/32442590
accepted answer: http://stackoverflow.com/a/21492111
has comment: http://stackoverflow.com/comment/32442393
has comment: http://stackoverflow.com/comment/32442836
has comment: http://stackoverflow.com/comment/32442783
type: AnsweredQuestion

http://stackoverflow.com/a/21448699
has body: It seems that your problem is that you are selecting catalog instead of book as NodeList. This way your list will have only one element instead of 8. Try maybe with this code (I print output to console but you can use it whatever you like) NodeList list = document.getElementsByTagName("book"); for (int i = 0; i &lt; list.getLength(); i++) { NodeList childs = list.item(i).getChildNodes(); //iterate over all child nodes like author/title/description for (int j = 0; j &lt; childs.getLength(); j++) { Node child = childs.item(j); //if node is the one we are looking for print it if (child.getNodeName().equals("author")) System.out.println("author : "+child.getTextContent()); if (child.getNodeName().equals("title")) System.out.println("title : "+child.getTextContent()); } System.out.println("------------");// }// end for Another approach would be using some other parsers. I like Jsoup which is mainly used to parse HTML but it also have XML parser. its code could look like this import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; ... InputStream xml = new FileInputStream("input.txt"); Document doc = Jsoup.parse(xml, "utf-8", "", Parser.xmlParser()); for (Element e : doc.select("book author, book title")) { System.out.println(e.nodeName() + ": " + e.text()); }
answers question: http://stackoverflow.com/q/21447771
type: Answer
score: 0

http://stackoverflow.com/comment/32475091
comment on: http://stackoverflow.com/a/21510457
score: 1
type: AnswerComment
type: Comment
has text: @StephenC OK, apparently it's a waste of time. I will leave this answer here for now just in case OP finds it useful. I understood that you don't, no need to repeat that 3-4 times IMHO.

http://stackoverflow.com/q/21394440
has comment: http://stackoverflow.com/comment/32270024
tagged with: arrays
accepted answer: http://stackoverflow.com/a/21394641
has comment: http://stackoverflow.com/comment/32270135
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: string
has comment: http://stackoverflow.com/comment/32270091
favorite count: 0
has comment: http://stackoverflow.com/comment/32270071
type: Question
answer count: 2
has body: I'm creating some code that prints a message to console with a border around it to reinforce my programming knowledge. I'm having issues with this specific snippet of code that should be splitting a large string into an array of strings which can then be printed //splits message into multiple parts //lines is an integer representing how many lines the text would take up within the provided border //panewidth is an integer representing the desired size of the window created by the borders String[] MessageParts = new String[lines]; for (int i = 0; i &lt; lines; i++){ MessageParts[i] = (message.substring(i*(panewidth-2), (i+1)*(panewidth - 2))); // //HACK System.out.println(MessageParts[i]); // } Full code: ChrisMadeaGame Class: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package chrismadeagame; /** * * @author 570694 */ public class ChrisMadeaGame { /** * @param args the command line arguments */ //Generates a statholder object for score StatHolder Score = new StatHolder(); StatHolder Turns = new StatHolder(); public static void main(String[] args) { // TODO code application logic here ChrisMadeaGame ChrisMadeaGame = new ChrisMadeaGame(); ChrisMadeaGame.display("Test"); } public void display(String message) { //Width of pane goes here final int panewidth = 80; //The character used for the border final String BorderChar = "*"; //The character used for whitespace final String WhitespaceChar = " "; //Calculates how many lines will be necessary to print the message. Always rounds up to an integer final int lines = (int) Math.ceil((panewidth - 2)/message.length()); // //HACK System.out.println(lines); System.out.println(message.length()); System.out.println(panewidth); System.out.println((panewidth - 2)/message.length()); // //splits message into multiple parts String[] MessageParts = new String[lines]; for (int i = 0; i &lt; lines; i++){…
has title: Split a string into an array of strings using substring (Java)
has comment: http://stackoverflow.com/comment/32270114
tagged with: java
possible better answer: http://stackoverflow.com/a/21394588
upvote count: 1
has answer: http://stackoverflow.com/a/21394641
has answer: http://stackoverflow.com/a/21394588
has comment: http://stackoverflow.com/comment/32270195

http://stackoverflow.com/a/21388146
has body: You can use OnClickListener on TextView and then use the following method on the OnClick, where textViewAbove is the TextView that is above the one you need to jump: scrollView.post( new Runnable() { @Override public void run() { new CountDownTimer(1500, 20) { @Override public void onTick(long millisUntilFinished) { scrollView.scrollTo(0, (int) (textViewAbove.getBottom()-millisUntilFinished)); } @Override public void onFinish() { } }.start(); } } ); Hope it helps!
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21387425
has comment: http://stackoverflow.com/comment/32259212
answers question: http://stackoverflow.com/q/21387425
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32263470
has comment: http://stackoverflow.com/comment/32278022
score: 1
has comment: http://stackoverflow.com/comment/32266989

http://stackoverflow.com/q/21497112
has body: I want to convert a string value to an integer but I can't. My statement checked =Integer.parseInt(input); has an error, please help and thanks a lot in advance. import java.util.Scanner; public class ass2a { public static void main(String []args) { Scanner reader = new Scanner(System.in); String input,b; long checked; System.out.print("Please enter the 12 digit:"); input = reader.nextLine(); if(input.length() &lt; 12) { System.out.println("The digit is less than 12."); } int one,two,three,four,five,six,seven,eight,nine,ten,eleven,twevle; checked =Integer.parseInt(input); System.out.println(checked); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32450981
tagged with: java
downvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/21497144
has answer: http://stackoverflow.com/a/21497245
has title: How to conver a string value to an integer
has comment: http://stackoverflow.com/comment/32450977
has comment: http://stackoverflow.com/comment/32451124
has answer: http://stackoverflow.com/a/21497185
answer count: 6
has comment: http://stackoverflow.com/comment/32451016
has answer: http://stackoverflow.com/a/21497183
upvote count: 0
has comment: http://stackoverflow.com/comment/32450989
has answer: http://stackoverflow.com/a/21497209
tagged with: parsing
has comment: http://stackoverflow.com/comment/32451055
favorite count: 0
has answer: http://stackoverflow.com/a/21497144
possible better answer: http://stackoverflow.com/a/21497153
score: -3
has comment: http://stackoverflow.com/comment/32451079
has answer: http://stackoverflow.com/a/21497153

http://stackoverflow.com/comment/32348108
type: Comment
score: 0
type: AnswerComment
has text: That's very cool. What model is that? Sorry I can't be of more help to your initial question.
comment on: http://stackoverflow.com/a/21426196

http://stackoverflow.com/comment/32318256
comment on: http://stackoverflow.com/q/21422156
score: 0
type: QuestionComment
type: Comment
has text: Having to manually type in "one two three four five six seven" is a bit of a pain. Can't paste it.

http://stackoverflow.com/a/21402838
accepted answer of: http://stackoverflow.com/q/21402605
has comment: http://stackoverflow.com/comment/60937466
upvote count: 3
has comment: http://stackoverflow.com/comment/32284568
score: 3
has body: With getElementById you will get an DOM Element by id. The id AddSerialNum does not exist, this is what the error tells you. You have an input with name="AddSerialNum", which, i think you want to get. Either add an id to it, or use getElementsByName("AddSerialNum")[0] EDIT: Like i already pointed out, you have to use this: webView.loadUrl("javascript: {document.getElementsByName(\"AddSerialNum\")[0].value ='" + ABC + "';};"); The getElementsByName returns an array of elements, you have to get the first one with [0]
has comment: http://stackoverflow.com/comment/64469571
answers question: http://stackoverflow.com/q/21402605
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32286743
has text: @Duncan that's fine. then, let me delete my comment
comment on: http://stackoverflow.com/q/21404162
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21447465
has body: This captures the text you want, although I'm not totally clear on your requirements for the (40) part. @lovetostrike's answer addresses that. \bClaims(?:\(\d+\))?\s+(.+?)\s+Description\b You must activate the DOTALL flag when compiling the pattern: Pattern.compile(regxStr, Pattern.DOTALL) Escaped in a Java string: "\\bClaims(?:\\(\\d+\\))?\\s+(.+?)\\s+Description\\b"
has comment: http://stackoverflow.com/comment/32364147
accepted answer of: http://stackoverflow.com/q/21447363
answers question: http://stackoverflow.com/q/21447363
type: Answer
has comment: http://stackoverflow.com/comment/32364097
downvote count: 0
has comment: http://stackoverflow.com/comment/32363867
score: 1
has comment: http://stackoverflow.com/comment/32364188
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21480087
has comment: http://stackoverflow.com/comment/32429523
answers question: http://stackoverflow.com/q/21479156
has comment: http://stackoverflow.com/comment/32429510
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21479156
has comment: http://stackoverflow.com/comment/32426118
type: Answer
has body: I think you transport connector configuration should look like this: <transportConnector name="tcp" uri="tcp://0.0.0.0:61616"/> See the documentation for connectors.
has comment: http://stackoverflow.com/comment/32427761
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/65622135
has comment: http://stackoverflow.com/comment/32431733

http://stackoverflow.com/q/21462530
has answer: http://stackoverflow.com/a/21462610
has comment: http://stackoverflow.com/comment/32389640
has body: I am having trouble fixing my code so that I stop getting java.lang.ArrayIndexOutOfBoundsException: 6 Here is my current code: public static boolean isRow(int row, double[][] array) { boolean flag = false; if ( array != null &amp;&amp; array.length &gt;= 0 ) { if ( array[row] != null ) { flag = true; } } return flag; } I know that I will probably have to have a for loop somewhere so that it can check to see that !(row &gt; array.length); But I am just not sure how to write that in. I am using a JUNIT test that is trying to pass "6" in as the row variable. Any help is greatly appreciated!
has title: Check if a Row exists in a 2D array in Java
has comment: http://stackoverflow.com/comment/32389613
type: AnsweredQuestion
tagged with: 2d
accepted answer: http://stackoverflow.com/a/21462610
tagged with: row
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21462672
has answer: http://stackoverflow.com/a/21462639
has answer: http://stackoverflow.com/a/21462672
tagged with: arrays
score: 0
answer count: 3

http://stackoverflow.com/a/21467878
accepted answer of: http://stackoverflow.com/q/21467017
downvote count: 0
answers question: http://stackoverflow.com/q/21467017
has body: Demonstrating what the commenter said: scala&gt; import collection.JavaConverters._ import collection.JavaConverters._ scala&gt; val js = (1 to 10).toSet.asJava js: java.util.Set[Int] = [5, 10, 1, 6, 9, 2, 7, 3, 8, 4] scala&gt; def f(is: collection.mutable.Set[Int]) = is.size f: (is: scala.collection.mutable.Set[Int])Int scala&gt; def g(js: java.util.Set[Int]) = f(js.asScala) g: (js: java.util.Set[Int])Int scala&gt; g(js) res0: Int = 10
has comment: http://stackoverflow.com/comment/32425641
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/32403642
score: 2
has comment: http://stackoverflow.com/comment/32400409
type: AcceptedAnswer

http://stackoverflow.com/comment/32388616
comment on: http://stackoverflow.com/q/21456494
score: 4
has text: You might want to use `containing` in order to benefits from indexes, see http://docs.spring.io/spring-data/jpa/docs/1.4.3.RELEASE/reference/html/repository-query-keywords.html
type: Comment
type: QuestionComment

java-ee-7
tags question: http://stackoverflow.com/q/21456683
tags question: http://stackoverflow.com/q/21375677
tags question: http://stackoverflow.com/q/21458196
tags question: http://stackoverflow.com/q/21387746
tags question: http://stackoverflow.com/q/21410828
tag name: java-ee-7
tags question: http://stackoverflow.com/q/21474726
tags question: http://stackoverflow.com/q/21378056
type: Tag
tags question: http://stackoverflow.com/q/21424808
tags question: http://stackoverflow.com/q/21399318

database
tags question: http://stackoverflow.com/q/21497089
tags question: http://stackoverflow.com/q/21356754
tags question: http://stackoverflow.com/q/21431658
tags question: http://stackoverflow.com/q/21416010
tags question: http://stackoverflow.com/q/21361781
tags question: http://stackoverflow.com/q/21382342
tags question: http://stackoverflow.com/q/21394667
type: Tag
tags question: http://stackoverflow.com/q/21366240
tags question: http://stackoverflow.com/q/21460074
tags question: http://stackoverflow.com/q/21465110
tags question: http://stackoverflow.com/q/21386941
tags question: http://stackoverflow.com/q/21377026
tags question: http://stackoverflow.com/q/21475764
tags question: http://stackoverflow.com/q/21505920
tags question: http://stackoverflow.com/q/21424607
tag name: database
tags question: http://stackoverflow.com/q/21513126
tags question: http://stackoverflow.com/q/21351000
tags question: http://stackoverflow.com/q/21480591
tags question: http://stackoverflow.com/q/21476755
tags question: http://stackoverflow.com/q/21396765
tags question: http://stackoverflow.com/q/21481193
tags question: http://stackoverflow.com/q/21402395
tags question: http://stackoverflow.com/q/21397393
tags question: http://stackoverflow.com/q/21358473
tags question: http://stackoverflow.com/q/21379824
tags question: http://stackoverflow.com/q/21364204
tags question: http://stackoverflow.com/q/21374880
tags question: http://stackoverflow.com/q/21362562
tags question: http://stackoverflow.com/q/21490733
tags question: http://stackoverflow.com/q/21463688

http://stackoverflow.com/a/21504199
has body: You can read about the JSON format here. Consider these two Java classes public class Foo { private Bar bar; private String value; } public class Bar { private int count; } and the objects Foo foo = new Foo(); foo.value = "some value"; Bar bar = new Bar(); bar.count = 42; foo.bar = bar; Could you do foo.count = 100; ? The answer is no. the field count belongs to the Bar object, not to the Foo object. Same thing applies to JSON. { "bar": { "count": 42 }, "value": "some value" } The count element is a JSON primitive that belongs to the JSON object named bar. (The fact that it is a JSON array is irrelevant.)
score: 0
answers question: http://stackoverflow.com/q/21504142
type: Answer

http://stackoverflow.com/comment/32285591
type: QuestionComment
has text: Because generics type are invariant. `List<String>` is not a subtype of `List<Object>`.
comment on: http://stackoverflow.com/q/21403750
score: 0
type: Comment

http://stackoverflow.com/comment/32441716
type: Comment
has text: If this is to be used in multi-threaded code, `final` could be replaced with `volatile`, to avoid synchronization, since this should also be the only mutation to `longArray` in the whole class (besides constructors).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21491262

http://stackoverflow.com/a/21499268
upvote count: 6
type: Answer
score: 6
has body: Java has a ternary conditional operator inherited from C, it looks like this: int x = some_condition ? 1 : 2; x will be equal to 1 if some_condition is true, and to 2 otherwise. Java requires that arguments to this operator are expressions, i.e. things which result in concrete values. For example, method call or constant literal are expressions, but a loop or a conditional statement or a variable definition are not expressions because they do not have meaningful value. This means that you cannot return, say, variable definition from a function, but you can return result of method call. Scala does not have ternary operator. But it does not need one because in Scala everything is expression. Even loops - they result in a special value of Unit type. Conditionals are also expressions, they return a value of common supertype of all branches. Because of this you can use plain conditional "statement" instead of ternary operator. This Scala snippet is equivalent to Java one above: val x = if (some_condition) 1 else 2 Moreover, in Scala every block is an expression too (its value is the value of the last line in the block), so you can have statements, for example assignments, inside the "ternary operator": val x = if (some_condition) { val y = some_computation() y*2 } else { val z = another_computation() z + 3 }
downvote count: 0
answers question: http://stackoverflow.com/q/21498993

http://stackoverflow.com/a/21505961
answers question: http://stackoverflow.com/q/21505718
has comment: http://stackoverflow.com/comment/32467119
accepted answer of: http://stackoverflow.com/q/21505718
type: Answer
has body: If you don't want to append to the file then use the correct FileWriter constructor parameter values for the second parameter, the "append" parameter: Not: fileWriter = new FileWriter(file, true); but rather: fileWriter = new FileWriter(file, false); As usual, please check the FileWriter API for the details. Edit You state: I am probably just confusing myself too much at this point - when I set append to false, it replaces what was in the file in the last run of my loop, so I end up with just the last line - well I want to feed the data in line by line while the program runs, when it finishes I want the file to be left there, until the next run - at that point I want to clear the contents.. It sounds like you're creating a new FileWriter with each iteration of the loop. If so, don't. Create one FileWriter with the second constructor parameter set to false, and create it before your loop. Then loop with it, without re-creating it in the loop, and then when the loop is over and you're through using it, close it. Simplify things.
has comment: http://stackoverflow.com/comment/32467427
score: 2
has comment: http://stackoverflow.com/comment/32467473
has comment: http://stackoverflow.com/comment/32467379
upvote count: 2
has comment: http://stackoverflow.com/comment/32467248
has comment: http://stackoverflow.com/comment/32467457
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/54904573
type: Comment
has text: This is a bad lack on the Android documentation... they should find a way to indicate that an interface is implemented (or a class is extended) only since a defined API level. However, thanks :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21353587

http://stackoverflow.com/q/21429058
accepted answer: http://stackoverflow.com/a/21433223
tagged with: try-catch
has comment: http://stackoverflow.com/comment/32344426
type: AnsweredQuestion
has title: Improve error handling of the code
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21433223
answer count: 1
has body: I want to improve some security aspects of my code. If there is any error while executing alg.solve(), then the process should not be stopped, rather the null must be returned by runMethod(). Will the following code snippet work this way? public Result runMethod() { Algorithm alg = new Algorithm(this); Result r = null; try { r = alg.solve(); } catch (Exception e) { e.printStackTrace(); } return r; }
tagged with: security
score: 0

http://stackoverflow.com/q/21389178
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/6742705
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/32268315
accepted answer: http://stackoverflow.com/a/22717451
has comment: http://stackoverflow.com/comment/32263047
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32261336
has comment: http://stackoverflow.com/comment/136081568
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Background: I'm calling web APIs that are in JSON format and passing them through a data orchestration tool that needs them in XML format. Orchestration tool allows custom Java procedures. Problem: JSON can contain elements that when converted to XML cause issues. For example twitter handles @john: somevalue is fine for a key in JSON but when converted to XML &lt;@john>somevalue causes the orchestration tool to throw errors. I'm hitting a wide variety of web APIs that change often. I need to be able to convert arbitrary JSON to XML with little to no maintenance. Research so far: I've found several ways to convert JSON to XML in Java but many of them are for fixed input structures. This StackOverflow post seems like what I want but I'm having issues getting it to work and tracking down all of the JARs required. I've seen some libraries will do some basic character escapes for &amp;, &lt;, >, ' and ". Is there one that is more robust?
type: Question
has title: Convert Arbitrary JSON with invalid XML characters to XML in Java
has answer: http://stackoverflow.com/a/22717451
score: 2
has comment: http://stackoverflow.com/comment/32260301

http://stackoverflow.com/comment/32204323
comment on: http://stackoverflow.com/a/21355616
type: AnswerComment
score: 0
has text: This is the code i started out with originally. My problem persists when The paddle gets to the height of the location.y 465, it goes back down to 464 and it becomes true again then goes up to 465, and its a constant cycle. 465, 464, 465, 464, 465. Any idea what my next step should be? thanks again, I implemented the changes you suggested.
type: Comment

http://stackoverflow.com/comment/34844712
comment on: http://stackoverflow.com/q/21354935
type: Comment
type: QuestionComment
has text: Yes, I'm sorry, I was in hurry before. So my initial question was, if there is a simple possibility to take an integer tuple and create a BDD out of it. But I don't think that it is possible, like I wanted. For this, I have to convert the integers to it's binary representations and add these as simple variables to the BDD. I will add an answer to this question now, how I think it is the best possibility, but this version is not really satisfying..
score: 0

http://stackoverflow.com/a/21413961
has body: In addition to what @Behe mentioned, you can also set an action command for your buttons to make it easier to figure out which button was pressed: runDemo = new JButton("Run Demo"); runDemo.addActionListener(new buttonListener()); runDemo.setActionCommand("rundemo"); runLive = new JButton("Run Live"); runLive.addActionListener(new buttonListener()); runLive.setActionCommand("runlive"); scan = new JButton("Scan Market"); scan.addActionListener(new buttonListener()); scan.setActionCommand("scan"); ... public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); // Get the action. if ( action.equalsIgnoreCase("rundemo") ) { // Run Demo
answers question: http://stackoverflow.com/q/21412838
score: 0
type: Answer

http://stackoverflow.com/comment/32469787
has text: Then if i want have a continous input like while(args[0]!=EOF){ add to array } How can we implement this.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21507042
type: AnswerComment

import
type: Tag
tags question: http://stackoverflow.com/q/21411492
tags question: http://stackoverflow.com/q/21407097
tag name: import
tags question: http://stackoverflow.com/q/21477783
tags question: http://stackoverflow.com/q/21395379
tags question: http://stackoverflow.com/q/21472494
tags question: http://stackoverflow.com/q/21411630
tags question: http://stackoverflow.com/q/21481316
tags question: http://stackoverflow.com/q/21511282
tags question: http://stackoverflow.com/q/21514390

http://stackoverflow.com/comment/32470249
comment on: http://stackoverflow.com/a/21507318
has text: There is no jsp, I'm passing json from a non-web application to the spring mvc app.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32344576
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21437242
score: 0
has text: @ pamphlet and christopher. it moves only to500,500.As i move the cursor by workig on the mouse,t again goes back to 500,500

http://stackoverflow.com/comment/32388809
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21461120
has text: in your code you are applying the margin to the TextTiews. And the TableRows are the parents of those TextTiews

http://stackoverflow.com/q/21505855
tagged with: generics
has body: class linkedqueue &lt;item_t&gt; { private class node{ item_t item; node link; public node(item_t t, node l){ item=t; link=l; } private node front = null; private node rear = null; public void insert (item_t any) { this.link=new node(any,this.link); } the insert method should add "any" to the end of the queue. It works only in the node class, but now it is in the linkedqueue class, I don't know how to fix the "this.link" part..
linked to: http://stackoverflow.com/q/5236486
type: UnansweredQuestion
has title: How to add a node to the end of the linked list in a generic class?
tagged with: linked-list
has answer: http://stackoverflow.com/a/21505923
tagged with: java
tagged with: queue
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/32244445
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21371759
has text: I would suggest to test in EMR.
type: AnswerComment

http://stackoverflow.com/comment/32280779
comment on: http://stackoverflow.com/q/21400142
score: 0
type: Comment
type: QuestionComment
has text: above is working on emulator."\u24D8". Can give example code if required.

http://stackoverflow.com/comment/32341339
comment on: http://stackoverflow.com/q/21433510
type: Comment
score: 0
type: QuestionComment
has text: <?xml version="1.0" encoding="utf-8"?>

http://stackoverflow.com/comment/32362252
comment on: http://stackoverflow.com/a/21446590
type: AnswerComment
has text: Thanks! That's the exact answer I wanted! :)
type: Comment
score: 0

http://stackoverflow.com/comment/32367187
type: AnswerComment
comment on: http://stackoverflow.com/a/21449398
score: 0
type: Comment
has text: I'm using a Nexus 4 16gig with 12gig free. I doubt this has anything to do with the storage.

http://stackoverflow.com/comment/32387947
type: AnswerComment
score: 0
has text: thanks for the reply... I have looked into Facebook API's etc, but using them would defeat the purpose of my program. You need to know users username and password. My program is for parents to monitor their child on social media sites, but if they know username and passwords there would be no need for my program lol i dont want to use recording key strokes because that would be just monitoring what the child says, I want to detect bullying from other people..
type: Comment
comment on: http://stackoverflow.com/a/21460333

http://stackoverflow.com/a/21381677
accepted answer of: http://stackoverflow.com/q/21381258
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You could pass a dummy output stream to the superclass constructor, such as the NullOutputStream from Apache commons-io, which is an OutputStream implementation that silently discards all data written to it. Alternatively, you could consider declaring your PersonDumper to take an instance of Appendable instead. PrintStream implements Appendable so this won't change your code in the normal case, but for testing you could pass in a StringBuilder or similar instead. class PersonDumper { // attributes public PersonDumper(Appendable output, Set&lt;Person&gt; persons) { // do stuff } public dump() { for(Person p : persons) { // String.valueOf rather than .toString to be null-safe output.append(String.valueOf(p)); output.append(","); } } }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21381258

http://stackoverflow.com/q/21485436
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/32429780
tagged with: java
has answer: http://stackoverflow.com/a/21560095
has body: I am trying to run a JUnit 4 test from commandline. This is my current command: java -cp C:\Users\some\.m2\repository\junit\junit\4.11\junit-4.11.jar junit.textui.TestRunner C:\Some\Path\target\test-classes\com\wicket\range\ui\MyTest.class This gives a class not found error. I have also tried the following: C:\Some\Path\target\test-classes&gt;java -cp C:\Users\some\.m2\repository\junit\junit\4.11\junit-4.11.jar junit.textui.TestRunner com.wicket.range.MyTest.class This also gives a class not found error; what could be the issue here?
has comment: http://stackoverflow.com/comment/32429715
answer count: 2
tagged with: junit
score: 0
has answer: http://stackoverflow.com/a/21485799
has title: JUnit test from commandline
tagged with: command-line

http://stackoverflow.com/comment/32420402
comment on: http://stackoverflow.com/a/21449157
has text: Yes, but the problem with this approach is that the controller will only be activated if the Application Context has been properly initialised, right? Of course the result would be some HTTP error code, but it would not come from my code. Instead it would probably come from Tomcat.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/21367313
has comment: http://stackoverflow.com/comment/32231270
has comment: http://stackoverflow.com/comment/32231102
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21363745
answers question: http://stackoverflow.com/q/21363745
upvote count: 2
type: Answer
has body: If you look at the result type of the query method in RestAPIFacade, you'll see that it returns a QueryResult&lt;T&gt; on QueryResult you have a bunch of methods to convert your result to other types, and these methods then use the result-converter to do the conversion. public interface QueryResult&lt;T&gt; extends Iterable&lt;T&gt; { &lt;R&gt; ConvertedResult&lt;R&gt; to(Class&lt;R&gt; type); &lt;R&gt; ConvertedResult&lt;R&gt; to(Class&lt;R&gt; type, ResultConverter&lt;T, R&gt; resultConverter); void handle(Handler&lt;T&gt; handler); } Where the to methods return a ConvertedResult which then is either an Iterable of type R or has methods to access a single value of type R. public interface ConvertedResult&lt;R&gt; extends Iterable&lt;R&gt; { R single(); R singleOrNull(); void handle(Handler&lt;R&gt; handler); } So in this case T is Map&lt;String, Object&gt; and R would be your target type. The default Converter supports conversion to node and path objects and vice versa. See the implementation here.
score: 2

http://stackoverflow.com/comment/32450348
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21492712
has text: The error message seeme to me to give the right hint: `Command execution failed. Process exited with an error: 1 `?

http://stackoverflow.com/q/21403991
type: UnansweredQuestion
has title: TestNG - methos should be used as test count
has comment: http://stackoverflow.com/comment/32289562
has comment: http://stackoverflow.com/comment/32318806
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34463800
has comment: http://stackoverflow.com/comment/32289908
score: 0
has body: I run testNG in jenkins. I have many tests classes crate and run around 100 tests, But problem i see is in jenskin it is a graph "test count 1" but i would like to have 100 tests. My file is below: &lt;suite name="Smoke ALL Parallel" parallel="classes" thread-count="1"&gt; &lt;test name="Smoke Tests"&gt; &lt;parameter name="url" value="https://${choose_hostname}"/&gt; &lt;parameter name="browser" value="${choose_browser}"/&gt; &lt;classes&gt; &lt;class name="BO.UnitTests.Smoke_Home"/&gt; &lt;class name="BO.UnitTests.Smoke_Users"/&gt; &lt;class name="BO.UnitTests.Smoke_Invoices"/&gt; &lt;class name="BO.UnitTests.Smoke_Managment"/&gt; &lt;/classes&gt; &lt;/test&gt; &lt;!-- Test --&gt; &lt;/suite&gt; &lt;!-- Suite --&gt; Jenkins: Test report for TestNG: The question is how my methods in classes are represented as Test in TestNG report. It should be same as in Junit or mbunit in .net wher eeach method represent test. all test represent total tests. Thank you for all support. Regards, Dani
tagged with: testng
answer count: 0
tagged with: jenkins

http://stackoverflow.com/q/21493634
has answer: http://stackoverflow.com/a/45749761
tagged with: java
tagged with: javafx
upvote count: 10
type: Question
has title: JavaFX CSS styling of TextArea does not work
downvote count: 0
score: 10
linked to: http://stackoverflow.com/q/36423200
has answer: http://stackoverflow.com/a/37215087
has answer: http://stackoverflow.com/a/21493800
favorite count: 0
has body: I'm writing a simple JavaFX application, but I can't get some of the CSS styling to work. The problem is the -fx-background-color property for my TextArea. This is the relevant CSS: .text-area { -fx-font-family: Consolas; -fx-highlight-fill: #00ff00; -fx-highlight-text-fill: #000000; -fx-text-fill: #00ff00; -fx-background-color: #000000; } All the fields perform as expected, except -fx-background-color, which apparently does nothing. I still have the default white background. As you can see in the picture, the TextField below, which has identical CSS, but does apply the background color as expected. Picture of my problem Any clues?
has answer: http://stackoverflow.com/a/53720322
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26055361
tagged with: css
linked to: http://stackoverflow.com/q/21936585
has comment: http://stackoverflow.com/comment/32445686

http://stackoverflow.com/q/21405230
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32303710
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32303451
has comment: http://stackoverflow.com/comment/32344786
has title: Hot Deployment with Spring Boot?
duplicate of: http://stackoverflow.com/q/21399586
has comment: http://stackoverflow.com/comment/32295719
has body: Usually I was able to set the scanIntervalSeconds when I used the Jetty Maven Plugin for Java Web Projects. Now I'm building a Spring Boot project and wonder if it's possible to achieve Hot Deployment. I couldn't find anything in the official Spring docs. Any suggestions? pom.xml: org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-jetty
answer count: 0
has comment: http://stackoverflow.com/comment/32326474
type: UnansweredQuestion
tagged with: jetty
tagged with: maven
upvote count: 1
tagged with: spring
tagged with: spring-boot
linked to: http://stackoverflow.com/q/21399586

http://stackoverflow.com/q/21424855
tagged with: maven
has body: We are using maven in combination with the maven-failsafe-plugin to run our integration tests. This works fine, but we notice that some more long running tests are started at the end. This is not optimal because all other tests are finished while this longer running tests still takes minutes to finish. It would be more efficient to start these long running tasks first. I notice that there is an runOrder option that can optimize this, but that uses analyses data from one test run that needs to be checked in. As we use git with a lot of branches this isn't really a good option. Also tests tend to run quite long when they are failing, when normally they are quite fast, so we are afraid these optimizations won't really work for us. What we are looking for is a way to just specify the exact order in which to run our tests. With that I mean the order of the test classes, not the methods. We have about 25 classes, so it would be totally doable just to list them in the optimal order when they should be picked up. Is there currently a way to achieve this?
has comment: http://stackoverflow.com/comment/32327337
tagged with: java
type: Question
has title: Create fixed order for integration tests in failesafe plugin
score: 0
has comment: http://stackoverflow.com/comment/32322636
answer count: 0
type: UnansweredQuestion
tagged with: surefire
tagged with: maven-failsafe-plugin

http://stackoverflow.com/q/21493154
type: UnansweredQuestion
downvote count: 1
tagged with: java
tagged with: mysql
type: Question
has title: INSERT INTO SELECT STATEMENT with multiple FK
upvote count: 0
has answer: http://stackoverflow.com/a/21493821
answer count: 1
has body: This is my code with 1 FK. here's the columns ([PK]charityRoomID, charityRoomStatus, [FK]charityWardID) INSERT INTO tbl_addcharityroom1 (charityRoomStatus, charityWardID) VALUES ('"+jTextField10aw.getText() +"', ( select charityWardID from tbl_addcharityward where diseaseCategory='"+ jComboBox1.getSelectedItem().toString() +"'))"; Now, I added a new column(RateID) which is another FK, but i don't know the correct statement for multiple FK. here's the columns ([PK]charityWardID, charityRoomStatus, [FK]charityWardID, [FK]rateID) I am using netbeans &amp; mySQL
favorite count: 0
tagged with: foreign-keys
score: -1
tagged with: netbeans

http://stackoverflow.com/comment/32481377
comment on: http://stackoverflow.com/a/21512758
type: AnswerComment
score: 0
type: Comment
has text: Actually I think the cause is other, because hibernate only persists the transients that we explicitly pass it. The reason I wanted to have a look at one of the unit tests is to see if you are using spring-test. This is because the spring context is by default kept around between tests http://docs.spring.io/spring/docs/2.5.5/reference/testing.html, if @DirtiesContext is not used. And the in-memory DB can stay around between tests, depending how we clean it

http://stackoverflow.com/comment/32286971
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21394421
has text: Ah your problem is related to a compilation failure and not related to the tags.
score: 0

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/21511076
tags question: http://stackoverflow.com/q/21367907
tags question: http://stackoverflow.com/q/21455539
tags question: http://stackoverflow.com/q/21500781
tags question: http://stackoverflow.com/q/21410695
tags question: http://stackoverflow.com/q/21354559
tags question: http://stackoverflow.com/q/21377510
tags question: http://stackoverflow.com/q/21400391

http://stackoverflow.com/a/21413707
has comment: http://stackoverflow.com/comment/32305182
has body: Sounds like a job for a custom renderer: http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#renderer
answers question: http://stackoverflow.com/q/21413678
score: 0
type: Answer

http://stackoverflow.com/q/21488438
type: Question
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/32436344
has comment: http://stackoverflow.com/comment/32435447
has comment: http://stackoverflow.com/comment/32435357
favorite count: 0
has answer: http://stackoverflow.com/a/21488626
has title: Android App Stops and Crashes when using a long nested loop
tagged with: android
tagged with: nested
has comment: http://stackoverflow.com/comment/32437381
has comment: http://stackoverflow.com/comment/32435742
has comment: http://stackoverflow.com/comment/32435818
downvote count: 2
has comment: http://stackoverflow.com/comment/32435574
upvote count: 1
has comment: http://stackoverflow.com/comment/32438040
has comment: http://stackoverflow.com/comment/32436674
accepted answer: http://stackoverflow.com/a/21488626
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/28587653
has body: I am trying to make a nested loop that will show me on screen the combinations of letters and numbers, I created a nested loop that will make a string of 15 characters then it will be put in a string named "pass". "tr" is a activity that i made to translate the numbers resulted in letters or numbers (something like ASCII table), I initially thought that the translate activity was the problem so i commented the whole thing out leaving just the loops and the app freeze. Here is the code: private void nestedLoopTest() { for (int aa = a; aa &lt; 35; aa++) { for (int bb = b; bb &lt; 35; bb++) { for (int cc = c; cc &lt; 35; cc++) { for (int dd = d; dd &lt; 35; dd++) { for (int ee = e; ee &lt; 35; ee++) { for (int ff = f; ff &lt; 35; ff++) { for (int gg = g; gg &lt; 35; gg++) { for (int hh = h; hh &lt; 35; hh++) { for (int ii = i; ii &lt; 35; ii++) { for (int jj = j; jj &lt; 35; jj++) { for (int kk = k; kk &lt; 35; kk++) { for (int ll = l; ll &lt; 35; ll++) { for (int mm = m; mm &lt; 35; mm++) { for (int nn = n; nn &lt; 35; nn++) { for (int oo = o; oo &lt; 35; oo++) { pass = tr .Translate(aa) + tr.Translate(bb) + tr.Translate(cc) + tr.Translate(dd) + tr.Translate(ee) + tr.Translate(ff) + tr.Translate(gg) + tr.Translate(hh) + tr.Translate(ii) + tr.Translate(jj) + tr.Translate(kk) + tr.Translate(ll) + tr.Translate(mm) + tr.Translate(nn) + tr.Translate(oo); passtxt.setText(pass); } } } } } } } } } } } } } } } } How can I solve this ? EDIT: The app freezes about 10mins and after that it display the last generated string, How can i make the code show every string and pause ?
has comment: http://stackoverflow.com/comment/32438271
has answer: http://stackoverflow.com/a/28587653
tagged with: java
score: -1
tagged with: loops

http://stackoverflow.com/comment/32424156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21482301
has text: In `request.getServletContext()` but you need take care for their synchronization.
score: 0

http://stackoverflow.com/comment/32466550
score: 1
type: QuestionComment
has text: How are you receiving the data? Is everything contained in one String, or do you have to read lines to get all the info? And above all, what have you already tried?
comment on: http://stackoverflow.com/q/21505651
type: Comment

http://stackoverflow.com/a/21453884
type: Answer
has comment: http://stackoverflow.com/comment/32375630
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21453485
upvote count: 1
has comment: http://stackoverflow.com/comment/32375200
has body: You can use Java nio package to allow multithreaded writing http://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/FileChannel.html This package provides control within the file where each thread can fill the different regions. Other way is that you can synchronize your File object; this will give access to one thread at a time.

http://stackoverflow.com/comment/90190226
comment on: http://stackoverflow.com/a/21406600
type: Comment
score: 0
type: AnswerComment
has text: Warning: `getProperty` throws `MissingPropertyException` if property is not found. Use Eron's answer instead: https://stackoverflow.com/a/43112126/915441

http://stackoverflow.com/comment/32950851
type: Comment
has text: Just open your project in NetBeans and invoke Profile Project. You can use just Monitoring mode and once your application is started, take a heap dump.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21754834

http://stackoverflow.com/a/21360681
type: Answer
has comment: http://stackoverflow.com/comment/32208884
has comment: http://stackoverflow.com/comment/32314154
has body: Une the reverse engineering tools provided by Hibernate. It depends on your IDE. For example with NetBeans this is how it is done: https://netbeans.org/kb/docs/web/hibernate-webapp.html
has comment: http://stackoverflow.com/comment/32209960
has comment: http://stackoverflow.com/comment/32362623
score: 0
answers question: http://stackoverflow.com/q/21360396
has comment: http://stackoverflow.com/comment/32230898

http://stackoverflow.com/comment/32831185
type: Comment
score: 0
type: AnswerComment
has text: Can someone let me know how to resolve this issue? The link which iam using seems to be correct and its happening all the time at copyURLToFile line.
comment on: http://stackoverflow.com/a/21444183

http://stackoverflow.com/comment/69368116
type: Comment
has text: Thanks Umesh for your info.
comment on: http://stackoverflow.com/a/21373831
score: 0
type: AnswerComment

http://stackoverflow.com/q/21397353
has answer: http://stackoverflow.com/a/21397413
has answer: http://stackoverflow.com/a/21397466
answer count: 5
has body: I am really new to Java, and I am writing a Java program that reads dates in the format mm/dd/yyyy and prints out the date in the format day, year. The program must verify that the year is between 1900 and 2014 (both limits included) and that the day and month and year are valid and mutually consistent. If the input is incorrect, the program must display an appropriate message and terminate. If the input is correct, the output should be printed in the specified format. For Example: Enter Date 04/30/2013 April 30, 2013 Enter Date 01/12/1888 Year should be between 1900 and 2014 I am stuck at how to limit the year and days (like February only has 28), and how to print out like the examples above. I am suppose to use if else and switch statement for this problem. Here is the code i got so far, and thanks for your help. import java.util.Scanner; public class Dates { public static void main(String[] args) { int month, day, year; Scanner input = new Scanner(System.in); System.out.print("Please Enter Date in The Format mm/dd/yyyy : "); month = input.nextInt(); day = input.nextInt(); year = input.nextInt(); String months = "January February March April May June July August " + "September October November December"; String January = months.substring(0,7); String February = months.substring(8,16); String March = months.substring(17,22); String April = months.substring(23,28); String May = months.substring(29,32); String June = months.substring(33,37); String July = months.substring(38,42); String August = months.substring(43,49); String September = months.substring(50,59); String October = months.substring(60,67); String November = months.substring(68,76); String December = months.substring(77,85); if (month == 1) { months = January; day = 31; } else if (month == 2) { months = February; day = 28; } else if (month == 3) { months = March; day = 31; } else if (month == 4) { months = April; day = 30; } else if (month == 5) { months = May; day = 31; } else if (month == 6) { months …
has comment: http://stackoverflow.com/comment/32275130
has title: Read and print out the dates in the format mm/dd/yyyy
has answer: http://stackoverflow.com/a/21397402
has answer: http://stackoverflow.com/a/21397640
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32275108
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21397411
score: 0

http://stackoverflow.com/a/21373730
has comment: http://stackoverflow.com/comment/32232367
has body: try this: TextView machineText = (TextView) v.findViewById(android.R.id.text1); thumbnail.setBounds(60, 60, 60, 60); machineText.setCompoundDrawables(bd, null, null, null); instead of 60 set the bounds as you need it.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21372987

http://stackoverflow.com/q/21486673
has comment: http://stackoverflow.com/comment/32435354
favorite count: 0
has comment: http://stackoverflow.com/comment/32432938
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32434694
score: 3
upvote count: 3
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/32546638
tagged with: bufferedimage
type: Question
downvote count: 0
has body: I am trying to use the tone mapping code here. It has a function: public void toneMap(final float[] image, final byte[] rgbOut) { for (int i = 0; i &lt; image.length; i++) { final float clamped = Math.max(0, Math.min(1f, image[i])); rgbOut[i] = (byte) (0xFF &amp; (short) (clamped * 255.0)); } } It takes in a float array and a byte array of images and clearly applies a simple clamping to the pixel values. I tried: int[]rbg=((DataBufferInt) image.getRaster().getDataBuffer()).getData(); But I got the following exception: java.lang.ClassCastException: java.awt.image.DataBufferByte cannot be cast to java.awt.image.DataBufferInt Other stackoverflow answers have clearly explained as to why it was so. I have an image file want to apply this function to that file. I know that I can read the image into a BufferedImage using ImageIO.read(). But how do I get a float[] rgb from it? Is it possible? Or are there any other libraries available which can help me do this conversion from image to a float[] rgb array of pixels? EDIT: As few people have mentioned in their comments that the code above would do nothing to the pixel values as they are in range of 0..255. But I want to apply above code to HDR images, like the .exr format image , which have an infinite range.
has comment: http://stackoverflow.com/comment/32433159
has comment: http://stackoverflow.com/comment/32432821
has comment: http://stackoverflow.com/comment/32441948
has title: Obtain float[] or int[] from BufferedImage

http://stackoverflow.com/a/21415651
answers question: http://stackoverflow.com/q/21413065
upvote count: 10
has body: Here's a sample: for (int i = 0; i &lt; 50; i++){ //click the button driver.findElement(By.xpath(xpath).click(); //wait 2 seconds Thread.sleep(2000); //check that data is being generated correctly ... }
score: 10
downvote count: 0
type: Answer

http://stackoverflow.com/a/21505745
type: Answer
answers question: http://stackoverflow.com/q/21505651
upvote count: 1
has body: If you are sure there are no more occurences of .. in your text, and your text is a String then this might be the easiest solution: String result = text.substring(text.indexOf("..") + 2, text.lastIndexOf("..") - 2); If there are more occurences of .., you could use regular expressions or a Scanner. Here's a solution using regular expressions. Pattern pattern = Pattern.compile(".*?\\.\\.(.*?)\\.\\.", Pattern.DOTALL); Matcher matcher = pattern.matcher(text); while (matcher.find()) { String result = matcher.group(1); // ... } This code assumes that the first .. starts a paragraph, the second .. ends a paragraph. The following characters are to be ignored until the next occurence of ...
score: 1
has comment: http://stackoverflow.com/comment/32466734
downvote count: 0

http://stackoverflow.com/comment/32381070
has text: I removed the line toolbar.(Box.creatHorzonal...) to move the icon to the left but what is this class for "box"
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21447111

http://stackoverflow.com/comment/32392868
has text: Alfasin => When I do so, it doesn't recognize the method `getItem` for menu. I also had to import menu (Android.R). But the android guide says to set it in the other method !
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21464033

http://stackoverflow.com/comment/32333654
type: QuestionComment
has text: This should work just fine.
comment on: http://stackoverflow.com/q/21430653
score: 0
type: Comment

http://stackoverflow.com/a/21457692
accepted answer of: http://stackoverflow.com/q/21457355
upvote count: 2
has body: In configuration file, change the property hibernate.query.factory_class value From org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory To org.hibernate.hql.ast.ASTQueryTranslatorFactory See more forum.hibernate.org Side Note Use Query.setParameter() method to pass parameter to query Query updateQuery = session.createQuery("update User set registered = '1' where user_activation_key = :userUUID"); updateQuery.setParameter("userUUID", userUUID);
score: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21457355
downvote count: 0
type: Answer

http://stackoverflow.com/a/21444011
type: Answer
answers question: http://stackoverflow.com/q/21442898
has body: To the best of my knowledge, the following options work on both Windows and Linux: Option #1 - open in Normal mode: WebDriver webDriver = new FirefoxDriver(); Option #1 - open in Headless mode: FirefoxBinary binary = new FirefoxBinary(new File("your/firefox/path")); binary.setEnvironmentProperty("DISPLAY",System.getProperty("lmportal.xvfb.id",":99")); WebDriver webDriver = new FirefoxDriver(binary,null);
score: 0

http://stackoverflow.com/comment/32351021
score: 2
comment on: http://stackoverflow.com/a/21439675
has text: @AaronMarcus: No, you cannot predict what multiple of the same kind of listeners will do, but you *can* state without hesitation that a DocumentFilter definitely acts ***before*** a DocumentListener acts. As for the other listeners, you may need to look at the source code to find out.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21692510
accepted answer of: http://stackoverflow.com/q/21397542
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21397542
has body: Okay, so looks like by default jmh looks for generated classes under META-INF/Microbenchmarks, which maven build puts under root of the project. However root of the eclipse project is not on the classpath, so executing it in IDE results in "no benchmarks found". I got it running following way: mvn clean package (using external maven installation, not embded in eclipse) Right-click on jmh-samples project, select "Build Path -> Use as a source folder" You can now run any of the benchmarks from jmh-samples as Java Application in eclipse On the downside you get like 1000+ "errors" in Problems view, since eclipse gets confused with auto-generated files, but oh well, at least it works.
has comment: http://stackoverflow.com/comment/32800425
has comment: http://stackoverflow.com/comment/32798387
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/32797619
has comment: http://stackoverflow.com/comment/32935725
score: 3
downvote count: 0

http://stackoverflow.com/a/21361381
accepted answer of: http://stackoverflow.com/q/21361042
answers question: http://stackoverflow.com/q/21361042
type: Answer
score: 2
has body: JVM works as native process, in this respect: JVM requests memory from OS that can allocate it either in RAM in swap. The memory you can allocate in java does not depend on your RAM but on command line option -Xmx you specify when you are running your JVM. If it is not enough memory in RAM JVM receives it from swap and (I believe) even does not know about that. However, in some opearating system (Windows XP) the limit is 4G. the heap in the JVM is not designed to run off disk. swap is limited. If you need to work with large data you need to work with BigMemory products (EhCache or Terracotta). Finally, run jvisualvm or with the -verbose:gc prameter to see the heap allocation.
downvote count: 0
has comment: http://stackoverflow.com/comment/32210000
has comment: http://stackoverflow.com/comment/32210146
upvote count: 2
type: AcceptedAnswer

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/21360326
tag name: spongycastle

http://stackoverflow.com/a/21484062
answers question: http://stackoverflow.com/q/21483942
has body: Something like this: public class Main { public static void main(String[] args) { ArrayList&lt;Person&gt; arrl = new ArrayList&lt;&gt;(); arrl.add(new Person("Tim", 23)); } } class Person { private String name; private int age; Person (String name, int age) { this.name = name; this.age = age; } }
score: 0
type: Answer

http://stackoverflow.com/q/21350195
score: 10
answer count: 2
has body: I have the following code: Set&lt;Integer&gt; l = new TreeSet&lt;&gt;(); l.add(1); l.add(10); l.add(3); l.add(-3); l.add(-4); and I want to unorder the collection with: l.stream().unordered().forEach(System.out::println); but the forEach returns always the collection ordered! Then I have also another doubt about the below sentence from here: For sequential streams, the presence or absence of an encounter order does not affect performance, only determinism. If a stream is ordered, repeated execution of identical stream pipelines on an identical source will produce an identical result; if it is not ordered, repeated execution might produce different results. In fact if I try this code on an unordered stream the results is always the same and never produce different results: Arrays.stream( new int[]{8, -1, 3}).forEach(System.out::println); Arrays.stream( new int[]{8, -1, 3}).forEach(System.out::println); I really don't understand this API part...
has title: Stream ordered/unordered problems
favorite count: 0
type: UnansweredQuestion
tagged with: java-8
has answer: http://stackoverflow.com/a/21350234
upvote count: 11
tagged with: java-stream
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/38038578
type: Question

http://stackoverflow.com/comment/32381073
comment on: http://stackoverflow.com/q/21457491
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik: It doesn't completely remove it, but it would still have helped. It turns out that's not the reason :)

http://stackoverflow.com/comment/32281754
type: AnswerComment
type: Comment
has text: actually, I already tested this setup, my Engine1 used smppclient1/password, and my engine2 is using smppclient2/password. based on logs, bind request was succesfull. but if I queried java instance on 1 IPadd/port was established.
comment on: http://stackoverflow.com/a/21398743
score: 0

http://stackoverflow.com/comment/32311991
comment on: http://stackoverflow.com/a/21413460
type: Comment
has text: +1, Keep it simple until you have a compelling reason to add complexity.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21417342
tagged with: java
tagged with: ssl
type: Question
upvote count: 2
has body: How do I set a client side keystore and truststore in an Apache Wink Client I cannot find any documentation on how to do it. http://wink.apache.org/documentation/1.2.1/Apache_Wink_User_Guide.pdf
tagged with: truststore
tagged with: apache-wink
answer count: 1
has answer: http://stackoverflow.com/a/21425936
favorite count: 0
type: UnansweredQuestion
has title: How to setup Apache Wink Client keystore and truststore
tagged with: keystore
score: 2
downvote count: 0

substance
tag name: substance
type: Tag
tags question: http://stackoverflow.com/q/21497119

http://stackoverflow.com/q/21511477
has answer: http://stackoverflow.com/a/21511587
possible better answer: http://stackoverflow.com/a/21511568
answer count: 5
score: 0
has answer: http://stackoverflow.com/a/21511568
type: Question
has comment: http://stackoverflow.com/comment/32476624
has answer: http://stackoverflow.com/a/21511569
type: AnsweredQuestion
has title: How to prevent an Interface from implementing in inherited class?
accepted answer: http://stackoverflow.com/a/21511587
tagged with: java
linked to: http://stackoverflow.com/q/49002
has comment: http://stackoverflow.com/comment/32476724
has body: interface I class A implements I class B extends A class C extends A class D extends A class E extends A What can I do so that only class D doesnot get the methods of I. I am currently thinking to override all the methods of 'I' in D with no body. Am I thinking in the right direction or is there a better way? Edit: D only doesnot want the methods contained in interface I. Rest of A's methods are inherited. A is the base class. interface I is the interface for ordering videos B,C,E are users with different privileges and D is the admin. The admins can not order videos so donot need the methods carried by the interface.
has answer: http://stackoverflow.com/a/49879773
has comment: http://stackoverflow.com/comment/32476635
has answer: http://stackoverflow.com/a/21511571
tagged with: inheritance
has comment: http://stackoverflow.com/comment/32476644
has comment: http://stackoverflow.com/comment/32476630
tagged with: interface

http://stackoverflow.com/a/21385885
has comment: http://stackoverflow.com/comment/32254200
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21385709
has body: You should annotate the costructor of your PersonService with @Autowired. @Service class PersonService { @Autowired public PersonService(Person person) { this.person = person; //the object the service can work with } } Then you must provide a Person bean somewhere. But I guess the Person is an instance that is loaded from a database. Since a PersonService is a singleton it makes no sense to bind it to one Person instance. In this case you have to create a new PersonService instance for every Person object that you retrieve from the db. If you want to do this then it also means that the PersonService is created by your code. Thus out of the spring containers control and therefore spring can not autowire it automatically. Nevertheless you can use the AutowireCapableBeanFactory to autowire beans that have been instantiated outside the container. But this is a one way. These beans will not be available to those defined in the container. AutowireCapableBeanFactory acbf = ...; acbf.autowireBean(someInstance); When I work with hibernate I usually use a PostLoadListener to autowire domain objects. But there is also another approach using aspectj and load-wime weaving. Take a look at the spring documentation 8.4.1 If you need to advise objects not managed by the Spring container (such as domain objects typically), then you will need to use AspectJ. You will also need to use AspectJ if you wish to advise join points other than simple method executions (for example, field get or set join points, and so on).
type: Answer
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/32254367
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21385709

http://stackoverflow.com/q/21365098
tagged with: eclipse
tagged with: class
has body: I am trying to use a variable from a method I created in another class in the main section. For example: public class test { public static int n; public void getLower(){ int p = 12; } public static void main(String[] args) { test example = new test(); example.getLower(); System.out.println(p); } } However, I get the error message 'p cannot be resolved to a variable'. Is what I'm trying to do possible? Thanks in advance!
score: 0
has comment: http://stackoverflow.com/comment/32216298
has answer: http://stackoverflow.com/a/21365370
tagged with: variables
has comment: http://stackoverflow.com/comment/32231986
favorite count: 0
accepted answer: http://stackoverflow.com/a/21365131
possible better answer: http://stackoverflow.com/a/21365120
has answer: http://stackoverflow.com/a/21365120
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: Java - How to use a variable from a method when imported into the main class
upvote count: 1
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32216268
has answer: http://stackoverflow.com/a/21365131
has answer: http://stackoverflow.com/a/21365126

http://stackoverflow.com/comment/32216812
comment on: http://stackoverflow.com/q/21361109
type: Comment
type: QuestionComment
has text: Ok, I just tried on a couple of different computers and - surprise. It seems to work ok with 1.6.0_27, 64 bit. But it definitely fails on several computers with 1.7.0_25. At least, it seems to be a Java Bug and not something else (?)
score: 0

http://stackoverflow.com/comment/32363359
comment on: http://stackoverflow.com/q/21447308
type: Comment
type: QuestionComment
has text: Could you please expand on "it just don't do anything [sic]"?
score: 1

http://stackoverflow.com/comment/32414505
has text: Thanks Deinum, Could you please explain what is singleton object and where we used **singleton object** in above code.
comment on: http://stackoverflow.com/a/21476410
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/32288900
score: 0
has text: "The tester on my school's compsci website is not working, so I am currently unable to test my code" SO is not a substitute for a compiler.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21405316

http://stackoverflow.com/a/21399330
has comment: http://stackoverflow.com/comment/32279345
score: 0
type: Answer
has body: Or you can try this: Button b=(Button) findViewById(R.id.btnB); b.setEnabled(true);
answers question: http://stackoverflow.com/q/21397830

http://stackoverflow.com/q/21413568
has body: What is the equivalent Java code of this MATLAB code: ran = sign(rand-0.5)? Is it randomly assigned either 1 or -1 to ran? Should I used a Pseudo random number generator that generates randomly 1 or -1? Random rand = new Random(key); ran = rand.nextInt(1);
favorite count: 0
has comment: http://stackoverflow.com/comment/32304556
tagged with: matlab
type: AnsweredQuestion
has title: What is the equivalent Java code of this MATLAB code?
has answer: http://stackoverflow.com/a/21413704
has comment: http://stackoverflow.com/comment/32303480
tagged with: java
has comment: http://stackoverflow.com/comment/32305772
upvote count: 1
downvote count: 10
type: Question
score: -9
accepted answer: http://stackoverflow.com/a/21413704
has comment: http://stackoverflow.com/comment/32303048
has comment: http://stackoverflow.com/comment/32304855
answer count: 1

http://stackoverflow.com/q/21498419
tagged with: spring
has body: I have a class (ConfigurationReaderUtil) that loads an XML config file to beans (with the simpleframework). There is an other class (let's name it as XXX class) that uses the beans that are loaded by the ConfigurationReaderUtil. I want to test the class XXX. It is important to test the wrong cases when there are invalid data in the XML config file. So at the moment I have a XML file in the src/test/resource that can be used to test the successful cases. I'd also need more XML file in the src/test/resource for testing the wrong cases. However I have something like this in the ConfigurationReaderUtil: InputStream in = new ClassPathResource(Constants.PATH_TEMPLATE_CONFIG_XML).getInputStream(); templatesBean = serializer.read(TemplatesBean.class, in); So what I'd need is to load different XML files for different unit tests. I really don't know how I could achieve this. Can I define somehow in the unit test which test XML file I need? However in this case how should I write the ConfigurationReaderUtil class? Hmm, this is the dilemma... Thanks, V.
type: UnansweredQuestion
tagged with: unit-testing
has title: Spring unit tests - loading different config file for different unit tests
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21498464
answer count: 1

http://stackoverflow.com/a/21354770
has comment: http://stackoverflow.com/comment/32214469
score: 0
has comment: http://stackoverflow.com/comment/32213953
has comment: http://stackoverflow.com/comment/32220387
has comment: http://stackoverflow.com/comment/32214325
has comment: http://stackoverflow.com/comment/32213212
has comment: http://stackoverflow.com/comment/32213944
type: Answer
has comment: http://stackoverflow.com/comment/32222419
has comment: http://stackoverflow.com/comment/32310180
answers question: http://stackoverflow.com/q/21352501
has body: You can also have a memory leak somewhere, or something preventing the correct garbage collection of used memory. I would do the following three things. Modify the EchoServer class You can add a static member to understand if, when the crash occurs, the number of existing thread in memory is the one you expect (they should be as many as the connected players). public class EchoServer extends Thread { private Socket sock = null; private static Integer CONNECTED = 0; public EchoServer(Socket sock) { try{ super("EchoServer"); this.sock = sock; CONNECTED++; } catch (Exception ex) { Logger.getLogger(EchoServer.class.getName()).log(Level.SEVERE, "Currently CONNECTED: "+CONNECTED); } } .... your stuff here @Override public void finalize(){ super.finalize(); CONNECTED--; } } If have more threads than connected players something is wrong. Use a profiler Use a profiler to observe the memory usage and identify bottlenecks. Also be sure there aren't "strange" objects surviving generations or that the memory is not increasing over time without an increment of the players. NetBeans has a nice profiler that can be connected via TCP to live apps too. Use -Xmx Use java -Xmx1g to launch the server.

http://stackoverflow.com/q/21425963
accepted answer: http://stackoverflow.com/a/21429354
has comment: http://stackoverflow.com/comment/32324854
has comment: http://stackoverflow.com/comment/32325105
favorite count: 0
has answer: http://stackoverflow.com/a/50265041
has comment: http://stackoverflow.com/comment/32325385
answer count: 5
has comment: http://stackoverflow.com/comment/32324905
possible better answer: http://stackoverflow.com/a/21426088
has answer: http://stackoverflow.com/a/21429354
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/32324814
has comment: http://stackoverflow.com/comment/32324919
has comment: http://stackoverflow.com/comment/32325015
has title: map is loading but can't see the map in Android development
has answer: http://stackoverflow.com/a/21426196
type: Question
has comment: http://stackoverflow.com/comment/32324718
tagged with: google-maps
has answer: http://stackoverflow.com/a/21426654
has answer: http://stackoverflow.com/a/21426088
downvote count: 0
upvote count: 3
has body: I am learning Android development with Lynda video tutorials. I am using the Google map API v2, to display a map. I have done all the steps according to the tutorial. when i try to view the application in my device, the application loads I can see the Google logo but map is not visible. (i see the white background with Google logo at the bottom). I have added my code and the screenshot. can someone please help me to fix this. thank you.. Screenshot My java code.. package lk.adspace.jaffnatemples; import java.io.IOException; import java.util.List; import android.app.Dialog; import android.location.Address; import android.location.Geocoder; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; public class MainActivity extends FragmentActivity { private static final int GPS_ERRORDIALOG_REQUEST = 9001; GoogleMap mMap; @SuppressWarnings("unused") private static final double SEATTLE_LAT = 47.60621, SEATTLE_LNG =-122.33207, SYDNEY_LAT = -33.867487, SYDNEY_LNG = 151.20699, NEWYORK_LAT = 40.714353, NEWYORK_LNG = -74.005973; private static final float DEFAULTZOOM = 15; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (servicesOK()) { setContentView(R.layout.activity_map); if (initMap()) { Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show(); gotoLocation(SEATTLE_LAT, SEATTLE_LNG, DEFAULTZOOM); } else { Toast.makeText(this, "Map not available!", Toast.LENGTH_SHORT).s…
tagged with: android
has comment: http://stackoverflow.com/comment/32330757

http://stackoverflow.com/a/21356025
accepted answer of: http://stackoverflow.com/q/21355977
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/32200131
has body: This is more accurate and relevant: private int countNodes(LNode ptr){ if (ptr == null) return 0; return 1 + countNodes(ptr.left) + countNodes(ptr.right); }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21355977
upvote count: 3

http://stackoverflow.com/a/21368085
score: 4
has comment: http://stackoverflow.com/comment/32228945
type: Answer
has comment: http://stackoverflow.com/comment/32221902
has body: In swing, you can create a compound border. Using this you could have the bevel border as the inner one and the empty border as the outer one on your JPanel. As as example: JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(0, 0, 3, 0), BorderFactory.createBevelBorder(BevelBorder.RAISED)); Check out the tutorials on borders in the docs.
accepted answer of: http://stackoverflow.com/q/21367939
upvote count: 4
answers question: http://stackoverflow.com/q/21367939
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32241427
type: Comment
comment on: http://stackoverflow.com/a/21376903
score: 0
type: AnswerComment
has text: Yes, there is a file with connection parameters but has nothing to do with what I want to do. Just when I press the green button to call somehow your batch file or whatever else and do some actions like delete some files from a specific directory. Sure, one solution is just write a batch file and just before start the tomcat to click on this batch file and then start the server. Any other solution?

http://stackoverflow.com/a/21482676
downvote count: 0
answers question: http://stackoverflow.com/q/21482602
upvote count: 3
has body: I think your answer is right there: in the future there will be possibility that the B class will be removed or modified I think that's a strong case for a testsuite for A.
type: Answer
score: 3

http://stackoverflow.com/q/21443173
has body: I want to figure out how the JMS API works, I know how to use this API but my problem is to know how it works in terms of networks. For example, when my client subscribes to receive notifications from the server, how the server send notifications to the client side without making a http request by the client? Did the JMS API use my IP in addition to my JMS session id? The pull mechanism is completely clear: the client will send requests periodically to receive new updates, but in push mechanism the client receives notification without sending a request.
score: 0
tagged with: jms
has title: How JMS API works
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21443461
tagged with: network-programming
tagged with: java
answer count: 1

http://stackoverflow.com/a/21474742
has comment: http://stackoverflow.com/comment/32411621
answers question: http://stackoverflow.com/q/21474608
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21474608
has comment: http://stackoverflow.com/comment/32411707
type: Answer
has comment: http://stackoverflow.com/comment/32411525
has body: Best HashMap = Unique Ids - one bucket for one object - fastest access to object when you know the key.

http://stackoverflow.com/comment/32468379
score: 0
type: Comment
has text: A JTextArea refreshes automatically when setText is called. None of this code above is needed which is why your current plan is madness.
comment on: http://stackoverflow.com/a/21506638
type: AnswerComment

http://stackoverflow.com/a/21499132
score: 0
has body: Create a custom adapter and call this: ItemDetailAdapter adapter=new ItemDetailAdapter(this,GetSearchResult()); new AlertDialog.Builder(view.getContext()).setAdapter(adapter, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } });
answers question: http://stackoverflow.com/q/21499100
type: Answer

http://stackoverflow.com/a/21497635
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In the code in your original unedited question, no elements are ever added to the java.util.ArrayList object. java.util.List&lt;String&gt; list = new java.util.ArrayList&lt;String&gt;(); Object[] array = list.toArray(); // array.length = 0 IDataCursor cursor = pipeline.getCursor(); IDataUtil.put(cursor, "array", array); IDataUtil.put(cursor, "array.length", array.length); cursor.destroy(); Your screenshot of the Service Result tab in Designer actually shows that ListOfFileNames was returned by your service correctly, so that part of your code is working. I know this because if it wasn't returned, then it wouldn't be listed in the Service Result tab at all. The fact that it is listed there means that it was returned correctly. But the reason why you think it's not working is because ListOfFileNames is a zero-length array, and thus Designer has no value to display in the right column of the Service Result tab. If you had added at least one element to the ArrayList before calling .toArray() on it, then Designer will have something to show you: the resulting array's contents. The other problem I noticed in the Designer screenshot is that ListOfFileNames is an Object[], rather than a String[]. That's because you're using .toArray() with no arguments, which returns an Object[]. Use the other version, .toArray(T[] a), as follows to make sure you get a String[] returned: java.util.List&lt;String&gt; list = new java.util.ArrayList&lt;String&gt;(); list.add("item1"); String[] array = list.toArray(new String[0]); // array.length = 1 IDataCursor cursor = pipeline.getCursor(); IDataUtil.put(cursor, "array", array); IDataUtil.put(cursor, "array.length", array.length); cursor.destroy();
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21467251
accepted answer of: http://stackoverflow.com/q/21467251

http://stackoverflow.com/a/21497678
has body: Because your method never returns. The compiler is able to tell that you always exit via non-local transfer (i.e. you throw an exception 100% of the time), so it has no need to warn you about the return value, because no code will ever receive it. Looking at it in reverse: If a caller were to have: int x = o.doIt (); … there is no case in which x could receive a non-integer. (There is also no case in which x could receive an integer)
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21497648

http://stackoverflow.com/a/21425136
score: 1
answers question: http://stackoverflow.com/q/21424981
has body: You call et=(EditText)findViewById(R.id.editText5); but editText5 is visible in your XML Layout , i.e., &lt;EditText android:id="@+id/editText5" android:layout_width="258dp" android:layout_height="wrap_content" android:ems="10" android:hint="@string/age" /&gt; So please call the invisible editText3 and I think then it will work for you. So replace your code et=(EditText)findViewById(R.id.editText5); by this one et=(EditText)findViewById(R.id.editText3); your editText3 is &lt;EditText android:id="@+id/editText3" android:layout_width="252dp" android:layout_height="wrap_content" android:ems="10" android:hint="@string/contact" android:inputType="phone" android:visibility="invisible"/&gt;
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/21436233
has body: This: String monthChoice = monthsArray[month - 1]; Should be: String monthChoice = monthsArray[month]; Because the first month is empty. Also, I don't understand this for loop, since you don't even use the i variable, and you don't need to repeat that action multiple times: for (int i=0; i &lt; monthsArray.length; i++)
has comment: http://stackoverflow.com/comment/32343077
score: 1
answers question: http://stackoverflow.com/q/21436068
has comment: http://stackoverflow.com/comment/32342583
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32342738
type: Answer
accepted answer of: http://stackoverflow.com/q/21436068
upvote count: 1

http://stackoverflow.com/comment/32542174
has text: As per comment above, sorry that I disappeared, had some skeletal issues, turns out that stairs are not my friend. I will have a read through and play again this afternoon. I don't understand Romans comment though.
type: Comment
comment on: http://stackoverflow.com/a/21490159
score: 0
type: AnswerComment

http://stackoverflow.com/a/21416557
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21416375
score: 3
answers question: http://stackoverflow.com/q/21416375
type: AcceptedAnswer
has body: You need to ask yourself what the relationship between Plane and Airport actually represents. I can think of a number of possibilities. This airport owns this plane. This plane is currently on the ground at this airport. This plane is currently en route to this airport. This plane is permitted to use this airport. Which of these are you going to represent in your database? It seems to me that three of these relationships are one-to-many, and one of them is many-to-many. So you need to decide what relationship you're trying to represent, before you decide its cardinality.
downvote count: 0

http://stackoverflow.com/a/21401387
score: 3
has comment: http://stackoverflow.com/comment/32283055
has body: The problem is that if anything inbetween the open and the close returns from the method or throws an exception then the close doesn't get called. Using a try-with-resources (or pre Java 7 try-finally) to do the close guarantees that the stream gets closed every single time.
has comment: http://stackoverflow.com/comment/32281911
upvote count: 3
has comment: http://stackoverflow.com/comment/32281831
type: Answer
answers question: http://stackoverflow.com/q/21401356
downvote count: 0
has comment: http://stackoverflow.com/comment/32281652

http://stackoverflow.com/comment/32229369
type: Comment
score: 6
has text: Did you try doing it in Java?
comment on: http://stackoverflow.com/q/21372059
type: QuestionComment

http://stackoverflow.com/comment/32895048
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21730319
has text: Thank you, but this didn't help me. I need UUIDs
score: 0

http://stackoverflow.com/comment/32219528
comment on: http://stackoverflow.com/q/21366911
type: Comment
type: QuestionComment
score: 1
has text: We should know what the algorithm is supposed to do first. *Compute an area between two lines* is a pretty vague description of what it should do, and I don't see any concept of "line" in the code. No comment at all either. Naming methods "f" and "g" doesn't help in understanding what they're supposed to do either.

http://stackoverflow.com/comment/32213631
comment on: http://stackoverflow.com/a/21362711
score: 0
type: AnswerComment
type: Comment
has text: In your words, "correct your toString()". What needs correction save for an *error*? Furthermore, how much time do you think one needs to stare at your code before realizig there's any difference at all?

http://stackoverflow.com/comment/32472702
score: 0
type: AnswerComment
type: Comment
has text: -1 for keyListener - that's **not** the correct way to restrict input: one reason is that it is completely safe as it doesn't catch pasted text
comment on: http://stackoverflow.com/a/21499809

http://stackoverflow.com/comment/32284250
has text: @ user657592 http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/FileInputStream.java You cannot get its name directly, but you can get it's file descriptor - and maybe you can use it somehow to find the name. As a side note- the FileDescriptor is just an `int` - http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/FileDescriptor.java#FileDescriptor
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21402828
type: Comment

http://stackoverflow.com/comment/32309989
comment on: http://stackoverflow.com/a/21417420
has text: This suggests that it's a compiler error. Someone who's got more time that work might try doing `javap` on the two versions of the code and seeing how they differ.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32287467
comment on: http://stackoverflow.com/a/21404217
has text: oke.. use Double.parsedouble(route.getLatitude()) instead of also for longitude too
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/42085822
upvote count: 2
has body: Use android:configChanges="orientation|screenSize" in your manifest file. Your manifest file will look like &lt;activity android:name="_________" android:configChanges="orientation|screenSize"/&gt;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21500372
score: 2

http://stackoverflow.com/q/21433927
tagged with: lotus-notes
has comment: http://stackoverflow.com/comment/32340520
type: AnsweredQuestion
tagged with: agents
has title: Cannot access file system from Java Agent
tagged with: java
tagged with: lotus-domino
has body: I want to check in the file system if file exists. This code is working in SSJS and I can correctly see if the file exists or not: var filePath = "/folder/temp.xlsx"; var inStream:NotesStream = session.createStream(); if( inStream.open(filePath,"ASCII") ){ if( inStream.getBytes()&gt;0 ){ .... }else{...} }else{...} but this code, looking for the exaxt same file is not working in an agent: (!!) Session session = getSession(); Stream inStream = session.createStream(); String filePath = "/folder/temp.xslx"; if( inStream.open(filePath,"ASCII")){ if(inStream.getBytes()&gt;0){ ... }else{...} }else{...} It always goes into the 2nd else which means that inStream.open(file...) is false. what is the difference between xpages file access and agent file access? any solutions?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21442292
tagged with: xpages
has answer: http://stackoverflow.com/a/21434470
accepted answer: http://stackoverflow.com/a/21434470
score: 0
has comment: http://stackoverflow.com/comment/32357849
has answer: http://stackoverflow.com/a/21442292

http://stackoverflow.com/comment/32471567
comment on: http://stackoverflow.com/a/21508432
has text: Instead of displaying a `JOptionPane` which you've done?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21492557
has comment: http://stackoverflow.com/comment/32666346
score: -1
has body: I want to create a scrollable cards view without any libraries. Each LinearLayout should be a card. Can I programmatically create a LinearLayout and initialize it with an id from xml LinearLayout? Like this here (but it does not work): public class LinearLayoutAdapter extends BaseAdapter { private List&lt;ImageContent&gt; images; private Context context; private Activity activity; private int width, height; public LinearLayoutAdapter(Activity activity, Context context, List&lt;ImageContent&gt; img, int width, int height) { this.context = context; this.activity=activity; this.images = img; this.width = width; this.height = height; } @Override public int getCount() { // TODO Auto-generated method stub return images.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return images.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout lLayout; if (convertView != null) { lLayout = (LinearLayout) convertView; //lLayout = (LinearLayout) convertView.findViewById(R.id.imageLinearLayout); // this does not work } else { lLayout = new LinearLayout(context); } return lLayout; } }
answer count: 1
downvote count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/21493024
tagged with: android
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/21493024
has title: Android - create LinearLayout programmatically and initialize id from xml LinearLayout
tagged with: java
tagged with: android-linearlayout
type: Question

http://stackoverflow.com/q/21371633
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21371826
tagged with: session
has body: I am a beginner in spring&amp;java. How do i properly pass UserDetailedInfo model into SessionAttrtibutes to access it in different controllers and different jsps? I am trying to create a login system using spring framework. //this is my mainpagecontroller.java @Controller @SessionAttributes("model") public class MainPageController{ @RequestMapping(value="/signin", method=RequestMethod.POST) @ResponseBody public Map&lt;String, Object&gt; userSignIn(@RequestParam Map&lt;String,String&gt; param, ModelMap sessions) throws UnsupportedEncodingException { FormHelpers helper = new FormHelpers(); Map&lt;String, Object&gt; resp = new HashMap&lt;String, Object&gt;(); resp.put("status", helper.signIn(param).getError()); sessions.addAttribute("model",resp); System.out.println(resp); //System.out.println(info.get); return resp; } } //formhelpers.java public UserDetailedInfo signIn(Map&lt;String, String&gt; data) { Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); SigninModel model = new SigninModel(); model.setEmail(data.get("email")); model.setPassword(data.get("password")); params.put("email", model.getEmail()); params.put("password", model.getPassword()); try { ObjectMapper mapper = new ObjectMapper(); String response = GlobalHelper.callService(RestServicesUrl.SIGNIN_URL, params); UserDetailedInfo info = mapper.readValue(response, UserDetailedInfo.class); System.out.println("error"+info.getError()); return info; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new UserDetailedInfo(); } } //singedinhomepagecontroller.java @Controller @RequestMapping(value="/main") @SessionAttributes("model") public class SignedInHomePageController { @RequestMapping(method=RequestMethod.GET) @ResponseBody public ModelAndView displaySignInHomePage(@ModelAttribute FormHelpers model) { ModelAndView view = new ModelAndView("homepage"); System.out.println(model.signIn().getEmail()); //unable to access the from session return view; } } //hom…
has title: how to set sessionAttributes in spring and access them in different jsps and controllers
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32228905
tagged with: spring
has comment: http://stackoverflow.com/comment/32228862

http://stackoverflow.com/q/21373222
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21373522
accepted answer: http://stackoverflow.com/a/21373522
favorite count: 0
has body: I Am new to the Android,I need to send an sms which will Contain the following content e.g: "1"+"\n"+"f_name"+"l_name"+"roll";i am storing these information in arraylist.can anyone suggest me how to perform the operation.i have done some operations. try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); System.out.println("RN--&gt;&gt;created parser"); SAXXMLHandlerChalanForm ch = new SAXXMLHandlerChalanForm(); xr.setContentHandler(ch); xr.parse(new InputSource(getAssets().open("Chalan.xml"))); ArrayList&lt;ChalanFormDTO&gt; chalanList = ch.getChalanData(); System.out.println("size of ChalanList" + chalanList.size()); for (int i = 0; i &lt; chalanList.size(); i++) { if (chalanNum.equalsIgnoreCase(chalanList.get(i).getChalanNo())) { text_chalanNo.setText(chalanList.get(i).getChalanNo()); text_buyName.setText(chalanList.get(i).getBuyerName()); text_date.setText(chalanList.get(i).getDates()); text_sales.setText(chalanList.get(i).getSales()); System.out.println("Size of LISTOFITEMS:\n" + chalanList.get(i).getListOfStock().size()); for (int j = 0; j &lt; chalanList.get(i).getListOfStock() .size(); j++) { TableRow tr1 = new TableRow(this); tr1.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); TextView tv9 = new TextView(this); tv9.setText(String.valueOf(j+1)); tv9.setBackgroundResource(R.drawable.border_top); tv9.setTextColor(getResources().getColor(R.color.Black)); tv9.setLayoutParams(new TableRow.LayoutParams(dpwidth/2, LayoutParams.WRAP_CONTENT)); tv9.setGravity(Gravity.CENTER_HORIZONTAL); tv9.setMinimumWidth(dpwidth); tr1.addView(tv9); TextView tv4 = new TextView(this); tv4.setText(chalanList.get(i).getListOfStock().get(j) .getName()); tv4.setBackgroundResource(R.drawable.border_top); tv4.setTextColor(getResources().getColor(R.color.Black)); tv4.setLayoutParams(new TableRow.LayoutParams(dpwidth, LayoutParams.WRAP_CONTENT)); tv4.setGravity(Gravity.CENTER_H…
tagged with: android
has title: concatenate N number of string
has comment: http://stackoverflow.com/comment/32231578
score: 2
has comment: http://stackoverflow.com/comment/32231492
type: AnsweredQuestion

http://stackoverflow.com/comment/32462636
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21502726
type: Comment
has text: That error means your path is wrong. You need your file in `src/res` and use this path `"/res/background.jpg"`.

http://stackoverflow.com/comment/32351750
type: Comment
type: AnswerComment
has text: I have `<string name="list_icon">&#xe623;</string>` and when I do this `holder.icon.setText(activity.getResources().getString(R.string.list_icon));` it is working great! Maybe I need to format the string to utf-8
score: 0
comment on: http://stackoverflow.com/a/21441135

http://stackoverflow.com/q/21484223
tagged with: upload
has comment: http://stackoverflow.com/comment/32474004
has title: Uploading images using Servlet 3.0
tagged with: tomcat
tagged with: image
tagged with: servlets
upvote count: 1
linked to: http://stackoverflow.com/q/1264709
answer count: 1
has body: I have a simple form with enctype "multipart"; I am using this to upload an image to my server. I have two possible solutions, but neither of them are complete. First solution: FileItemIterator iterator = upload.getItemIterator( request ); while( iterator.hasNext() ){ FileItemStream item = iterator.next(); if( item.isFormField() ){ // store IMG } } // ~while( iter.hasNext() ) In this solution, I can't get the dimensions of the uploaded file, but I can get if it's a form field or not (using item.isFormField()) My second solution uses the Servlet 3.0 API: for( Part part: request.getParts() ){ System.out.println( part.getSize() ); } Here I can get the size of the uploaded image, but I can't tell whether it's a simple form field or not. What am I missing? What you need for help me?
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21509970
accepted answer: http://stackoverflow.com/a/21509970
type: Question

http://stackoverflow.com/q/21354494
tagged with: collections
tagged with: apache-commons
has comment: http://stackoverflow.com/comment/32197518
has body: I'm reading the Apache Commons source code to become a better programmer. I noticed in AbstractLinkedList: transient Node&lt;E&gt; header; /** The size of the list */ transient int size; /** Modification count for iterators */ transient int modCount; Don't we need these to be serialized/deserialized?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21354617
has comment: http://stackoverflow.com/comment/32197544
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32198264
type: UnansweredQuestion
score: 1
has title: Why are the attributes in AbstractLinkedList transient?
upvote count: 1

http://stackoverflow.com/a/21377040
accepted answer of: http://stackoverflow.com/q/21376957
has body: Fragment is not an activity, it's a part of activity means they work together, without activity, fragment won't work etc. If you want to use your data in another fragment you need to use Bundle Bundle b = new Bundle(); b.putInt("my_data",YourData); YourFragment f = new YourFragment(); f.setArguments(b); And in your fragment to get value, Bundle b = getArguments(); int v = b.getInt("my_data",0); if it's an object that you want to pass, you need to serialize it and deserialize in fragment again
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21376957
has comment: http://stackoverflow.com/comment/32238263
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32238204
has comment: http://stackoverflow.com/comment/32238787
has comment: http://stackoverflow.com/comment/32238858
type: Answer
has comment: http://stackoverflow.com/comment/32238888

http://stackoverflow.com/a/21542383
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21479403
answers question: http://stackoverflow.com/q/21479403
type: Answer
score: 2
upvote count: 2
has body: You can call axis service using non-blocking client way by registering the callback instance. Client class: ServiceClient sc = new ServiceClient(); Options opt= new Options(); //set the target EP opt.setTo(new EndpointReference("http://localhost:8080/axis2/services/CountryService")); opt.setAction("urn:getCountryDetails"); sc.setOptions(opt); sc.sendReceiveNonBlocking(payload, callBack); // inner class with axisCallback , overide all its methods. onMessage get called once result receive from backend AxisCallback callBack = new AxisCallback() { @Override public void onMessage(MessageContext msgContext) { System.out.println(msgContext.getEnvelope().getBody().getFirstElement()); //this method get called when you received the results from the backend } ... } Reference for writing axis service : http://jayalalk.blogspot.com/2014/01/writing-axis2-services-and-deploying-in.html
type: AcceptedAnswer

http://stackoverflow.com/a/21504755
has body: You should not be calling things like cond.await(); on the UI thread (on the event dispatching thread). This is why your UI hangs. Also, even though this is not related, don't use empty catch blocks as you did there when catching the InterruptedException.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21504736
answers question: http://stackoverflow.com/q/21504736
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21470222
has comment: http://stackoverflow.com/comment/32404928
has comment: http://stackoverflow.com/comment/32407557
has comment: http://stackoverflow.com/comment/32404603
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32428310
tagged with: java
has comment: http://stackoverflow.com/comment/32404522
type: Question
has comment: http://stackoverflow.com/comment/32404501
has body: This code will currently take in an array list and create 10 equal width bins from the floats contained; it will then print the bin ranges. What I am having trouble with is figuring out how to index through the ArrayList and print a star in the correct bin according to the float found. I'm not asking for code; rather a push in the right direction. public static String getHist( String Tag, ArrayList &lt;Float&gt; x) { Float max = getMaximum(x); Float min = getMinimum(x); Float interval = (max - min) / 10f; // System.out.print("Interval:" + interval); Float base = min; //System.out.println(Tag); //Loops through for 10 iterations for(Float i = base ; i &lt;= (max - interval); i+= interval) { //System.out.print("Interval:" + i + "\n"); //prints out the bin range System.out.print(i + " - " + (base += interval) + " | "); //Loop through ArrayList and if a number found belongs within a bin place it // within that appropiate bin //Logic not correct? for(Float index = i; index &lt;= base; index++) { for(Float n : x) { System.out.print("*"); } } System.out.println(); } return Tag; }
score: 0
has answer: http://stackoverflow.com/a/21487688
accepted answer: http://stackoverflow.com/a/21487688
answer count: 1
has comment: http://stackoverflow.com/comment/32407630
has title: Placing floats from an arrayList into equal width bins to create a histogram

http://stackoverflow.com/q/21388476
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21388583
type: Question
tagged with: arrays
answer count: 3
has answer: http://stackoverflow.com/a/21388878
has title: Calculating statistics from a double array
score: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/21388583
favorite count: 0
possible better answer: http://stackoverflow.com/a/21388878
has body: I have an array of double values. I would like to calculate a max and average from all of the values in that array. Currently I just iterate trough the array and calculate the numbers, and everything works fine. But it feels odd to me, that I have to implement such a basic methods. I was looking in Java API if there is a method that can do something like that, but I could not find any... Am I missing something? I've searched here, but I only found a bunch of examples, where they implement it the same way I did.
has answer: http://stackoverflow.com/a/21388523

http://stackoverflow.com/comment/32245898
type: Comment
comment on: http://stackoverflow.com/q/21380910
score: 1
type: QuestionComment
has text: I don't know what to do. As i told in question segment, thread1 has already acquired the lock on location {0,2}. The only thing which is shred between two threads is the location, i cannot find synchronized way to communicate between thread1 and other thread trying to acquire the lock.

http://stackoverflow.com/comment/32396687
type: Comment
comment on: http://stackoverflow.com/a/21466367
type: AnswerComment
has text: Thank you. That worked. So all of those classes have to be public static. I did notice that WEBMethods does not let you place classes outside of the main class like you can do in Java. This is my first morning with WEBMethods so it is a learning experience. Is there a good book on this subject.
score: 0

filewriter
tag name: filewriter
type: Tag
tags question: http://stackoverflow.com/q/21437838
tags question: http://stackoverflow.com/q/21379575

http://stackoverflow.com/comment/32387925
type: Comment
comment on: http://stackoverflow.com/a/21461645
has text: I want to use the same code with few identical tables (but containing different information) and that's why I have String tableName = "shop_"+shop; String sql = "INSERT INTO " + tableName + " (name,tel..."; When debugging I see that the query looks right. It points to the right table.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21350954
downvote count: 0
has body: The reason why you are getting all those error statements, even though there is a match in both the list is, you are printing them for each mismatch, in the else if statement. Rather what you should do is, take a boolean variable found, initialize it to false. Now, just have the if block inside your for loop. And if that if condition is satisfied, reset the found variable to true, and break from the loop. Outside the loop, check the value of found, and if it is false, that means no match was there. That was the suggestion regarding your approach. However, I would follow a different approach here. Since you are using an ArrayList, you don't need to iterate manually over it to find if there is a match or not. You can use ArrayList#contains(Object) method for that. The method internally uses equals() method for comparison, so I would override equals() and hashCode() methods in both Movie and Theatre class. Here's how the equals method would look like: // Movie: @Override public boolean equals(Object obj) { if (!(obj instanceof Movie)) return false; Movie that = (Movie) obj; return this.title.contains(that.title) || that.title.contains(this.title); } Similarly for Theatre class: // Theatre: @Override public boolean equals(Object obj) { if (!(obj instanceof Theatre)) return false; Theatre that = (Theatre) obj; return this.name.contains(that.name) || that.name.contains(this.name); } And then, replace your for loop with: String mTitle = Helper.readString("Enter movie title &gt; "); String tName = Helper.readString("Enter theatre name &gt; "); // Create `Movie` and `Theatre` instance // Ideally you would not create a new instance. Rather just fetch them from // database, or some `static` list, in case of in-memory implementation. // From your implementation, it seems like the entered value might not be the exact // match. So that you have to handle. Movie movie = new Movie(mTitle); Theatre theatre = new Theatre(tName); // If you are fetching the movie and theatre from some …
answers question: http://stackoverflow.com/q/21350603
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/21350603
upvote count: 1
has comment: http://stackoverflow.com/comment/32196428
has comment: http://stackoverflow.com/comment/32195888
type: AcceptedAnswer

http://stackoverflow.com/comment/32192849
type: Comment
comment on: http://stackoverflow.com/a/21351586
has text: Hi, may I ask the meaning of this %? I cannot comprehend.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32281150
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21401082
has text: An mistake that you are doing is that you adding e.g. the 15 twice. You do that also for all values which are divisible through 3 and 5
score: 0

http://stackoverflow.com/comment/32234487
comment on: http://stackoverflow.com/q/21374285
score: 0
type: Comment
type: QuestionComment
has text: try this: (crime) getListAdapter().getItemViewType(position);

http://stackoverflow.com/comment/32251914
type: QuestionComment
comment on: http://stackoverflow.com/q/21384375
has text: How are you setting the jvm memory?
score: 0
type: Comment

http://stackoverflow.com/q/21493436
score: 2
answer count: 0
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/15736012
has body: In Swing, if I create a JEditorPane like so: JEditorPane jep = new JEditorPane(); jep.setSize(300, Integer.MAX_VALUE); jep.setText(content); int wrapHeight = jep.getPreferredSize().height; wrapHeight gives me the height of the content when the width is 300, which I can then use to wrap the component around its content. I'm trying to do the same thing with a WebView in JavaFX, but when I do this: WebView wv = new WebView(); wv.setMaxWidth(300); wv.getEngine().loadContent(content); int wrapHeight = wv.getPrefHeight(); (having added the WebView to a Pane), wrapHeight remains 600 (presumably the default). Following the answer here, I tried inserting the line String heightText = WV.getEngine().executeScript( "window.getComputedStyle(document.body, null).getPropertyValue('height')" ).toString(); but heightText always comes back as 0px. Having loaded content into a WebView, how can I determine the height of that content at a fixed width? Update: If I call: engine.documentProperty().addListener(new ChangeListener&lt;Document&gt;() { @Override public void changed(ObservableValue&lt;? extends Document&gt; prop, Document oldDoc, Document newDoc) { String heightText = WV.getEngine().executeScript( "window.getComputedStyle(document.body, null).getPropertyValue('height')").toString(); double height = Double.valueOf(heightText.replace("px", "")); System.out.println(height); } }); I get a value returned of 2023.0. However, the height of the content loaded is far less than that - less than 500 px. Where is 2023 coming from?
has title: Scale WebView to fit content
has comment: http://stackoverflow.com/comment/32450753
has comment: http://stackoverflow.com/comment/49381041
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32480891
type: AnswerComment
has text: settings.xml is empty, what should I put in it?
comment on: http://stackoverflow.com/a/21513464
type: Comment
score: 0

http://stackoverflow.com/a/21379826
answers question: http://stackoverflow.com/q/21379766
upvote count: 15
has body: These are not keywords: these are JVM bytecode instructions. E.g. Java code new int [3][2] compiles into these bytecodes: iconst_3 iconst_2 multianewarray [[I 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 15
has comment: http://stackoverflow.com/comment/32242854
accepted answer of: http://stackoverflow.com/q/21379766

http://stackoverflow.com/q/21507555
has title: creating a method that randomly returns a fish from an arraylist
downvote count: 2
accepted answer: http://stackoverflow.com/a/21507684
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/32470169
possible better answer: http://stackoverflow.com/a/21507658
tagged with: java
has answer: http://stackoverflow.com/a/21507658
tagged with: methods
has body: Hello I am having trouble creating a method called catchAFish() that randomly returns a fish from an arraylist (in which I have created another method that adds to it). If an index is empty, it is replaced with null. My attempt is provided below, Here is my pond class: import java.util.ArrayList; public class Pond { private int numFish; ArrayList&lt;Fish&gt; fishes = new ArrayList&lt;Fish&gt;(); public int getFish() { return this.numFish; } public Pond(int numFish) { this.numFish = numFish; } public boolean isFull() { return numFish == fishes.size(); } public String toString() { return("Pond with " + this.numFish + " Fish"); } public void add(Fish fish) { if(fishes.size() &lt; this.numFish) { fishes.add(fish); } } public void listFish() { // iterate for every fish in the fishes ArrayList for (Fish fish : fishes) { System.out.println(fish.toString()); } } public void catchAFish() { int randomNumber = 1 + (int) (Math.random() * fishes.size() - 1); fishes.remove(randomNumber); for(int j = 0; j &lt; fishes.size(); j++) { System.out.println(fishes.get(j)); } } } Everything works fine. When I add all the fish to the arraylist it works, when I just want to run the program once it works fine (a fish at random index is removed), but when I run it with the following tester code it doesn't. I keeping getting errors. Any help is appreciated, thank you! public class PondTestProgram { public static void main(String args[]) { //Create a pond with 10 fish Pond pond = new Pond(15); pond.add(new Fish(4, "Sunfish")); pond.add(new Fish(25, "Pike")); pond.add(new Fish(20, "Bass")); pond.add(new Fish(30, "Perch")); pond.add(new Fish(4, "Sunfish")); pond.add(new Fish(15, "Pike")); pond.add(new Fish(9, "Pike")); pond.add(new Fish(12, "Bass")); pond.add(new Fish(5, "Sunfish")); pond.add(new Fish(12, "Sunfish")); pond.listFish(); System.out.println(""); // Now catch 7 random fish System.out.println("Catching 7 random fish as follows ..."); for (int i=0; i&lt;7; i++) System.out.println(pond.c…
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/32470099
tagged with: arrays
has answer: http://stackoverflow.com/a/21507684
tagged with: arraylist
score: -2
favorite count: 0

http://stackoverflow.com/a/21493961
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21493900
downvote count: 0
answers question: http://stackoverflow.com/q/21493900
type: Answer
has body: try if ( ! build.equals(vs) ) { //there is an update! don't do it the other way round, vs may be null. build won't, since it's a literal, I assume.
score: 1
upvote count: 1

http://stackoverflow.com/comment/60328820
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21388654
has text: @Jean-PhilippePellet Because he wants multiple maximum values. There are some tricks you can do such as keeping the top x and scanning the list but the savings you gain are only significant if you have a small x and a really really big list, which is unlikely to be true in this case.
type: Comment

http://stackoverflow.com/comment/32421525
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21480679
has text: The problem is if i click on the button when the jdialog is open then it will close the jdialog and open it again
type: AnswerComment

http://stackoverflow.com/comment/32477165
has text: Since the letterhead is also a .doc, you can save it as a Word 2003 XML Document from Word. Once you've done that, you should be able to work with the WordprocessingML to add whatever content you need. I've tested out saving a .doc (with a header and footer) as a .xml in Word, making some changes to the .xml, then re-opening it in Word, and it looks like the header and footer are preserved.
score: 0
comment on: http://stackoverflow.com/a/21500978
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21501207
has title: CustomListView with checkboxes: Use selected items in code
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32472598
has comment: http://stackoverflow.com/comment/32473638
has comment: http://stackoverflow.com/comment/32458250
tagged with: listview
has comment: http://stackoverflow.com/comment/32473578
downvote count: 0
favorite count: 0
has body: I have created a CustomListView with checkboxes. How can I create code such that I can use the selected items of the ListView in my code. This code has been suggested: Main activity code: ArrayList&lt;PeopleDetails&gt; people_selected = new ArrayList&lt;PeopleDetails&gt;(); peoplelist_customadapter adapter = (peoplelist_customadapter) people_list.getAdapter(); StringBuilder test_builder = new StringBuilder(); for(int i=0; i &lt; adapter.checkstates.size() ; i++){ if(adapter.checkstates.get(i) == true){ people_selected.add(people_details.get(i));///lines throws error java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 ///so people_details is empty - 0 entries. why??? test_builder.append(people_details.get(i).name); } Adapter: package com.example.partyorganiser; import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.util.SparseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.TextView; public class peoplelist_customadapter extends ArrayAdapter&lt;PeopleDetails&gt; implements CompoundButton.OnCheckedChangeListener{ Context context; int layoutResourceId; ArrayList&lt;PeopleDetails&gt; data = null; SparseBooleanArray checkstates; public peoplelist_customadapter(Context context, int layoutResourceId, ArrayList&lt;PeopleDetails&gt; data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; checkstates = new SparseBooleanArray(data.toArray().length); } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; personHolder holder = null; PeopleDetails[] people_array = data.toArray(new PeopleDetails[data.size()]); if(row == null) { LayoutInfl…
tagged with: android
has comment: http://stackoverflow.com/comment/32458303
tagged with: checkbox
linked to: http://stackoverflow.com/q/18162931
has comment: http://stackoverflow.com/comment/32473657
has comment: http://stackoverflow.com/comment/32458138
has comment: http://stackoverflow.com/comment/32473339
has comment: http://stackoverflow.com/comment/32473621
has comment: http://stackoverflow.com/comment/32473666
answer count: 0
has comment: http://stackoverflow.com/comment/32473646
type: UnansweredQuestion
score: 1
tagged with: checkboxlist
upvote count: 1

http://stackoverflow.com/q/21359473
favorite count: 0
accepted answer: http://stackoverflow.com/a/21360000
tagged with: android
possible better answer: http://stackoverflow.com/a/21370480
has comment: http://stackoverflow.com/comment/32207195
has answer: http://stackoverflow.com/a/21370480
has comment: http://stackoverflow.com/comment/32207115
type: AnsweredQuestion
tagged with: java
tagged with: calendar
downvote count: 1
type: Question
score: -1
has answer: http://stackoverflow.com/a/21360000
has body: I am working on Calendar project and I am wondering is there any build in function available in class Calendar in android which can change daily basis or weekly basis. For e.g. I am storing a data in today's date. And I want to repeat that operation on daily basis or weekly basis. I don't want to use Calendar api. e.g. let's say my Calendar instance variable storing date "2014-26-01" so I want to do something like final Calendar c = Calendar.getInstance(); for(int i = o ; i &lt;= 30 ; i++){ yy = c.get(Calendar.YEAR); mm = c.get(Calendar.MONTH); dd = c.get(Calendar.DAY_OF_MONTH); Toast.makeText(this,yy+"-"+mm+"-"+dd,Toast.LENGH_SHORT).show(); /** here i want to change the value of `Calendar c` to next day or next week**/ }
has comment: http://stackoverflow.com/comment/32206950
has title: Changing dates in weekly or monthly basis
answer count: 2
has comment: http://stackoverflow.com/comment/32207126
has comment: http://stackoverflow.com/comment/32207042
upvote count: 0
has comment: http://stackoverflow.com/comment/32206962

http://stackoverflow.com/a/21449460
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21378837
has body: $(document).ready(function(){ $.getJSON("Test.json",function(data){ $.each(data,function(key,value){ alert(data[key].activities); alert(data[key].enterpriseName); $('input').val(data[key].enterpriseName); activities=data[key].activities; console.log(value); }); }); });
accepted answer of: http://stackoverflow.com/q/21378837

http://stackoverflow.com/comment/32417378
has text: What is the range for the numbers?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21477871
type: QuestionComment

http://stackoverflow.com/comment/32452130
type: Comment
score: 1
has text: Alright, it works though. Thanks for helping, Sabuj!
type: AnswerComment
comment on: http://stackoverflow.com/a/21497151

http://stackoverflow.com/comment/32445186
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21493459
has text: possible duplicate of [Access / process (nested) objects, arrays or JSON](http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json)
score: 0

http://stackoverflow.com/a/21511540
has comment: http://stackoverflow.com/comment/32479048
answers question: http://stackoverflow.com/q/21511511
has comment: http://stackoverflow.com/comment/32477380
has body: To answer the first part of your question: First I want all my buttons to be the same size, and there to be a little space between them. Add your JButtons to a JPanel that uses a GridLayout with 4 parameters. The first 2 parameters will be row and column count, and the next two will be horizontal and vertical gap. e.g., JPanel buttonPanel = new JPanel(); // below: create a grid layout with 1 row, variable number of columns // with a 5 points horizontal gap between each component and no vertical gap buttonPanel.setLayout(new GridLayout(1, 0, 5, 0)); buttonPanel.add(button1); buttonPanel.add(button2); buttonPanel.add(button3); //... etc // now add the buttonPanel to the main GUI As I have stated in my comment, you appear to be trying to solve too much all at once, and instead should concentrate on trying to solve one small problem at a time, in isolation of the others. First work on spacing your buttons, then try to tackle the next step. At each step if stuck, feel free to come here, but show us your attempt to solve that one step and ask your specific question regarding your misunderstandings and that one step.
has comment: http://stackoverflow.com/comment/32477358
has comment: http://stackoverflow.com/comment/32477572
has comment: http://stackoverflow.com/comment/32477190
has comment: http://stackoverflow.com/comment/32477270
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/32477279
type: Answer
has comment: http://stackoverflow.com/comment/32477119

http://stackoverflow.com/q/21386764
favorite count: 0
has answer: http://stackoverflow.com/a/21386871
upvote count: 0
accepted answer: http://stackoverflow.com/a/21386871
has answer: http://stackoverflow.com/a/21386894
possible better answer: http://stackoverflow.com/a/21386865
type: AnsweredQuestion
tagged with: java
has body: I made a method that is supposed to clean up a String. It has to delete every char with a reach of [a,z]. But I am getting this exception: StringIndexOutOfBoundsException. The moment I insert a number out of the reaching the conditions, this exception pops up. I can't spot what I have done wrong. public static String kuisStringOp(String str){ StringBuilder strb = new StringBuilder(str); for (int i = 0; i &lt; str.length(); i++) { if(strb.charAt(i)&lt;'a'||strb.charAt(i)&gt;'z'){ strb.deleteCharAt(i); } } return strb.toString(); }
score: -1
has title: Method that is supposed to clean up a String throws StringIndexOutOfBoundsException
has answer: http://stackoverflow.com/a/21386865
type: Question
tagged with: stringindexoutofbounds
downvote count: 1
has answer: http://stackoverflow.com/a/21386993
answer count: 4

http://stackoverflow.com/comment/32299978
comment on: http://stackoverflow.com/a/21385613
has text: is just to add "@SupressWarnings 'ressource' to 'content'.. @Mohammad S.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/32353528
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21441928
score: 0
has text: Did you try with `mvn install` from other project? Missing artifact is in maven repository for sure?

http://stackoverflow.com/q/21496221
tagged with: sqliteopenhelper
downvote count: 0
has comment: http://stackoverflow.com/comment/71590521
tagged with: android
tagged with: memory-leaks
tagged with: sqlite
linked to: http://stackoverflow.com/q/18147354
answer count: 4
favorite count: 0
has body: I am making my first android app, and I took some sqlite tutorials first, that taught me to use a databaseHelper that extends SQLiteOpenHelper. So my databaseHelper does extend SQLiteOpenHelper. I get a sqlite connection leak warning in the Logcat so would like some advice about what to do to fix that. I get this error: 02-01 21:39:50.740: W/SQLiteConnectionPool(32061): A SQLiteConnection object for database '/data/data/com.btf271.fashionassistant/databases/clothingManager' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed. My databaseHelper functions that are called where the leak occurs: public List&lt;Sticker&gt; getObjectsByGenderAndCategory(String gender, String category) { List&lt;Sticker&gt; objects = new ArrayList&lt;Object&gt;(); String selectQuery = String.format( "SELECT * FROM %s WHERE %s = \"%s\" AND %s = \"%s\"", TABLE_OBJECT, KEY_GENDER, gender, KEY_CATEGORY, category); Log.e(LOG, selectQuery); SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(selectQuery, null); try{ // looping through all rows and adding to list if (c.moveToFirst()) { do { Object o = createClothingItemJavaObject(c); // adding to object list objects.add(o); } while (c.moveToNext()); } }finally { c.close(); db.close(); } return objects; } I found this which I will try tomorrow. It's late. Thanks.
has title: SQLite connection object leaked - Android
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/62646206
has answer: http://stackoverflow.com/a/30352464
has answer: http://stackoverflow.com/a/21496355
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/21504862
upvote count: 10
type: Question
has answer: http://stackoverflow.com/a/38580855

http://stackoverflow.com/comment/32259447
score: 0
has text: Still a concern, so I need to compile all application once before running superDev? if yes, so by changing branch (git), developers should do clean/compile/get:compile then be able to run superDev?
type: Comment
comment on: http://stackoverflow.com/a/21387532
type: AnswerComment

http://stackoverflow.com/a/21510182
accepted answer of: http://stackoverflow.com/q/21506072
upvote count: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43234128
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/21506072
has body: Figured this out now: The reason was that I had no setters for the fields in my model. That way the form was unable to set the properties and failed silently.

http://stackoverflow.com/comment/32290729
has text: Possible Duplicate: http://stackoverflow.com/questions/20049887/best-practice-sending-objects-over-tcp-ip-between-platforms
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21406537

http://stackoverflow.com/q/21459880
has title: How to get TableViewerColumn from tableViewer?
has comment: http://stackoverflow.com/comment/32410581
has comment: http://stackoverflow.com/comment/32411597
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32401543
type: Question
has comment: http://stackoverflow.com/comment/32399620
has comment: http://stackoverflow.com/comment/32399755
has comment: http://stackoverflow.com/comment/32400836
downvote count: 0
tagged with: tableviewer
has body: I need to get the TableViewerColumn[] from tableViewer ( jface) I need it to update the the setEditingSupport. I tried this code private TableViewerColumn[] getTableViewerColumns(TableViewer tableViewer) { TableColumn[] columns = tableViewer.getTable().getColumns(); TableViewerColumn[] viewerColumns = new TableViewerColumn[columns.length]; for (int i = 0; i &lt; columns.length; i++) { TableColumn tableColumn = columns[i]; viewerColumns[i] = (TableViewerColumn) tableColumn.getData(Policy.JFACE + ".columnViewer"); //$NON-NLS-1$ } return viewerColumns; } It is working but I thought maybe there is an easy or classic way to get the TableViewerColumn. Could you advise me on different way?
tagged with: jface
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32398566
upvote count: 1
has comment: http://stackoverflow.com/comment/32411410

http://stackoverflow.com/a/21489975
downvote count: 0
upvote count: 2
type: Answer
has body: May be you can do something like this System.out.println(Mode == 1 ? "1" : Mode == 2 ? "2" : "3"); switch-case also makes code more readable than multiple if-else
has comment: http://stackoverflow.com/comment/32438953
score: 2
answers question: http://stackoverflow.com/q/21489908

http://stackoverflow.com/a/21380722
type: Answer
has body: Yes: public class Profile { Profile profile; HashMap&lt;String,InterestMetric&gt; interests = ... } Why do you need the second class if it only contains the Map? And on second thought... why does Profile contain a Profile? Shouldn't it only contain the information assembled in a profile? Edit: Since you mentioned that the codebase won't change, the @JsonUnwrapped annotation should be what you are looking for: public class Profile { Profile profile @JsonUnwrapped Interests interests } public class Interests { HashMap&lt;String,InterestMetric&gt; interests = ... } I can't test it from where I am, but it should change your output into this: { profile:... interests:... }
downvote count: 0
has comment: http://stackoverflow.com/comment/32244481
score: 3
has comment: http://stackoverflow.com/comment/32244949
accepted answer of: http://stackoverflow.com/q/21380634
answers question: http://stackoverflow.com/q/21380634
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32244774
upvote count: 3
has comment: http://stackoverflow.com/comment/32244940

http://stackoverflow.com/comment/32323044
comment on: http://stackoverflow.com/q/21425108
has text: Shouldn't it be `a < array1.length` instead of `i <= array1.length`?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32259168
type: Comment
type: AnswerComment
has text: I'm not supposed to use HashMap or ArrayList in this problem
score: 0
comment on: http://stackoverflow.com/a/21388654

http://stackoverflow.com/a/21490004
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/32438714
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21489908
answers question: http://stackoverflow.com/q/21489908
has body: Well, if you don't mind the boxing hit, you could use a set which you prepared earlier: // Use a more appropriate name if necessary private static final Set&lt;Integer&gt; VALID_MODES = new HashSet&lt;&gt;(Arrays.asList(1, 2, 3)); ... if (VALID_MODES.contains(mode)) { } You could use an int[] and a custom "does this array contain this value" method if you wanted... it would be O(N) or O(log N) for a binary search, but I suspect we're talking about small sets anyway.
has comment: http://stackoverflow.com/comment/32438826
upvote count: 1

http://stackoverflow.com/comment/32389873
type: QuestionComment
comment on: http://stackoverflow.com/q/21462301
has text: What is it you are exactly trying to match here? Or rather, what is your end goal?
score: 3
type: Comment

http://stackoverflow.com/q/21485046
tagged with: blowfish
has title: URL special character Code conversion with blowfish encryption?
type: AnsweredQuestion
tagged with: url-rewriting
has answer: http://stackoverflow.com/a/21485556
type: Question
tagged with: encryption
answer count: 1
score: 0
tagged with: java
has body: I am working on a problem where client is sending email thru URL in encrypted format. We have to use blowfish for encryption at Client end and decryption at out end. BLOWFISH CODE below--- //ENCRYPTED as jAOtTv22BfkTkVrhTN/RHQ== public String encrypt(String username,String code) throws Exception { try { byte[] keyData = (username).getBytes(); SecretKeySpec secretKeySpec = new SecretKeySpec(keyData, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); byte[] hasil1 = cipher.doFinal(username.getBytes()); byte[] hasil2 = cipher.doFinal(code.getBytes()); return new BASE64Encoder().encode(hasil1); } catch (Exception e) { System.out.println(e); return null; } } //DECRYPT --doug@gmail.com public String decrypt(String email,String code) throws Exception { try { byte[] keyData = (code).getBytes(); SecretKeySpec secretKeySpec = new SecretKeySpec(keyData, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); byte[] hasil = cipher.doFinal(new BASE64Decoder().decodeBuffer(email)); return new String(hasil); } catch (Exception e) { System.out.println("exaception ="+e); return null; } } We need to decrypt and mask before showing on web page. But the problem with special character coding coming as url. how to handle it for decrypting at our side??? for example we are getting this - http://localhost/demo/Controller?email=jAOtTv22BfkTkVrhTN/RHQ%3D%3D where blowfish encryption is - jAOtTv22BfkTkVrhTN/RHQ== Works fine where no special character code involved e.g - wK6DTqKguftd0%2BePXqlB9BORWuFM39Ed Character code in url --- http://perishablepress.com/url-character-codes/ thanks for any suggestion or help in advance.
accepted answer: http://stackoverflow.com/a/21485556

http://stackoverflow.com/a/21384178
type: Answer
score: 4
has body: Your Select statement would like something like this SELECT P.NAME, P.AGE FROM PERSON_DETAILS P WHERE SOMECOLUMN is NULL AND DATA IN (SELECT DATA FROM PARENT_TABLE WHERE PARENT_VALUE IN ${item} ) ORDER BY P.NAME FETCH FIRST 10 ROW ONLY
accepted answer of: http://stackoverflow.com/q/21374677
upvote count: 4
answers question: http://stackoverflow.com/q/21374677
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/32435796
comment on: http://stackoverflow.com/a/21478294
score: 0
type: AnswerComment
type: Comment
has text: This question is on Java not on C#.

http://stackoverflow.com/a/21515367
answers question: http://stackoverflow.com/q/21469791
has comment: http://stackoverflow.com/comment/32525447
has comment: http://stackoverflow.com/comment/32578106
has comment: http://stackoverflow.com/comment/32521208
has comment: http://stackoverflow.com/comment/32572627
has comment: http://stackoverflow.com/comment/32494476
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32655422
has body: The problem with the petcare namespace is that it's not available online by following the schema location URL. Spring gets around this at runtime using the spring.schemas file, but eclipse does not know about this file nor how to use it to find XSD's. The solution is to configure the petcare namespace manually in eclipse, using the XML Catalog. Go to Preferences, and in there in the XML Catalog section configure the namespace like this: In location put the full hard drive path to the xsd file spring-petcare-3.0.xsd, choose key type Schema location and as key put the full URL for the XSD: http://www.springframework.org/schema/petcare/spring-petcare-3.0.xsd For confirming that it works, right click on the servlet-context.xml file and click validate. The file should no longer be in red. This is an example of the application looks running: And this is the URL to access it: http://localhost:20010/users/signin To run it, these are the steps: create a file named context.xml in webapp/META-INF <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/"/> add this to your pom.xml in the build/plugins section: org.apache.tomcat.maven tomcat7-maven-plugin 20010 / run the application from the command line with: mvn clean install tomcat7:run-war -Dmaven.test.skip=true Running log: INFO : org.springframework.integration.endpoint.EventDrivenConsumer - started org.springframework.integration.config.ConsumerEndpointFactoryBean#2 INFO : org.springframework.integration.endpoint.EventDrivenConsumer - started doctorMail.adapter INFO : org.springframework.context.support.DefaultLifecycleProcessor - Starting beans in phase 0 INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 1661 ms Feb 05, 2014 12:11:01 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-20010"] access the application with the URL above you can create a maven launch configuration in eclipse to launch it…
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21469791

http://stackoverflow.com/q/21482492
upvote count: 1
has title: Deployment java app offline
favorite count: 0
tagged with: offline
has body: I've just finished developing a desktop app, for patients data. I'm using eclipse on mac osx, and mysql server for database access. I need to install this software on a Desktop Pc that has no internet connection, so i have downloaded java 1.7 installer and mysql server. Up to now, i put mysql server,the java platform and the program together in a usb drive. I Installed everything and it works but my question is... Is there a way to pack everything to make a full installer? I've been searching about java web start, but i think it's for deploying apps via browser, anyway jws needs internet connection (I'm not sure about that, just saying) Thanks in advance!
type: UnansweredQuestion
tagged with: deployment
has comment: http://stackoverflow.com/comment/32425724
answer count: 0
tagged with: installation
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question

http://stackoverflow.com/comment/32479567
score: 2
type: Comment
type: QuestionComment
has text: two clicks of a given button *always* come one after the other. What are you trying to achieve?
comment on: http://stackoverflow.com/q/21513099

http://stackoverflow.com/comment/32713738
comment on: http://stackoverflow.com/q/21360091
type: QuestionComment
has text: You generally use `init` and `destroy` and only use `@PostConstruct` and `@PreDestroy` if for whatever reason you can't get get by using only the former. This is rare though.
score: 0
type: Comment

http://stackoverflow.com/a/21487824
answers question: http://stackoverflow.com/q/21487728
score: 3
upvote count: 3
type: Answer
has body: The latter isn't bad style at all, but it requires that the object can be used right away and then added to one attribute at a time. In some scenarios, it's preferable to collect all attributes first, and then do a one time creation event, without doing a re-create or update for each additional attribute. In the sandwich example, the latter is probably fine and there isn't a need for a separate builder class. Maybe a GUI control wants to collect all parameters first and then do a one time create rather than recreate/update for each individual parameter, in which case a separate Builder would be more appropriate.
downvote count: 0

http://stackoverflow.com/q/21495470
tagged with: java
has answer: http://stackoverflow.com/a/21555796
tagged with: automation
answer count: 1
tagged with: ios
tagged with: javascript
score: 0
has body: Folks - I am looking for an automation tool to automate windows 8 metro application and an iOS application for functional automation I have researched some tools and found about Ranorex UI automation tool (for metro and iOS applications) UI automation (by Microsoft) (for metro apps) UI Instruments (for iOS application) The real problem I am facing is with all these UI automation tools, if there is a small change in the UI, the scripts are failing ...... I want to test the functionality first and need more robust scripts/tools to handle UI changes. How can I identify metro app objects uniquely? I see that the UI code is XAML Also, I have the source code of the app available and don't mind using variables or resources from it in my automation code.... Can anyone please suggest any good tools or How I can handle this? My manager wants a real customer experience !! Also, would be great if scripting can be done using Java, Javascript No record and playblack tools which identify based on the static text please !!
tagged with: windows
accepted answer: http://stackoverflow.com/a/21555796
has title: functional automation of Metro, iOS apps ----- UI object identification techniques
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/21353101
answers question: http://stackoverflow.com/q/21352986
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/32196331
has comment: http://stackoverflow.com/comment/32196203
has body: Here is one solution: public static void main(String[] args) { String s = "p1 p2 p2 p2 p2 p3 p3 p4 p5 p5 p5 p5 p5 p2 p2 p1 p1 p1"; String[] parts = s.split(" "); ArrayList&lt;String&gt; arr = new ArrayList&lt;String&gt;(); arr.add(parts[0]); // Add first item for (int i = 1; i &lt; parts.length; i++) { if (!parts[i - 1].equals(parts[i])) { // Check if last item is different arr.add(parts[i]); } } StringBuilder sb = new StringBuilder(); for (String str: arr) { // Creating the new String via StringBuilder sb.append(str); sb.append(" "); } System.out.println(sb.toString()); } Output: p1 p2 p3 p4 p5 p2 p1
upvote count: 1

http://stackoverflow.com/comment/32376605
comment on: http://stackoverflow.com/a/21453624
score: 0
type: AnswerComment
has text: `stud = studentArray.get(i); student.add(stud);` this wouldn't work as `Stundent` objects are still added to a List
type: Comment

uniformgrid
type: Tag
tags question: http://stackoverflow.com/q/21495864
tag name: uniformgrid

http://stackoverflow.com/q/21371561
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: android-studio
tagged with: google-cloud-endpoints
has answer: http://stackoverflow.com/a/21374068
accepted answer: http://stackoverflow.com/a/21374068
tagged with: java
has comment: http://stackoverflow.com/comment/32272858
has title: Generate Client Libraries fails if ClassnameEndpoint.java has 'Multiple methods with same rest path "GET classname": etc
type: Question
possible better answer: http://stackoverflow.com/a/31434946
has answer: http://stackoverflow.com/a/31434946
has body: after generating Endpoint from a model class I edit the ClassnameEndpoint file to make a method that will return a list of Entities using a modified SELECT string. Somehow this makes a clash and Generate Client Libraries fails like this: INFO: Successfully processed C:\Users\1177\AndroidStudioProjects\N5\appN5-AppEngine\target/generated-sources/appengine-endpoints\WEB-INF/appengine-web.xml [ERROR] com.google.api.server.spi.config.validation.ApiConfigInvalidException: Multiple methods with same rest path "GET eventdata": "listUserEventData" and "listEventData" here is the ClassnameEndpoint.java, which is edited by hand after being generated: note listEventData and listUserEventData are identical except for SELECT string... So how can I create an endpoint method to get ALL the entities and another method to get SOME entities without the clash? package sic.example.appn5; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import com.google.api.server.spi.response.CollectionResponse; import com.google.appengine.api.datastore.Cursor; import com.google.appengine.datanucleus.query.JPACursorHelper; import java.util.List; import javax.annotation.Nullable; import javax.inject.Named; import javax.persistence.EntityExistsException; import javax.persistence.EntityNotFoundException; import javax.persistence.EntityManager; import javax.persistence.Query; @Api(name = "eventdataendpoint", namespace = @ApiNamespace(ownerDomain = "example.sic", ownerName = "example.sic", packagePath = "appn5")) public class EventDataEndpoint { /** * This method lists all the entities inserted in datastore. * It uses HTTP GET method and paging support. * * @return A CollectionResponse class containing the list of all entities * persisted and a cursor to the next page. */ @SuppressWarnings({"unchecked", "unused"}) @ApiMethod(name = "listEventData") public CollectionResponse&lt;EventData&gt; listEventData( @…
score: 0
has comment: http://stackoverflow.com/comment/32262359
answer count: 2
has comment: http://stackoverflow.com/comment/32235345
linked to: http://stackoverflow.com/q/17003093
tagged with: rest

http://stackoverflow.com/a/21504277
downvote count: 0
type: Answer
has body: Try was the bracket mismatch I have corrected your code try it public class task_4 { public static void main(String[] args) { double cent = 10; double fahr = 10; double centToFahrResult = centToFahr(10); double fahrToCentResult = fahrToCent(20); System.out.println(fahrToCentResult + " " + centToFahrResult); } public static double fahrToCent(double fahr) { double cent; cent = ((fahr - 32) / 1.8); return cent; } public static double centToFahr(double cent) { double fahr; fahr = ((cent * 1.8) + 32); return fahr; } }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21504222
has comment: http://stackoverflow.com/comment/32463999

series
tag name: series
type: Tag
tags question: http://stackoverflow.com/q/21409270

http://stackoverflow.com/comment/32196028
has text: In this case you must add the `<classpath/>` argument in the `pom.xml`. See my changes in the original answer.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21352647

http://stackoverflow.com/comment/32469609
has text: My Token class just contains the following: public class Token { String id, lexeme; public Token(String id, String lexeme) { this.id = id; this.lexeme = lexeme; } public String getId() { return id; } public String getLexeme() { return lexeme; } }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21507331
score: 0

http://stackoverflow.com/comment/32291711
has text: How many images do you want to show every two seconds? Is it a fixed or variable number? Are you trying to do a presentation like MS PowerPoint or LibreOffice Impress do?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21406671
score: 0

http://stackoverflow.com/q/21380701
has comment: http://stackoverflow.com/comment/32244400
has comment: http://stackoverflow.com/comment/32248149
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/21380935
score: 0
has comment: http://stackoverflow.com/comment/32244447
has title: Compare two long Strings
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21380878
has answer: http://stackoverflow.com/a/21380839
has answer: http://stackoverflow.com/a/21380798
has answer: http://stackoverflow.com/a/21380939
tagged with: string
has body: I want to compare two string who have those form s1="1390785186301" s2="1390785191301" Shall I convert them to long and then compare with &gt; or there are methods?
has answer: http://stackoverflow.com/a/21380796
has comment: http://stackoverflow.com/comment/32244414

http://stackoverflow.com/comment/32261318
type: QuestionComment
comment on: http://stackoverflow.com/q/21389712
has text: I know, but when I run the String ( How to equals an character in string and then calculate it? - "a" was found 60 times.
score: 0
type: Comment

libgdx
tags question: http://stackoverflow.com/q/21420161
tags question: http://stackoverflow.com/q/21367186
tags question: http://stackoverflow.com/q/21444209
tags question: http://stackoverflow.com/q/21378206
tags question: http://stackoverflow.com/q/21402697
tags question: http://stackoverflow.com/q/21488858
tags question: http://stackoverflow.com/q/21359322
tags question: http://stackoverflow.com/q/21354075
tag name: libgdx
tags question: http://stackoverflow.com/q/21392366
tags question: http://stackoverflow.com/q/21448004
tags question: http://stackoverflow.com/q/21376258
tags question: http://stackoverflow.com/q/21499759
tags question: http://stackoverflow.com/q/21478339
tags question: http://stackoverflow.com/q/21488311
tags question: http://stackoverflow.com/q/21357811
tags question: http://stackoverflow.com/q/21400119
tags question: http://stackoverflow.com/q/21458965
tags question: http://stackoverflow.com/q/21351339
tags question: http://stackoverflow.com/q/21375972
type: Tag
tags question: http://stackoverflow.com/q/21509652
tags question: http://stackoverflow.com/q/21426845
tags question: http://stackoverflow.com/q/21484983
tags question: http://stackoverflow.com/q/21382913
tags question: http://stackoverflow.com/q/21453204
tags question: http://stackoverflow.com/q/21423119
tags question: http://stackoverflow.com/q/21363823
tags question: http://stackoverflow.com/q/21459636
tags question: http://stackoverflow.com/q/21395935
tags question: http://stackoverflow.com/q/21369864
tags question: http://stackoverflow.com/q/21487733
tags question: http://stackoverflow.com/q/21512369
tags question: http://stackoverflow.com/q/21416741
tags question: http://stackoverflow.com/q/21415618
tags question: http://stackoverflow.com/q/21412846
tags question: http://stackoverflow.com/q/21497744
tags question: http://stackoverflow.com/q/21398553
tags question: http://stackoverflow.com/q/21371110
tags question: http://stackoverflow.com/q/21464011
tags question: http://stackoverflow.com/q/21456883

http://stackoverflow.com/a/21352046
upvote count: 1
has body: Assuming these are your own activities, you need to declare an action on the activity you want to be closeable, then call that action from the other app. The closing activity will get notified in onNewIntent() where you can check the action and call finish In closable activity: @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if ("action.action.myactionstring".equals(intent.getAction())) { finish(); } } In closeable activity mainfest &lt;activity android:name=".CloseableActivity" &gt; &lt;intent-filter&gt; &lt;action android:name="action.action.myactionstring" /&gt; ... &lt;/intent-filter&gt; &lt;/activity&gt; In the other activity Intent intent = new Intent("action string"); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent);
downvote count: 0
has comment: http://stackoverflow.com/comment/32193149
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32245017
type: Answer
has comment: http://stackoverflow.com/comment/32245759
answers question: http://stackoverflow.com/q/21351974
accepted answer of: http://stackoverflow.com/q/21351974
score: 1

http://stackoverflow.com/comment/32422318
has text: Thanks Jon, I know that the problem is with creation, and was only interested in some quick and dirty workaround.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21481088

http://stackoverflow.com/q/21506502
has comment: http://stackoverflow.com/comment/32468087
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32468575
has comment: http://stackoverflow.com/comment/32468071
has title: How does Minecraft Forge load mods from external JARs?
score: 0
has body: How do I load a class from an external JAR that I'm not aware of prior to compiling? The issue comes down to, "How do I get the path of a class in a jar?" try { for (int x = 0; x &lt; new File("mods").listFiles().length; x++) { if (new File("mods").listFiles()[x].getName().endsWith(".jar")) { JarFile file = new JarFile(new File("mods").listFiles()[x].getPath()); Enumeration&lt;JarEntry&gt; entries = file.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); if (entry.getName().endsWith(".class")) { new URLClassLoader(new URL[]{new URL("file://"+new File("mods").listFiles()[x].getAbsolutePath())}).loadClass(%path-to-class%); } } file.close(); } } } catch (Exception e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/32468103
answer count: 1
has comment: http://stackoverflow.com/comment/32468202
has answer: http://stackoverflow.com/a/21506665
accepted answer: http://stackoverflow.com/a/21506665

http://stackoverflow.com/q/21443297
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21539730
favorite count: 0
has comment: http://stackoverflow.com/comment/32377652
has body: I'm really new in android ndk and I appreciate any help. How can I create recursive folder scanning in c++ with the checking extension ? I know it's really easy to do in java. In java I use this: public void scan(File root) { File[] list = root.listFiles(tracksFilter); for (File f : list) { String path; if (f.isDirectory()) { scan(f); } else if(path.endWith(".mp3"){ doMP3(f); } else if(path.endWith(".png"){ doPNG(f); } } }
has comment: http://stackoverflow.com/comment/32355893
type: Question
has title: Recursivly scan sd card android ndk
tagged with: android
accepted answer: http://stackoverflow.com/a/21539730
tagged with: c++
has comment: http://stackoverflow.com/comment/32356970
upvote count: 2
has comment: http://stackoverflow.com/comment/32368693
answer count: 1
tagged with: android-ndk
tagged with: java

http://stackoverflow.com/comment/32480661
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21513629
has text: Why not creating a set of Threads downloading all at the same time?

http://stackoverflow.com/comment/32383223
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21458690
has text: Then I recommend posting a full example that shows exactly what you've tried so that we can copy and paste it and run it ourselves. AKA an [SSCCE](http://sscce.org).

http://stackoverflow.com/q/21427586
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21427718
tagged with: nullpointerexception
type: Question
has body: I have this method in Main activity: public void setPositionToView (Context ctx, List&lt;Address&gt; addresses) { try { String street = addresses.get(0).getAddressLine(0); String city = addresses.get(0).getAddressLine(1); String country = addresses.get(0).getAddressLine(2); Log.i(AppHelper.APP_LOG_NAMESPACE, street); // display toast message with success state Toast.makeText(ctx, "TEST", Toast.LENGTH_LONG).show(); // change state text to success and colorize text green TextView eanTv = (TextView) findViewById(R.id.street); eanTv.setText("Test"); //stateTv.setTextColor(getResources().getColor(R.color.green)); } catch (Exception e) { Log.e(AppHelper.APP_LOG_NAMESPACE, "getAndSavePosition method cannot be processed", e); e.printStackTrace(); } } Method is called as a callback from helper class (extended from Activity). If in method i try to call: TextView eanTv = (TextView) findViewById(R.id.street); I got always null pointer exception, but if i try to call from onCreate method in Main activity method like this, is everything fine: public void colorizeIt () { try { TextView stateTv = (TextView) findViewById(R.id.state); stateTv.setText("This is O.K"); } catch (Exception e) { Log.e(AppHelper.APP_LOG_NAMESPACE, "getAndSavePosition method cannot be processed", e); e.printStackTrace(); } } I tried to find some solution for this but without luck, should i create some layout, view instance or something similar to example below? LayoutInflater in = getLayoutInflater() ; View layout = in.inflate(R.layout.toast_layout, (ViewGroup) findViewById ( R.id.toast_layout_root ) ) ; Thanks for any advice and example..
type: AnsweredQuestion
tagged with: android
tagged with: textview
has answer: http://stackoverflow.com/a/21427718
has answer: http://stackoverflow.com/a/21427763
has title: Android findViewById in activity method is not working if is called from helper class
answer count: 2
possible better answer: http://stackoverflow.com/a/21427763

http://stackoverflow.com/q/21459718
has answer: http://stackoverflow.com/a/21459848
has comment: http://stackoverflow.com/comment/121562475
tagged with: jpanel
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21460065
has comment: http://stackoverflow.com/comment/32384442
has body: Quite green regarding javas component-stuff etc so please excuse me if information given by me isn't enough! Considet the code below. Adding menu and menu showing in frame, no problem. I want when gameOn() is called to remove the menu and instead start the game. The code below only makes the Frames surface "blank", no gamepanel added. Any thoughts/suggestions on how to fix it? The MenuPanel has a mouselistener. public class GameFrame extends JFrame { private MenuPanel mp; //extends JPanel private GamePanel gp; //extends JPanel public GameFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(new Dimension(GameFrame.XSIZE, GameFrame.YSIZE)); setLocationRelativeTo(null); setVisible(true); mp = new MenuPanel(this); add(mp); } public void gameOn() { remove(mp); GamePanel gp = new GamePanel(5); add(gp); } }
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: jframe
has answer: http://stackoverflow.com/a/21460060
has title: How do I Switch JPanels inside a JFrame
tagged with: java
answer count: 3
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/32362762
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21446923
has text: @user278153 There's another issue then. I suggest looking into how you declare the amount variable.

http://stackoverflow.com/a/21501248
has body: You shouldn't need to close eclipse. If you look in the top right corner of your console box when there is a running program, you can halt and shut down the process by clicking the little red stop button. That should end even an infinite loop. See the image below: As long as you have a running process created by eclipse, that button will be enabled, and you can click it at any time.
score: 1
answers question: http://stackoverflow.com/q/21501173
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21501173
has comment: http://stackoverflow.com/comment/32458327
upvote count: 1

http://stackoverflow.com/comment/32463977
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21503860
type: Comment
has text: Thanks for your reply. Well this explains the error, as I was using Hibernate 3.6 jar while this code is more for Hibernate 3.5...one last question please...won't changing Object to Date cause me trouble for the custom mapping to read and write UTC Timestamps to DB with Hibernate as mentioned in my question?

http://stackoverflow.com/q/21407972
has title: Restoring original activity as it is (like home button) when back button pressed
tagged with: java
linked to: http://stackoverflow.com/q/2000102
has comment: http://stackoverflow.com/comment/32293352
type: Question
tagged with: android-service
score: 0
answer count: 1
tagged with: android-homebutton
linked to: http://stackoverflow.com/q/10479965
tagged with: android
type: UnansweredQuestion
has body: I am designing android application using tabHost. TabActivity is always being launched from anther activity( suppose, Activity A). After that Activity A has no use. When I am on tabActivity &amp; if back button is pressed, then all goes in background( like every app). Now using task manager when I start app again, I want to retain tabActivity as it was. (like home button.) But currently I am getting Activity A. (as with back Button activities are getting destroyed.) In short, I want to override backButton similar to Home Button. I tried without luck with moveTaskToBack(true). Can anybody suggest solution?
has answer: http://stackoverflow.com/a/21408293

printing
tags question: http://stackoverflow.com/q/21505068
tags question: http://stackoverflow.com/q/21486889
tags question: http://stackoverflow.com/q/21383853
tag name: printing
tags question: http://stackoverflow.com/q/21425036
tags question: http://stackoverflow.com/q/21367577
tags question: http://stackoverflow.com/q/21468706
tags question: http://stackoverflow.com/q/21391826
type: Tag
tags question: http://stackoverflow.com/q/21407003
tags question: http://stackoverflow.com/q/21383761

http://stackoverflow.com/q/21481671
has comment: http://stackoverflow.com/comment/32423094
has comment: http://stackoverflow.com/comment/32423652
has comment: http://stackoverflow.com/comment/32423220
has title: Android not starting other activity
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21482946
has answer: http://stackoverflow.com/a/21482395
accepted answer: http://stackoverflow.com/a/21482395
tagged with: android
has answer: http://stackoverflow.com/a/21482317
has body: I'm pretty new to Android programming, but i have never encountered this problem before. When i click the button, the emulator is just not doing anything, when it's supposed to start another activity. Here's my intent within the button: public class StartScreen extends Activity implements OnClickListener { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start_screen); } public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.bStartQuiz: Intent a = new Intent(StartScreen.this, QuizMenu.class); startActivity(a); break; Here follows some more cases which are not defined yet. onCreate method from the class i try to start: public class QuizMenu extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.categories); Here is the manifest: &lt;activity android:name="com.ultimatequiz.StartScreen" 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; &lt;activity android:name="com.ultimatequiz.QuizMenu" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="com.ultimatequiz.QuizMenu" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; What i really don't understand is that i get no errors in the log. It's just not "responding", but the button do change into state_pressed.
has comment: http://stackoverflow.com/comment/32422983
has comment: http://stackoverflow.com/comment/32424342
score: 1
has comment: http://stackoverflow.com/comment/32423331
has comment: http://stackoverflow.com/comment/32423721
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/32423568
has comment: http://stackoverflow.com/comment/32423769
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21482317
has comment: http://stackoverflow.com/comment/32423245

http://stackoverflow.com/a/21511587
upvote count: 4
answers question: http://stackoverflow.com/q/21511477
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21511477
has comment: http://stackoverflow.com/comment/32476818
type: Answer
has body: You probably want to rethink your design. If D extends A then D should do everything A can, like implementing the interface I. This is the basis of the very important Liskov Substitution Principle in OOP programming. You can rework your design to still share the relevant code while retaining logical inheritance: A /| D A' implements I /|\ B C E It might also be possible that (as @OliCharlesworth pointed out) a solution using composition might be more useful. It depends on the specific case, but if B,C,D and E use A rather than that they are an A composition is more appropriate.
score: 4

http://stackoverflow.com/comment/32439312
type: Comment
comment on: http://stackoverflow.com/a/21490469
has text: You probably did something wrong on some of your XML file, everytime I got this error I did a little mistake on one of my XML files, I'm glad you fixed it (y)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/32416624
type: AnswerComment
has text: Please read through the whole guide: http://developer.android.com/tools/publishing/app-signing.html#signapp Alternatively, you can simply sign your app using Eclipse.
type: Comment
comment on: http://stackoverflow.com/a/21458940
score: 1

jvm
tags question: http://stackoverflow.com/q/21429766
tags question: http://stackoverflow.com/q/21362956
tags question: http://stackoverflow.com/q/21422422
type: Tag
tags question: http://stackoverflow.com/q/21405713
tags question: http://stackoverflow.com/q/21438226
tags question: http://stackoverflow.com/q/21496214
tags question: http://stackoverflow.com/q/21395408
tags question: http://stackoverflow.com/q/21448328
tags question: http://stackoverflow.com/q/21361042
tags question: http://stackoverflow.com/q/21499142
tags question: http://stackoverflow.com/q/21446955
tags question: http://stackoverflow.com/q/21465868
tag name: jvm
tags question: http://stackoverflow.com/q/21384076
tags question: http://stackoverflow.com/q/21397125
tags question: http://stackoverflow.com/q/21379766
tags question: http://stackoverflow.com/q/21395082
tags question: http://stackoverflow.com/q/21397149

http://stackoverflow.com/comment/32368294
has text: @Isslamakkilah look at my file structure and the code. from the image. It should work fine. You are getting the null pointer because it can't find the image. make sure your path is correct, and you directory you use is in the src
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21447111

http://stackoverflow.com/comment/32484297
has text: You can see that when i connect with the Oracle BD manually, the SID name is orc1, with a one. And I tried with the space between * and from, but the result is the same: ORA-12514, TNS:listener does not currently know of service requested in connect descriptor :(
comment on: http://stackoverflow.com/q/21510372
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32328597
type: AnswerComment
type: Comment
has text: Thanks for the reply! As you see in the code I used `"address" : {"houseBldgNum" : { "$regex" : "(.+)3(.+)?" , "$options" : "i"} }` not just `address:{"houseBldgNum"}`
comment on: http://stackoverflow.com/a/21428174
score: 0

http://stackoverflow.com/q/21397295
has comment: http://stackoverflow.com/comment/32274989
has answer: http://stackoverflow.com/a/21397460
has title: Polynomial class Java
has body: I'm trying to make two methods for a Polynomial class but I'm having troubles. The first method checkZeros is supposed to check if there are any leading zeros in the coefficients of a polynomial. The method should resize the coefficient array if there are leading zeros. The second method should find the derivative of a polynomial, but I keep getting ArrayIndexOutOfBounds errors. Here they are: public class Poly { private float[] coefficients; public static void main (String[] args){ float[] fa = {3, 2, 4}; Poly test = new Poly(fa); } public Poly() { coefficients = new float[1]; coefficients[0] = 0; } public Poly(int degree) { coefficients = new float[degree+1]; for (int i = 0; i &lt;= degree; i++) coefficients[i] = 0; } public Poly(float[] a) { coefficients = new float[a.length]; for (int i = 0; i &lt; a.length; i++) coefficients[i] = a[i]; } public int getDegree() { return coefficients.length-1; } public float getCoefficient(int i) { return coefficients[i]; } public void setCoefficient(int i, float value) { coefficients[i] = value; } public Poly add(Poly p) { int n = getDegree(); int m = p.getDegree(); Poly result = new Poly(Poly.max(n, m)); int i; for (i = 0; i &lt;= Poly.min(n, m); i++) result.setCoefficient(i, coefficients[i] + p.getCoefficient(i)); if (i &lt;= n) { //we have to copy the remaining coefficients from this object for ( ; i &lt;= n; i++) result.setCoefficient(i, coefficients[i]); } else { // we have to copy the remaining coefficients from p for ( ; i &lt;= m; i++) result.setCoefficient(i, p.getCoefficient(i)); } return result; } public void displayPoly () { for (int i=0; i &lt; coefficients.length; i++) System.out.print(" "+coefficients[i]); System.out.println(); } private static int max (int n, int m) { if (n &gt; m) return n; return m; } private static int min (int n, int m) { if (n &gt; m) return m; return n; } public void checkForZeros(){ int newDegree = getDegree(); int length = coefficients.length; double testArray[] = coefficients; for (int i…
upvote count: 1
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21397460
has answer: http://stackoverflow.com/a/21397451
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32275538
has comment: http://stackoverflow.com/comment/32274975
tagged with: arrays
has answer: http://stackoverflow.com/a/21397490
accepted answer: http://stackoverflow.com/a/21397451
has comment: http://stackoverflow.com/comment/32275078
score: 0
answer count: 3
favorite count: 0

http://stackoverflow.com/q/21435358
linked to: http://stackoverflow.com/q/16116264
has comment: http://stackoverflow.com/comment/32343338
answer count: 2
has comment: http://stackoverflow.com/comment/32350839
tagged with: playframework
has answer: http://stackoverflow.com/a/32797064
downvote count: 0
has body: I'm trying to pass a list of strings from my java controller to the scala template. This is the view code: public static Result index() { List&lt;String&gt; scripts = Arrays.asList( "script1.js", ... "scriptN.js" ); return ok(views.html.index.render(scripts)); } and this is the tempate code: @(scripts: List[String]) @main("test page")(scripts) { ... html here ... } The error I'm getting (in the Typesafe Activation Compile page): method render in class index cannot be applied to given types; required: scala.collection.immutable.List found: java.util.List reason: actual argument java.util.List cannot be converted to scala.collection.immutable.List by method invocation conversion Is there a way to solve it without using the java > scala conversions? I found this question: Play doesn&#39;t convert java-list to scala-list which describes a similar situation, though I do not have any templateImports that I'm aware of, I don't even see a Build.scala file... Any ideas? Thanks!
favorite count: 0
has comment: http://stackoverflow.com/comment/32377226
linked to: http://stackoverflow.com/q/495741
has answer: http://stackoverflow.com/a/21436389
accepted answer: http://stackoverflow.com/a/21436389
upvote count: 2
tagged with: scala
has title: Play! failing to convert java list to scala list
score: 2
type: AnsweredQuestion
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/32343548
possible better answer: http://stackoverflow.com/a/32797064
has comment: http://stackoverflow.com/comment/32343477
tagged with: java
type: Question

http://stackoverflow.com/q/21350098
tagged with: set
tagged with: collections
possible better answer: http://stackoverflow.com/a/21350193
type: Question
has answer: http://stackoverflow.com/a/21527216
has answer: http://stackoverflow.com/a/21350193
tagged with: arrays
has title: Set created from Arrays.asList storing duplicate elements
has comment: http://stackoverflow.com/comment/32189953
answer count: 2
has comment: http://stackoverflow.com/comment/32189941
has comment: http://stackoverflow.com/comment/32189970
has comment: http://stackoverflow.com/comment/32190006
downvote count: 0
accepted answer: http://stackoverflow.com/a/21527216
favorite count: 0
has comment: http://stackoverflow.com/comment/32189993
has body: I used a structure like the following to get unique elements from an array of objects. dataList.put(column, new LinkedList&lt;Object&gt;(new HashSet&lt;Object&gt;(Arrays.asList(entry.getValue())))); The array from entry.getValue() is a 100 element array containing values from 1 to 99, with 1 being repeated twice. The documentation says that Arrays.asList(arr[]) method returns a fixed-length list of the same length as the array. I have observed that the set created also contains the duplicate values given by the original array. Please explain this behaviour. More details. I have also tried using set.addAll(Arrays.asList(entry.getValue()); , where set is a HashSet and got the same results. The array returned by entry.getValue() is an array of type java.lang.Short
has comment: http://stackoverflow.com/comment/32190005
type: AnsweredQuestion
score: 3
tagged with: list
has comment: http://stackoverflow.com/comment/32189927
upvote count: 3
tagged with: java

http://stackoverflow.com/q/21413738
has title: Unit testing jersey Restful Services
downvote count: 0
has answer: http://stackoverflow.com/a/21415129
tagged with: rest
accepted answer: http://stackoverflow.com/a/21425393
answer count: 3
tagged with: junit
upvote count: 32
favorite count: 0
has answer: http://stackoverflow.com/a/21414265
score: 32
has body: I'm new to unit testing and I want to test some jersey services in a project. We are using Junit. Please guide me to write test cases in better way. CODE: @GET @Path("/getProducts/{companyID}/{companyName}/{date}") @Produces(MediaType.APPLICATION_JSON) public Object getProducts(@PathParam("companyID") final int companyID, @PathParam("date") final String date, @PathParam("companyName") final String companyName) throws IOException { return productService.getProducts(companyID, companyName, date); } Above mentioned service is working fine and I want to write junit test case to test above mentioned method. Above method will retrieve list of products (List&lt;Product&gt;) in JSON format. I would like to write test case to check response status and json format. NOTE: We are using Jersey 1.17.1 version. Help would be appreciated :)
possible better answer: http://stackoverflow.com/a/21414265
tagged with: unit-testing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21425393
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/32466838
score: 0
comment on: http://stackoverflow.com/q/21503031
type: Comment
type: QuestionComment
has text: Well I've used absolute positioning before with no problems. Only recently has this happened. Not sure if it is my class setup or what. I don't think it has anything to do with the positioning.

http://stackoverflow.com/comment/32460371
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21501267
has text: It is too much work for me :D but it sounds like a correct answer :D
score: 0

http://stackoverflow.com/comment/32415942
comment on: http://stackoverflow.com/a/21477460
score: 0
type: AnswerComment
type: Comment
has text: I think it is ok but you better to test it. You don't need to use @Transient. I've this implementation in my project and it works fine.

http://stackoverflow.com/q/21358604
has title: (Gradle) ClassNotFoundException when running testNG test task for new source set
upvote count: 2
type: Question
tagged with: gradlew
tagged with: build
type: AnsweredQuestion
has body: I have my own source set that uses some of the main sources: sourceSets { special { java { source main.java } } I made sure that it can be compiled and run properly: configurations { specialCompile.extendsFrom(compile) specialRuntime.extendsFrom(runtime) } And have my own test task for it: task heavyTest(type: Test) { useTestNG() testClassesDir = project.sourceSets.special.output.classesDir testSrcDirs += project.sourceSets.special.java.srcDirs.toList() } Special source contains test methods in class org.me.ImportantTests Compilation works and tests runs succesfully in eclipse as well, yet when i try to execute heavyTest task from gradle it fails 01:18:23.360 [ERROR] [system.err] 01:18:23.357 [ERROR] [system.err] [TestNG] [ERROR] No test suite found. Nothing to run 01:18:23.488 [QUIET] [system.out] 01:18:23.486 [QUIET] [system.out] Usage: &lt;main class&gt; [options] The XML suite files to run running with -d reveals that gradle encountered ClassNotFoundException: 01:18:23.559 [DEBUG] [TestEventLogger] Caused by: 01:18:23.559 [DEBUG] [TestEventLogger] org.gradle.api.GradleException: Could not load test class 'org.me.ImportantTests'. 01:18:23.560 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.processTestClass(TestNGTestClassProcessor.java:67) 01:18:23.561 [DEBUG] [TestEventLogger] at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) 01:18:23.561 [DEBUG] [TestEventLogger] ... 21 more 01:18:23.561 [DEBUG] [TestEventLogger] 01:18:23.562 [DEBUG] [TestEventLogger] Caused by: 01:18:23.563 [DEBUG] [TestEventLogger] java.lang.ClassNotFoundException: org.me.ImportantTests It looks like the .class file is not in the classpath... but I set testClassesDir properly and the class is exactly where it shold be (/org/me/ImportantTests.class)! What is wrong with this task?
has answer: http://stackoverflow.com/a/21358803
tagged with: java
tagged with: gradle
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21358803
score: 2

http://stackoverflow.com/a/21509668
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/32473822
upvote count: 2
has body: Remove the intent filter from your NotificationReceiverActivity. to use a button to start NotificationReceiverActivity from you CreateNotificationActivity you have to assign a clicklistener to that button in you activity This is an example of this public class CreateNotificationActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); } public void addListenerOnButton() { button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(CreateNotificationActivity.this,NotificationReceiverActivity.class); startActivity(intent); } }); } }
has comment: http://stackoverflow.com/comment/32473670
type: Answer
answers question: http://stackoverflow.com/q/21509560

http://stackoverflow.com/a/21407399
has body: Static methods can be accessed (but should not be, as a good programming practice) by objects too, because at compile time, these variable types are resolved into class names.
answers question: http://stackoverflow.com/q/21407335
downvote count: 0
has comment: http://stackoverflow.com/comment/32292529
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/21404276
type: Answer
has comment: http://stackoverflow.com/comment/32286473
score: 0
answers question: http://stackoverflow.com/q/21403782
has body: In normal cases : StringBuilder sb = new StringBuilder(myString); String newString=sb.reverse().toString(); return myString.equalsIgnoreCase(newString); In case of case sensitive use : StringBuilder sb = new StringBuilder(myString); String newString=sb.reverse().toString(); return myString.equals(newString);
has comment: http://stackoverflow.com/comment/139999883

http://stackoverflow.com/comment/32292282
has text: I am supposed to wake the Minute-object via a method inside the Waker-class. In the main-method I have both a Minute and Waker-object instantiated. I just can't see how the Waker would be allowed to interfere with the Minute-object.
type: AnswerComment
comment on: http://stackoverflow.com/a/21407461
score: 0
type: Comment

http://stackoverflow.com/a/21412926
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21412815
type: Answer
has body: Name here is a local type, it cant be referenced in main method. Try making a class member example package com.test; public class Test { public static void main(String args[]) { B b = new B(); System.out.println(b.name); } } class B { String name="test"; } Hope this helps.
has comment: http://stackoverflow.com/comment/32302281
accepted answer of: http://stackoverflow.com/q/21412815
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/32303185
has comment: http://stackoverflow.com/comment/32301986

http://stackoverflow.com/a/21473149
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21472947
has body: Here is the code public static List&lt;String&gt; stutter(ArrayList&lt;String&gt; list,int k) { List&lt;String&gt; resultList=new ArrayList&lt;String&gt;(); // creating new list if(k&lt;=0) { return resultList; //return empty list. Return null if necessary } else { for(String s : list) { //looping the list input for(int i=0;i&lt;k;i++) { resultList.add(s); // adding the same string k times } } return resultList; } }

http://stackoverflow.com/a/21481154
has body: Use java.text.DecimalFormat to format the numbers. NumberFormat format = new DecimalFormat("0.####"); System.out.println(format.format(num)); The format options can be found here
answers question: http://stackoverflow.com/q/21481088
has comment: http://stackoverflow.com/comment/32422043
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32422093
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21481088

http://stackoverflow.com/comment/32332506
score: 0
has text: @alya 3 columns ([PK]charityRoomID, charityRoomStatus, [FK]charityWardID)
comment on: http://stackoverflow.com/q/21430527
type: Comment
type: QuestionComment

image
tags question: http://stackoverflow.com/q/21361292
tags question: http://stackoverflow.com/q/21494128
tags question: http://stackoverflow.com/q/21391613
tags question: http://stackoverflow.com/q/21496792
tags question: http://stackoverflow.com/q/21364253
tags question: http://stackoverflow.com/q/21433232
tags question: http://stackoverflow.com/q/21385429
tags question: http://stackoverflow.com/q/21382726
tags question: http://stackoverflow.com/q/21382966
tags question: http://stackoverflow.com/q/21489942
tags question: http://stackoverflow.com/q/21499733
tags question: http://stackoverflow.com/q/21418892
tags question: http://stackoverflow.com/q/21401030
tags question: http://stackoverflow.com/q/21389650
tags question: http://stackoverflow.com/q/21410506
tags question: http://stackoverflow.com/q/21484223
tags question: http://stackoverflow.com/q/21503031
tags question: http://stackoverflow.com/q/21394345
tags question: http://stackoverflow.com/q/21351303
tags question: http://stackoverflow.com/q/21360867
tags question: http://stackoverflow.com/q/21432279
tags question: http://stackoverflow.com/q/21356563
tags question: http://stackoverflow.com/q/21478905
tags question: http://stackoverflow.com/q/21445691
tags question: http://stackoverflow.com/q/21382980
tags question: http://stackoverflow.com/q/21500339
tag name: image
tags question: http://stackoverflow.com/q/21393668
tags question: http://stackoverflow.com/q/21389063
type: Tag

http://stackoverflow.com/q/21427958
type: Question
has answer: http://stackoverflow.com/a/21434177
linked to: http://stackoverflow.com/q/21410808
tagged with: arraylist
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/32336992
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: extracting data from the list on a certain condition
tagged with: linkedhashmap
tagged with: java
has body: I have a map as shown below: Key Value 23 20 32 20 (20+20 =40 , min=23 max=32) 43 18 45 24 (24+18 =42 , since 42 &gt;40 so here min and max will be same that is 43 47 10 56 6 (24 +10 +6 =40) so here min =45 and max = 56 43 50 ****so how we will handle the case where value is greater than key 50 &gt;43 ******** so i have implemented the logic which will take the 1) where value of map value reaches 40 2) where the map value upon calculation becomes greater than 40 3) ** haven't implemented the scenario in where first instance where the value of map at initial level is greater at first instance let say as shown above the key is 43 and the value is 50** Now please advise how to handle the third scenario, what I have implemented is .. create a Pair class that will hold the key and the value. class Pair { public int key; public int value; public Pair(int key, int value){ this.key = key; this.value = value; } } hen create a list of pair and iterate through it. If the sum is 0, initialize the min and the max. Then for each pair iterated, add its value to the sum. If the sum is inferior continue the loop and update the max key, else you have two cases possible: The sum is equals to the limit so update the max key The sum is not equals to the limit (so it's superior), decrement the index and don't update the max key public static void main(String[] arg) { Map&lt;Long, Integer&gt; m = new LinkedHashMap&lt;&gt;(); //fill your map here List&lt;Pair&gt; l = new ArrayList&lt;&gt;(); for(Map.Entry&lt;Long, Integer&gt; entries : m.entrySet()){ l.add(new Pair(entries.getKey(), entries.getValue())); } //Now you have a list of Pair int sum = 0; int min = -1; int max = -1; for(int i = 0; i &lt; pairList.size(); i++){ Pair p = pairList.get(i); if(sum == 0){ min = p.key; max = p.key; } sum += p.value; if(sum &lt; LIMIT){ max = p.key; } else { if(sum &gt; LIMIT){ i--; } else { max = p.key; } System.out.println(min+"_"+max); sum = 0; } } } Which prints: 23_32 43_43 45_56 Can you please advi…
downvote count: 1

http://stackoverflow.com/comment/32365341
comment on: http://stackoverflow.com/a/21448062
has text: Eclipse never run a file if its not saved. I tried to save it again and run again but same result I am using %2%d and it's working fine dear.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21369385
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/32224547
has body: You just point the header to it header=new Node(null,currNum,null);
answers question: http://stackoverflow.com/q/21369188
has comment: http://stackoverflow.com/comment/32224672

http://stackoverflow.com/comment/32481524
has text: [Implement your own interruption mechanism.](http://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21514142

http://stackoverflow.com/q/21371657
score: 2
answer count: 0
has title: My textures aren't rendering correctly
favorite count: 0
type: Question
has body: I initialize the window as an 800x600 try { Display.setDisplayMode(new DisplayMode(800,600)); Display.create(); Mouse.create(); Keyboard.create(); } catch (LWJGLException e) { e.printStackTrace(); } Then I create an 800x100 button with 800x100 textures public MenuButton(int x, int y, int height, int width, Texture tex, Texture border){ this.x = x; this.y = y; this.x2 = x + width; this.y2 = y + height; this.tex = tex; this.border = border; } And then I try to render it this.border.bind(); Color.white.bind(); glBegin(GL_QUADS); GL11.glTexCoord2f(0, 0); glVertex2f(this.x, this.y2); GL11.glTexCoord2f(1, 0); glVertex2f(this.x2, this.y2); GL11.glTexCoord2f(1, 1); glVertex2f(this.x2, this.y); GL11.glTexCoord2f(0, 1); glVertex2f(this.x, this.y); glEnd(); But instead of going all the way across the display like it should, it goes about 80% of the way and has two wierd lines on the edge of the display and under the button. Ignore the texture on top, look at the rectangle that says play.
upvote count: 3
tagged with: lwjgl
downvote count: 1
tagged with: opengl
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/21510991
has comment: http://stackoverflow.com/comment/32475846
score: -8
type: Question
has comment: http://stackoverflow.com/comment/32475668
has comment: http://stackoverflow.com/comment/32475800
tagged with: java
has body: Why when I put "//" before extends Point nothing changes in the result? public class lab11info { public class Point { private float x; private float y; protected float getX(){ return x; } protected float getY(){ return y; } protected void setX(float newX){ x = newX; } protected void setY(float newY){ y = newY; } } public class Points extends Point { private Point[] points; public Points(int numberOfPoints) { this.points = new Point[numberOfPoints]; } public void pointSetX(int index, float x) { if(points[index]==null) points[index] = new Point(); points[index].setX(x); } public void pointSetY(int index, float y) { if(points[index]==null) points[index] = new Point(); points[index].setY(y); } public float pointGetX(int index) { if(points[index]!=null) return points[index].getX(); else return 0f; } public float pointGetY(int index) { if(points[index]!=null) return points[index].getY(); else return 0f; } } public static void main(String args[]) { lab11info Main = new lab11info(); Points points = Main.new Points(5); points.pointSetX(1,1.9099f); System.out.println(points.pointGetX(1)); } }
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32475691
type: UnansweredQuestion
downvote count: 8
has title: Java: Protected or Public, do not matter
has answer: http://stackoverflow.com/a/21511108

http://stackoverflow.com/a/67881296
has body: @Rammohan's answer helped me but I can't vote it up or apparently add a comment because of low reputation. Being new to Eclipse I didn't get what he meant at first, so wanted to add a little detail for other people. From the top menu it's Window -&gt; Perspective -&gt; Open Perspective -&gt; Java. I had unwittingly switched to the Debug perspective and had the double-creation problem happening in src/test/java (but not in src/main/java, still don't get why). Switching to the Java perspective cleared it right up.
upvote count: 1
answers question: http://stackoverflow.com/q/21372232
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/113161001
comment on: http://stackoverflow.com/q/21460131
score: 0
has text: it was a long time ago but below was what i then thought was the answer :)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21420084
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32314918
tagged with: operator-overloading
has comment: http://stackoverflow.com/comment/32314779
linked to: http://stackoverflow.com/q/77718
has comment: http://stackoverflow.com/comment/32314838
has comment: http://stackoverflow.com/comment/40064617
has body: I have spent hours researching this, and I'm still very confused. I, like many others, searched this on Google and found this SO thread. However, recently, a student in one of my programming courses told me that this wasn't true, and in fact, the instructor verified it. Hell, the entire class heard it, and no one contested him. He offered this link from Java.net as proof. I said to him immediately, "That looks like JavaScript," but he pointed to this section: class User { List roles; User() { roles = new List(); } operator +(Role newRole) { this.roles.add(newRole); } } main() { User alice = new User(); Role adminUser = new Role("TIMESHEET_ADMIN", 3); alice + adminUser; print(alice.roles.length); } and told me that it was indeed Java. I, having no experience in JS couldn't tell, and he got away (for now), but I tried putting this into my IDE (IntelliJ), and I was assaulted by compiler errors. I didn't even know where to begin with fixing them, but the main thing was the cannot resolve symbol "operator". I'm not looking here for any discussion on Java's built-in operator overloading, I am looking for a definitive answer on whether or not users in Java can overload operators themselves.
linked to: http://stackoverflow.com/q/8003206
upvote count: 3
has title: So.... does Java support operator overloading?
has comment: http://stackoverflow.com/comment/32315551
downvote count: 1
has comment: http://stackoverflow.com/comment/32315013
answer count: 1
has answer: http://stackoverflow.com/a/21420153
favorite count: 0
accepted answer: http://stackoverflow.com/a/21420153
has comment: http://stackoverflow.com/comment/32315031
has comment: http://stackoverflow.com/comment/32314787
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32314869

http://stackoverflow.com/comment/32275184
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21397433
type: Comment
has text: Tried removing that. No difference.

http://stackoverflow.com/q/21434061
has title: Background Circle menu issue
has comment: http://stackoverflow.com/comment/32340669
has comment: http://stackoverflow.com/comment/32340643
tagged with: android
has body: Sorry for bothering again, i am trying to set a background to a circle menu that i have made, but the application crash, i have tried several times but i havent figured it out. Could you help me? TestMenuActivity.java package com.example.circlemenu; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.Toast; public class TestMenuActivity extends Activity { CircleView cView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View pruebafondo = findViewById(R.id.pruebafondo); pruebafondo.setBackgroundResource(R.drawable.circle); int numberOfElements = 6; View[] elems = new View[numberOfElements]; ImageButton tv = new ImageButton(this); tv.setBackgroundResource(R.drawable.images1); tv.setLayoutParams(new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); elems[0] = tv; tv.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Toast t = Toast.makeText(getBaseContext(), "Enviar correo a un Socio", Toast.LENGTH_SHORT); t.show(); } }); tv.setOnLongClickListener(new OnLongClickListener(){ public boolean onLongClick(View arg0){ Intent intent = new Intent(TestMenuActivity.this, prueba.class); startActivity(intent); return true; } }); ImageButton tv1 = new ImageButton(this); tv1.setBackgroundResource(R.drawable.imagen2); tv1.setLayoutParams(new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); elems[1] = tv1; ImageButton tv2 = new ImageButt…
has comment: http://stackoverflow.com/comment/32339918
tagged with: menu
has comment: http://stackoverflow.com/comment/32340076
answer count: 0
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/32351491
tagged with: eclipse
has comment: http://stackoverflow.com/comment/32341256

http://stackoverflow.com/a/21446136
answers question: http://stackoverflow.com/q/21446103
downvote count: 0
type: Answer
has body: Your array cars appears to be of type Car[]. With a reference variable of Car after you have referenced the array element, there is no way to tell if it refers to a Car, a NewCar, or another subclass of Car. It looks like you expect cars[z] to have the attribute color, so perhaps cars should be of type NewCar[] instead of Car[]. Another option is to move the attribute color to the superclass Car so any Car can have a color.
upvote count: 3
has comment: http://stackoverflow.com/comment/122058412
has comment: http://stackoverflow.com/comment/32361499
score: 3

http://stackoverflow.com/comment/32386102
type: Comment
type: QuestionComment
has text: @mfc Bit-wise operations have nothing to do with signs. Your problem is actually when showing these values, see my answer.
comment on: http://stackoverflow.com/q/21460561
score: 0

http://stackoverflow.com/comment/32208096
has text: How does Address relate to Bank? It isn't printing the address because the bankParse method only returns a Bank object.
type: Comment
comment on: http://stackoverflow.com/a/21360285
type: AnswerComment
score: 0

http://stackoverflow.com/a/25224434
has body: According to your noAction unit test, the correct URL seems to be: webResource.path("product/") This is also confirmed by your actual service class: @Path("/product") public class Product { //... } This means that you need to change your other test to use the same path. Also, it is companyName, not productName as per your service class. @Test public void testGetProducts() throws URISyntaxException { WebResource webResource = JerseySpringSuiteTest.jerseyTest.resource(); ClientResponse response = webResource.path("product/getProducts/1/companyName/01-01-2013/") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); Assert.assertEquals(200, response.getStatus()); } One possible reason that it works in a browser is that your server (Tomcat, Jetty, etc.) is configured to add the common URL prefix Products/rest to all paths. This server is not in the picture when you execute unit tests.
downvote count: 0
answers question: http://stackoverflow.com/q/21422155
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/32477066
comment on: http://stackoverflow.com/a/21511665
type: AnswerComment
score: 0
type: Comment
has text: @OliCharlesworth the behaviour is only well-defined if you use floats as specified by IEEE standard or some other rigid standard. This does not apply to all floats (but yes, it does apply for java floats). My main point was though that float internal representation typically means they're inprecise as values when you try to use them in base-10 number world, even if their behaviour is well-defined.

http://stackoverflow.com/a/21514754
answers question: http://stackoverflow.com/q/21503950
has body: In the nutshell, you should choose the JNI layer to suit your application best. Keep in mind that switching context from Java to C++ and vice versa may have significant overhead. Conversion of complex objects from one realm to the other is expensive, too. Therefore it is preferable to keep as much data as possible encapsulated in C++, and keep the JNI calls to minimum.
score: 1
accepted answer of: http://stackoverflow.com/q/21503950
upvote count: 1
has comment: http://stackoverflow.com/comment/32487856
has comment: http://stackoverflow.com/comment/32490018
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/32317581
type: Comment
comment on: http://stackoverflow.com/a/21388819
has text: This helps me understand your solution better: "Well, there's your problem. If LineGetter says that getObjectCopy() returns LineGetter, then TextLineValidator can't say that it returns Copyable. Otherwise, you might have a TextLineValidator that doesn't obey the contract of LineGetter. – David Wallace" http://stackoverflow.com/questions/21421576/how-to-justify-why-an-unchecked-cast-is-okay-regarding-copyable-getobjectcop#comment32317418_21421576
score: 0
type: AnswerComment

http://stackoverflow.com/q/21360326
has title: Format issue while decrypting text (Spongycastle)
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21360397
tagged with: java
tagged with: spongycastle
score: -1
type: Question
upvote count: 0
answer count: 1
has body: I have a problem while encrypting/decrypting with RSA in spongycastle on android. enctext contains encrypted text while dectext contains the text after decryption. In debugger, dectext matches plain text message "test" but when passed to smssend(string,string) function as string, some unknown format is shown. here is code. { byte[] enctext; byte[] dectext; String message="test"; KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "SC"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SC"); keyGen.initialize(1024, random); KeyPair pair = keyGen.generateKeyPair(); PrivateKey priv = pair.getPrivate(); PublicKey pub = pair.getPublic(); Cipher rsaCipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding","SC"); rsaCipher.init(Cipher.ENCRYPT_MODE, pub); enctext=rsaCipher.doFinal(message.getBytes()); Cipher rsaCipher2 = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding","SC"); rsaCipher2.init(Cipher.DECRYPT_MODE, priv); dectext=rsaCipher2.doFinal(enctext); sendSMS("5554",dectext.toString());// in debugger dectext shows equivalent "test" values in decimal but when passed as string to sendSMS func it shows some unknown format... } private void sendSMS(final String phoneNumber,String message) { } Whats wrong with the code?? Is it some format issue?? Which format should I use??
tagged with: android
has answer: http://stackoverflow.com/a/21360397
favorite count: 0

http://stackoverflow.com/a/21356757
score: 0
has body: First of all, two Scanners are not necessary, you can do many inputs with the same Scanner object. Also, this if condition if (match(substring, word) == true) can be rewritten like if (math(substring, word)) I would also recommend you to use i++ to increase the loop variable. Is not strictly necessary but is "almost" a convention. You can read more about that here. Now, about theIndexOutOfBoundsException, I've tested the code and I don't find any input samples to get it. Besides, there is an issue, you are missing one iteration in the for: for (int i = 0; i &lt; string.length() - word.length() + 1; i++) { // Add '+ 1' String substring = string.substring(i, i + word.length()); // System.out.println(substring); if (match(substring, word)) { count++; } } You can test it by putting a print statement inside the loop, to print each substring.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21356591
answers question: http://stackoverflow.com/q/21356591

http://stackoverflow.com/comment/32383875
comment on: http://stackoverflow.com/a/21458847
has text: I have added a bit of explanation on runtime exceptions are hardly ever caught. Take a look.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21509652
tagged with: libgdx
tagged with: java
has body: I'm making a 2D platformer / shooter with LibGDX. I'm having this loop where holding fire-button down causes bullets to fly from the main character's gun the whole duration while the fire-button is pressed down (rapid fire). That part works perfectly and as intended. However, I'd like the rate of fire to be a bit slower. Currently the loop just adds a bullet to the world on each game frame which means the rate of fire is ridiculously high. I've been trying to find a good way to do this, to no avail. Any suggestions would be vastly appreciated. the loop: if (keys.get(Keys.FIRE)) { player.setState(State.FIRING); world.addBullet(new Bullet(1f,1f,0)); }
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/21523881
has title: LibGDX - Best way to adjust fire rate in a loop
answer count: 3
accepted answer: http://stackoverflow.com/a/21509726
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32507107
has comment: http://stackoverflow.com/comment/32473422
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32478673
tagged with: rate
has comment: http://stackoverflow.com/comment/32513679
has answer: http://stackoverflow.com/a/21509726
has comment: http://stackoverflow.com/comment/32474061
possible better answer: http://stackoverflow.com/a/21509721
tagged with: timing
type: Question
has answer: http://stackoverflow.com/a/21509721

overlay
tags question: http://stackoverflow.com/q/21353806
type: Tag
tags question: http://stackoverflow.com/q/21357638
tag name: overlay

named-query
type: Tag
tag name: named-query
tags question: http://stackoverflow.com/q/21432078

http://stackoverflow.com/q/21402538
downvote count: 1
has title: How to know from which line within a function an exception is occuring in Java?
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/32283605
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/21402681
has body: When developing an application, we normally use different functions from different classes. Now a function can be written in a way, where only the different functions are called. So I just want to know suppose I am having a function where I have called some other functions and also having unique code in that function. So how I will know for a bigger project, that from which line for a particular function, exception is occurring in Java. At most, right now I can detect only from which function exception is occurring. But I need specific portion(specific line) of that function where the exception is occurring. Any helpful answer will be appreciated.......Thanks in advance......!!!!!
has answer: http://stackoverflow.com/a/21402614
has answer: http://stackoverflow.com/a/21403047
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21402684
has comment: http://stackoverflow.com/comment/32283540
has comment: http://stackoverflow.com/comment/32286507
type: UnansweredQuestion

http://stackoverflow.com/comment/32326208
type: Comment
has text: Thnx for reminder, but I always use setters with private fields. It was just for illustration, but ok, I will try to avoid such illustrations, if it confuses folks so much;)
comment on: http://stackoverflow.com/a/21426339
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32252652
comment on: http://stackoverflow.com/q/21384806
has text: @Kalija It doesn't have to ***always*** compile if compiling is the issue that needs to be resolved. |=^/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32301997
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21412329
type: Comment
has text: instead i tried to use `lv.setAdapter(adapter);` but using this line Coustom adapter is not called ...:(

http://stackoverflow.com/a/21463209
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21462862
type: Answer
accepted answer of: http://stackoverflow.com/q/21462862
upvote count: 3
has body: Assuming you are referring to the part of Florida following EST, you can set the timezone for SimpleDateFormat and set your TimeZone to EST. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("America/New_York")); Date date = format.parse("2014-01-30 07:48:25"); Your parsed date now can be utilized by your default TimeZone of the system (or set it to your liking as we did in the first place). TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.out.println(date); The output I get for your date offset to UTC: Thu Jan 30 12:48:25 UTC 2014
score: 3

http://stackoverflow.com/comment/32384215
type: Comment
has text: Wauw. I must admit that this is the first time I hear of *optional dependencies*. Really embarrassing. At first look it seems to be exactly what I'm after.
comment on: http://stackoverflow.com/a/21457765
score: 0
type: AnswerComment

http://stackoverflow.com/a/21420981
has body: The problem seems to be that the code adds the listener 3 times to a single button, rather than once each to each of the 3 buttons! ..my application is for a very limited scope and can do without a layout manager for my purposes, unless you think this is affecting the table's behaviour? No, not the table. It was however causing the emptyLabel to be assigned no space in the layout. Here is a robust, resizable version of the GUI. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.table.*; import java.util.*; public class test1 implements ActionListener { private boolean payrollActive = false; private JPanel mainPanel = new JPanel(new BorderLayout(5,5)); private JTable dataTable; private Vector&lt;String&gt; courseColumns = new Vector&lt;String&gt;(); private Vector&lt;String&gt; courseColumnsPay = new Vector&lt;String&gt;(); private Vector&lt;String&gt; profsColumns = new Vector&lt;String&gt;(); private Vector&lt;String&gt; offSpaceColumns = new Vector&lt;String&gt;(); public test1() { mainPanel.setBorder(new EmptyBorder(5,5,5,5)); //Add columns for tables String[] courseColsPay = {"Year", "Program", "Course", "Code", "CCCode", "Weight", "Session", "Section", "Day", "STime", "FTime", "BookedRM", "EnrolCap", "Description", "ProfFName", "ProfLName", "ProfEmail", "Notes", "Syllabus", "Exam", "CrossList", "PreReqs", "EnrolCtrls", "Shared", "TrackChanges", "Address", "WageType", "BasePay", "BenefitRate", "Budgeted", "PayAmount", "MthAmount", "Term", "AccNumber", "PayAdmin", "PayableTo"}; for (String col : courseColsPay) { courseColumnsPay.add(col); } for (int i = 0; i &lt; 25; i++) { courseColumns.add(courseColsPay[i]); } String[] profCols = {"FName", "LName", "Email", "UTEmail", "Birthdate", "OfficeBC", "OfficeRM", "Department", "Status", "Fellowship", "OfficeStat", "PhoneNum", "HomeAddr", "HomePhoneNum", "Notes"}; for (String col : profCols) { profsColumns.add(col); } String[] offSpaceCols = {"Building", "Dep…
answers question: http://stackoverflow.com/q/21420537
score: 5
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/61682209
answers question: http://stackoverflow.com/q/21386449
upvote count: 1
downvote count: 0
type: Answer
has body: If anyone is in need of transactional support for reactive style spring boot and MongoDb integration then please go through the answer here
score: 1

http://stackoverflow.com/comment/32202760
type: Comment
type: QuestionComment
has text: Is the `Message` class the *same* class in both interface and your implementation? Check that the two import statements name the same fully qualified class name.
comment on: http://stackoverflow.com/q/21357375
score: 1

http://stackoverflow.com/a/21401579
has body: I think it would be easier to convert the two ArrayLists to Set objects then use set operations to determine if one is a subset of another. This will also avoid duplicity: ArrayList&lt;String&gt; a1 = ...; ArrayList&lt;String&gt; a2 = ...; public boolean isSubset(ArrayList&lt;String&gt; a1, ArrayList&lt;String&gt; a2) { Set&lt;String&gt; s1 = new HashSet(a1); Set&lt;String&gt; s2 = new HashSet(a2); return s1.containsAll(s2); }
answers question: http://stackoverflow.com/q/21399900
score: 0
type: Answer

http://stackoverflow.com/comment/32316871
type: Comment
has text: I went to my teacher asking if we could use ArrayList and he specifically told the entire class to use nothing but Array. This was not in the instructions.
comment on: http://stackoverflow.com/q/21421253
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32462677
comment on: http://stackoverflow.com/a/21502726
type: Comment
has text: Omg, Thankyou so much, this error has been troubling me so much, You are the BEST, thankyou. ps. On a side note it did work :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32423455
type: Comment
type: QuestionComment
has text: @Denis: yes, that's true (in except, that `clustered` is only the default-behaviour. You can put the cluster on any other column if you want)
comment on: http://stackoverflow.com/q/21481193
score: 0

http://stackoverflow.com/comment/32230861
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21372644
has text: @Pritom When you say "replace with its equivalent code", by "code" do you mean an ascii value that's mapped to that unicode value, or the unicode reference number?

http://stackoverflow.com/a/21444942
has comment: http://stackoverflow.com/comment/32365843
has body: This code works for me: package test; import javax.swing.JFrame; public class Test { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(100,200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } I only see a difference at frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); where I added the frame. However your stacktrace looks like there's another error, so first try this and if it still don't work, give us a bit more code to look at.
answers question: http://stackoverflow.com/q/21444846
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/32358770
downvote count: 1
type: Answer

http://stackoverflow.com/a/21498277
has comment: http://stackoverflow.com/comment/32453442
accepted answer of: http://stackoverflow.com/q/21498159
score: 0
type: AcceptedAnswer
has body: Instead of creating individual variables, you could store the values in an array with length 12 and iterate that array: long[] digits = new long[12]; // Add the input to the array ... for(int i=0;i&lt;digits.length;i++){ if(digits[i]%2==0){ digits[i] *= 3; } } This is not complete code, but just an example to get you started. You can read up on Java arrays.
has comment: http://stackoverflow.com/comment/32454340
type: Answer
has comment: http://stackoverflow.com/comment/32453207
has comment: http://stackoverflow.com/comment/32453619
answers question: http://stackoverflow.com/q/21498159

http://stackoverflow.com/a/21472739
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21472660
has body: try this : extends AsyncTask&lt;String, Integer, String&gt; Integer with a capital I

http://stackoverflow.com/comment/32393767
comment on: http://stackoverflow.com/a/21462767
type: AnswerComment
score: 0
type: Comment
has text: i did not know how to correct this,can u help me out?

http://stackoverflow.com/q/21409270
answer count: 2
has answer: http://stackoverflow.com/a/21410404
downvote count: 0
favorite count: 0
has title: JavaFX LineChart: Insert new data in the middle of the chart
tagged with: series
has answer: http://stackoverflow.com/a/28839384
has body: I'm using a line chart with JavaFX: LineChart&lt;Number, Number&gt; lineChart = new LineChart&lt;&gt;(xAxis, yAxis); XYChart.Series series = new XYChart.Series(); lineChart.getData().add(series); I want to add data to the series successively, thereby the order in which the values arrive can not be predicted. For example, the index can be between 0 and the current size of the series. series.getData().add(new XYChart.Data(index, value)); Consider the following scenario: //initializing... series.getData().add(new XYChart.Data(1, 400)); series.getData().add(new XYChart.Data(3, 500)); series.getData().add(new XYChart.Data(8, 100)); series.getData().add(new XYChart.Data(12, 120)); series.getData().add(new XYChart.Data(20, 300)); //later... series.getData().add(new XYChart.Data(2, 450)); series.getData().add(new XYChart.Data(5, 300)); series.getData().add(new XYChart.Data(15, 200)); The problem is how the graph is depicted. In the example above, at index 20 the graph makes a loop back to index 2. It looks like this: But I want it to look like this: What settings are necessary to update the graph properly without additional lines crossing the graph?
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: javafx
type: Question
tagged with: charts
score: 3
tagged with: linechart

http://stackoverflow.com/a/21480996
answers question: http://stackoverflow.com/q/21480625
has comment: http://stackoverflow.com/comment/32422259
has comment: http://stackoverflow.com/comment/32422106
score: 0
type: Answer
has body: The default value of minOccurs and maxOccurs of a element is 1. So, by default, each element has to appear, if you don't define those parameters.

http://stackoverflow.com/comment/32407521
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21472171
type: Comment
has text: You can't do it in CSS. You can set "title" on a Label when you want (e.g. on MouseOver, etc.)

http://stackoverflow.com/comment/32467132
has text: Sorry, by graphics context I simply mean the `Graphics` object. The graphics object of the image draws on to the image. The graphics object from the buffer strategy draws on to the frame. To draw on to the image, you must use the graphics object returned by the call to `image.getGraphics()` in your render method. All you need to do is move the painting code that is in render() into some method that takes a graphics object as a parameter. Then, you can call that method either with the graphics object from the buffer strategy, or the graphics object for the image, as needed.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21505886

http://stackoverflow.com/comment/32372195
has text: @DanielBarbarian It's great. It is ok to have a class containing about 100 class imports (for filling the hashmap)?
score: 0
comment on: http://stackoverflow.com/q/21451868
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32266211
has text: The code has been given
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21391826

http://stackoverflow.com/comment/32340160
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21434845
has text: @SotiriosDelimanolis: Looks like you'd get enough upvotes to make it worthwhile.
type: QuestionComment

http://stackoverflow.com/comment/32280056
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21400129
has text: `JFrame` _is not_ a `JComponent`.

http://stackoverflow.com/a/21493712
downvote count: 0
has comment: http://stackoverflow.com/comment/32456485
has body: Your question is "How can I be sure that my class is immutable?" I'm not sure that's what you mean to ask, but the way to make your class immutable is listed by Josh Bloch in Effective Java, 2nd Ed. in item 15 here, and which I'll summarize in this answer: Don't provide any mutator methods (methods that change the object's state, usually called "setters"). Ensure the class can't be extended. Generally, make the class final. This keeps others from subclassing it and modifying protected fields. Make all fields final, so you can't change them. Make all fields private, so others can't change them. "Ensure exclusive access to mutable components." That is, if something else points to the data and therefore can alter it, make a defensive copy (as @user949300 pointed out). Note that immutable objects don't automatically yield a the big performance boost. The boost from immutable objects would be from not having to lock or copy the object, and from reusing it instead of creating a new one. I believe the searches in HashMap use the class' hashCode() method, and the lookup should be O(c), or constant-time and fast. If you are having performance issues, you may need to look at if there's slowness in your hashCode() method (unlikely), or issues elsewhere. One possibility is if you have implemented hashCode() poorly (or not at all) and this is causing a large number of collisions in your HashMap -- that is, calling that method with different instances of your class returns mostly similar or same values -- then the instances will be stored in a linked list at the location specified by hashCode(). Traversing this list will convert your efficiency from constant-time to linear-time, making performance much worse.
upvote count: 2
has comment: http://stackoverflow.com/comment/32447708
type: Answer
answers question: http://stackoverflow.com/q/21492772
score: 2

http://stackoverflow.com/comment/32237517
comment on: http://stackoverflow.com/q/21376629
type: Comment
type: QuestionComment
score: 2
has text: if memory leak is happening set -XX:PermSize=256m -XX:MaxPermSize=256m as VM arguments

http://stackoverflow.com/q/21496076
tagged with: servlets
has body: I'm trying to send a small String over from my app to a Java servlet: //Send user mobile number to the server. EditText cinMobile = (EditText)findViewById(R.id.mobile_no); String inputVal = cinMobile.getText().toString(); URL mobileurl = new URL(url); URLConnection connection = mobileurl.openConnection(); connection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); out.write(inputVal); out.close(); The servlet is supposed to receive the value through doPost(): //Accept the phone number form the app int length = request.getContentLength(); byte[] input = new byte[length]; ServletInputStream sin = request.getInputStream(); int c, count = 0; while((c = sin.read(input, count, input.length-count)) != -1) { count = +c; } sin.close(); String receivedString = new String(input); response.setStatus(HttpServletResponse.SC_OK); System.out.print(receivedString); But when I run my command and try to send the String over, I get Negative array size exception on the servlet side for the line byte[] input = new byte[length];: Feb 01, 2014 2:06:02 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [project_server.Login] in context with path [/project_server] threw exception java.lang.NegativeArraySizeException at project_server.Login.doPost(Login.java:47) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostV…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21496103
linked to: http://stackoverflow.com/q/10121677
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/32449258
has comment: http://stackoverflow.com/comment/32449311
has title: Unable to send a string from app to servlet using outputStreamWriter()
has comment: http://stackoverflow.com/comment/32449479
score: 0
answer count: 1
tagged with: http
has answer: http://stackoverflow.com/a/21496103
tagged with: jakarta-ee
tagged with: java

http://stackoverflow.com/comment/32239602
score: 0
type: Comment
type: QuestionComment
has text: What problem are you having?
comment on: http://stackoverflow.com/q/21377862

http://stackoverflow.com/q/21503031
type: Question
has comment: http://stackoverflow.com/comment/32470259
linked to: http://stackoverflow.com/q/11369171
has comment: http://stackoverflow.com/comment/32489934
has comment: http://stackoverflow.com/comment/32489782
upvote count: 1
answer count: 1
tagged with: applet
has body: I am currently having a problem with JFrame and Images. This program uses an Applet then adds it to a JFrame in a different class, so it can be ran as either an Applet or an Application. Currently, the frame holds only a handful of images, and no components. I recently attempted to add a JTextField using absolute positioning (LayoutManger is null) and it works fine, except all the images are removed, leaving me with just a JTextField. Why is this happening? How can I fix it? My code is posted below. Thanks! The Main Class (Creates the Applet and Images): package net.xenix.src; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Rectangle2D; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JComponent; import javax.swing.Timer; public class XenixMain extends JApplet implements ActionListener { private static final long serialVersionUID = 1L; private static int pixelSize = 2; public static Dimension size = new Dimension(1600, 900); public static Dimension pixel = new Dimension(size.width / pixelSize, size.height / pixelSize); public static String name = "Xenix"; public static final int WIDTH = 1600; public static final int HEIGHT = 900; //Finding player Windows name static String username = System.getProperty("user.name"); public static int secondsCount = 0; //Shortcut to image directory public static String imagePath = "C:\\Users\\" + username + "\\Desktop\\Xenix Dev\\Xenix\\resources\\graphics\\"; private static PaintSurface canvas; public static ImageIcon XenixBackgroundIcon = new ImageIcon(imagePath + "XenixBackground.png"); public static Image XenixBackground = XenixBackgroundIcon.getImage(); p…
favorite count: 0
has comment: http://stackoverflow.com/comment/32464786
has comment: http://stackoverflow.com/comment/32461820
has comment: http://stackoverflow.com/comment/32469930
has answer: http://stackoverflow.com/a/21518993
tagged with: swing
has comment: http://stackoverflow.com/comment/32467503
accepted answer: http://stackoverflow.com/a/21518993
has comment: http://stackoverflow.com/comment/32466838
type: AnsweredQuestion
tagged with: components
downvote count: 0
has title: Component removing images when added
score: 1
tagged with: java
tagged with: image

http://stackoverflow.com/comment/32347792
type: AnswerComment
score: 0
type: Comment
has text: Thanks, but the file is on local drive, had forgotten to mention it
comment on: http://stackoverflow.com/a/21439036

http://stackoverflow.com/comment/32229849
comment on: http://stackoverflow.com/q/21372208
type: Comment
type: QuestionComment
has text: but dont know how to do the same on button click...
score: 0

http://stackoverflow.com/a/21464686
has body: You can think of it like a simple loop in this case, it just iterates untill x is &gt; 10, so ret value of this recusrsion is 11, since it is the first number which is bigger than 10. Since nothing printed before recursive call you print the values in the reversed order, after x becomes 11, and function returns, previos stack frame contains values x == 10, y 10 + 1, and r contains return value of the functon => 11, same for previos frame and previos .....
answers question: http://stackoverflow.com/q/21464367
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/32291622
has text: Are you importing android project or general one?
comment on: http://stackoverflow.com/q/21407097
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32378795
comment on: http://stackoverflow.com/q/21456643
score: 0
type: Comment
type: QuestionComment
has text: What problem are you facing?

http://stackoverflow.com/a/21471828
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/32467591
answers question: http://stackoverflow.com/q/21471788
has body: When you use parseInt(str), you will get an Exception if the parameter str cannot be converted to an integer. You must use char, since you are comparing the input with single characters: char letter; letter = in.nextLine().charAt(0); str.charAt(index) Returns the char value at the specified index.
has comment: http://stackoverflow.com/comment/32467072
downvote count: 0
has comment: http://stackoverflow.com/comment/32440189
has comment: http://stackoverflow.com/comment/32440383

http://stackoverflow.com/comment/32224149
comment on: http://stackoverflow.com/a/21355048
score: 0
type: Comment
has text: You could consider a custom JSON serialization, where your map is expressed as a JSON array of objects, where the object has keys `key` and `value` to express each `Map` entry pair: [{"key": {`the serialized key1`}, "value": {`the serialized value1`}}, {"key": {`the serialized key2`}, "value": {`the serialized value2`}}, ...]
type: AnswerComment

http://stackoverflow.com/a/21442948
type: Answer
answers question: http://stackoverflow.com/q/21442813
accepted answer of: http://stackoverflow.com/q/21442813
has body: Googling finds me Stomp and Stompconnect : http://docs.jboss.org/jbossmessaging/docs/usermanual-2.0.0.beta3/html/interoperability.html
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/32243094
type: Comment
comment on: http://stackoverflow.com/a/21378485
score: 0
type: AnswerComment
has text: this type is not id, the field type is string, validator type is email

http://stackoverflow.com/a/21507926
answers question: http://stackoverflow.com/q/21507331
has comment: http://stackoverflow.com/comment/32511568
upvote count: 1
has comment: http://stackoverflow.com/comment/32470771
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32515581
has body: You are not fully iterating over the contents of your input String, as you are taking substrings, incrementing counter i and checking for your input length. In fact you don't have to take substring at all as per your code lexeme takes care of getting the required content. However, lexeme also adds data to itself and per your print statements you want individual elements to be displayed as part of your lexeme. Remove this: input = input.substring(lexeme.length(), input.length()); At the start of every parent condition, instead of incrementing lexeme, start it from the beginning lexeme = "" + input.charAt(i); However, in your inner loops and conditions, you might still want to increment it. Another aspect is you have not written the code to handle the text content (temp). EDIT: Based on the above suggestions, I tried your code with the changed XML and here is the changed getToken(): public static ArrayList&lt;Token&gt; getToken(String input) { String lexeme = ""; // lexeme = TOKEN = ie. TAGIDENT Token t = null; ArrayList&lt;Token&gt; a = new ArrayList&lt;Token&gt;(); for (int i = 0; i &lt; input.length(); i++) { if (input.charAt(i) == '&lt;') { lexeme = "" + input.charAt(i); i++; // case 1: if followed by ! &lt; = COMMENT if (input.charAt(i) == '!') { lexeme += input.charAt(i); i++; while (input.charAt(i) != '&gt;') { lexeme += input.charAt(i); i++; } } // case 2: if followed by letter &lt; = TAGIDENT if (isALetter(input.charAt(i))) { lexeme += input.charAt(i); i++; while (input.charAt(i) != '&gt;' &amp;&amp; input.charAt(i) != ' ') { lexeme += input.charAt(i); i++; } t = new Token("TAGIDENT", lexeme); a.add(t); } // case 3: if followed by number or space &lt; = LTHAN if ((isANumber(input.charAt(i)))) { lexeme = "" + input.charAt(i); i++; while (input.charAt(i) != '&lt;' || input.charAt(i) == ' ') { lexeme += input.charAt(i); i++; } t = new Token("LTHAN", lexeme); a.add(t); } // case 4: if followed by / &lt; = ENDTAGHEAD if (input.charAt(i) == '/') { lexeme = "" + inp…
type: Answer

http://stackoverflow.com/a/74239980
upvote count: 0
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/21416315
has body: this also possible to convert an Integer array to an int array int[] result = new int[arr.length]; for (int i = 0; i &lt; arr.length; i++) { result[i] = arr[i].intValue(); }
score: -1

http://stackoverflow.com/a/21370627
upvote count: 3
has body: Its a typo issue, your problem is after instantiating adjustersSub you re-defined the layout for adjusters instead 49c49 &lt; adjusters.setLayout(new BorderLayout(0, 0)); --- &gt; adjustersSub.setLayout(new BorderLayout(0, 0));
answers question: http://stackoverflow.com/q/21370260
accepted answer of: http://stackoverflow.com/q/21370260
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32227535
type: Answer
score: 3

http://stackoverflow.com/q/21458749
favorite count: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/32382582
tagged with: exception
linked to: http://stackoverflow.com/q/3881
has answer: http://stackoverflow.com/a/21458847
type: UnansweredQuestion
tagged with: java
has title: Is there any case when NPE and IAE get handled differently?
upvote count: 1
has comment: http://stackoverflow.com/comment/32382687
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21458841
tagged with: illegalargumentexception
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21459227
has body: Concerning the holy war question about choosing the proper exception in case of a null argument, I wonder if this choice has any practical consequences. I mean, is there a case when you'd catch a NullPointerException and not IllegalArgumentException, or vice versa, or catch both and handle them differently? To make it clear: This is definitely not the linked question. I'm not asking what exception to throw... I'm asking if they ever get handled differently. I know that with both being RuntimeExceptions they hardly ever get caught, but sometimes you have to do it.

http://stackoverflow.com/comment/32382853
type: AnswerComment
comment on: http://stackoverflow.com/a/21458883
has text: Maybe compile all package together? `javac mytree/*.java`
type: Comment
score: 2

http://stackoverflow.com/comment/32224145
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21369038
has text: **The error I am getting now is where it says sliderStateChanged(evt), it tells me to remove the slider and also the sliderStateChanged in the private void is giving an error.**
type: AnswerComment

http://stackoverflow.com/a/21388168
has comment: http://stackoverflow.com/comment/32262885
has comment: http://stackoverflow.com/comment/32262919
has comment: http://stackoverflow.com/comment/32265985
has comment: http://stackoverflow.com/comment/32266474
has comment: http://stackoverflow.com/comment/32264703
score: 0
has comment: http://stackoverflow.com/comment/32267066
has comment: http://stackoverflow.com/comment/32264780
has comment: http://stackoverflow.com/comment/32260494
has comment: http://stackoverflow.com/comment/32264794
type: Answer
has comment: http://stackoverflow.com/comment/32266602
answers question: http://stackoverflow.com/q/21387856
has comment: http://stackoverflow.com/comment/32261912
has body: String input1, input2, input3, input4, input5; input1 = "Input value 1"; input2 = "Input value 2"; input3 = "Input value 3"; input4 = "Input value 4"; input5 = "Input value 5"; JTextField field1 = new JTextField(); JTextField field2 = new JTextField(); JTextField field3 = new JTextField(); JTextField field4 = new JTextField(); JTextField field5 = new JTextField(); //move this after creating the fields field2.setEnabled(false); field3.setEnabled(false); field4.setEnabled(false); field5.setEnabled(false); Object[] message = { input1, field1, input2, field2, input3, field3, input4, field4, input5, field5, }; int option = JOptionPane.showConfirmDialog(null, message, "Enter all your values", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { String value1 = field1.getText(); String value2 = field2.getText(); String value3 = field3.getText(); String value4 = field4.getText(); String value5 = field5.getText(); field1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { if (Integer.parseInt(value1) &gt; 0 || Integer.parseInt(value1) &lt; 8) { input1 = "Wrong input for value 1"; }else{ field2.setEnabled(false); field3.setEnabled(false); field4.setEnabled(false); field5.setEnabled(false); } } } }
has comment: http://stackoverflow.com/comment/32263592

http://stackoverflow.com/a/21473169
type: Answer
has comment: http://stackoverflow.com/comment/32408994
upvote count: 5
downvote count: 0
has body: Like so, Matrix&lt;String, Double&gt; matrix = new Matrix&lt;String, Double&gt; (); In Java 7 (and later), you can make it shorter with the diamond operator; like so, Matrix&lt;String, Double&gt; matrix = new Matrix&lt;&gt;();
accepted answer of: http://stackoverflow.com/q/21473114
answers question: http://stackoverflow.com/q/21473114
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32443578

http://stackoverflow.com/comment/32259143
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21386228
has text: Is your Derby Network Server started? Try reading the Derby "Getting Started" documentation: http://db.apache.org/derby/docs/10.10/getstart/twwdactivity2.html

http://stackoverflow.com/a/21455551
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21431254
has body: You cannot return a value from a void method. You can however print it out. Alternativey, you can call a Method that returns a value for example: public String returnStringValue(){ return textfield.getText(); } public void actionPerformed(ActionEvent arg0) { lblAnotherlabel.setText(returnStringValue); } But Why do all that if you can achieve this directly?

http://stackoverflow.com/comment/32356609
comment on: http://stackoverflow.com/q/21442451
has text: @Anthony In order to write a proof about an algorithm's complexity, you must first have an algorithm.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32420179
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21479971
has text: Maybe you created this file as directory (ie. by accident while testing), and it stayed as directory

http://stackoverflow.com/q/21356262
has answer: http://stackoverflow.com/a/21356333
has title: What's wrong with my random search?
has body: I get the error: "ArrayIndexOutOfBounds Exception3" I don't think that is the only error, but so far that's all I've been able to figure out. import java.util.Random; /*class containing random search algorithm*/ public class RandomSearch { public static int randomSearch(int queryValue, int[] list) { /*conducts a random search as specified by user*/ /*trys 10,000,000 random combinations searching for user value*/ int length = list.length; for(int i=0; i &lt; 10000000; i++) { /*generates a random number from 0 to length*/ int randomNum = (int)Math.floor(Math.random()*(length+1)); StdOut.print(randomNum); if((int)queryValue == (int)list[randomNum]) { return randomNum; } } /*returns -2 if user value not found*/ return -2; } }
type: Question
has comment: http://stackoverflow.com/comment/32201288
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21356325
has comment: http://stackoverflow.com/comment/32201111
has answer: http://stackoverflow.com/a/21357455
answer count: 6
has answer: http://stackoverflow.com/a/21356322
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21356427
has answer: http://stackoverflow.com/a/21356316

http://stackoverflow.com/q/21468099
has comment: http://stackoverflow.com/comment/32399947
linked to: http://stackoverflow.com/q/41107
tagged with: encryption
has title: Random character generator to be stored in array
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21468424
has comment: http://stackoverflow.com/comment/32400015
score: 1
tagged with: java
upvote count: 1
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/21468236
has comment: http://stackoverflow.com/comment/32400001
accepted answer: http://stackoverflow.com/a/21468236
tagged with: arrays
has answer: http://stackoverflow.com/a/21468424
answer count: 2
has comment: http://stackoverflow.com/comment/32400151
has comment: http://stackoverflow.com/comment/32400095
has comment: http://stackoverflow.com/comment/32400057
downvote count: 0
has body: How do I instantiate my array so it has 26 random characters in it? import java.util.Random; public class Encryption { Random r = new Random(); char[] real = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; char[] decrypted = //?????? for( i=0; i &lt; decrypted.length; i++) { }
favorite count: 0

http://stackoverflow.com/comment/32326014
comment on: http://stackoverflow.com/q/21418001
type: Comment
type: QuestionComment
has text: Please, provide your code snippet relevant to the HashMap and timer and the exception. Where is your HashMap referenced? In the WebApplication singelton instance? I use Quartz together with Wicket without any problem, so probably we can think about a solution. However, it would be possible to use your solution as well.
score: 1

http://stackoverflow.com/q/21357624
tagged with: animated-gif
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/21371562
score: 0
has body: I am using the following code to run a gif movie if (movieStart == 0) { movieStart = (int) now; } if (mMovie != null) { int relTime = (int) (now - moviestart); if (relTime &gt; mMovie.duration()) { relTime = mMovie.duration(); } mMovie.setTime(relTime); mMovie.draw(canvas, getWidth() / 2 - mMovie.width() / 2, getHeight() / 2 - mMovie.height() / 2); My movie runs fine. My question is this: How do I know when the movie has finished playing? (of course I have an action that I need to start when the movie ends.) by the way, I am using android.graphics.Movie
has title: android: How do I check that a movie has done playing?
answer count: 1
tagged with: android-canvas
accepted answer: http://stackoverflow.com/a/21371562
has comment: http://stackoverflow.com/comment/32221530
tagged with: android
has comment: http://stackoverflow.com/comment/32228411
has comment: http://stackoverflow.com/comment/32203756

http://stackoverflow.com/comment/32310058
type: QuestionComment
has text: because `C#` isn't `Java`
score: 7
comment on: http://stackoverflow.com/q/21417489
type: Comment

http://stackoverflow.com/a/21395776
type: Answer
answers question: http://stackoverflow.com/q/21394978
has body: Encase the whole thing in a do while loop, prompting the user at the end if they want to keep going and making the while condition true if they say yes.
score: 0

http://stackoverflow.com/q/21354559
has comment: http://stackoverflow.com/comment/32200639
type: AnsweredQuestion
has body: I need to send some data encrypted with Blowfish from a java-based server to a client. I can successfully encrypt data but I can't decrypt it on the client side. Here is my java code: byte[] kd = key.getBytes("UTF-8"); SecretKeySpec ks = new SecretKeySpec(kd, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, ks); byte[] encrypted = cipher.doFinal(text.getBytes("UTF-8")); String str = new String(encrypted, "UTF-8"); As for js library I decided to use this one. out = blowfish.decrypt(code, skey, {cipherMode: 1, outputType: 0}) As a result I get some strange characters. What's wrong with my code? UPD: This code works perfectly: byte[] kd = key.getBytes("UTF-8"); SecretKeySpec ks = new SecretKeySpec(kd, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.ENCRYPT_MODE, ks); byte[] encrypted = cipher.doFinal(text.getBytes("UTF-8")); String str = new String(Base64.encodeBase64(encrypted), "UTF-8"); JS: out = blowfish.decrypt(code, skey, {cipherMode: 0, outputType: 0})
tagged with: java
has title: Java and Javascript Blowfish
type: Question
has answer: http://stackoverflow.com/a/21385720
has comment: http://stackoverflow.com/comment/32211972
tagged with: javascript
has comment: http://stackoverflow.com/comment/32211949
score: 0
has comment: http://stackoverflow.com/comment/32205944
answer count: 1
tagged with: cryptography
has comment: http://stackoverflow.com/comment/32213934
accepted answer: http://stackoverflow.com/a/21385720
tagged with: encryption

http://stackoverflow.com/a/21383877
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21383814
accepted answer of: http://stackoverflow.com/q/21383814
score: 1
has body: Most probably GRIDGAIN_HOME environment variable is not set or is set incorrectly. Please, set GRIDGAIN_HOME to your GridGain installation folder.

http://stackoverflow.com/comment/32210007
type: QuestionComment
comment on: http://stackoverflow.com/q/21361492
score: 0
has text: I'm creating a chatbot! (Don't worry, it's just because I think it's interesting to make so it won't be spammed everywhere on the internet) In the top of my code I got 2 strings called Greetings and ChatBot, now, in both of them there's {"something i can say"}{"what the bot will reply"}, and the greetings part works fine because there's only one of those lines, however, in Chatbot, there's more of them for different questions. The problem is, in my loop it seems to only check if what I said is in the first line of Chatbot, I want to make it so it checks the whole thing
type: Comment

http://stackoverflow.com/q/21411628
has comment: http://stackoverflow.com/comment/32300141
has answer: http://stackoverflow.com/a/21411846
has body: Hi i am trying to make a public function in order to change activities/changes in my android application. In a external class (Utl.java) I have this code. public class Utl extends Activity{ public void onBtnClicked(View v) { Intent i; Integer data=0; switch(v.getId()){ case R.id.btnStart: i=new Intent(getApplicationContext(), LevelChoose.class); startActivity(i); break; case R.id.btnEasy: i=new Intent(getApplicationContext(), PlayGame.class); startActivity(i); break; case R.id.btnMedium: i=new Intent(getApplicationContext(), PlayGame.class); data=48; i.putExtra("extra", data); startActivity(i); break; case R.id.btnHard: i=new Intent(getApplicationContext(), PlayGame.class); data=96; i.putExtra("extra", data); startActivity(i); break; } } } and in my xml's files i use the on click function of the buttons... &lt;Button android:id="@+id/btnStart" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="42dp" android:minHeight="110dp" android:text="Start Game" android:onClick="cls2.onBtnClicked(this)" /&gt; I get that the function can't be found... I wish to dynamically change screens.... Thank you for your time!!
tagged with: android-intent
accepted answer: http://stackoverflow.com/a/21411846
has answer: http://stackoverflow.com/a/21411842
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21411766
has answer: http://stackoverflow.com/a/21411766
has comment: http://stackoverflow.com/comment/32299778
type: Question
has comment: http://stackoverflow.com/comment/32299765
tagged with: function
has comment: http://stackoverflow.com/comment/32299690
has title: Android Intent in public function
score: 0
answer count: 3
tagged with: android

http://stackoverflow.com/comment/32422409
type: QuestionComment
type: Comment
has text: @Trenin you mean (new Gets()).foo() right?
comment on: http://stackoverflow.com/q/21481316
score: 0

http://stackoverflow.com/a/21513976
has body: The instanceof keyword needs to be used as ReferenceTypeExpression instanceof ReferenceType You are using it as ReferenceTypeExpression instanceof ReferenceTypeExpression You should instead have if (c instanceof Vehicle) { The above explains the correct use of the instanceof operator, but take note of JB Nizet's comment.
upvote count: 5
has comment: http://stackoverflow.com/comment/32481441
answers question: http://stackoverflow.com/q/21513962
has comment: http://stackoverflow.com/comment/32481428
downvote count: 0
score: 5
type: Answer

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/21419364
tags question: http://stackoverflow.com/q/21468239

http://stackoverflow.com/a/21510809
has comment: http://stackoverflow.com/comment/32475422
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21510763
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21510763
has comment: http://stackoverflow.com/comment/32475522
type: Answer
downvote count: 0
score: 1
has body: integer/integer will give you the integer value make any value either denominator or numerator as float you will get the answer int i = (int) Math.ceil((30 * 50) / 1000.0); or int i = (int) Math.ceil((30.0 * 50) / 1000); or int i = (int) Math.ceil((30 * 50.0) / 1000);
has comment: http://stackoverflow.com/comment/32475445

http://stackoverflow.com/a/21350164
has comment: http://stackoverflow.com/comment/32190135
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21350135
has comment: http://stackoverflow.com/comment/32190042
has body: Logically it doesn't matter who is hosting it. Basically this should be transparent. The only thing is that when it's hosted locally the performance (when calling it) will probably be better as the data doesn't need to travel over the Internet but just in say your local network.

rotten-tomatoes
tag name: rotten-tomatoes
tags question: http://stackoverflow.com/q/21380475
type: Tag

http://stackoverflow.com/comment/32190052
type: QuestionComment
has text: You need to show more code. What you have should not cause this exception.
comment on: http://stackoverflow.com/q/21350109
score: 0
type: Comment

modal-dialog
tag name: modal-dialog
type: Tag
tags question: http://stackoverflow.com/q/21461754

http://stackoverflow.com/comment/32263955
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21390058
has text: yes i have an addTextChangedListener for each of the edittexts

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/21406853
tags question: http://stackoverflow.com/q/21466491
tags question: http://stackoverflow.com/q/21463777
tag name: android-cursoradapter

http://stackoverflow.com/q/21412463
tagged with: jbehave
tagged with: testng
type: AnsweredQuestion
has body: I'm looking for a BDD library that will work with TestNG (this is important because we already have a configured CI server that is integrated with TestNG). I found JBehave but want to know if it is possible to use features such as TestNG's data provider. Can someone with experience of these combined technologies show me how it can be done?
upvote count: 3
tagged with: java
has title: Can you use TestNG's dataprovider with JBehave?
accepted answer: http://stackoverflow.com/a/21527059
tagged with: dataprovider
type: Question
score: 3
tagged with: bdd
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21527059

http://stackoverflow.com/a/21381967
type: Answer
score: 2
has body: Sorting one list and updating others according to that sort order is quite cumbersome, since you'd have to match the new index of an element to the old index and use both to update the other lists. In some cases that would be necessary and I'd solve that with some intermediate maps but in most cases, yours included, I'd just create an object for the data and put them into a single list, e.g.: class User { String name; int id; String email; } List&lt;User&gt; list = ...; Collections.sort( list, new Comparator&lt;User&gt;() { public int compare( User lhs, User rhs ) { return lhs.name.compareTo(rhs.name); } }); Note that I intentionally left out stuff like constructors or null checks, to boil the code down to the essential parts.
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21381873

http://stackoverflow.com/comment/32313760
comment on: http://stackoverflow.com/q/21419150
type: Comment
type: QuestionComment
has text: I wouldn't switch to BigDecimal yet. Not until you've worked out the logic. But I would switch to using int, or long, and working with whole numbers of cents. Using floating point for money is just going to cause problems.
score: 2

http://stackoverflow.com/q/21460579
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21461022
tagged with: java
has answer: http://stackoverflow.com/a/21462365
type: Question
answer count: 2
has title: Webstorm on centos 6.5
has body: I've downloaded and extracted the tar file, but when I try to run the webstorm.sh file, I get the error: "No JDK found. Please validate either WEBIDE_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation. I have Java installed: [root@local.host]# java -version java version "1.7.0_51" OpenJDK Runtime Environment (rhel-2.4.4.1.el6_5-x86_64 u51-b02) OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode) [root@local.host]# ls -lah /etc/alternative/java lrwxrwxrwx. 1 root root 46 Jan 27 23:06 /etc/alternatives/java -&gt; /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java I've also set the environment path, although I'm not 100% certain of it's correctness. Contents of .bash_profile: PATH=$PATH:$HOME/bin export PATH export JDK_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin export PATH=$PATH:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin What am I missing/doing wrong?
tagged with: webstorm
score: 0

http://stackoverflow.com/comment/32205324
score: 0
comment on: http://stackoverflow.com/a/21355616
type: AnswerComment
type: Comment
has text: It's fine, I can replace them or disuse them easily

http://stackoverflow.com/comment/32200514
type: AnswerComment
type: Comment
has text: I'm not sure this explains how 0 is being obtained. In `return retval = 1;`, the `retval = 1` evaluates to `1`, which is what then gets returned.
score: 2
comment on: http://stackoverflow.com/a/21356097

http://stackoverflow.com/comment/32337191
comment on: http://stackoverflow.com/q/21428961
type: Comment
score: 0
has text: I wanted to know can I avoid this and combine into one method without separating all with one connection
type: QuestionComment

http://stackoverflow.com/comment/32337098
type: Comment
has text: It actually is an answer @ᴍarounᴍaroun.. I would just note that it stops the active Thread, not the complete program. Can you specify your question please?
type: AnswerComment
comment on: http://stackoverflow.com/a/21433249
score: 0

http://stackoverflow.com/a/21460968
downvote count: 0
answers question: http://stackoverflow.com/q/21460800
has comment: http://stackoverflow.com/comment/32387866
has body: This has complexity O(N*M), where N and M are the number of strings in the two strings public Boolean hasNames(String s1, String s2){ List&lt;String&gt; s1List = Arrays.asList(s1.split(",")); List&lt;String&gt; s2List = Arrays.asList(s2.split(",")); for(String s : s1List) if(s2List.indexOf(s)&gt;=0) return true; for(String s : s2List) if(s1List.indexOf(s)&gt;=0) return true; return false; } Another option public Boolean hasNames(String s1, String s2){ Set&lt;String&gt; s1Set = new HashSet&lt;String&gt;(); List&lt;String&gt; s2List = Arrays.asList(s2.split(",")); for(String s : s1.split(",")) s1Set.add(s); s1Set.retainAll(s2List); return !s1Set.isEmpty(); }
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21460800
has comment: http://stackoverflow.com/comment/32386854
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21511282
has answer: http://stackoverflow.com/a/21511952
tagged with: reference
has body: Suppose I have a Java package in Eclipse with 50 classes. This package is called PackageA. Suppose further a package called PackageB with the class ClassName that I want to import into all 50 classes within PackageA. Currently I do this by doing import somefolder.ClassName within all 50 classes in PackageA, after placing PackageB onto my build path (here, ClassName is within folder somefolder within PackageB). Suppose that ProjectB is deprecated in favour of ProjectC, and that I want to replace all import somefolder.ClassName with import somefolder2.ClassName, where somefolder2 is a folder within ProjectC and somefolder2/ClassName is the newer version of ClassName that I want to be used within by 50 PackageA classes. How do I get rid of the deprecated ProjectB/somefolder/ClassName in favour of the new ProjectC/somefolder2/ClassName in every class in ProjectA?
type: UnansweredQuestion
tagged with: package
type: Question
tagged with: java
tagged with: eclipse
tagged with: import
has title: How to change a particular package import reference in every class in a project
score: 0
answer count: 1

http://stackoverflow.com/comment/32435738
has text: Updated with your idea. Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/21487936
score: 0
type: Comment

http://stackoverflow.com/comment/32432866
type: Comment
type: QuestionComment
has text: I have found out the reason why it is coming at my end. Navigate to JFrame->Properties and set "Always on Top" to true. then the app appears in background. If it is set to false then it appears in foreground.Anyhow Thanks for your reply.
comment on: http://stackoverflow.com/q/21486826
score: 0

http://stackoverflow.com/comment/32432637
score: 0
has text: If you have a specific problem you can't get further - happy to help. Currently, the question sounds like you haven't done any research to do it yourself and more like "guys, please do my jobs for me".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21486683

http://stackoverflow.com/q/21511954
tagged with: hashmap
tagged with: arrays
tagged with: keyset
tagged with: arraylist
has comment: http://stackoverflow.com/comment/32477458
has answer: http://stackoverflow.com/a/21512105
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
score: 2
has body: first off this is an assignment so I'm more looking for help then coded answers (don't want to cheat!). My assignment is to create a program that processes a train/railway network of stations. The section i'm stuck on adds the stations, their connections, and returns these connections as an Array List of Strings. I've included below the code I have so far, and also an extract from the assignment (related to the section I'm on now). I've been struggling with this bit all weekend, so any help would be hugely appreciated. It's only the implementation of the interface I need to edit, the "MyNetwork" class. I just feel I've been going in circles, and may not have even gotten off on the right foot? From the assignment; Create a class MyNetwork that implements the Network interface. The getConnections method of this class should return an array containing only those stations directly connected to the fromStation argument. Hint 1: you can do this using a HashMap, with the keys being Strings (representing stations) and the values being ArrayLists of Strings (representing the stations to which there is a direct connection). Hint 2: Although the getConnections method returns an array of Strings, it would be better for the values in the HashMap to be ArrayLists of Strings The Interface; public interface Network { /** * Add a station to the network. * @param station The station to be added. */ public void addStation(String station); /** * Add a direct connection from one station to another. * @pre both fromStation and toStation have already been added by the method * addStation. * @param fromStation The station from which the connection begins. * @param toStation The station at which the connection ends. */ public void addConnection(String fromStation, String toStation); /** * Get a list of all stations directly connected to a given station. * @pre fromStation has been added to the network by the method addStation. * @param fromStation * @return A list of all the stations to whi…
has title: HashMap as an ArrayList of Strings
accepted answer: http://stackoverflow.com/a/21512105
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/a/21536370
has comment: http://stackoverflow.com/comment/53298028
type: AcceptedAnswer
score: 1
type: Answer
has body: I've been looking at JSR-220, from which Session#merge claims to get its semantics. The JSR is sadly ambiguous, I have found. It does say: Optimistic locking is a technique that is used to insure that updates to the database data corresponding to the state of an entity are made only when no intervening transaction has updated that data since the entity state was read. If you take "updates" to include general mutation of the database data, including deletes, and not just a SQL UPDATE, which I do, I think you can make an argument that the observed behaviour is not compliant with optimistic locking. Many people agree, given the comments on my question and the subsequent discovery of this bug. From a purely practical point of view, the behaviour, compliant or not, could lead to quite a few bugs, because it is contrary to many developers' expectations. There does not seem to be an easy fix for it. In fact, Spring Data JPA seems to ignore this issue completely by blindly using EM#merge. Maybe other JPA providers handle this differently, but with Hibernate this could cause issues. I'm actually working around this by using Session#update currently. It's really ugly, and requires code to handle the case when you try to update an entity that is detached, and there's a managed copy of it already. But, it won't lead to spurious inserts either.
upvote count: 1
answers question: http://stackoverflow.com/q/21489300
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21489300

http://stackoverflow.com/a/21371562
accepted answer of: http://stackoverflow.com/q/21357624
answers question: http://stackoverflow.com/q/21357624
score: 0
type: AcceptedAnswer
has body: Supposing your pasted code sits within onDraw(), the movie should have played fully once after relTime &gt;= mMovie.duration() evaluates to true. Your code already checks for it, so you should just fire your action instead of relTime = mMovie.duration();: if (movieStart == 0) { movieStart = (int) now; } if (mMovie != null) { int relTime = (int) (now - moviestart); mMovie.setTime(relTime &lt; mMovie.duration() ? relTime : mMovie.duration()); mMovie.draw(canvas, getWidth() / 2 - mMovie.width() / 2, getHeight() / 2 - mMovie.height() / 2); if (relTime &gt;= mMovie.duration()) { // move has played once fireAction(); // or set a member variable or whatever }
type: Answer

http://stackoverflow.com/comment/32225240
type: QuestionComment
has text: Hello , i edited my post , of course i return 'valid' , but i was testing to determine where is the error, i have also other uses to do with this custom validator , not to determine remote user ip only,
score: 0
comment on: http://stackoverflow.com/q/21368583
type: Comment

http://stackoverflow.com/a/21487903
accepted answer of: http://stackoverflow.com/q/21487813
downvote count: 0
answers question: http://stackoverflow.com/q/21487813
has body: You forgot to set traversed[x][z] = true; when you poll a new element. Make sure you do it AFTER you query if (traversed[current.x][current.z]) ... Also, as a side note, for your implementation - a Queue will be a better idea I think. (when I wrote a PriorityQueue will be better I had multiple peaks in mind - which seems not to be the case for you, I think a simple Queue will be best).
has comment: http://stackoverflow.com/comment/32435991
has comment: http://stackoverflow.com/comment/32438229
score: 4
has comment: http://stackoverflow.com/comment/32435948
has comment: http://stackoverflow.com/comment/32434426
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32436166
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/32435872

http://stackoverflow.com/a/21436143
score: -1
has body: From the looks of your monthsArray, the first element is a blank string. Remember that arrays are zero-based, and you asked your user for a month between 1 and 12 (which is fine, because nobody thinks of January as month 0, right?). Later in your code, you do this: String monthChoice = monthsArray[month - 1]; However, your array actually contains 13 elements, because you added that blank space, so in your case, you're actually safe to simply use the unaltered month index, like so: String monthChoice = monthsArray[month]; OR, get rid of the empty string at the beginning of the array, and leave your monthChoice line as is (depends on how your implementation is supposed to work. That is purely your choice). Some side notes: You are presently declaring your monthArray in the body of the switch statement, which is unnecessary. It would be better to declare it at the top of the method, OR even better, as a constant in the class, like so: private static final String[] monthsArray = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" }; Also, this line: for (int i=0; i &lt; monthsArray.length; i++) is useless. I don't know whether this is part of an unfinished solution, however all it is doing is repeating the statement that immediately follows it, which as as far as I can tell, is unnecessary. Basically it is the same as this: for (int i=0; i &lt; monthsArray.length; i++){ String monthChoice = monthsArray[month - 1]; } So you should be safe to get rid of it.
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32343525
type: Answer
answers question: http://stackoverflow.com/q/21434924
accepted answer of: http://stackoverflow.com/q/21434924
downvote count: 1
has comment: http://stackoverflow.com/comment/32343084
has comment: http://stackoverflow.com/comment/32343347

http://stackoverflow.com/comment/32342070
score: 0
comment on: http://stackoverflow.com/q/21435177
type: Comment
type: QuestionComment
has text: What error do you get?

http://stackoverflow.com/comment/32298587
comment on: http://stackoverflow.com/a/21408197
has text: @xSNRG There is no reason to do synchronization between the two validation scopes mostly. The controller layer should briefly examine any bean properties that it can validate, and if all seems valid, pass to service. Then service should do its own business validation and pass it on to the model (which should have its own domain constraints and validation thingies). If you don't tightly couple those layers, there wouldn't be much need to do any synchronization in between them, but rather just maintaining each layer on its own.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21354546
upvote count: 4
has comment: http://stackoverflow.com/comment/32207274
has answer: http://stackoverflow.com/a/45354846
downvote count: 0
has answer: http://stackoverflow.com/a/21375080
favorite count: 0
has comment: http://stackoverflow.com/comment/32206774
has body: I have a complex JSON as below which I need to parser recursively. The end result of recursion is Map> type of object where key is the audience - name value and the inner map is Text-key, Title-value. This is just a part of the complete JSON. "sections": { "1": { "1": { "1": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "2": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" }, "2": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "2": { "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "1": { "name": "xxx", "title": "xxx", "id": "xxx" } } }, "anchor":"xxx" }, "3": { "1": { "title": "xxx", "text": "xxx", "tags": { "audience": { "tag": { "name": "xxx", "title": "xxx", "id": "xxx" } }, "styleHint": { "tag": { "name": "xxx", "title": "xxx", "id": "xxx" } } } }, "title": "xxx", "text": "xxx", "tags": { "audience": { "1": { "name": "xxx", "title": "xxx", "id": "xxxx" } }, "styleHint": { "1": { "name": "xx", "title": "xxx", "id": "xxxx" } } } } } I used JSONObject for this only to realise very late that iteration happens in reverse order :( I tried to parse the whole structure recursively and reverse it to my benefit. BUt the order is going haywire :( :( mainly because of the text, title, snippet which follows the 2nd text,title and has 2 audience names. The text and titl…
has comment: http://stackoverflow.com/comment/32199934
has comment: http://stackoverflow.com/comment/32207190
has answer: http://stackoverflow.com/a/21356043
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/21375080
has title: Recursively parsing JSON via JSONObject to fetch value against specific keys
has comment: http://stackoverflow.com/comment/37566249
type: Question
possible better answer: http://stackoverflow.com/a/55139235
has answer: http://stackoverflow.com/a/55139235
score: 4

http://stackoverflow.com/comment/32233706
type: Comment
type: QuestionComment
score: 1
has text: Sorry cleared it up in my edit, by cycles I mean take the integer value of the initial object and locate the index value that it corresponds to. Take that integer value at that index and do the same. Continue doing this until it points back to an object that's already been referenced.
comment on: http://stackoverflow.com/q/21374420

http://stackoverflow.com/comment/37323885
comment on: http://stackoverflow.com/q/21446519
type: QuestionComment
has text: I had similar issue, but cleaning project worked for me.
score: 0
type: Comment

http://stackoverflow.com/comment/32284551
has text: what is it i don't even
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21403132

tabs
type: Tag
tags question: http://stackoverflow.com/q/21492860
tags question: http://stackoverflow.com/q/21360528
tag name: tabs

http://stackoverflow.com/q/21488540
tagged with: http://stackoverflow.com/tag/mp3
has comment: http://stackoverflow.com/comment/32436261
type: Question
has answer: http://stackoverflow.com/a/38475021
tagged with: eclipse
has title: mp3 in java eclipse
score: 0
answer count: 1
has body: //here is a copy my code that i am trying to make play eye of the tiger, which i have saved on my desktop. first where should i save it, also how do i make it play? and also does it matter what type of file it is (i am using a mp3) any help would be appreciated. also if you could explain the code that would help (music is also saved to eclipse &lt; java &lt; stopwatch &lt; src &lt; stopwatch ) package stopwatch; import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Date; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; import org.omg.CORBA.portable.InputStream; public class StopWatch extends JFrame { /** * */ private static final long serialVersionUID = -7203812812064067525L; long startTime; long stopTime; long currentTime; double elapsedTime; boolean timeStarted = false; int lapTime; JButton startButton = new JButton(); JLabel startLabel = new JLabel(); JTextField startTextField = new JTextField(); JButton lapButton = new JButton(); JLabel lapLabel = new JLabel(); JTextField lapTextField = new JTextField(); JButton stopButton = new JButton(); JLabel stopLabel = new JLabel(); JTextField stopTextField = new JTextField(); JButton exitButton = new JButton(); JLabel elapsedLabel = new JLabel(); JTextField elapsedTextField = new JTextField(); public StopWatch(String title) { setTitle(title); setDefaultCloseOperation(3); getContentPane().setLayout(new GridBagLayout()); GridBagConstraints gridConstraints = new GridBagConstraints(); this.startButton.setText("Start Timing"); gridConstraints.gridx = 0; gridConstraints.gridy = 0; getContentPane().add(this.startButton, gridConstraints); this.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StopWatch.this.startButtonActi…
has comment: http://stackoverflow.com/comment/32437052
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6045384
tagged with: java
has comment: http://stackoverflow.com/comment/32436418

http://stackoverflow.com/q/21400041
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/32279997
answer count: 2
has comment: http://stackoverflow.com/comment/32279346
linked to: http://stackoverflow.com/q/13109588
has answer: http://stackoverflow.com/a/21400176
has answer: http://stackoverflow.com/a/21400165
has body: I'm trying to represent numbers to a String and backwards. For instance if i have the number 64568899. I want to represent it in a way i could decrypt it later but i need to write it as String or chars but not as a number. Any ideas ?
has title: Convert double to file as a String/Chars (For encryption)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32279371

http://stackoverflow.com/a/21413201
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32303031
downvote count: 0
has body: You have extraneous annotations. it should be: @AfterClass public static void tearDownClass() throws Exception { // Code executed after the last test method } That method itself should be static in order to perform the teardown, and itself should not be a @Test.
type: Answer
answers question: http://stackoverflow.com/q/21413174
score: 20
accepted answer of: http://stackoverflow.com/q/21413174
upvote count: 20

http://stackoverflow.com/q/21427383
score: 6
has comment: http://stackoverflow.com/comment/32327426
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/32327548
has answer: http://stackoverflow.com/a/23090880
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/32327174
downvote count: 0
tagged with: jsp
has body: The team that works on the client side in my project has asked me to write a sample test page, and give them a working URL that they can hit and get back 200. They have asked me to also give a sample request body. Here is the request body I will be giving to them. { "MyApp": { "mAppHeader": { "appId": "", "personId": "", "serviceName": "", "clientIP": "", "requestTimeStamp": "", "encoding": "", "inputDataFormat": "", "outputDataFormat": "", "environment": "" }, "requestPayload": { "header": { "element": "" }, "body": { "request": { "MyTestApp": { "data": { "AuthenticationRequestData": { "appId": "", "appPwd": "" } } } } } } } } To develop the sample page, I have no idea where to start. Please go easy on your downvotes (in case the question seems irrelevant) as I have no experience working on JSP Servlets. Here is what I have as of now. Its a simple login page - <%@ page language="java" contentType="text/html; charset=windows-1256" pageEncoding="windows-1256" %> Login Page AppId AppPassword And this is my servlet class - package com.test; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class TestClient extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public TestClient() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/json"); App app = new App(); app.setAppID(request.getParameter("appID")); app.setAppPassword(request.getParameter("appPwd")); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } My App is a simple Java class that has appID, and …
has title: Create a simple page that returns a JSON response
has comment: http://stackoverflow.com/comment/32327597
has answer: http://stackoverflow.com/a/21427764
has answer: http://stackoverflow.com/a/21427790
has comment: http://stackoverflow.com/comment/32329880
has answer: http://stackoverflow.com/a/21428930
favorite count: 0
has comment: http://stackoverflow.com/comment/32327447
type: UnansweredQuestion

http://stackoverflow.com/comment/32221009
comment on: http://stackoverflow.com/q/21367461
has text: How is this different from you [previous question](http://stackoverflow.com/questions/21227412/trying-to-open-2-different-xml-page-using-2-different-buttons) that I answered?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/32328869
score: 0
type: QuestionComment
has text: @Reddy Added a pseudocode sketch for you to my post. It's ugly though...
type: Comment
comment on: http://stackoverflow.com/q/21427278

http://stackoverflow.com/comment/32213526
type: AnswerComment
comment on: http://stackoverflow.com/a/21362526
type: Comment
has text: 1. Yes its true. One disclaimer - as Kayaman noted its still possible to compile with jre 1.7 with "target" 1.6 (this is an emulation of jre 1.6 instructions set). I answered "in general". 2. No this is not true, this JRE is not really "installed", so it completely depends on you whether to update JRE or leave it as is (usually JRE can be updated with a newer version of the game).
score: 0

http://stackoverflow.com/q/21469042
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm using a plugin in my pom that looks like this: org.codehaus.enunciate maven-enunciate-plugin 1.27 docs ${project.build.directory}/docs And I'm wondering, if I run package will this plugin run or is it during site or something else? Is there an easy way to tell by looking at this, or do I have to either Read the plugin documentation Experiment through trial and error I'm hoping there's an easier way. I'm using intellij-idea, if that provides a means I'd be happy with that. Assuming I can't tell without one of these two methods, is it a best practice to always define the phase in the pom so that I can save myself and others time in the future?
has comment: http://stackoverflow.com/comment/32401933
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21469378
tagged with: java
has title: How can I tell what phase a plugin will run in?
type: Question
tagged with: intellij-idea
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/21469378
has comment: http://stackoverflow.com/comment/32401993

http://stackoverflow.com/comment/32273612
has text: In your example code, `Socket s = serverSocket.accept();` blocks, waiting for a connection. So it won't loop fast like your posted code will. You need to call `accept()` or something similar.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21396298

http://stackoverflow.com/comment/38626048
comment on: http://stackoverflow.com/q/21469687
type: QuestionComment
has text: @Sebastian Unfortunately, I do not think you can simply inject a jackson mapper as spring-data-mongo doesn't use jackson to convert to json. It actually maps directly to MongoDb DBOject instances. However, you could theoretically replace the standard MappingMongoConverter with your own implementation which uses jackson to generate the json to be written.
type: Comment
score: 5

http://stackoverflow.com/a/21512864
type: Answer
answers question: http://stackoverflow.com/q/21512823
has comment: http://stackoverflow.com/comment/32481255
has comment: http://stackoverflow.com/comment/32479115
accepted answer of: http://stackoverflow.com/q/21512823
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/32479140
type: AcceptedAnswer
downvote count: 0
has body: You can use lookarounds: (?&lt;!\\d)([12]\d{3})(\d{6})(\d{2})(?!\\d) Here: (?&lt;!\\d) is a negative lookbehind which means your pattern is not preceded by a digit (?!\\d) is a negative lookahead which means your pattern is not followed by a digit Read more about lookarounds
has comment: http://stackoverflow.com/comment/32481131

http://stackoverflow.com/comment/32471231
score: 0
comment on: http://stackoverflow.com/a/21505611
type: AnswerComment
type: Comment
has text: Can you elaborate on "know your enemy" a bit more ? Obviously i would prefer your solution for its simplicity but i dont feel im doing here anything exceptionally out of the ordinary. Im still calling Google Map APIs from the UI thread, its just the caching that is being performed asynchronously.

http://stackoverflow.com/q/21356591
has comment: http://stackoverflow.com/comment/32201263
accepted answer: http://stackoverflow.com/a/21356757
score: 0
linked to: http://stackoverflow.com/q/5098282
possible better answer: http://stackoverflow.com/a/21356686
has answer: http://stackoverflow.com/a/21356686
has answer: http://stackoverflow.com/a/21356757
type: AnsweredQuestion
tagged with: java
has title: out of bounds error with word count
type: Question
answer count: 2
has body: I'm trying to write my own Java word count program. I know there may already be a method for this, but I'd like to get it work. I'm getting an out of bounds error at line 14. I'm trying to use an input word to count how many times it appears in an input string. So I'm looping up to stringlength - wordlength, but that's where the problem is. Here is the code: import java.util.Scanner; public class wordcount { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print( "Enter word : " ); String word = s.nextLine(); Scanner t = new Scanner(System.in); System.out.print("Enter string: "); String string = t.nextLine(); int count = 0; for (int i = 0; i &lt; string.length()-word.length(); i = i+1){ String substring = string.substring(i,i+word.length()); if (match(substring, word)==true){ count += 1; } } System.out.println("There are "+count+ " repetitions of the word "+word); } public static boolean match(String string1, String string2){ for (int i=0; i&lt;string1.length(); i+=1){ if (string1.charAt(i)!=string2.charAt(i)){ return false; } } return true; } }

http://stackoverflow.com/comment/32191261
type: QuestionComment
comment on: http://stackoverflow.com/q/21350835
score: 0
type: Comment
has text: You can't have UI code in background since it is not executed with the main(ui) thread. tv.setText(title); Also for future questions, please include the StackTrace from LogCat, I am sure it will throw a exception clearly indicating you tried to run UI code on a non-ui thread.

http://stackoverflow.com/q/21375902
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/32236203
has comment: http://stackoverflow.com/comment/32238934
tagged with: interface
has answer: http://stackoverflow.com/a/21375959
tagged with: spring
has answer: http://stackoverflow.com/a/21378198
type: AnsweredQuestion
tagged with: java
has body: This concept is unclear with me. I have worked on several frameworks for an instance Spring. To implement a feature we always implement some interfaces provided by the framework. For an instance if I have to create a custom scope in Spring, my class implements a org.springframework.beans.factory.config.Scope interface. Which has some predefined low level functionality which helps in defining a custom scope for a bean. Whereas in Java I read an interface is just a declaration which classes can implement &amp; define their own functionality. The methods of an interface have no predefined functionality. interface Car { topSpeed(); acclerate(); deaccelrate(); } The methods here don't have any functionality. They are just declared. Can anyone explain this discrepancy in the concept? How does the framework put some predefined functionality with interface methods?
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/21375956
accepted answer: http://stackoverflow.com/a/21375956
has title: Implementing an interface from a framework vs simple java interface
tagged with: frameworks
possible better answer: http://stackoverflow.com/a/21375959

http://stackoverflow.com/comment/32215964
type: QuestionComment
has text: UDP does not have channels.
score: 0
comment on: http://stackoverflow.com/q/21364925
type: Comment

http://stackoverflow.com/a/21504543
has comment: http://stackoverflow.com/comment/32464451
has comment: http://stackoverflow.com/comment/32464566
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/21504404
answers question: http://stackoverflow.com/q/21504404
has body: There are certain circumstances where onPause/onResume won't get called at all. A ViewPager is an example, as the pages either side of the visible page are kept in an active state. I'm not 100% sure if this applies to tabs as I've not used them for ages, but it may be the case. The approach for communication here is not really correct and a better way to do it would be to use a listener to communicate changes up to the activity, then for the activity to communicate relevant changes back down to other fragments. Refer to this page in the docs for more info: http://developer.android.com/training/basics/fragments/communicating.html

http://stackoverflow.com/comment/32229601
score: 0
has text: Sorry, this type of questions is discouraged in StackOverflow. Admittedly you did *something* before (by implementing it in JS), but this is not enough... Show us some Java attempts we can fix!
comment on: http://stackoverflow.com/q/21372059
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21366463
has answer: http://stackoverflow.com/a/21366508
tagged with: validation
has title: Validate a pattern in java
has answer: http://stackoverflow.com/a/21366503
accepted answer: http://stackoverflow.com/a/21366503
has comment: http://stackoverflow.com/comment/32218673
type: AnsweredQuestion
tagged with: tokenize
tagged with: java
type: Question
answer count: 2
has body: I have to validate following pattern in java X.X.X Where X can be any valid integer, but X.X.X will be in form of string. Currently I am tokenizing the string to check for the values and also the number of levels. Is there any better way to do this?
possible better answer: http://stackoverflow.com/a/21366508
score: 0

http://stackoverflow.com/a/21411264
answers question: http://stackoverflow.com/q/21407966
has body: To force your code to run, I simply changed the call in main() : floor_sorting.sorting_floors(new int[]{1,2,3}); The input array is ignored as I mentioned in my comments. However, it does print out nothing but zeros when it runs. (How did you figure that out?) The reason is your use of static members in user_stops. These being static means they are not being instantiated at any point. This is not obvious unless you realise that even static members of a class will not always be instantiated. I added the following statement at the top of sorting_floors(): user_stops user_stops_1 = new user_stops(); The program now runs as expected. (Go ahead... try it.) Another thing that might have worked, though I didn't try it, is to initiate the static arrays in the declaration: public static int user_up[] = new int [] {1, 3, 2, 7, 5, 8}; public static int user_down[] = new int [] {8, 5, 4, 2, 6, 1}; However, I think you should re-think your use of the key-word static if you ever want this program to work properly.
accepted answer of: http://stackoverflow.com/q/21407966
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/21432246
score: -1
has comment: http://stackoverflow.com/comment/46814786
has comment: http://stackoverflow.com/comment/53311353
answers question: http://stackoverflow.com/q/21432078
upvote count: 2
type: Answer
has body: As far as I understand you want to select random question from the table. You'd rather use WHERE clause, with providing some parameter from your code, like: SELECT q FROM Question AS q WHERE id = :id Then in the code, which creates your query you must generate random id to be selected: query.setParam("id", getRandomId()); And to get random id, you may want to query number of rows from DB and use java.util.Random.nextInt(rowsCount) (if all ids are there, of course). Btw, something similar is described here: http://www.shredzone.de/cilla/page/53/how-to-fetch-a-random-entry-with-hibernate.html
has comment: http://stackoverflow.com/comment/53350783
downvote count: 3

http://stackoverflow.com/comment/32229126
type: Comment
has text: Thank you very much for your answers! I would definitely up if I had enough rep.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21371697

http://stackoverflow.com/q/21437181
type: Question
answer count: 1
score: 0
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/32345161
has body: Code in Question There isn't an actionListener for the image thumbnails, yet when clicked they update the image. From this webpage. Edit: I am currently importing images using JFileChooser and then creating a thumbnail and displaying the full image in a similar way to this, although not using ImageIcons. But would like to use this method so when I add an image it adds to the list and allows me to click the thumbnail to show that image. However mine using actionListeners to change when something is pressed but this doesn't and can't understand the code where it does. Thanks Edit2: Regarding the repaint option: I have a class which extends component which then calls a repaint function. public class Image extends Component { private BufferedImage img; //Print Image public void paint(Graphics g) { g.drawImage(img, 0, 0, null); } } I then have a class with all my Swing components which call methods from other classes. Image importedImage = new Image(loadimageone.openFile()); Image scaledImage = new Image(); // Save image in Buffered Image array images.add(importedImage.getImg()); // Display image imagePanel.removeAll(); imagePanel.add(importedImage); imagePanel.revalidate(); imagePanel.repaint(); previewPanel.add(scaledImage); previewPanel.revalidate(); previewPanel.repaint(); If I remove the revalidate or repaint it wont' update the image on the screen. Edit 3: This is the code on how I implemented the dynamic buttons: //Create thumbnail private void createThumbnail(ImpImage image){ Algorithms a = new Algorithms(); ImpImage thumb = new ImpImage(); //Create Thumbnail thumb.setImg(a.shrinkImage(image.getImg(), 75, 75)); //Create ImageIcon ImageIcon icon = new ImageIcon(thumb.getImg()); //Create JButton JButton iconButton = new JButton(icon); //Create ActionListener iconButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bottomBarLabel.setText("Clicked"); imagePanel.removeAll(); imagePanel.add(images.get(position)); //Need…
accepted answer: http://stackoverflow.com/a/21437336
tagged with: actionlistener
type: AnsweredQuestion
has title: How does this update a component without using an actionListener?
tagged with: java
has answer: http://stackoverflow.com/a/21437336

http://stackoverflow.com/a/21507042
has comment: http://stackoverflow.com/comment/32469787
score: 0
type: Answer
has body: you can pass your input parameters in following way in Eclipse: click menu Run -> Run Configurations -> Arguments in Program arguments put your arguments, which will be loaded to "String [] args" you could just separate your arguments by space: e.g. 1 2 3 and your args = {1,2,3}
has comment: http://stackoverflow.com/comment/32470458
answers question: http://stackoverflow.com/q/21506974

http://stackoverflow.com/a/21450199
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32370612
has comment: http://stackoverflow.com/comment/32374159
score: 3
type: Answer
answers question: http://stackoverflow.com/q/21449646
has comment: http://stackoverflow.com/comment/32382874
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21449646
has body: Stateful session bean will allow you to store the same state as an http session. Few advantages over using http session that I can think of: Scalability - Your SFSB can be deployed on another server and scale independently using remote interfaces Non-web clients - You can use SFSB to maintain state for a non-web client where http session will not be available The other benefits that come with using an EJB To hold a reference to a stateful EJB in a servlet you should use @SessionScoped with @Inject as indicated in this answer
has comment: http://stackoverflow.com/comment/32371686

http://stackoverflow.com/a/21494050
has comment: http://stackoverflow.com/comment/32446600
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21493847
has comment: http://stackoverflow.com/comment/32446362
score: 4
has body: In the following code, I print: System.out.println(comp.getClass().getSimpleName() + " Bounds: " + comp.getBounds()); But for a much more comprehensive view of the component, change that to: System.out.println(comp); import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; class ListComponents { public static void listComponents(Container c) { Component[] components = c.getComponents(); for (Component comp : components) { System.out.println(comp.getClass().getSimpleName() + " Bounds: " + comp.getBounds()); if (comp instanceof Container) { listComponents((Container)comp); } } } public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { final JPanel gui = new JPanel(new BorderLayout(3,3)); JTree tree = new JTree(); tree.setVisibleRowCount(8); gui.add(new JScrollPane(tree), BorderLayout.LINE_START); JToolBar tb = new JToolBar(); gui.add(tb, BorderLayout.PAGE_START); Action list = new AbstractAction("List") { @Override public void actionPerformed(ActionEvent e) { listComponents(gui); } }; tb.add(list); tb.add(new JToggleButton("Toggle")); tb.add(new JCheckBox("Check")); gui.add(new JScrollPane(new JTextArea("Default Text",3,20))); JOptionPane.showMessageDialog(null, gui); } }; // Swing GUIs should be created and updated on the EDT // http://docs.oracle.com/javase/tutorial/uiswing/concurrency SwingUtilities.invokeLater(r); } } Output when tool-bar is on GUI JScrollPane Bounds: java.awt.Rectangle[x=0,y=35,width=81,height=147] JViewport Bounds: java.awt.Rectangle[x=1,y=1,width=78,height=144] JTree Bounds: java.awt.Rectangle[x=0,y=0,width=78,height=144] CellRendererPane Bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0] ScrollBar Bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0] MetalScrollButton Bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0] MetalScrollButton Bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0] ScrollBar Bounds: java.awt.Rectangle[x=0,y=0,width=0,height=0] MetalScrollButton Bounds: jav…
has comment: http://stackoverflow.com/comment/32446730

http://stackoverflow.com/comment/32360398
score: 0
has text: I'm right about that though, right? The previous code worked because you're counting the number of occurrences which can never be -1.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21445640

http://stackoverflow.com/a/21365271
answers question: http://stackoverflow.com/q/21365174
type: AcceptedAnswer
has body: import just allows you to refer to a class, or field without needing to use the full package name. It doesn't give to access to something you didn't have access to already. It just makes your code shorter. If you want to pass a list from one class to another (whether in another package or not) the simplest approach is to call a method and pass a reference with that list. What you are doing is using a global field. While that can work it is generally not a good idea as it makes scaling and testing your application harder. Instead I suggest you avoid mutable static fields, and use a instance field instead. I also suggest avoiding returning a collection. If you need to to string a list add a method like public String listToString() { return list.toString(); }
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21365174

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/21396136
tags question: http://stackoverflow.com/q/21438645
tags question: http://stackoverflow.com/q/21497816
tags question: http://stackoverflow.com/q/21501207
type: Tag
tags question: http://stackoverflow.com/q/21406853
tags question: http://stackoverflow.com/q/21501737

http://stackoverflow.com/comment/32314688
has text: I have accepted the answer can you please also advise what modifications need to be done in pair class, Thanks in advance
type: AnswerComment
comment on: http://stackoverflow.com/a/21411761
score: 0
type: Comment

http://stackoverflow.com/q/21349997
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21350290
has title: How to add missing Android javadoc to Eclipse?
favorite count: 0
tagged with: android
score: 1
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question
has body: My Eclipse is missing some Android javadoc options. For instance, I don't get autocomplete option for android:layout_span, which is under TableRow. How do I add these javadocs and others that may be missing?

http://stackoverflow.com/comment/32224812
score: 0
has text: If users answer wont be "1 or 0" from keyboard Same message will prompt again with a string( Please answer with(1) or (0)) ;
type: Comment
comment on: http://stackoverflow.com/q/21369530
type: QuestionComment

http://stackoverflow.com/comment/32467248
has text: `"I want that same file to just be cleared on the next run."` -- I'm quite confused again. Your statement above means not appending to file.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21505961
type: AnswerComment

http://stackoverflow.com/a/21502717
upvote count: 7
has comment: http://stackoverflow.com/comment/139641729
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/21502667
has body: return does what it names suggests. It returns the value of c. so if you have this int result = addThem(1, 2); result will equal 3, so you can then print it in main.
has comment: http://stackoverflow.com/comment/32461513

http://stackoverflow.com/q/21477139
tagged with: jms
has answer: http://stackoverflow.com/a/21595344
has body: TopicConnection.createTopicSession hangs sometimes in one env and it is working fine in another env. Env: JBoss5.1, jdk1.6.0_45, RHEL 5.8, Dell VM-ware The below is the code. TopicConnectionFactory _factory = (TopicConnectionFactory)context.lookup("java:JmsXA"); TopicConnection _connection = _factory.createTopicConnection(); TopicSession _session = _connection.createTopicSession(false, 1); --This is the place where it hangs. Topic _topic = (Topic)context.lookup(s); TopicPublisher _publisher = _session.createPublisher(_topic); _connection.start(); I feel that it could be some server configuration related issue. Kindly provide your suggestion.
has title: JBoss 5.1 - TopicConnection.createTopicSession hangs sometimes
upvote count: 1
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21595344
tagged with: jboss
answer count: 1
downvote count: 0
favorite count: 0
tagged with: rhel

http://stackoverflow.com/a/21374464
answers question: http://stackoverflow.com/q/21374305
score: 0
type: Answer
has body: You can use : (\/p\/.*\/bugs\/.*?(?=")) Java Code : String REGEX = "(\\/p\\/.*\\/bugs\\/.*?(?=\"))"; Pattern p = Pattern.compile(REGEX); Matcher m = p.matcher(line); while (m.find()) { String matched = m.group(); System.out.println("Mached : "+ matched); } OUTPUT Mached : /p/gnomecatalog/bugs/search/?q=status%3Aclosed-accepted+or+status%3Awont-fix+or+status%3Aclosed DEMO Explanation:

http://stackoverflow.com/q/21351657
answer count: 1
has comment: http://stackoverflow.com/comment/32204545
score: 0
has body: I wrote a simple RMI server and gave it a default RMISecurityManager with: System.setSecurityManager (new RMISecurityManager()); When I try to run the server it throws an exception: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") I thought the security manager would throw an exception if any downloaded code attempted to connect somewhere. But here the security manager is complaining when the server itself tries to do something. Why? Here's the code for the server (from Oracle RMI tutorial but I added the RMISecurityManager): package example.hello; import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.RMISecurityManager; public class Server implements Hello { public Server() {} public String sayHello() { return "Hello, world!"; } public static void main(String args[]) { try { Server obj = new Server(); // * Addition * System.setSecurityManager (new RMISecurityManager()); // Create object that will provide the remote service Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry(); registry.bind("Hello", stub); System.err.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } } I do this: $ javac -d classes example/*java $ java -cp pwd/classes -Djava.rmi.server.codebase=file:pwd/classes/ example.hello.Server Server exception: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:5…
has comment: http://stackoverflow.com/comment/32192768
has answer: http://stackoverflow.com/a/21357333
type: UnansweredQuestion
tagged with: rmi
tagged with: java
has title: RMISecurityManager sandboxing
type: Question

http://stackoverflow.com/q/21481669
score: 2
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21482246
type: Question
tagged with: jakarta-ee
has body: We're migrating from Java 6u17 to Java 7u45. The application is run under Weblogic 12.1.1.0, it has tons of legacy code and dependencies (versions of which we left unchanged). After recompilation we got the app running. At first it seemed all fine but in a while we ran into 'gc overhead limit exceeded'. It emerged from one of the batch jobs that worked perfectly fine for years under Java 6_17 (and it hasn't been changed since). Obviously there is more to just 'recompile and run', at least one has to consider GC tweaking. So the question stands, has anyone experienced problems (or maybe surprises) during the migration of an enterprise app from Java 6 to Java 7? Or are there any guidelines/good practices? PS: This is purely practical question. Let's omit discussion of pros and cons, language changes and so on.
has title: What to expect during migration from Java 6 to Java 7
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/32422986
has comment: http://stackoverflow.com/comment/32423019
downvote count: 1

http://stackoverflow.com/comment/32798387
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21692510
has text: `target/classes` are on classpath by default and adding `jmh-samples/target/generated-sources/annotations` doesn't give you anything, because this is not the location where org.openjdk.jmh.Main looks for benchmark classes. Check the value of org.openjdk.jmh.runner.MicroBenchmarkList.MICROBENCHMARK_LIST

http://stackoverflow.com/comment/32231964
comment on: http://stackoverflow.com/a/21366377
type: Comment
score: 1
has text: `Foo blah` is an instance of class `Foo`. `Foo[] blahArray` is an array of instances of `Foo`. In Java you could write `blah.valueX` or `blahArray[0].valueX`, but you couldn't write `blahArray.valueX`. Internally, the VM creates a new class for "array of Foo" the first time you reference a `Foo[]`.
type: AnswerComment

http://stackoverflow.com/comment/32348964
type: Comment
has text: @HugoSousa I'm not sure I've ever tried, because it is so uncommon, but AFAIK you can define local named classes.
type: QuestionComment
comment on: http://stackoverflow.com/q/21439223
score: 0

http://stackoverflow.com/q/21446262
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/32361453
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/32361605
has comment: http://stackoverflow.com/comment/32362165
has comment: http://stackoverflow.com/comment/32361637
accepted answer: http://stackoverflow.com/a/21446763
has comment: http://stackoverflow.com/comment/32361527
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/32362123
has comment: http://stackoverflow.com/comment/32361524
answer count: 1
has comment: http://stackoverflow.com/comment/32361508
has comment: http://stackoverflow.com/comment/32361538
has comment: http://stackoverflow.com/comment/32362045
has body: I am trying to create a program where a car dealership can pick what kind of customer and then enter in the info. It works fine up to where it prints the results. Then it gives me the error at the bottom. PLEASE HELP!! **I also need a way to add up the service objects and print them as well. Any help is appreciated! thanks in advance public static void main(String[] args) { Scanner s = new Scanner(System.in); final int MAX = 9999; Customer [] cust = new Customer[MAX]; int choice = 0; int cnt; double total; for(cnt=0; cnt &lt; MAX &amp;&amp; choice == 1 || choice ==2 || choice == 0; cnt++){ System.out.println("For a Service customer type 1, for a Purchaser type 2, to terminate the program press 9"); choice = s.nextInt(); switch (choice){ case 1: cust [cnt] = new Service(); break; case 2: cust [cnt] = new Purchaser(); break; default: break; } } for(int i=0; i &lt; cnt; i++){ cust[i].showData(); } //for(int i=0; i &lt; cnt; i++ ){ //total = cust. //} s.close(); } } interface Functions { public void getData(); public void showData(); } abstract class Customer implements Functions { protected String name; } class Purchaser extends Customer { protected double payment; public Purchaser(){ getData(); } public void getData() { Scanner s = new Scanner(System.in); System.out.println("Enter the name of the customer"); name = s.nextLine(); System.out.println("Enter payment amount: "); payment = s.nextDouble(); } public void showData() { System.out.printf("Customer name: %s Payment amount is: %.2f\n",name,payment); } } class Service extends Customer { protected String date; protected double amount; public Service () { getData(); } public void getData() { Scanner s = new Scanner(System.in); System.out.println("Enter the name of the customer"); name = s.nextLine(); System.out.println("Enter date of Service: "); date = s.nextLine(); System.out.println("Enter the cost of Service: "); amount = s.nextDouble(); } public void showData() { System.out.printf("Customer name: %s The date is:…
has comment: http://stackoverflow.com/comment/32361638
has comment: http://stackoverflow.com/comment/32361589
favorite count: 0
has comment: http://stackoverflow.com/comment/32361618
linked to: http://stackoverflow.com/q/5141070
has answer: http://stackoverflow.com/a/21446763
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32361399
has comment: http://stackoverflow.com/comment/32361418
tagged with: java
downvote count: 2
has title: Why am I getting an error!?(Null pointer Exception)
has comment: http://stackoverflow.com/comment/32361558
has comment: http://stackoverflow.com/comment/32361443
has comment: http://stackoverflow.com/comment/32361983
type: Question
has comment: http://stackoverflow.com/comment/32362178

http://stackoverflow.com/q/21476344
has comment: http://stackoverflow.com/comment/32521656
tagged with: java
tagged with: apache-camel
type: Question
tagged with: apache-karaf
tagged with: jpa
answer count: 1
has body: I'm getting the following error trying to poll a JPA entity Person. There's no error in the code. Everything compiles ok with a mvn clean install and the Person entity does exist in the net.lr.tutorial.karaf.camel.jpa2jms.model package. I have installed all the necessary features I believe and I know it's correctly connection to the database because it's creating a sequence database for the primary key. 2014-01-30 21:33:59,848 | WARN | jms.model.Person | JpaConsumer | 125 - org.apache.camel.camel-core - 2.12.0 | Consumer Consumer[jpa://net.lr.tutorial.karaf.camel.jpa2jms.model.Person?consumer.delay=3500] failed polling endpoint: Endpoint[jpa://net.lr.tutorial.karaf.camel.jpa2jms.model.Person?consumer.delay=3500]. Will try again at next poll. Caused by: [org.apache.openjpa.persistence.ArgumentException - An error occurred while parsing the query filter "select x from Person x". Error message: The name "Person" is not a recognized entity or identifier. Perhaps you meant Person, which is a close match. Known entity names: [Person]] &lt;openjpa-2.1.1-r422266:1148538 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "select x from Person x". Error message: The name "Person" is not a recognized entity or identifier. Perhaps you meant Person, which is a close match. Known entity names: [Person] Any ideas? Sean
has answer: http://stackoverflow.com/a/21839158
has title: Apache Camel - JpaConsumer failed polling endpoint
has comment: http://stackoverflow.com/comment/32748399
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/32454450
type: Comment
type: QuestionComment
has text: The answer to your question in the post is in the title of your question. The solution is also in the title of the question: create a copy of each array in the collection.
score: 2
comment on: http://stackoverflow.com/q/21499062

http://stackoverflow.com/comment/32297466
type: Comment
has text: If you're only updating every 30 minutes or so, and from the looks of it, it looks like its a pretty simple and quick task, it shouldn't have the much strain on battery life. The other option is to just increase the check up interval to > 30 minutes.
score: 0
comment on: http://stackoverflow.com/a/21410411
type: AnswerComment

http://stackoverflow.com/q/21467251
downvote count: 1
type: Question
has title: My Java class returns an ArrayList<String> but will not populate my WEBMethods StringList, why?
accepted answer: http://stackoverflow.com/a/21497635
score: -1
upvote count: 0
answer count: 1
has body: I am trying to populate a WEBMethods String List with an ArrayList and the variable is not populated and no error in WEBMethods occurs. Why is it that my String List is not populating. Question: String List not populated with ArrayList returned from Java? Code: This is setting no value to the String List --&gt; listOfFileName = FindArrayListOfFiles.getMyFileList(); The getMyFileList() is not setting the value of the ArrayList to the String List in the Java Flow Service. There is no error on the webmethods other than my values are not int he String List when I open it and see. There is nothing located in my list and I am not certain why that is the case.
tagged with: webmethods
has comment: http://stackoverflow.com/comment/32398379
favorite count: 0
has answer: http://stackoverflow.com/a/21497635
has comment: http://stackoverflow.com/comment/32398366
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21475613
type: Question
has comment: http://stackoverflow.com/comment/32413111
has body: I have a java app that can be run both on tomcat and jboss. I need to do a "if condition" for performing certain tasks based on the webserver type. How can I access this information? I need to do that because I need to connect to the datasource, and I can get the Context in different ways based on the webserver: try{ String webserver = getWebServer(); Logger logger=Logger.getLogger("myLog"); if(webserver.equalsIgnoreCase("Jboss")){ logger.severe("Webserver: " + webserver); Hashtable&lt;String, String&gt; ht= new Hashtable(); ht.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); ht.put(InitialContext.PROVIDER_URL,"jnp://localhost:1099"); ht.put(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); InitialContext ic=new InitialContext(ht); if(ic!=null){ logger.severe("success");/*I am getting success as output here*/ DataSource ds=(DataSource)ic.lookup(getDatasource()); /*this is where it's failing*/ if(ds!=null){ logger.severe("success1"); } return ds.getConnection(); } return null; } else{ //TOMCAT logger.severe("Webserver: " + webserver); // Obtain our environment naming context Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); // Look up our data source DataSource ds = (DataSource) envCtx.lookup(getDatasource()); // Allocate and use a connection from the pool Connection conn = ds.getConnection(); return conn; } } Tomcat version doesn't work on jboss, and viceversa Thank you!
accepted answer: http://stackoverflow.com/a/21476034
has title: java - which webserver is the application running on
linked to: http://stackoverflow.com/q/35842
answer count: 2
has comment: http://stackoverflow.com/comment/32413168
downvote count: 0
has comment: http://stackoverflow.com/comment/32413141
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21476034
has comment: http://stackoverflow.com/comment/32412889
has comment: http://stackoverflow.com/comment/32412891
possible better answer: http://stackoverflow.com/a/21475815
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21475815
tagged with: java

http://stackoverflow.com/comment/32352703
has text: I just checked, it doesn't work for static classes at all, even if not referenced by class.
comment on: http://stackoverflow.com/a/21441195
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21478336
answer count: 3
possible better answer: http://stackoverflow.com/a/21478717
has title: How to set the max connection accepted on Jetty
has answer: http://stackoverflow.com/a/21478717
tagged with: jetty
has answer: http://stackoverflow.com/a/22351643
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22351643
type: Question
has answer: http://stackoverflow.com/a/21482538
has body: final SslSocketConnector conn = new SslSocketConnector(sslContextFactory); conn.setReuseAddress(true); conn.setPort(port); ResourceHandler resources = new ResourceHandler(); resources.setCacheControl("no-cache"); resources.setDirectoriesListed(true); resources.setWelcomeFiles(new String[] { "abc.blank" }); resources.setResourceBase(fileLoc); server.setConnectors(new Connector[] { conn }); server.setHandler(resources); I have a Jetty (8.0) setup as above. But since my file is large, i need to define max number of connections allowed. What should I set?
score: 0

http://stackoverflow.com/comment/32241416
comment on: http://stackoverflow.com/q/21378966
score: 2
has text: Linux: `which java`. Windows: `echo %PATH%` and check all directories listed there to find the first one which contains `java.exe`.
type: Comment
type: QuestionComment

opengl-es-2.0
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/21421860
type: Tag
tags question: http://stackoverflow.com/q/21499449

http://stackoverflow.com/q/21424846
has title: How can I understand bitmap photo is vertical or horizontal?
tagged with: bitmap
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21425041
possible better answer: http://stackoverflow.com/a/21424973
has answer: http://stackoverflow.com/a/21424973
answer count: 2
has body: I did not find what I really need on google and stackoverflow, I want to understand that a photo which I just capture from the camera is vertical or horizontal, Code: path_img= ("image_url"); Bitmap photo = null ; photo = BitmapFactory.decodeFile(path_img ); int imageHeight = photo.getHeight(); int imageWidth = photo.getWidth(); When I capture the photo on my phone imageHeight and imageWidht always same I mean if I capture photo vertical or horizantal it is always 960x1280, I want to horizantal photo size is (width:960 height:1280) and vertical is (width:1280 height:960) thanks
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/32322646
accepted answer: http://stackoverflow.com/a/21425041
tagged with: android
tagged with: android-bitmap

http://stackoverflow.com/comment/32206546
comment on: http://stackoverflow.com/a/21359346
score: 0
type: Comment
has text: I will do my best to do this, and you are right about the pasted thing. Well, I copied it exactly.
type: AnswerComment

http://stackoverflow.com/a/21474385
has body: The method is still existing after the recursive call to itself. Once those calls are dealt with, the method will come back to execute the remaining lines of code. Have a look at this : http://ideone.com/zWqP8h public static void main(String[] args) { test(5); } static void test(int n) { if (n &gt; 0) { System.out.println("First step :" + n); test(n-1); System.out.println("Second step :" + n); } } Probably it will help to clarify things.
type: Answer
answers question: http://stackoverflow.com/q/21474297
score: 0

http://stackoverflow.com/comment/32270436
has text: You need some way for your model to tell the UI that something has changed. You could employ a observer pattern using something a `ChangeListener` for example
score: 1
comment on: http://stackoverflow.com/q/21394568
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21462193
upvote count: 9
has body: I'm not sure I understand your end goal, but here's a possible solution. With Servlet 3.0, implement the ServletContainerInitializer interface. Register it as the javadoc says Implementations of this interface must be declared by a JAR file resource located inside the META-INF/services directory and named for the fully qualified class name of this interface In its onStartup(..) method, you will have access to all the classes on your web application's classpath. Scan them one by one. If a class is in the package you want and it has the annotation you are looking for, process it and store the URL pattern in a collection. When the scan is done, you can register Servlet instances/classes with the provided ServletContext and register URL patterns with the given ServletRegistration.Dynamic object. ServletRegistration.Dynamic registration = servletContext.addServlet("myServlet", new MyServlet()); registration.addMapping(yourCollectionAsAStringArray); You have many other configuration options as well if you need them.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21461797
type: Answer
accepted answer of: http://stackoverflow.com/q/21461797
has comment: http://stackoverflow.com/comment/32389040
score: 9

http://stackoverflow.com/a/21382569
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21381186
has body: Update your service class as follows @Service @Transactional(readOnly = true,propagation=Propagation.SUPPORTS) public class PersonService { } OR you can do this way also package org.hibtests.service; @Service public class PersonService { @Autowired private PersonDao personDao; @Transactional(readOnly = true,propagation=Propagation.SUPPORTS) public PersonDao getPersonDao() { return personDao; } @Transactional(readOnly = true,propagation=Propagation.SUPPORTS) public void addPerson(Person person) { getPersonDao().insert(person); } } hope this will help you
has comment: http://stackoverflow.com/comment/32249165

http://stackoverflow.com/q/21415809
upvote count: 4
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/21417976
has answer: http://stackoverflow.com/a/21415864
favorite count: 0
has title: regex for letters or numbers in brackets
possible better answer: http://stackoverflow.com/a/21415864
tagged with: regex
has body: I am using Java to process text using regular expressions. I am using the following regular expression ^[\([0-9a-zA-Z]+\)\s]+ to match one or more letters or numbers in parentheses one or more times. For instance, I like to match (aaa) (bb) (11) (AA) (iv) or (111) (aaaa) (i) (V) I tested this regular expression on http://java-regex-tester.appspot.com/ and it is working. But when I use it in my code, the code does not compile. Here is my code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class Tester { public static void main(String[] args) { Pattern pattern = Pattern.compile("^[\([0-9a-zA-Z]+\)\s]+"); String[] words = pattern.split("(a) (1) (c) (xii) (A) (12) (ii)"); String w = pattern. for(String s:words){ System.out.println(s); } } } I tried to use \ instead of \ but the regex gave different results than what I expected (it matches only one group like (aaa) not multiple groups like (aaa) (111) (ii). Two questions: How can I fix this regex and be able to match multiple groups? How can I get the individual matches separately (like (aaa) alone and then (111) and so on). I tried pattern.split but did not work for me.
score: 4
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21416265
has answer: http://stackoverflow.com/a/21417976

http://stackoverflow.com/comment/32291299
type: Comment
comment on: http://stackoverflow.com/a/21406669
type: AnswerComment
has text: @JonHanna indeed, the main thing that occurred to me when I looked at the Kryo pages is "and... what is it actually going to produce? what is the raw format?"
score: 0

http://stackoverflow.com/q/21362874
accepted answer: http://stackoverflow.com/a/21423299
score: 0
has body: I created a simple web application in eclipse which connect to sql server. I downloaded the sql driver and added it to build path like this: Build Path->Configure Build Path->Add External JARs. When I run my application on Tomcat I get exception: ClassNotFoundException. I think that I know what it reason is (the folder WEB-INF-&gt;lib of my application is empty). When I put jar file of driver in WEB-INF-&gt;lib - everything is good. How I can add jar file(sql driver) to folder WEB-INF-&gt;lib of my application using eclipse?
has answer: http://stackoverflow.com/a/21423299
has title: Deploy web application on Tomcat
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32213036
has comment: http://stackoverflow.com/comment/32212686
has comment: http://stackoverflow.com/comment/32212479
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/1001714
has comment: http://stackoverflow.com/comment/32212558
answer count: 1
tagged with: tomcat

http://stackoverflow.com/a/21477699
score: 1
has comment: http://stackoverflow.com/comment/32417145
has body: 1) Image size in file is the size of structured data, compressed (e.g. in jpeg format) in file on the disk. 2) Data in memory is object representation of your image, so it could be much more greater then image resources in file. 3) There isn't way how to solve your problem without increasing memory space. Look at this: What does Java option -Xmx stand for?
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/32418433
answers question: http://stackoverflow.com/q/21477607
has comment: http://stackoverflow.com/comment/32417059
has comment: http://stackoverflow.com/comment/32417826
has comment: http://stackoverflow.com/comment/32417548
downvote count: 0

http://stackoverflow.com/q/21427924
has title: Get Portlet Application Context from another portlet (Liferay + Spring)
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21598028
upvote count: 3
tagged with: portlet
type: UnansweredQuestion
tagged with: spring
has body: I want to create a portlet (let's call it 'Action Manager') to list all the action methods (using spring Annotation @ActionMapping) from all the portlets in the same page as my Action Manager portlet. All my other portlets are using ParameterHandlerMapping to map the incoming requests to the appropriate Controller &lt;bean id="parameterHandlerMapping" class="org.springframework.web.portlet.handler.ParameterHandlerMapping"&gt; &lt;property name="defaultHandler" ref="Controller1" /&gt; &lt;property name="parameterName" value="control" /&gt; &lt;property name="parameterMap"&gt; &lt;map&gt; &lt;entry key="1" value-ref="Controller1" /&gt; &lt;entry key="2" value-ref="Controller2" /&gt; &lt;/map&gt; &lt;/property&gt; &lt;/bean&gt; So my intention is to get all the portlets in my current page (I'm already doing that) and try to get the parameterHandlerMapping bean from each portlet and, from there, get its controller names (Controller1, Controller2) which I will later used to get the @ActionMapping annotated methods. Is it possible to access each portlet "private" context and retrieve the parameterHandlerMapping bean? I'm currently stuck with this: PortletBag portletBag = PortletBagPool.get(portlet.getPortletId()); if (portletBag != null) { ServletContext servletContext = portletBag.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext); ParameterHandlerMapping parameterHandlerMapping = (ParameterHandlerMapping) ctx.getBean(ParameterHandlerMapping.class); } This results in an exception being thrown because there's no matching bean in the application context. I tried to get it by the bean's name and the result is pretty much the same. I also got a list of all the beans present in the context using String beanNames[] = ctx.getBeanNamesForType(Object.class); for (String beanName : beanNames) { System.out.println(beanName); } and the parameterHandlerMapping bean is not present. It's my understanding that each portlet h…
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: liferay
tagged with: spring-portlet-mvc

http://stackoverflow.com/comment/32471489
type: AnswerComment
comment on: http://stackoverflow.com/a/21508529
type: Comment
has text: I don't think that last statement make sense. PreparedStatement#setDate expects a java.sql.Date, making java.util.Date incompatible
score: 1

http://stackoverflow.com/comment/32374974
type: Comment
type: QuestionComment
has text: this is the reading code: Team[] teams_loaded= null; try{ System.out.println(DexLoader.class.getClassLoader().getResource("teams.txt")); Reader reader = new InputStreamReader(DexLoader.class.getClassLoader().getResourceAsStream("teams.txt")); Gson gson = new GsonBuilder().create(); JsonReader read = new JsonReader(reader); teams_loaded = gson.fromJson(read, Team[].class); }catch(Exception c){ c.printStackTrace(); } and it gives me the error MalformedJson (don't mind about the different file pointing, i'm in debug)
comment on: http://stackoverflow.com/q/21453203
score: 0

http://stackoverflow.com/a/21426246
score: 0
has comment: http://stackoverflow.com/comment/32325064
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21426065
has comment: http://stackoverflow.com/comment/32325639
accepted answer of: http://stackoverflow.com/q/21426065
has body: Guice and Spring are tools for dependency injection, which means that creating objects is easier with them because they take care of instantiating objects and placing them into other objects that depends on them. Now, when we talk about plugins, we usually are talking too about dynamically loading new classes into a running app. Think on eclipse IDE. Its architecture was designed from the beginning to be "pluggable", like, you can download jars and eclipse will add them to the running application without the need of application restart. In this case, if you want to build pluggable apps, in a sense of dynamic classloading, I'd recommend you not to go through this path, but to research subjects such as OSGI. One popular OSGI framework is http://felix.apache.org/ Another approach for application extension (we may call this pluggable too, somehow, I guess), depending on how your app is organized and what it does, is to develop a DSL (http://en.wikipedia.org/wiki/Domain-specific_language) for it and extend it letting people adding scripts to it. Isn't something like this when a browser let you add pieces of funcionality written in javascript? Groovy makes DSL easier in some aspects, for java programmers. (see http://docs.codehaus.org/display/GROOVY/Writing+Domain-Specific+Languages)
type: Answer
has comment: http://stackoverflow.com/comment/32325166
has comment: http://stackoverflow.com/comment/32325391
has comment: http://stackoverflow.com/comment/32325481
has comment: http://stackoverflow.com/comment/32325579

http://stackoverflow.com/comment/32440478
has text: Any ideas? I'm stumped...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21490714
type: Comment

http://stackoverflow.com/q/21511850
answer count: 2
has comment: http://stackoverflow.com/comment/32477448
has comment: http://stackoverflow.com/comment/32477338
has body: How can I make an android app that generates a random word every 1 second? Here is my code: new Timer().scheduleAtFixedRate(new TimerTask(){ public void run() { started = true; word = ""; for (int i = 0; i &lt; lenght+1; i++) { int j = rand.nextInt((max-min) + 1) + min; word += tr.Translate(j); } txt.setText(word); } }, 0, 5000); It seems that my app stops every time it must change the text of the TextView("txt"); how can I make this work?
possible better answer: http://stackoverflow.com/a/21511982
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21511935
accepted answer: http://stackoverflow.com/a/21511935
has title: Android app that generates random words every second and displays them on screen
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32477392
has comment: http://stackoverflow.com/comment/32477359
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21511982

http://stackoverflow.com/comment/32362737
comment on: http://stackoverflow.com/a/21446920
score: 0
type: AnswerComment
type: Comment
has text: Also needs a change in the `Service` class to make this work.

http://stackoverflow.com/comment/32349994
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21439889
has text: Okay temp = 1 now. But all the sums are one under. and when i switch the order instead of 1+2+3+4+5=14 it says 2+3+4+5+5=20

http://stackoverflow.com/comment/32239210
score: 0
has text: Check this http://stackoverflow.com/questions/18089923/translating-c-sharp-rsacryptoserviceprovider-into-java-code
type: Comment
comment on: http://stackoverflow.com/q/21377510
type: QuestionComment

http://stackoverflow.com/a/21467902
has comment: http://stackoverflow.com/comment/32399960
answers question: http://stackoverflow.com/q/21467787
score: 0
type: Answer
has body: The problem is with Eclipse. Sometimes the R.java file is still not restored after cleaning the project. You can try to delete the gen and bin from the project directory and again try to import the project and clean it. Maybe that will help. Try to use Android Studio.. Till now I didn't get any issues with the R.java.

http://stackoverflow.com/q/21371722
has title: My Java program keeps telling me that I can't put my else statement without an if, but I already have one
has answer: http://stackoverflow.com/a/21371755
score: -1
has comment: http://stackoverflow.com/comment/32228786
has answer: http://stackoverflow.com/a/21371785
downvote count: 2
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32228747
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21371832
has answer: http://stackoverflow.com/a/21371776
has comment: http://stackoverflow.com/comment/32228746
has body: public static void main(String[] args) { String password, firstOption, firstNumber = ""; int number, option; password = JOptionPane.showInputDialog("Please Enter Password"); // now starts code if (password.equals("HW1")) { firstOption = JOptionPane.showInputDialog("Please select an option: \n0 = Quit \n1= Math Time"); option = Integer.parseInt(firstOption); if (option == 0) { JOptionPane.showMessageDialog(null, "You Quit!", "Quitter!", JOptionPane.OK_CANCEL_OPTION); } else { firstNumber = JOptionPane.showInputDialog("Please enter a number between 1-30:"); number = Integer.parseInt(firstNumber); if (number &lt;= 30 &amp;&amp; number &gt;= 0) { JOptionPane.showMessageDialog(null, "The number " + number + " to the second power is " + number, "Math Time", JOptionPane.OK_OPTION); } else { JOptionPane.showMessageDialog(null, "That is not a number between 1-30", "Idiot Alert!", JOptionPane.OK_OPTION); } } else { JOptionPane.showMessageDialog(null, "Incorrect Password", "Incorrect Password", JOptionPane.OK_OPTION); } } The problem is with the very last else statement, I want it to correspond to the if statement that says (password.equals ("HW1") Basically I want it to check and see if the password is HW1, if so then run all the code in the if statement. If not, run the else statement
tagged with: java
has comment: http://stackoverflow.com/comment/32228842
type: Question
has answer: http://stackoverflow.com/a/21371782

http://stackoverflow.com/a/21431594
has body: For your query you simply need to start Intent only when this Radio button has been clicked. For Ex: Use condition check which will insure that your radio box has been checked.. i.e if( radio_b.ischecked()){ // start Intent over here }else{ // Toast a message to user to select same } I hope this clears your doubt. As far placing code is concerned then you can place same in onCreate(); Method only. That actually depends upon your need. Cheers!
answers question: http://stackoverflow.com/q/21431309
score: 0
type: Answer

http://stackoverflow.com/q/21460561
tagged with: random
answer count: 3
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21468840
has comment: http://stackoverflow.com/comment/32385891
favorite count: 0
has answer: http://stackoverflow.com/a/21460643
has comment: http://stackoverflow.com/comment/32386102
possible better answer: http://stackoverflow.com/a/22856797
has body: I'm trying to implement the xorshift random number algorithm from Wikipedia in Java. It has an example in C that has unsigned longs. Given that Java doesn't have unsigned numbers, how can I get rid of the Math.abs in my code below? I only want positive numbers. private static long x = 0; private static long y = 0; private static long z = 0; private static long w = 0; private static long xorShiftRandom() { while ((x | y | z | w) == 0) { Random rand = new Random(); x = rand.nextLong(); y = rand.nextLong(); z = rand.nextLong(); w = rand.nextLong(); } long t = x ^ (x &lt;&lt; 11); x = y; y = z; z = w; return w = Math.abs(w ^ (w &gt;&gt;&gt; 19) ^ (t ^ (t &gt;&gt;&gt; 8))); }
has title: Xorshift random in Java
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/32437833
has comment: http://stackoverflow.com/comment/32386025
type: Question
has answer: http://stackoverflow.com/a/22856797
accepted answer: http://stackoverflow.com/a/21460643