« first day (1099 days earlier)      last day (3833 days later) » 

11:37 AM
helo
helpp
helpp!
 
3 messages moved from JavaScript
 
hello?
can someone help me
hello
 
 
1 hour later…
user1125394
1:08 PM
final CurveFitter fitter = new CurveFitter(new LevenbergMarquardtOptimizer());
int i=1;
String[] boobs = "4	2.5	2.1	2.3	3	2.3	2.1	2.5	4".split("\\s+");
for (String s : boobs){
	fitter.addObservedPoint(i++, Double.parseDouble(s));
}
final double[] init = { 1, 1, 1, 1, 1 }; // initial guess, we want degree 4
final double[] best = fitter.fit(new PolynomialFunction.Parametric(), init);
final PolynomialFunction fitted = new PolynomialFunction(best);
String boobsRegression="";
for(i=1;i<boobs.length;i++)
 
user1125394
 
1:22 PM
boobs :P
 
user1125394
gonna try some boobs prediction, with 1 boob and a half
 
try
 
user1125394
 
user1125394
only the 9th given the first 8 points
 
user1125394
but I don't like the fact you need to force a given polynomial degree
 
user1125394
1:36 PM
with degree 3 or 5 or 6 the prediction is far
 
2:53 PM
Hello
Lol boobsRegression
 
hi guys
 
Welcome to boob support - aka Brassiere
 
any one can help me with small java snippet
static void Case1() // doesn't work when using variables of numberOfEmployees (4th line)
{
int numberOfEmployees=5;
double Deviation = 30349.625;
double Variance=0;
Variance = (1/numberOfEmployees) * Deviation;
System.out.printf("The standard deviation %.2f \n",Variance);
}
static void Case2() // works if i used values not variables (4th line)
{
int numberOfEmployees=5;
double Deviation = 30349.625;
double Variance=0;
Variance = 0.2 * Deviation; // 1 divided by 5 = 0.2
System.out.printf("The standard deviation %.2f \n",Variance);
 
You're doing integer division
1/5 == 0, whereas 1.0 / 5 == 0.2
 
double x = (1/numberOfEmployees); still doesn't work ...equals 0
 
3:02 PM
Variance = (1.0/numberOfEmployees) * Deviation;
should give the result you want
 
oh ok
you're the best ...
thanks a lot kiheru
 
you're welcome. that's a quite common error (and can happen to experienced devs too, but they know what to fix when they hit the issue)
 
it's true...i spent a whole day trying to figure it out ...but you did for me ;-)..cheers
 
ints are not widened to floats unless that's necessary, so the division is integer division when both the arguments are ints. Making one of them a double results it to be done to doubles (so it really becomes 1.0 / (double) numberOfEmployees; the cast is not just needed because the compiler will add it automatically)
 
3:48 PM
@kiheru, think adding the cast to double for numberIfEmployees is important, from a readability standpoint.
 
kiheru , i got another wierd issue
public static void FruitShop()
{
//Instance object that will get the value from the user
Scanner input = new Scanner(System.in);
String fruitName = "";
int priceKG = 0;
int kgCount = 0;
int EarnedMoney = 0;
String BigFruitAchived = "";
int BigFruitProfit = 0;
System.out.println("Please type fruit's name , price per kilogram , number of kilograms sold (in one line) : ");

while (!fruitName.equals("stop"))
{
fruitName = input.next();
priceKG = input.nextInt();
kgCount = input.nextInt();

EarnedMoney = priceKG * kgCount;
this functions works but it suppose to end when i type stop as fruitname ...but it doesn't
there's a problem with euality i think
 
4:20 PM
Do you know what Java needs?
(Someone say "What?")
 
What?
 
I think
JAva
should have a new keyword
"shares"
E.g.
I can do
public class Controller implements KeyListener shares KeyEvent{
}

And from there, I can gain access to all of the static variable in KeyEvent
without doing KeyEvent.VK_DOWN
I can just do VK_DOWN
 
How is that different from extend keyword?
 
Because extends is for inheritnce
shares is for sharing static fields and methods
 
How is that different from inheriting fields and methods?
 
4:32 PM
If I do:
public class Chocolate extends Sweets{}
Chocolate is now a subclass of Sweets
But if I do:
 
I know what that means
 
public class Chocolate shares Sweets{}
I can access ONLY the static variables and methods in that class
An example is this
 
But that doesn't make sense
How can a chocolate share sweets?
 
This will make it make sense, hold on:
public class ChalkBoard extends Canvas{
public ChalkBoard(){
setBackground(RED);
setForeground(BLUE);
}
}
This would throw an error
RED doesn't exist
However:
public class ChalkBoard extends Canvas shares Color{
public ChalkBoard(){
setBackground(RED);
setForeground(BLUE);
}
}
Would be fine
it just makes code a lot less tedious to write
 
No. Again how does a Chalkboard share Color?
I understand what you mean/are implying but the semantics doesn't make sense
 
4:35 PM
What do you mean?
Maybe it would work better if it wasn't declared with the class name
 
A chocolate can't share sweet.
A chalkboard cannot share colors
 
Are you trolling me?
 
Do I sound like I am trolling you?
 
Yes
Really hard at that
 
Ok tell me.. how a chocolate can share sweets?
 
4:37 PM
Reword it
I'm not 100% sure what you're asking
Are you saying this literally? As in how can a piece of choocolate share out sweets?
 
Yes
Because that's what I read from:
class Chocolate shares Sweets{
 
Focus on the chalkboard example
 
The same thing
 
how about this
package ...;

<imports bla bla..>

shares Color, KeyEvent;

public class Keyboard extends Canvas implements KeyListener{
public Keyboard(){
setBackground(WHITE);
}

@Override
public void keyTyped(KeyEvent e) {}
@Override
public void keyReleased(KeyEvent e) {
if(e.getExtendedKeyCode() == VK_UP){
setBackground(BLACK);
}
}
@Override
public void keyPressed(KeyEvent e) {
if(e.getExtendedKeyCode() == VK_UP){
setBackground(WHITE);
}
}
}
Notice how you don't need to do

KeyEvent.VK_UP
or
Color.WHITE
or
Color.BLACK
Do you understand?
 
That's very much like inheritance but specific to static methods and fields
I don't think it is necessary. And can be confusing.
 
4:44 PM
It's not really inheritence, because you can't say Keyboard instanceof KeyEvent = true
 
Very much like
I didn't say it was lol
 
You're making me upset Lewis
 
Lews..
And why?
 
Lewis
 
@BoskoMijin Wow you look very depressed in your picture. Cheer up man :O
 
4:47 PM
Hahaha
 
@ShaunWild And you are making me upset now
 
Let's all be upset together
 
Lol
 
Would anyone like a program that randomly generates roads?
 
On a map?
 
4:48 PM
Yes
 
A fictional road?
 
Yes
 
Why? For what purpose?
 
It uses Gaussian math and Hierarchical structuring to randomly generate road systems
I'm desiging the theory for it
Because I plan on transferring it into a game
 
I see
 
4:51 PM
I can't upload a preview image because it's 10000x10000 pixels :P
It brings my cpu temps right up trying to generate an image
 
lol
 
what was the last thing you made in Java?
 
I can't remember. I think a auction application
I haven't used Java since last year
 
Do you know how I can make a java program use all of the cpu?
This program is running at 70% cpu
but if it ran at 90 it would be better
 
I dunno, it depends on number of cores you I have guess.
Spread your application across those cores
 
5:05 PM
Ahh
 
 
2 hours later…
7:13 PM
hey
 
8:01 PM
hi
 

« first day (1099 days earlier)      last day (3833 days later) »