Violet_82 89 Posting Whiz in Training

thanks for you comments guys.
@bguild. It is interesting to find out that somehow all the values (I printed off them allSystem.out.println("\nSide1 is " + side1 + " side2 is " + side2+ " hypothenuse is " + hypothenuse);)
get to infinity, what I don't undestand is why they get to infinity in the first place. Then I realized that perhaps it's because I don't set any limit
to side1, side2 and hypothenuse, in that they keep incrementing, so that's might be why. SO I run a little test, and changed the three loops to this

        for(int i = 0; i <= limitValue && side1 <= limitValue; i++,side1++){
                side1 = Math.pow(side1, 2);     

                for(int j = 0; j <= limitValue && side2 <= limitValue; j++,side2++){
                    side2 = Math.pow(side2, 2);             

                    for(int k = 0; k <= limitValue && hypothenuse <= limitValue; k++,hypothenuse++ ){
                        hypothenuse = Math.pow(hypothenuse, 2);
System.out.println("\nSide1 is " + side1 + " side2 is " + side2+  " hypothenuse is " + hypothenuse);                    
                        if((side1 + side2) == hypothenuse ){
                                System.out.printf("%f\t: %f\t: %f\t",
                                side1, side2, hypothenuse );    

                            }//if                           
                        }//inner loop
                    }//side2 loop
            }//outer loop       

I added 3 more conditions to make sure that side1, side2 and hypothenuse don't grow to infinite, but still I got some funny output, here's what I got:

Side1 is 0.0 side2 is 0.0 hypothenuse is 0.0
0.000000        : 0.000000      : 0.000000
Side1 is 0.0 side2 is 0.0 hypothenuse is 1.0

Side1 is 0.0 side2 is 0.0 hypothenuse is 4.0 …
Violet_82 89 Posting Whiz in Training

Hi there, I have to calculate the pithagorean triplets up to 500 (it's an exercise I found on the deitel and deitel book) and I got a little stuck, in that it looks like I am getting an infinite loop. The exercise says to use a triple for loop, but obviously something is wrong there, well, I got something wrong there.
ANyway, here are the files:

//TripletsTest.java
public class TripletsTest{
    public static void main( String[] args){
        Triplets theTriplets = new Triplets(500);
        theTriplets.calculateTriplets();
        }   
    }



and



/*
Triplets.java
Write an application that displays a table of Pythagorean triple for side1, side2 and hypothenuse.
*/
public class Triplets{

    private double side1;//double because Math.pow takes 2 double arguments
    private double side2;
    private double hypothenuse;
    private int limitValue;

    //constructor
    public Triplets(int limit){
        limitValue = limit;
        }

    public void calculateTriplets(){

        for(int i = 0; i <= limitValue; i++,side1++){
                side1 = Math.pow(side1, 2);     

                for(int j = 0; j <= limitValue; j++,side2++){
                    side2 = Math.pow(side2, 2);             

                    for(int k = 0; k <= limitValue; k++,hypothenuse++ ){
                        hypothenuse = Math.pow(hypothenuse, 2);

                        if((side1 + side2) == hypothenuse ){
                                System.out.printf("%f\t: %f\t: %f\t",
                                side1, side2, hypothenuse );                            
                            }//if                           
                        }//inner loop
                    }//side2 loop
            }//outer loop       
        }           
    }

Any suggestion at all?
thanks

Violet_82 89 Posting Whiz in Training

Like something I really don't understand about templates: apparently there is only one default template but my understanding is that even if you use that, the layout of the page can be changed because elements can be dragged and dropped. Is that the case for navigation as well? In other words will I be able to build a site with whatever comes with the package, moving things around to completely change the layout, moving and customize the navigation, without developing other templates myself?
thanks

Violet_82 89 Posting Whiz in Training

thanks, no I need info specifically on Open CMS I am afraid, thanks, I thought somebody might know a bit about it : - )

Violet_82 89 Posting Whiz in Training

Hi all, can somebody please let me know where I can find a good guide on how to use and especially what's included and what you can accomplish with Open CMS (I believe it's an open source content management system, probably a bit like wordpress)?
ALso, if anybody has used it, please let me know how you find it, possibly main features as well?
thanks a lot

