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 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.
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?
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 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 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?
My JSONObject has some random characters contained within the string so I'm trying to remove them. I've tried this but with no luck.
String result = s.substring(1, s.length() - 2);
JSONObject json_data = new JSONObject(result);
if (json_data.has("["))
{
json_data.remove("[");
}
if (json_data.has("]"))
{
json_data.remove("]");
}
if (json_data.has(","))
{
json_data.remove(",");
}
It's still not removing the characters from the JSONObject. Am I checking the JSONObject for the characters incorrectly?
This seems like a simple request, but google is not my friend because "partition" scores a bunch of hits in database and filesystem space.
I need to enumerate all partitions of an array of N values (N is constant) into k sub-arrays. The sub-arrays are just that - a starting index and ending index. The overall order of the original array will be preserved.
For example, with N=4 and k=2:
[ | a b c d ] (0, 4)
[ a | b c d ] (1, 3)
[ a b | c d ] (2, 2)
[ a b c | d ] (3, 1)
[ a b c d | ] (4, 0)
I'm pretty sure this isn't an original problem (and no, it's not homework), but I'd like to do it for every k <= N, and it'd be great if the later passes (as k grows) took advantage of earlier results.
If you've got a link, please share.
I have a program where i have a button to change the background color to red and another button to set back the default panel color.
How do i get back the default color for panel??
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..
Alright so I'm working on something where I take input from System.in; the first line is an int (n) representing the size of a matrix. The next n lines are the matrix itself like so:
10
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 1 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0
0 0 0 1 0 1 0 0 0 0
0 0 0 0 1 0 0 1 1 0
0 1 0 0 0 0 0 1 0 0
0 0 0 0 0 1 1 0 0 0
1 1 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0
The problem is there may be multiple matrix's in a single input, so the next line would have another int and the corresponding matrix underneath until it hits a line with a single 0. I then have to pass each matrix along with the size at the top as a BufferedReader to a method which adds the numbers to a 2D array.
I'm just a little unsure on how to split the input up and send it to the method. Would making a new BufferedReader using skip() and specifying a size each time work? The biggest problem I seem to be running into is reading the size but then the size being excluded as it has already been read.
Cheers
I'm trying to get the resultCode to be OK inside my onActivityResult function. However, it keeps coming back as 0. I have spent several days on this, and can't figure out why it doesn't work. Here's my code. If anybody can help me, I'll be very grateful, Thanks.
My Activity1 class:
private class MyTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
// process
return result;
}
@Override
protected void onPostExecute(String result) {
Intent i = new Intent(Activity1.this, Activity2.class);
i.putExtra("Value1", "This value one for ActivityOne ");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(i, REQUEST_CODE);
textView.setText(result);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
// do something
}
}
My Activity 2 class:
@Override
public void finish() {
Intent data = new Intent();
data.putExtra("returnKey1", "return 1");
setResult(RESULT_OK, data);
super.finish();
}
My manifest:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Activity1"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity2"
android:label="@string/app_dialog_name"
android:launchMode="singleTop"
android:excludeFromRecents="true"
android:taskAffinity=""
android:theme="@android:style/Theme.Dialog">
</activity>
</application>
Using an oracle database, I need to perform a check to see if a user in my 'users' table is banned or not. The user is banned if his column 'banned' has a value of '1', '0' if he is not.
I have the following working code here:
public boolean banUser(String username)
{//TODO check if user is banned already
try
{
pstmnt = conn.prepareStatement("UPDATE users SET banned = 1 WHERE username = ?");
pstmnt.setString(1, username);
pstmnt.execute();
logger.info("Banned User : " + username);
return true;
} catch ( SQLException e ) { e.getMessage(); }
return false;
}
I'm not sure how to perform an if statement on top of a prepared statement. Any ideas?
Lets say I have a class A that is fairly simple like this -
public class A{
private int randomField = 0;
protected int key;
protected double dmg;
}
Now I want to write a number of sub-classes that inherit the protected fields and only differ based on the initial values that are assigned to those fields - for example, if I wrote two subclasses B and C, the only difference between those two sub-classes would be that the values key and dmg would have different values. They would share a method, set, which would be exactly the same, in that it would affect the same variable.
I find when I'm writing these sub-classes I'm repeating myself, as I just change the constructor to set different initial values to key and dmg, and simply copy and paste the set method.
Is there a 'good' way to do this?
I know add() adds the specified (signed) amount of time to the given time field, based on the calendar's rules.
And roll() adds the specified (signed) single unit of time on the given time field without changing larger fields.
I can't think of an everyday usage of roll() I would do everything by add().
Can you help me out with examples when do we use roll() and when add()?
Which one of the following is NOT a pitfall of inheritance?
Base-derive classes should be totally separate and do not have an is-a relationship.
Base-derive classes should have been aggregate classes instead.
Inheritance may be inverted, example: Truck<-Vehicle should be Vehicle<-Truck.
Incompatible class hierarchies may be connected because of multiple inheritance.
Aggregation should have been used instead.
Functionality is transferred from a base class to a derived one.
In my opinion, NOT a pitfall of inheritance meas can use inheritance.
1 seems do without inheritance
2 aggregate substitute Base-derive I don't know
So, I think 5 is the answer.
I set an request attribute in my action class as follows:
request.setAttribute("xFg",Boolean.TRUE);
I want to retrive this in my JSP. I want to retrive them using JSTL tags. I tried this :
<c:if test="${requestScope.xFg}">
<c:set var="showlist" value="true" />
</c:if>
But c:if didnt work, i mean it didnt goto c:set
I tried to print the sameusing c:out but nothing got displayed. What is wrong or How should i test request attribute value. I havent used requestScope so far. Is requestScope the option to get the request value? pls help.Thanks in advance.
We are looking for Web Designers & Developers. Urgent Opening.
Profile:-
a) Have exp. in Designing websites in wordpress
b) Have Creativity in work
c) Send us your work – [email protected]
d) Min Exp. required: 2 + years
e) Can Integrate the Facebook, Twitter & other social networking websites.
To review our profile – please check – www.dicorporation.com & www.ismoip.com
public class Node{
Node p,l,r;
int height;
String s;
{
/** class body**/
}
}
String[] S=new String[5000];
int i=0;
while (i<5000){
Node x=new Node();
x=S[i];
}
I want to make 5000 Node object.
above code assign same variable name x every time but i want different variable name .
then how to declare 5000 class variable name without declaring it manually.
is there something by which i can create 5000 Node class object with ease.