Hi,
I want to annotate a class dynamically to make it the more generic as possible:
public class Test<T> {
@XmlAttribute(name = dynamicvalue)
T[] data;
public Test(String dynamicvalue) {
}
}
Is there any way to achieve something like this.
TA
I am trying to make an android app that makes connection with bluetooth device. It works fine but when I call BluetoothSocket.connect() and it is not able to connect to devise its blocking. The thread and does not throw any exception. So when I try to close application while connect() is running its not responding. How can I cancel it? Used BluetoothSocket.close() in ... but still its not working for me.
protected void simpleComm(Integer port) {
// The documents tell us to cancel the discovery process.
try {
Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
mmSocket = (BluetoothSocket) m.invoke(mmDevice, port);
mmSocket.connect(); // <== blocks untill is not connected
Log.d(TAG, " connection success===");
}catch(Exception e){
if (!abort) {
connectionFailed();
// Close the socket
try {
mmSocket.close();
// Start the service over to restart listening mode
BluetoothService.this.start();
} catch (IOException e2) {
Log.e(TAG,"unable to close() socket during connection failure", e2);
}
}
return;
}
}
public void cancel() {
try {
abort = true;
mmSocket.close();
} catch (IOException e) {
Log.e(TAG, "close() of connect socket failed", e);
}
}
Hello Team,
I am using the below code in my application ...
Process process = Runtime.getRuntime().exec(
"perl " + perlScript + " " + project + " " + fileName);
:
:
:
result = process.waitFor();
:
:
and this result gives the code 2 every time.....while running the application.
what could be the reason for the "reason code" ???
Thanks In Advance
I have .jpg images in my buttons. I also would like to put some text on top of the images. I use the following syntax for that:
JButton btn = new JButton(label,icon);
But I do not see text in the buttons (only image). What am I doing wrong?
Hi
I want to know that can two different jvm run in the same machine?
I also want to know more about jvm working.Can any one provide some useful links.
Thanks
Is ther any way to get data from other sites and display in our jsp pages dynamically.
http://www.dictionary30.com/meaning/Misty see this url
in that one block is like
Wikipedia Meaning and Definition on 'Misty'
In that block they are fetching the data from Wikipedia and displaying into dictionaly30.
Question:
How they are fetching wiki data to their site.?
I need to display data like that in my jsp page by fetching from other site.
Hey Guys
I want to set two different look and fields on one frame.
I have two different panels in that.
i want to set two different look and field for both.
Can I do that?
And if yes then how?
Is there a simple way to clear all fields of an instance from a an instance? I mean, I would like to remove all values assigned to the fields of an instance.
ADDED
From the main thread I start a window and another thread which controls state of the window (the last thread, for example, display certain panels for a certain period of time). I have a class which contains state of the window (on which stage the user is, which buttons he already clicked).
In the end, user may want to start the whole process from the beginning (it is a game). So, I decided. So, if everything is executed from the beginning, I would like to have all parameter to be clean (fresh, unassigned).
ADDED
The main thread, creates the new object which is executed in a new thread (and the old thread is finished). So, I cannot create a new object from the old thread. I just have a loop in the second thread.
I personally quite like instance initializers - I use them to assign default values to things such as collections so when writing constructors I don't have to remember to assign them the same default values each time. It seems quite elegant to me - avoids annoying NPE's popping up and avoids duplicate code. A private method doesn't seem as nice because a) it can't assign values to final fields, b) it could be run elsewhere in code and c) the method still needs to be explicitly called at the start of each constructor.
However, the flip side with others I have spoken to is that they're confusing, some people reading the code might not understand what they do or when they're called and thus they could cause more problems than they solve.
Are proper use of these initializers something to be encouraged or avoided? Or is it an "each to their own" case?
Hey I try to write a littel bash script. This should copy a dir and all files in it. Then it should search each file and dir in this copied dir for a String (e.g @ForTestingOnly) and then this save the line number. Then it should go on and count each { and } as soon as the number is equals it should save againg the line number. = it should delete all the lines between this 2 numbers.
I'm trying to make a script which searchs for all this annotations and then delete the method which is directly after this ano.
Thx for help...
I have a List with say size n, and i have to dynamically create n variables ie i want to dynamically create the variables depending upon the size of the list. How can i achieve this?
Say i have List as List year with n elements in it;
then i have to create the n Integer variables from the above list.
thanks.
Currently anybody can access the solr admin page by going to my_ip:8983/solr
I can't have it like that, so how can I make it prompt for password or something?
I have setup my servers apache2.conf file to prompt for password whenever my site is accessed by www.mydomain.com.
But when using another port, the "require password" wont show up.
Any ideas how to secure this?
Don't point me to the SolrSecurity wiki because it's simply too outdated. I have tried it without luck.
Thanks
i need to implement a project with visual intimacy between persons,can anyone recommends an algorithm for person's intimacy in phone contact?
intimacy attenuate over time(the intimacy attenuates automatically if you havnt click/dial it for a long time).
Assume in my address book:
Person Intimacy(0-100%)
A 40%
B 80%
C 10%
A's intimacy needs raise after i call A ,like this
Person Intimacy(0-100%)
A 42%
B 80%
C 10%
nothing happens after follow 5 days, A,B,C's intimacy need decline,like this
Person Intimacy(0-100%)
A 37%
B 78%
C 8%
thanks for everyone's answer
I am currently stuck with a homework assignment, question below;
Define a default constructor for Deck that initialises the deck field with an array of size 0.
Also define a constructor that takes an integer parameter and initialises the deck field with an array of that size. The constructor should also initialise every element with a new random MovieCard. The cards should be uniquely named.
so far my code is
public class Deck {
MovieCard[] deck = new MovieCard[] {};
public Deck() {
MovieCard deck[];
}
public Deck(int size) {
MovieCard deck = new MovieCard[];
}
}
Obviously this is incomplete by I can't find any references in my previous notes about referring a parameter into an array and setting this as the length.
hello everyone,
Can anyone please tell the way to find out the mac address of a system which is:
1. Shutdown
2. Power plugged in
3. Connected to Lan
4. Nic card ON.
Kindly post the solution as i urgently need it in my project...
thank you
I have a question. What is wrong with regards to the below code:
ArrayList tempList2 = new ArrayList();
tempList2 = getXYZ(tempList1, tempList2);
//method getXYZ
getXYZ(ArrayList tempList1, ArrayList tempList2) {
//does some logic and adds objects into tempList2
return tempList2;
}
The code will get executed but it seems by passing tempList2 to the getXYZ method argument, it is doing object recycling.
My question is, Is recycling the tempList2 arraylist object correct?
I have a certain value of date and time say 28-3-2012(date) - 10:36:45(time) . I wish to convert this whole timestamp to nanoseconds with the precision of nanoseconds. As in the user would input the time and date as shown but internally i have to be accurate upto nanoseconds and convert the whole thing to nanoseconds to form a unique key assigned to a specific object created at that particular time.
Could some one please help me with the same..
Hello eveyone,
i using elastic in my script.
I have also jQuery Tabs (every will be get over AJAX and content a textarea) and a timer for Saving content all 3 minutes. So some JS code...
I have 2 parts on my site, left and right. On the right side i have 2 tabs (jQuery not AJAX) with each one textarea. And Left side between 5-10 Textareas each in Tab but they gonna be loaded only if Tab is activ (AJAX).
my Problem is:
If i paste a lot of text in a Textarea (1000 characters) the writing get slowed, not fluid, jerky.
It ist 100% the elastic problem, without elastic there no Problem while writing.
Have some one an idea for the solution of this Porblem? Is it Overload?