have you ever tried the key combination ALT + TAB? Not only you can see the icons but also the name of the program
have you ever tried the key combination ALT + TAB? Not only you can see the icons but also the name of the program
true, didn't think about it : - )!
thanks
Hello AleMonteiro, thanks for that, really nice of you.
How does that piece of software work? I mean you said you did exactly the same thing, in which way?
I can see a few problems with using C#:
1)I will have to make sure that it can be integrated with Wordpress - if I decide to use wordpress of course. Do you know how/where I could find out? DO you reckon on the worpress forum perhaps?
2) I don't know anything about C#, so I might need a hand with integration, implementation and maintenance
cheers
ok thanks, I did google it actually, I was expecting something similar to this in truth http://repair4laptop.org/wiki/Free_Take_Apart_Guide_for_the_ASUS_Pro_61S_Laptop
Chaps, I am thinking to build a nice picture blog, to upload pictures and add a bit of a blurb, just enough to describe the picture, and let people comment if they want to. Now, here's the thing: one of the main feature I would like to have, well really the most important one, is the ability to take a picture on my android phone when I am out and about and then upload it onto the website straight away, a bit like you do for facebook if that makes sense. Now, are you aware on any platform capable of doing this? I have an account with wordpress, so I was thinking to use that, but I was wondering if anybody has any experience in the above (uploading picture to your blog straight from the phone) and how doable it is. I don't think I will be able to develop an application that does it myself, I am not that skilled (I code in javascript and jquery and basic java so out of my reach really). What do you guys say?
cheers
karlcunanan, the thread is specifically about openCMS and not Joomla.
thanks.
@stultuske, yes I know, but I am not really tha familiar with the documentation as yet, I find it rather confusing...
no I haven't, reason being that I have to consult with the client about this first. The thing is, if this problem was something I had caused for whatever reason, then I would have applied your fix straight away, but because it seems to originate from a decision taken by the web browser (or whoever for them) then, things change quite radically. It is good to know that there is a fix though : -), thanks for providing it
thanks, it looks like it is a browser issue...
http://apple.stackexchange.com/questions/40835/how-to-force-coloured-display-of-visited-links-in-safari-5
If that's the case, too bad for them, I don't want to force the user. They have decided to step up privacy, then tehy will pay the consequences!
Hi all, does anybody know a good guide (step by step perhaps) that could help me to take apart my dell xps17? COuldn't find that much on google. I have to get to the back and have a look at the power connector
thanks
HI all, I have just come across this:System.out.printf("Student %2d: %3d\n");
What does that ":" mean? I assume it is a kind of separator becasue that line prints something like this:Student 1: 87
thanks
@migcosta, in response to your suggestion about changinga.linkStyle:link{
to thisa.linkStyle {
I am not sure that will work, my understanding is that the :link is needed, see this
http://www.w3schools.com/css/css_pseudo_classes.asp although they don't say anything about it here:
http://www.w3.org/TR/css3-selectors/#the-link-pseudo-classes-link-and-visited
ANy idea?
thanks
I will take the ram out and put it back in then, but as I said, the beeps don't sound like real beeps, as mentioned, you can barely hear them if you get very close to the laptop itself, it's not like a distinctive beep like the one you can hear in the video I posted. If it was like that, I wouldn't have any doubt that something is wrong, but the beeps I hear, are weird...and then as said, the beeps change, if I restart the machine (1Long 2Short)or if I switch it on again (2short). I'd record the beeps and post them here but chances are you won't hear them.
@rubberman: I appreciate that, I am not an engineer no, but I like to take apart machines and reassemble them when I have some time, kind of hobby. The laptop works fine, just these beeps at the beginning...
HI all, I wonder if you can help me at all. Today I changed the system battery to an Asus laptop, which had to be taken apart completely. I changed the battery and put it back together and everything was working ok. Now, when I switched it back on I heard 3 beeps (1 short and 2 long). I had a look online and apparently people say it is to signify a video problem. I have restarted the laptop a few times and only once I had a video problem, teh screen was flickering a bit near the 4 corners, that's it, after that the video seemed ok at every restart. After watching a couple of videos online I came to realize that my beeps are not as loud as they should be (take this video for the sake of argument http://www.youtube.com/watch?v=atzg6oJtMpA here you definitely hear them whereas mine are barely audible, you have to be very close to the laptop to hear them). So now I wonder, is there a problem with my machine or not?!
thanks
Ah sorry, here's an update: if I restart the machine then I get the 3 beeps above, but if I switch it off and then on again I only get 2 short beeps
Thanks AleMonteiro, if it was for me, like you I wouldn't worry about it, but the client wants me to resolve the issue, so I don't have a choice I am afraid (or at least I would have to come to an explanation as to why this is happening). The thing is, I have absolutely no idea why this happens, other browsers seems to be ok...
Sorry, maybe I wasn't clear.
@JorgeM: The questions shold ideally change colour when clicked on them and take the visited link colour as detailed in the css. At the moment they don't, they retain their original colour.
@migcosta, thanks for that, I wasn't aware this was the right way to do it. I have amended it now http://antobbo.webspace.virginmedia.com/various_tests/links/faqTest.html but I still have the same problem, in that, as described above, the colour of the clicked on question, doesn't change to a visited link. It should change from 2a00ff to ff00ae. How do I achieve that
HI guys, sorry to go on about these visited links. I have spotted an issue with safari, and it looks like it is only safari doing it (at least on windows). DOes safari have some special settings that need to be enabled/changed?
Same link as before, but different content this time:
http://antobbo.webspace.virginmedia.com/various_tests/links/faqTest.html
If you click on any of the anchor links (the letters from a to z) in every browser they behave the way they should, which is, change the colour from #2a00ff
to #ff00ae
.
In safari this doesn't happen: the links don't change colour, well some of them do, some others won't change unless you click on another link...very odd stuff. Does anybody have any idea why?
the css code is still the same for links:
/*STYLED LINKS*/
a.linkStyle:link{
color:#2a00ff;
}
a.linkStyle:visited{
color:#ff00ae;
}
a.linkStyle:hover{
color:#333333;
}
a.linkStyle:active{
color:#2a00ff;
}
/*STYLED LINKS*/
ANy help much appreciated as usual
thanks
HI all, not long ago I posted something about a similar issue http://www.daniweb.com/web-development/web-design-html-and-css/threads/447728/change-the-colour-of-visited-link-with-avisited
but this time it is slightly different. Ok, so here's the offending page http://antobbo.webspace.virginmedia.com/various_tests/links/faqTest.html
When you click on the question, the answer will slide down. Now, the links will always point to #, but I still need them to change colour when clicked on, and take the visited colour. From previous post I have learned that the fact that links point to # might be a problem, how do I get around it please?
The links have this styles in this order:
/*STYLED LINKS*/
a.linkStyle:link{
color:#2a00ff;
}
a.linkStyle:visited{
color:#ff00ae;
}
a.linkStyle:hover{
color:#333333;
}
a.linkStyle:active{
color:#2a00ff;
}
/*STYLED LINKS*/
Here's the full relevant code:
HTML:
<!-- START OF MAIN CONTENT -->
<div id="content">
<div id="theContent">
<h1>Frequently asked faqs</h1>
<p class="faq"><a href="#" class="linkStyle">Question n1</a></p>
<p class="answ">
This is the answ to the 1st FAQ faq that has been clicked to show how the answ would display. This is
the answ to the FAQ faq that has been clicked to show how the answ would display.
</p>
<p class="faq"><a href="#" class="linkStyle">Question2?</a></p>
<p class="answ">This is the answ to the 2st FAQ faq that has been clicked to show how the answ would display. This is
the answ to the FAQ faq that has been clicked to show how the answ would display.
</p>
<p class="faq"><a href="#" class="linkStyle">Question3?</a></p>
<p class="answ">This is the answ to the 3rd FAQ faq that has been clicked to …
well by add up I mean that, like in the above example, the first number will print at position number 5 (by position I mean that if you count using the cursor if the output is in the terminal) and the second number, because it is is floated right is printed at position 13, so 8+5.
thanks, yes it is a big headache really. It is a really good idea to wrap everything in a div, unfortunately I can't use spans with classes, because the website I am working on will be managed through a CMS which apparently won't allow the addition of classes within spans (yes I know...!) but I think I can get it to work with divs and margins
thanks
Thanks, so basically to make sure that everything is aligned, I have to have a div for each row
HI all, I am a bit confused about right justifying and formatting strings and numbers in general, and I was wondering if somebody can clarify this for me please. Ok, so let's take an example:
// Fig. 7.2: InitArray.java
// Initializing the elements of an array to default values of zero.
public class InitArray
{
public static void main( String[] args )
{
int[] array; // declare array named array
array = new int[ 10 ]; // create the array object
System.out.printf( "%s%8s\n", "Index", "Value" ); // column headings
// output each array element's value
for ( int counter = 0; counter < array.length; counter++ )
System.out.printf( "%5d%8d\n", counter, array[ counter ] );
} // end main
} // end class InitArray
Ok, so the first printf System.out.printf( "%s%8s\n", "Index", "Value" ); // column headings
prints off the string Index and the string Value with a field width of 8, meaning the the first character will be in 8th position (if you're ought to count the position), so the string index has 5 characters so the "V" of value will be positioned 3 characters after "Index":Index Value
The second System.out.printf( "%5d%8d\n", counter, array[ counter ] );
, on a separate line will start printing on the 5th character so the indexes are just below the 5th character which is the "x":
Index
0
The int instead has a field width of 8 charachters and will start printing at the 5+8th position, so 8 positions after …
Hi all, I am trying desperately to align correctly a set of 2 adjacent input boxes, but alas, this is turing into a nightmare and I wonder what guys you think it might be the best approach. Here's the code:
<html>
<head>
<title>test</title>
<style>
.theForm{
background-color:#f4f4f4;
margin-top:14px;
padding:25px 0 40px 25px;
font-size: 0.875em;/* 14/16*/
color: #333333;
}
.theForm #email, .theForm #residence {
margin:0 7% 14px 0; /*percentage is 42/600 */
width:52.33333333333333%; /* 314/600*/
float:right;
}
.theForm #theMonth {
width:14.5%; /* 87/600*/
margin:0 12px 14px 13%; /*percentage is 93/600 */
}
.theForm #theYear{
width:14.5%; /* 87/600*/
margin:0 10px 14px 0; /*percentage is 18/600 */
}
.theForm a#mandatory{
font-size:0.75em;/*12/16*/
}
.theForm select option{
color: #333333;
}
.theForm #theDay{
width:14.5%; /* 87/600*/
margin:0 12px 14px 18.83333333333333%; /*percentage is 93/600 */
}
.theForm #specificDay{
width:14.5%; /* 87/600*/
margin:0 10px 14px 0; /*percentage is 18/600 */
}
.clear{clear:both;}
#main{
width:600px;
margin:0 auto;
}
/*REGISTER FORM*/
</style>
</head>
<body>
<div id="main">
<div class="theForm">
<form>
Email address:<input type="text" name="email" id="email"><br>
<div class="clear"></div>
theMonth / theYear of birth:
<select name="theMonth" id="theMonth">
<option value="theMonth"></option>
<option value="January"></option>
<option value="February"></option>
<option value="March"></option>
<option value="April"></option>
<option value="May"></option>
<option value="June"></option>
<option value="July"></option>
<option value="August"></option>
<option value="September"></option>
<option value="October"></option>
<option value="November"></option>
<option value="December"></option>
</select>
<select name="theYear" id="theYear">
<option value="theYear"></option>
<option value="1940"></option>
<option value="1941"></option>
<option value="1942"></option>
<option value="1943"></option>
<option value="1944"></option>
<option value="1945"></option>
<option value="1946"></option>
<option value="1947"></option>
<option value="1948"></option>
<option value="1949"></option>
<option value="1950"></option>
<option value="1951"></option>
</select>
<a href="#" id="mandatory">Why this?</a>
<div class="clear"></div>
theDay of resignation:
<select name="theDay" id="theDay">
<option value="theMonth"></option>
<option value="January"></option>
<option value="February"></option>
<option …
ah yes, I suppose I can get rid of it, you're right! thanks for your help!
HI thanks, yes the image won't change, it's fixed but the background has some gradient at the top and bottom. I might use just the background colour as you have indicated and then perhaps create the gradient with css3? WOuld that be better?
thanks
thanks guys
Hi AleMonteiro, haven't hear from you for a while : - )!
Thanks for the code. I had a good look at it and applied it to my css, it works as you said. Going through the code I have noticed that after having applied pretty much everything the page still wasn't doing what I wanted it to do, but after changing the background declaration, ie, removing the background image url("banner.jpg") repeat-x scroll 0px 0px transparent;
and replacing it with background:#000;
so just the colour. This seems to be the magic trick if you like, but then I wonder, what if I want to use an image like I attempted to do? You said in the comment
using image as background here must take care of repeat-y so when the browser resize and this banner height increase the background will also increase
what do you exactly mean? The image I was using had of course a hight of its own, and had a small gradient even if it wasn't clear from the page, so I wonder how much should I increase the height?
thanks
ok sorry, I had another stab at it.
this is what I came back with. I have modified the code a little bit. The variavle colour is now of type Color because it calls a function of type Color (decideColour()
) that returns a value of type color which is then the object that contains the red, green and red. Then this g.setColor(decideColour());
uses the colour values that will be emplyed when the shapes are drawn. It seems to work fine, let me know if it is correct(I haven't done arrays yet so I can't really use them):
/*
p263 draw 10 random filled shapes in random colours, positions and sides
*/
//Shapes.java
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
import java.util.Random;
public class Shapes extends JPanel{
private static final Random randomShape = new Random();
public void paintComponent( Graphics g ){
super.paintComponent( g );
int width = getWidth();
int height = getHeight();
int shape;//holding the shape
Color colour;//holding the colour
int x;//holding x coordinate
int y;//holding y coordinate
int shapeWidth;
int shapeHeight;
for( int i = 0; i < 10; i++ ){
//determine the coordinates and size of shapes to draw
shape = decideShape();
colour = decideColour();
x = decideCoordinates( width );
y = decideCoordinates( height );
shapeWidth = decideSize( width );
shapeHeight = decideSize( height );
g.setColor(decideColour());
//switch statement for shape
switch( shape ){
case 1:
g.fillOval( x, y, shapeWidth, shapeHeight );
break;
case 2:
g.fillRect( x, y, shapeWidth, shapeHeight );
break;
}//shape switch
}//end of for loop
}//end …
uhm, I see thanks, but I can't quite understand how I could use it within the exercise. I could do something like this couldn' I?
/*
p263 draw 10 random filled shapes in random colours, positions and sides
*/
//Shapes.java
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
import java.util.Random;
public class Shapes extends JPanel{
private static final Random randomShape = new Random();
public void paintComponent( Graphics g ){
super.paintComponent( g );
int width = getWidth();
int height = getHeight();
int shape;//holding the shape
int colour;//holding the colour
int x;//holding x coordinate
int y;//holding y coordinate
int shapeWidth;
int shapeHeight;
for( int i = 0; i < 10; i++ ){
//determine the coordinates and size of shapes to draw
shape = decideShape();
colour = decideColour();
x = decideCoordinates( width );
y = decideCoordinates( height );
shapeWidth = decideSize( width );
shapeHeight = decideSize( height );
//switch statement for shape
switch( shape ){
case 1:
g.fillOval( x, y, shapeWidth, shapeHeight );
break;
case 2:
g.fillRect( x, y, shapeWidth, shapeHeight );
break;
}//shape switch
}//end of for loop
}//end of paintComponent method
//choose randomly the shape, 1 for oval, 2 for rectangle
public static int decideShape(){
int theShape = 1 + randomShape.nextInt(2);
// System.out.printf("Shape value returned is %d\n", theShape);
return theShape;
}
** //choose randomly the colour
public static int decideColour(){
Color theColour = new Color(randomShape.nextInt(256), randomShape.nextInt(256), randomShape.nextInt(256));
//System.out.printf("Colour value returned is %d\n", theColour);
return theColour;
}**
//choose random coordinates, x and y depending on …
Ok, it is better now: http://antobbo.webspace.virginmedia.com/test/responsive/test.html
I gave #banner
an absolute position and #cnes
a relative one. SO now when I resize the cnes logo stays there. This is good, but I still have the issue with the #logoText
that when resizing the windows ends up at the bottom of the banner, whereas I'd like it to be within the banner, so that the black background wraps around it. Is this still a positioning issue you reckon?
don't you feel like it's important fixed this issue you are having first than tackle on the media queries?
Yes you're totally right. I will test it and see how it goes. thanks
ok thanks, so say something like this then:
//randomColours
//generates random colours
//Rgb.java
import java.util.Random;
import java.awt.Color;
public class Rgb{
public static void main( String[] args){
Random randomValue = new Random();
for( int i=0; i < 10; i++ ){
Color newColour = new Color(randomValue.nextInt(255), randomValue.nextInt(255), randomValue.nextInt(255));
System.out.println("New colour is " + newColour);
}
}
}
This should give me the int valies of colours? However the output is
New colour is java.awt.Color[r=171,g=55,b=174]
New colour is java.awt.Color[r=72,g=212,b=84]
New colour is java.awt.Color[r=181,g=21,b=162]
New colour is java.awt.Color[r=81,g=161,b=131]
New colour is java.awt.Color[r=120,g=2,b=143]
New colour is java.awt.Color[r=252,g=205,b=143]
New colour is java.awt.Color[r=127,g=117,b=145]
New colour is java.awt.Color[r=88,g=156,b=225]
New colour is java.awt.Color[r=92,g=192,b=46]
New colour is java.awt.Color[r=189,g=158,b=175]
How do I return just int numbers I can use somewhere else?
thanks
thanks...wouldn't have a clue how to save the shapes sorry : -). From memory the method paintComponent()
is called implicitly, so this behaviour (whe you resize it is called) is normal isn't it?
Thanks for the code. So this Color color = new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255));
calls an integer between 0 and 255?
I will try, but bear in mind that then I will have to use some media queries to change the positions when the page shrink yeah?
Allowing threads on pirated software could potentially put Daniweb in a sticky legal position, so the appropriate response is to strongly suggest acquiring a legitimate copy of the software regardless of the problem
I can't disagree with that, in that being Daniweb a public forum of course we should encourage people to do the right thing nad not intalling pirated software, then everybody is free to do what they want, as long as they don't come here and openly say they support piracy. That said, I still believe that there are people there who could install a pirated copy of an os without knowing (an example: somebody has a problem and asks a friend to fix his computer and the 'friend' format his HD and install a fake copy of windows: now, who's fault is that?). So personally, although as said I can't disagree with deceptikon, I think we might be firm and helpful at the same time.
We dont know if the user installed it knowingly
True, we don't, but I guess we could give him the benefit of doubt, many people don't know what they're doing with their machines, and I think they shouldn't be penalised becasue of their ignorance.We've done what we should have which is, telling him to get rid of the pirated software and install a genuine copy and he doesn't seem one of those that goes on about supporting piracy, getting a pirate copy of this and that. I think it is safe to assume that the issue he's reporting doesn't have anything to do with his xp being pirated or not. That's just my opinion thought : - )
Chaps, I wonder if you can give me a hand with this. Here's the brief:
"Create a program that draws 10 random filled shapes in random colors, position and sizes. Method paintcomponent should contain a loop that iterates 10 times. In each iteration, the loop should determine whether to draw a filled rectangle or an oval, create a random color and choose coordinates and dimension at random. The coordinates should be chosen based on the panel's width and height. Lenghts of sides should be limited to half the width or height of the window. "
Right, so I managed to do that, code's here:
//ShapesTest.java
import javax.swing.JFrame;
public class ShapesTest{
public static void main( String[] args){
Shapes panel = new Shapes();
JFrame application = new JFrame();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
application.add( panel );
application.setSize( 600, 600 );
application.setVisible( true );
}
}
AND:
/*
p263 draw 10 random filled shapes in random colours, positions and sides
*/
//Shapes.java
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
import java.util.Random;
public class Shapes extends JPanel{
private static final Random randomShape = new Random();
public void paintComponent( Graphics g ){
super.paintComponent( g );
int width = getWidth();
int height = getHeight();
int shape;//holding the shape
int colour;//holding the colour
int x;//holding x coordinate
int y;//holding y coordinate
int shapeWidth;
int shapeHeight;
for( int i = 0; i < 10; i++ ){
//determine the coordinates and size of shapes to draw
shape = decideShape();
colour = decideColour();
x = decideCoordinates( width ); …
I agree, the user is not asking for advice about pirated software, he's just got an issue with his screen - as already mentioned he must have used the key combination to turn the screen upside down. He clearly doesn't know what he's talking about, it's irrelevant whether his version of xp is pirated or not (but I think everybody in this forum appreciate the advice given to unistall a pirated copy and install a genuine one).
Hi chaps, I wonder if you can help me with something. I am looking into responsive design a bit, and I was testing something here http://antobbo.webspace.virginmedia.com/test/responsive/test.html
Now, if you try to resize the window the cnes logo gets pushed under the "this is an extra bit" div: what I would like to happen instead is - when the cnes logo touched the "extra bit" - the "extra bit" div to be positioned under the star logo but still within the black background: in other words, I'd like the black background to extend and accomodate the "extra bit" div when that gets pushed down by the cnes logo. How would I achieve that please? Here's my code:
<!DOCTYPE html>
<html>
<head>
<title>TEST</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="wrapper">
<div id="page">
<div id="banner">
<div id="logo1">
<img src="small_LOGO.gif">
</div>
<div id="logoText">
<p>This is an extra bit</p>
</div>
<div id="cnes">
<img src="cnes.jpg" >
</div>
</div><!-- banner-->
</div><!-- page-->
</div><!-- wrapper-->
</body>
</html>
and the css:
#wrapper{
width:100%;
border:1px solid red;
min-height:43em;
}
#page{
width:75%;
border:1px solid magenta;
height: 40em;
margin:0 auto;
}
#banner{
background:url("banner.jpg") repeat-x 0 0;
height:65px;
border:1px solid blue;
}
#logo1{
border:1px solid red;
float:left;
}
#logoText {
width:350px;
float:left;
}
#logoText p{
border:1px solid blue;
color:white;
}
#cnes{
float:right;
height:60px;
border:1px solid yellow;
}
I just can't get that to work!
thanks
Sorry guys, I'd like to just confirm this, is it correct to have a p tag inside a form tag? Something like
<form action="demo_form.asp">
<p>This is a test.</p>
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
thanks
ah ok thanks guys. Is that because the target is the same and once a link is clicked effectively the target site become "visited" for all the links? Just trying to find an explanation
thanks
ah! yes they do, the html is actually the same for all the links at the moment in that it points to #
:...<a href="#" class...
Didn't occur to me that could be the cause. So once I insert the right url it will work correct?
thanks
HI all, I have a question about changing the colour of visited link with a:visited{}
: it doestn' seem to work the way I thought it would, or, more likely I am doing something wrong.
I have this situation:
.box1 a:link{
color:#ac2973;
text-decoration:none;
}
.box1 a:visited{
color:#6bb8c0;
}
.box1 a:hover{
color:black;
}
But I have more than 1 link in the div. Now, when I click on one of the link, all of them - even those on other divs - change the colour to be #6bb8c0
even if I haven't visited them. Is this normal?
thanks
Hi all, I am looking into responsive design and I have a problem with media query. Being pretty new to the whole responsive design business, it seems that media queries are quite a good way to deal with it. But IE7 and 8 don't seem to be able to read media queries, so I wonder what's the alternative/work around? Say I have something like
@media screen and (max-width:930px){
#Logo{
left:70%;
}
}
that changes the position of the Logo container when the screen is smaller than 930px, how do I translate this into something that IEs can read and execute?
thanks
thanks for the replies guys. When I asked the question, I suspected I didn't really need to worry about the number that goes as seed, it was just something I was curious to know. After having read your answers and duly checked the links provided, I came to realize that sometimes ignorance is bliss : - )!
thanks
Hi I wonder if somebody can help me with this. This programs simulates throwing a die 20 times:
import java.util.Random; // program uses class Random
public class RandomIntegers
{
public static void main( String[] args )
{
Random randomNumbers = new Random(); // random number generator
int face; // stores each random integer generated
// loop 20 times
for ( int counter = 1; counter <= 20; counter++ )
{
// pick random integer from 1 to 6
face = 1 + randomNumbers.nextInt( 6 );
System.out.printf( "%d ", face ); // display generated value
// if counter is divisible by 5, start a new line of output
if ( counter % 5 == 0 )
System.out.println();
} // end for
} // end main
} // end class RandomIntegers
I have read that often - maybe not in this instance but in general - for debugging purposes it helps to be able to generate always the same sequence of number, and to achieve that rather than having Random randomNumbers = new Random();
we should provide a seed argument like this Random randomNumbers = new Random(seedValue);
So if I change that particular line in the above program to something like Random randomNumbers = new Random(15);
the sequence of numbers generated is always the same at each roll of the die. Now, my question now is this: which number should I use as seed? I mean can I use any number, say 1, 30, 34, 100? What is the …
read everything already drjohn thanksm even the 2 manuals in the documentation, I was just hoping for somebody who used it to tell me how it is.
thanks
@LastMitch thanks, that's right, yes I haven't created it, it's just that it's good to know what it does I suppose. I take your point about learning it, although I might not have time to do this at the moment, but thanks
@gon1387 thanks for the eplanation, much appreciated. SO the combination of ?=
stands for "follows" and ?!
for "not follow"? I appreciate it is probably too simplistic and difficult to explain like this, but just so I get an idea
thank
thanks bguild, it all makes sense now that you have explained it. I guess I have lost the actual value of the variable while I was incrementing it, will try to be more careful next time : - )!
that said, taking this as example http://www.daniweb.com/software-development/cpp/threads/345155/calculating-the-pythagorean-triples and adapting it to java I came up with this:
...
for(int i = 1; i <= limitValue; i++){
side1 = i;
for(int j = 1; j <= limitValue; j++){
side2 = j;
for(int k = 1; k <= limitValue; k++){
hypothenuse = k;
if((Math.pow(side1,2)) + (Math.pow(side2,2)) == (Math.pow(hypothenuse,2))){
//System.out.println("third loop");
System.out.printf("%f\t: %f\t: %f\t\n",
side1, side2, hypothenuse );
}//if
}
}
}
...
which produced what looks like the desired output (I went up to 50 and not 500):
3.000000 : 4.000000 : 5.000000
4.000000 : 3.000000 : 5.000000
5.000000 : 12.000000 : 13.000000
6.000000 : 8.000000 : 10.000000
7.000000 : 24.000000 : 25.000000
8.000000 : 6.000000 : 10.000000
8.000000 : 15.000000 : 17.000000
9.000000 : 12.000000 : 15.000000
9.000000 : 40.000000 : 41.000000
10.000000 : 24.000000 : 26.000000
12.000000 : 5.000000 : 13.000000
12.000000 : 9.000000 : 15.000000
12.000000 : 16.000000 : 20.000000
12.000000 : 35.000000 : 37.000000
14.000000 : 48.000000 : 50.000000
15.000000 : 8.000000 : 17.000000
15.000000 : 20.000000 : 25.000000
15.000000 : 36.000000 : 39.000000
16.000000 : 12.000000 : 20.000000
16.000000 : 30.000000 : 34.000000
18.000000 : 24.000000 : 30.000000
20.000000 : 15.000000 : 25.000000
20.000000 : 21.000000 : 29.000000
21.000000 : 20.000000 : 29.000000
21.000000 : 28.000000 : 35.000000
24.000000 : 7.000000 : 25.000000
24.000000 : 10.000000 : 26.000000
24.000000 : 18.000000 : 30.000000
24.000000 : 32.000000 : 40.000000
27.000000 : 36.000000 : 45.000000
28.000000 : 21.000000 : 35.000000
30.000000 : 16.000000 : 34.000000
30.000000 : 40.000000 : 50.000000
32.000000 : 24.000000 : 40.000000
35.000000 : 12.000000 : 37.000000
36.000000 : 15.000000 : 39.000000
36.000000 : 27.000000 : 45.000000
40.000000 : 9.000000 : 41.000000
40.000000 : 30.000000 : 50.000000
48.000000 : 14.000000 : 50.000000
the thing is...why this is right and the other one is wrong?!