Violet_82 89 Posting Whiz in Training

yep I know about the innermost circle, more like a dot really...I think I see what you mean now, and perhaps my terminology wasn't correct in that by resizing I actually meant draw more circles as you increase the sixe of the window and draw less as you decrease it.
So taking on board what you said, I suppose we are talking about something like this in the for loop:

for(int i = 0; i < xPoint / 10; i++){
            g.drawOval(xPoint - (i * 5), yPoint - (i * 5), (i * 10), (i * 10));
            //System.out.printf("Width is %d \t and height is %d\n", xPoint, yPoint );

        }

If you look at the previous code, xPoint is equal to width / 2. So if the width is about 550 (I say about because if I print the value of the width it is actually coming back with a value of 484px so I assument he rest is taken by the frame) then xPoint being 275 means that the loop will draw 27 circles. SO if the width increases the number of circles will increase too. The think is, I have chosen to divide xPoint by 10 only because the size of the circle increases of 10 pixels each time, but I kind of feel that the proportions are not quite ok somewhere, kinda missing something? Or do you reckon it is just about right?
thanks for your help

Violet_82 89 Posting Whiz in Training

hi chaps, I am having some trouble decoding this regex in a javascript (wasn't entirely sure whether javascript was the right place to post this
since it has more to do with regex). I am very new to it - this is the first time I look into that - and desite having done a bit
of research online on various regex sites I am still not entirely clear how the followoing works:

function numberConversion(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

Basically I know this function change the passed parameter to a string and then inserts a comma after every 3 digits, but I'd like to know what each bit in the regex does.

-I know this \B makes sure that we don't look at te beginning of the string;
-I for the life of me couldn't determine what this combination does ?=. I know that the ? if preceded by a character will match that character once or 1 time, but here it seems to be used in combination with the = sign;
-(\d{3}) this is a group and basically says find a group of 3 digits;
- +: again the + sign from what I know means match the previous character once or more times, but here seems to be more like a kind of concatenation
operator
-(?!\d)) not entirely sure: does it means something like exclude a digit or something?
-g is a flag, and stands for global …

Violet_82 89 Posting Whiz in Training

thanks for the feedback, sorry for making these silly mistakes! Here 's an improved version of it, I got the circles to work but for some reason the circles don't resize when I make the window bigger/smaller...how's that?

//Ovals.java

import java.awt.Graphics;
import javax.swing.JPanel;

public class Ovals extends JPanel{

    public void paintComponent(Graphics g){
        super.paintComponent(g);
        //calculates the centre of the frame
        //int widthMiddle = ((getWidth()) / 2);
        //int heightMiddle = ((getHeight()) / 2);

        int width = getWidth();
        int height = getHeight();       
        System.out.printf("Width is %d \t and height is %d\n", width, height );

        //calculates the centre of the panel

        int xPoint = width / 2;
        int yPoint = height / 2;

        for(int i = 0; i < 10; i++){
            g.drawOval(xPoint - (i * 5), yPoint - (i * 5), (i * 10), (i * 10));
            //System.out.printf("Width is %d \t and height is %d\n", xPoint, yPoint );

        }

    }
}

and

//OvalsTest.java
//This program draws concentric circles starting fromt the middle of the frame
import javax.swing.JFrame;
public class OvalsTest{
    public static void main( String[] args){
        Ovals ovalsPanel = new Ovals();
        JFrame newFrame = new JFrame();

        newFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        newFrame.add( ovalsPanel );
        newFrame.setSize( 550, 550 );
        newFrame.setVisible( true );
    }
}

Any idea? thanks

Violet_82 89 Posting Whiz in Training

thanks mKorbel for your suggestions, but I must say - sorry I haven't done so in my previous post - I am at the very beginning of my java career so to speak, so I haven't done arrays yet, I am still at chapter 5 of my Deitel and deitel book, so what you've said above sounds rather obscure to me...
I appreciate there are a million mor efficient ways to optimize the code I posted, but I'd rather keep it simple - and perhaps rather inefficient for the time being.
I know you mean well but:

JPanel has implemented FlowLayout in API

What do you mean?

FlowLayout accepting only PreferredSize that came from JComponents back to the container (JPanel in this case)

Not sure what it means sorry

Painting in Swing, Graphics(2D) by default never returns any PreferredSize, have to override this Dimension

really don't know

don't forget to set coordinates to the getHeight/Weight, instead of calculating this coordinates on the fly, and then painting will be resizable with contianer (JPanel)

Do you mean declare the two variables as private and set them with a setter method?

I'd be put all Objects (Circles in your case) to the array, in all case, prepare these Objects before, including all required coordinates, then loop in array inside paintComponent only,

I'd rather keep it simple, I appreciate that arrays are better but haven't got that far yet

because paintComponent …

Violet_82 89 Posting Whiz in Training

hi all, I need to draw a series (10) concentric circles starting fromt he middle of the panel. This is what I have done, do you reckon it is ok?

//Ovals.java

import java.awt.Graphics;
import javax.swing.JPanel;

public class Ovals extends JPanel{

    public void paintCmponent(Graphics g){
        super.paintComponent(g);
        //calculates the centre of the frame
        int widthMiddle = ((g.getWidth()) / 2);
        int heightMiddle = ((g.getHeight()) / 2);
        //draw the rectangles
        for(int = i; i < 10; i++){
            g.drawOval(widthMiddle - (i * 10), heightMiddle - (i * 10), 1 + (i * 10), 1 + (i * 10));
        }
    }


}

and

//OvalsTest.java
//This program draws concentric circles starting fromt the middle of the frame
import javax.swing.JFrame;
public OvalsTest{
    public void static main( String[], args){
        Ovals ovalsPanel = new Ovals();
        JFrame newFrame = new JFrame();

        newFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        newFrame.add( ovalsPanel );
        newFrame.setSize( 250, 250 );
        newFrame,setVisible( true );
    }
}

thanks

Violet_82 89 Posting Whiz in Training

ok, got somewhere, but a little stuck now. So here's what I came up with:
first file Encrypt.java

    public class EncryptionTest{

    public static void main( String[] args){

        Encryption myNumber = new Encryption();
        myNumber.insertNumber();

    }   

    }

second file Encryption.java

//Encryption.java
import java.util.Scanner;

public class Encryption{
    private int number;//digit inserted by the user
    private int numberLenght;//to calculate the length
    //private int numberLeft;
    private int digit;

    public void insertNumber(){
        //System.out.print("digit is " + number + "\n");
        System.out.print("Insert your 4 digit int to convert and press enter: ");
        Scanner input = new Scanner(System.in);
        number = input.nextInt();
        System.out.printf("You have inserted %d\n", number);
        extractNumber();
        }
    private void extractNumber(){
        //System.out.printf("Digit inserted in previous method %d\n", number);
        int numberLenght = number;  

        while(number > 0){
            //int numberOfDigits += 1;
            digit = number % 10;            //4 123 u get 3
            encryptNumber(digit);           
            number /= 10;                       
            }
        } 

        private void encryptNumber(int toEncrypt){
            toEncrypt = ((toEncrypt + 7) % 10);
            String theNumber = String.valueOf(toEncrypt);
            System.out.print(theNumber );
            //return theNumber;
            }
    }

So the problem I have is that I need to change the order of the digits in the number that I have converted into string. The thing is the conversion happens in the encryptNumber()method, so is it better to return the string somewhere and then swap the digits or how? ANy advice please?
thannks

Violet_82 89 Posting Whiz in Training

Actually no, that's wrong. I have to have something like this

private void encryptNumber(){
        //System.out.printf("Digit inserted in previous method %d\n", number);
        int numberLenght = number;  

        while(numberLenght > 0){
            //int numberOfDigits += 1;
            digit = number % 10;            //4 123 u get 3
            numberLenght = number / 10;

with a digit variable that can hold the digit and keep the number as it is, plus a variable which is equal to the number to keep the loop running

Violet_82 89 Posting Whiz in Training

thanks, yesterday I have developed the function in a slight different way, what do you think of this?

    private void encryptNumber(){
        //System.out.printf("Digit inserted in previous method %d\n", number);
        int numberLenght = number;  

        while(numberLenght > 0){            
            number %= 10;           //4 123 u get 3
            numberLenght = number / 10;                     
            }

With this function I need a counter that tells me how many digits are left in the number so that the while loop can run numberLenght
what do you reckon?

Violet_82 89 Posting Whiz in Training

cool, thanks for this, much clearer now!

Violet_82 89 Posting Whiz in Training

ok this is really interesting, thanks. The only thing though with this approach is that I have to save each digit in a different int variable so that I can then process each single digit

Violet_82 89 Posting Whiz in Training

ok so sorry bit confused now, to summarize: I will read a 4 digits int, then what? COnvert each digit to char do all the calculations and back to in usingCharacter.digit(char ch, int radix)
thanks

Violet_82 89 Posting Whiz in Training

thanks. ABout the first way with toString, that I suppose means to turn the int into a string correct? But then if I do that and pick up each digit with charAt() I will have to change it back to an int when I divide/add the digits and then back again to string to apply the swap...?

Violet_82 89 Posting Whiz in Training

that's right it doesn't swap the digits as yet because that will go into the file that has the class and methods which is not "mapped" in the pseudocode. If you input a 4 digits int, how do you then change each digit? You will have to split the number correct?

Violet_82 89 Posting Whiz in Training

hi chaps, I would like to do this exercise taken from the deitel and deitel book, chap 4 exercise 4.38, in brief: "Write an application that reads a 4 digit int and encrypt it replacing each digit with the result of addin 7 to it and getting the reminder after dividing the new value by 10. Then swap the first digit with the 3rd and swap the second with the fourt, then print the encrypted digit".
Now bearing in mind that I am only allowed to use a while statement (no for loops, no array, no switch and assuming the user enters numbers and not letters) becaue I haven't done them as yet, here's my pseudocode, and I would appreciate some feedback on it, if I am doing it right or wrong:

declare variables: digit, counter
input 1 digit
increment counter
print the inserted digit (just for testing purposes)
while counter > 0 and <=4
    encrypt the digit
    insert another number
    print the inserted digit (just for testing purposes)
    increment counter
    Print each digit of the password

But I have a few questions:
1)The user will enter a digit one by one rather than a 4 digits int, is that ok?
2)I am thinking to have 2 files, one with a main method and another one with the class, variables and methods, but I wonder, when writing pseudocode, do you write it for both files? Take the example above, I don't say in there how …

Violet_82 89 Posting Whiz in Training

vishnu.khera.5, tux4life's suggestion helped as said, I am just a bit confused by the number of ways you can set up environment variables

Violet_82 89 Posting Whiz in Training

thanks tux4life, that worked. Can I ask - I don't know much about environment variable to be honest - but before reading your post I tried something else I found on the net http://www.itcsolutions.eu/2010/11/29/set-environment-variables-in-windows-7-for-java/ and it didn't work in that I could compile my program ok but I couldn't run it, wa it because it is not linking to the bin folder?
thanks

Violet_82 89 Posting Whiz in Training

Hi all, I have just installed the jdk on a windows7 machine 64bit. I run the first test application in the terminal and got the following message: "'java' is not recognized as an internal or external command, operable program or both file". So I had a look online and found this tutorial http://java.com/en/download/help/path.xml which unfortunately it doestn't tell you what to modify the path variable to.
Now, looking on the Environment variables window, under system variables I have lots of variables and then there is a "Path" (not PATH though, not sure whether capitalization here makes a difference) which as a value has

C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\;c:\Program Files (x86)\Common Files\Ulead Systems\MPEG

One important thing to notice is that I have installed the 64bit version of the JDK because my machine has a 64bit version of windows, but for some strange reason the above Path variable seems to have a 32bit...
Now, can anybody kindly tell me what this should be changed to, or if I need to set up a new PATH and how so I can get the windows terminal to work properly
I so hate windows, I installed the jdk in ubuntu and everything worked perfectly...

Violet_82 89 Posting Whiz in Training

oh brilliant, thanks a lot!

Violet_82 89 Posting Whiz in Training

Hi all, I am having a few problems with a css. Basically in my conditional css I need to target IE9 and below (IE9 included). Now, I have this:

<!--[if IE 9]>
...
<![endif]-->

and

<!--[if lt IE 9]>
...
<![endif]-->

Can I combine them together somehow?
thanks

Violet_82 89 Posting Whiz in Training

well first of all, should I include an import java.util.Formatter when I use for example String.format(...?
In this code
System.out.printf("\nSalary: \u00A3%.2f", employee2.getSalary());
If I read the documentation I can't really find this format anywhere, that's what 's confusing me
thanks

Violet_82 89 Posting Whiz in Training

ok thanks, quite an involved reading though, not sure I understood everything...

Violet_82 89 Posting Whiz in Training

ok thanks for that

Violet_82 89 Posting Whiz in Training

oh right, that's interesting. So basically it's a bit like the price of petrol you mean, say £1,489.00 will be 148900. But how do I then format it as a tring? Is there a specific class in java the can do it, or should I do it manually

Violet_82 89 Posting Whiz in Training

thanks all for the replies. bguild, I tried what you suggested and yes problem solved. SO basically by using 10%% rise are we somehow escaping the %? Shouldn't have it been something like /%? Just so I understand exactly what's going on
thanks

Violet_82 89 Posting Whiz in Training

I see what you mean thanks, so which type should I declare my variable if it holds money?
thanks

Violet_82 89 Posting Whiz in Training

Hi there, I have opened another thread even if the program is very similar.
I have modified some code I have produced earlier and now I am getting some runtime errors, and I can't quite understand why.
Now, here's the code:
EmployeeClass.java

public class EmployeeClass{ 
    private String firstName;
    private String lastName;
    private double salary;

    //constructor taking 3 parameters
    public EmployeeClass(String name, String surname, double money){
        firstName = name;
        lastName = surname;
        salary = money;
    }

    //setters to set the instance variables
    public void setName(String name){
        firstName = name;
    }
    public void setLastName(String surname){
        lastName = surname;
    }
    public void setSalary(double money){
        if(money >= 0.0){
            salary = money;
        }
    }

    //getters to get the values back
    public String getName(){
        return firstName;
    }
    public String getLastName(){
        return lastName;
    }
    public double getSalary(){
        return salary;
    }

    //salary rise of 10%
    public double salaryIncrease(){
        salary += ((salary / 100) * 10);
        return salary;
    }
}

Employee.java

import java.util.Scanner;

public class Employee{
    public static void main(String[] args){
        EmployeeClass employee1 = new EmployeeClass("your name 1", "your surname 1", 0.0);
        System.out.println("\nPrinting values '1' initialized by the constructor.");
        System.out.printf("Name: %s", employee1.getName());
        System.out.printf("\nSurnname: %s", employee1.getLastName());
        System.out.printf("\nSalary: \u00A3%.2f", employee1.getSalary());

        EmployeeClass employee2 = new EmployeeClass("your name 2", "your surname 2", 0.0);
        System.out.println("\nPrinting values '2' initialized by the constructor.");
        System.out.printf("Name: %s", employee2.getName());
        System.out.printf("\nSurnname: %s", employee2.getLastName());
        System.out.printf("\nSalary: \u00A3%.2f", employee2.getSalary());

        //input data for employee1
        Scanner input = new Scanner(System.in);
        System.out.println("\nFirst employee's details");
        System.out.println("Name: ");
        String theName = input.nextLine();

        System.out.println("Surnname: ");
        String theSurnname = input.nextLine();

        System.out.println("Salary: \u00A3");
        double theSalary …
Violet_82 89 Posting Whiz in Training

thanks, I think I have found it here http://www.sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm

No it doesn't say anything about not using that notation to represent money, why is it bad?
thanks

Violet_82 89 Posting Whiz in Training

Hi all,
finally following the advice on this forum I got hold of the Deitel and Deitel java how to program 9th edition! Great book I must say so far (only got to chapter 3). Now, I am doing some of the exercises as I go along, and today I have done 3.14:

p 137 ex 3.14 EMPLOYEE CLASS: create a class called Employee that includes three instances variables - a first name (string), a last name (string) and a monthly
salary (double). Provide a constructor that initializes the three instance variable. Provide a set and get method for each instance variable. If the monthly salary is
not positive do not set its value. Write a test application named employeeTest that demonstrates class Employee's capabilities. Create two Employee objects and
display each object's yearly salary. Then give each employee a 10% raise and display each Employee's yearly salary

It all went quite well, but there are a few things I had some problems with. My program has 2 files Employee.java and EmployeeClass.java:

//Employee.java
public class Employee{
    public static void main(String[] args){
        EmployeeClass employee1 = new EmployeeClass("your name 1", "your surname 1", 0.0);
        System.out.println("Printing values '1' initialized by the constructor.");
        System.out.printf("Name:%s ", employee1.getName());
        System.out.printf("\nSurnname:%s ", employee1.getLastName());
        System.out.printf("\nSalary:" + employee1.getSalary());

        EmployeeClass employee2 = new EmployeeClass("your name 2", "your surname 2", 0.0);
        System.out.println("\n\nPrinting values '2' initialized by the constructor.");
        System.out.printf("Name:%s ", employee2.getName());
        System.out.printf("\nSurnname:%s ", employee2.getLastName());
        System.out.printf("\nSalary: " + employee2.getSalary());

        //setting the values of the instance variables …
Violet_82 89 Posting Whiz in Training

As far as I can see, it looks like IE9 doesnt' round the pixel: say you get a value of 12.13px, then it attempts to render that, as opposed to IE7 and 8 that will round it down to 12px

Violet_82 89 Posting Whiz in Training

uhm, I see thanks, but how does that apply to text as opposed to divs? I mean, is it the same thing in terms of size?

Violet_82 89 Posting Whiz in Training

thanks, read that, but it is slightly different, in that it rounds number ending with .5, whereas I need oto understand how the whole thing works with numbers ending with any digit, like the one I posted above, and also I don't really want to change the behaviour of the browser, I am just interested in what it does when it comes across these numbers. I mean there they talk about subtracting percentages to make sure that the numbers get rounded up/down to the desired one, whereas I just need to find out what happens
thanks

Violet_82 89 Posting Whiz in Training

Hi all, I was looking into determine the size of some text on 2 websites (basically it is 2 websites a dev and a live copy and I wanted to determine whether they are the same on every browser) and because I couldn't find a way to do that in IEs, I thought I will write a very small internal script to find out:

<script>
var size = $(".myDiv p").css("font-size");
console.log("The size is: " + size);
</script>

That worked ok but I am now trying to put the values I got back from it in use. In IE9 the first website returned this value: 11.93px; The second 12.13px. Now my question is about rounding up and down. From memory and experience I think IEs round everything up, which, in a case like 9.5px is quite easy, because you will get 10px, but what about in relation to the values output above? What's the real size of the text in pixel?
Also, how about the other browsers? Having a quick look around I found this http://ejohn.org/blog/sub-pixel-problems-in-css/ which helps to an extent, but still not quite clear
ANy idea?
thanks

Violet_82 89 Posting Whiz in Training

ok thanks

Violet_82 89 Posting Whiz in Training

ah sorry, one more screenshot...it actually does say something about an unknown device devices_prob

I have also used microsoft fix and it came back with some errors, screenshot of that too fix_it
Needless to say it doestn' fix anything

Violet_82 89 Posting Whiz in Training

HI all, I am experiencing a very weird problem. I dont' seem to be able to read from any usb. When I insert one windows recognize it in that it play the usb sound and even it shows that up - eventually - in my computer (although with a significant delay) but when I click on it it just hangs forever and doesn't get there. Went into control panel, device manager but everything seems ok, see attachment.
ANy idea?

Violet_82 89 Posting Whiz in Training

thank you all guys for the suggestions and avices. COuple of things:

The definition of setTimeout does not have that parameter, so it would only be possible if you make a new function that would enable this.

I suppose this translates in what stbuchok has done, another function. But what do you mean exactly by setTimeout not having the "this" parameter? Do you mean that it doesn't accept it in general or just this time because of the way I have construct the function?

You can add the jQuery function delay.

I had a look at the api, and is it correct to say that the delay method might cause problems if you run it too many times, in that it doesn't have the equivalent of the queue: false to stop the animation? For example I am thinking about the above code triggered by a button: if you go click frenzy and click the button 10-15 times then how do I make sure that jquery doesn't go nuts?
thanks

Violet_82 89 Posting Whiz in Training

Hi guys,
if you have an anonymous function sitting within an each function and I would like to use the this parameter within the anonymous function, how would
I do it? Currently it returns an error saying "SyntaxError: missing formal parameter setTimeout(function(this){". I am trying to apply a delay of 1 seconds
to a an image that moves in a new position
Thanks

...
$(".container > a > img").each(function(){
var opacityVal = $(this).css('opacity');
...
setTimeout(function(){
$(this).animate({left:newVal});

},1000);
});
Violet_82 89 Posting Whiz in Training

thanks for the explanation

Violet_82 89 Posting Whiz in Training

true, but gmail and other mainstream providers are trackable in that they require js to work and I seem to remember they also attach your ip address, tormail is not. Maybe I am making a lot of fuss for nothing, I mean the blog won't trade military secrets or anything like that, it's just a silly blog about commenting the news of the day, that's all. I just didn't want anybody to be able to associate it with me because people seem to get upset very easily if you say something they don't agree with, so I thought I will play safe and make an effort to be anonymous, but perhaps it's not needed. Fact is I haven't seen many blogs of that kind around and that made me suspicious, enough to consider the "anonymity" option. Still, it is interesting to talk about anonymity anyway I believe!

Violet_82 89 Posting Whiz in Training

I have bought the laptop already thanks

Violet_82 89 Posting Whiz in Training

Hi there, I would like to start an anonymous blog. The reason is that I simply don't want people to associate its content with my name, I am not planning to post anything dodgy on it. Now, here's my strategy, please let me know if you have any suggestion. I will use tor and then create an anonymous email address, perhaps using tormail, then sign up with wordpress and create the actual blog. How about hosting, what should I do, should I use a free hosting? any suggestion's welcome as usual
thanks

Violet_82 89 Posting Whiz in Training

thanks for that guys

Violet_82 89 Posting Whiz in Training

Hi thanks, yes sorry I meant player = new Player(parameter1, parameter2);. Ah ok, I thought that the variable declaration Player player; and player = new Player(parameter1, parameter2); had to be in the same declaration, but I seem to understand that it is not the case
thanks

Violet_82 89 Posting Whiz in Training

HI all, I am having a little problem with the following program. Here are the files:
Player.java:

import java.text.DecimalFormat;

public class Player {   
    private String name;
    private double average; 

    public Player(String name, double average) {
        this.name=name;
        this.average=average;
    }

    public String getName() {
        return name;
    }

    public double getAverage() {
        return average;
    }

    public String getAverageString() {
        DecimalFormat decFormat = new DecimalFormat();
        decFormat.setMaximumIntegerDigits(0);
        decFormat.setMaximumFractionDigits(3);
        decFormat.setMinimumFractionDigits(3);
        return decFormat.format(average);    
    }
}

ShowTeamFrame.java:

import java.io.IOException;

class ShowTeamFrame {

    public static void main(String args[]) 
                               throws IOException {
        new TeamFrame();
    }
}

TeamFrame.java

import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.GridLayout;

@SuppressWarnings("serial")
public class TeamFrame extends JFrame {

    public TeamFrame() throws IOException {
        Player player;
        Scanner keyboard = 
                    new Scanner(new File("Hankees.txt"));

        for (int num = 1; num <= 9; num++) {
            player = new Player(keyboard.nextLine(),
                                keyboard.nextDouble());
            keyboard.nextLine();

            addPlayerInfo(player);
        }        

        setTitle("The Hankees");
        setLayout(new GridLayout(9, 2, 20, 3));
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    }

    void addPlayerInfo(Player player) {
        add(new JLabel("  " + player.getName()));
        add(new JLabel(player.getAverageString()));
    }   
}

My problem is with the constructor: where does it get called? I would have thought in this line
Player player; but shouldn't this be Player player = new Player();?
thanks

Violet_82 89 Posting Whiz in Training

HI all, yes it's like you said in the end. Funny business, never had a laptop where the battery led is off when fully charged. I guess whatconfused thng even more is the fact that I have never heard of brand new laptop battery being fully charged, in my experience they are only half full or something like that. I used it a bit without the acdc adapter and then plugged it in again, and the light went on. Thanks for your help : - )