• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:45
CEST 13:45
KST 20:45
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL22] Ro8 Preview: In A Tizzy9[ASL22] Ro16 Preview: Holy Diver5[ASL22] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9
Community News
Weekly Cups (Sep 13-20): herO scores triple1BSL Season 236Weekly Cups (Sep 7-12): SHIN, ByuN, MaxPax double down1StarCraft open world shooter announced at BlizzCon101Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10
StarCraft 2
General
Balance hotfix patch 5.0.16b (July 16) Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool How do you feel about the StarCraft shooter announcement at BlizzCon 2026? The Death of Cheese: From a Professional Cheeser Weekly Cups (Sep 13-20): herO scores triple
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) Sparkling Tuna Cup - Weekly Open Tournament 2026 GSTL Announcement RSL Revival: Season 6 - Qualifiers and Main Event RSL goes to London! 2026 Offline Finals Nov 21-22
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 544 Double Trouble The PondCast: SC2 News & Results Mutation # 543 Enhanced Defenses Mutation # 542 The Ascended
Brood War
General
NaDa's Body BW General Discussion BSL Season 23 screpdb: new Starcraft reporting tool an AI researcher's take on the ladder bot
Tourneys
[ASL22] Ro8 Day 2 [ASL22] Ro16 Group D [ASL22] Ro8 Day 1 [IPSL] IPSL is Back With Winter 26-27!
Strategy
Cliff Jump Revisited (1 in a 1000 strategy) Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation
Other Games
General Games
Nintendo Switch Thread Diablo IV Warcraft III: The Frozen Throne Stormgate/Frost Giant Megathread EVE Corporation
Dota 2
Dota 2 Champions League Season 3 Begins April 25! Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Artificial Intelligence Thread Things Aren’t Peaceful in Palestine All you football fans (soccer)!
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! [Manga] One Piece Diablo Animated Series on Netflix
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Gaming Intensity, Problemati…
TrAiDoS
38 yo Retired SWE loo…
PurE)Rabbit-SF
Can Bots Beat Pros?? Starcr…
namkraft
[meme] I finally understa…
LUCKY_NOOB
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
Customize Sidebar...

Website Feedback

Closed Threads



Active: 7886 users

The Big Programming Thread - Page 263

Forum Index > General Forum
Post a Reply
Prev 1 261 262 263 264 265 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 06 2013 18:37 GMT
#5241
Hey guys, so I am making a website and I want to incorporate a user login system. I am using phpmyadmin, lubuntu 12.10, html 4, and mysql. The problem I am having is that whenever I try to register a user, my browser just downloads register.php instead of adding the user to the database.

I think it has something to do with my apache2 conf files, but I haven't nailed it down.

I edited etc/apache2/mods-available/php5.conf and I created a .htaccess file in the same directory as my index.html where all it has in it is: Type application/x-httpd-php5 .php .phtml

Point is, I am totally lost and would love some insight! I am new to website programming.
LiquidLegends StaffWho is Jon Galt?
tofucake
Profile Blog Joined October 2009
Hyrule19257 Posts
March 06 2013 19:57 GMT
#5242
do you have php installed and enabled?
Liquipediaasante sana squash banana
tuho12345
Profile Blog Joined July 2011
4482 Posts
March 07 2013 01:41 GMT
#5243
Hi everyone, I've been spending the last 2 days try to figure out but I gave up. It looks like a simple homework except I don't know how or where to start. Please help me with this Java problem

here's the question and code
+ Show Spoiler +

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100, 200), and the second circle has center (200, 100). Draw the circles. If they intersect, then color both circles green. Otherwise, color them red. Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius. In your exercise, declare a class Circle and a method boolean intersects(Circle other).

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

/**
This class implements a Circle. It includes a method to test whether
two circles intersect.
*/
public class Circle
{
private double xCenter;
private double yCenter;
private double radius;
private Color color;

/**
Constructs a black circle.
@param x the x-coordinate of the center
@param y the y-coordinate of the center
@param r the radius
*/
public Circle(double x, double y, double r)
{
xCenter = x;
yCenter = y;
radius = r;
color = Color.BLACK;
}

/**
Sets the color of this circle.
@param aColor the color
*/
public void setColor(Color aColor)
{
color = aColor;
}

/**
Draws the circles.
@param g2 the graphics context
*/
public void draw(Graphics2D g2)
{
if (radius < 0)
return;

g2.setColor(color);
// draw the circle
Ellipse2D.Double circle
= new Ellipse2D.Double(xCenter - radius, yCenter - radius,
2 * radius, 2 * radius);
g2.draw(circle);
}

/**
Tests whether or not the two circles intersect with each other.
@param other the other circle
@return true the two circles intersect
*/
public boolean intersects(Circle other)
{

double distance;
distance =......
radius = radius + other.radius;
if (distance <= radius)
{
return true;
}
else
{
return false;

}
}
}


tester file

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import javax.swing.JComponent;
import javax.swing.JPanel;

/**
Shows two Circles and tests whether they intersect or not.
*/
public class CircleComponent extends JComponent
{
private Circle circle1;
private Circle circle2;


/**
Constructs a component for showing two circles.
@param r1 the radius of the first circle
@param r2 the radius of the second circle
*/
public CircleComponent( double r1, double r2)
{
String message;

circle1 = new Circle(100, 200, r1);
circle2 = new Circle(200, 100, r2);
Color color;
if (........)
color = Color.GREEN;
else
color = Color.RED;
circle1.setColor(color);
circle2.setColor(color);
}

public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;

circle1.draw(g2);
circle2.draw(g2);
}
}



I think I have the idea of finding distance and compare it with radius, however I don't know what's the right formula for calculating distance cause I haven't touched trig since like 9th grade. Also for the if statement in the tester file, i keep having error with the parameter for the argument.
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
Last Edited: 2013-03-07 01:58:25
March 07 2013 01:51 GMT
#5244
On March 07 2013 10:41 tuho12345 wrote:
Hi everyone, I've been spending the last 2 days try to figure out but I gave up. It looks like a simple homework except I don't know how or where to start. Please help me with this Java problem

here's the question and code
+ Show Spoiler +

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100, 200), and the second circle has center (200, 100). Draw the circles. If they intersect, then color both circles green. Otherwise, color them red. Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius. In your exercise, declare a class Circle and a method boolean intersects(Circle other).

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

/**
This class implements a Circle. It includes a method to test whether
two circles intersect.
*/
public class Circle
{
private double xCenter;
private double yCenter;
private double radius;
private Color color;

/**
Constructs a black circle.
@param x the x-coordinate of the center
@param y the y-coordinate of the center
@param r the radius
*/
public Circle(double x, double y, double r)
{
xCenter = x;
yCenter = y;
radius = r;
color = Color.BLACK;
}

/**
Sets the color of this circle.
@param aColor the color
*/
public void setColor(Color aColor)
{
color = aColor;
}

/**
Draws the circles.
@param g2 the graphics context
*/
public void draw(Graphics2D g2)
{
if (radius < 0)
return;

g2.setColor(color);
// draw the circle
Ellipse2D.Double circle
= new Ellipse2D.Double(xCenter - radius, yCenter - radius,
2 * radius, 2 * radius);
g2.draw(circle);
}

/**
Tests whether or not the two circles intersect with each other.
@param other the other circle
@return true the two circles intersect
*/
public boolean intersects(Circle other)
{

double distance;
distance =......
radius = radius + other.radius;
if (distance <= radius)
{
return true;
}
else
{
return false;

}
}
}


tester file

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import javax.swing.JComponent;
import javax.swing.JPanel;

/**
Shows two Circles and tests whether they intersect or not.
*/
public class CircleComponent extends JComponent
{
private Circle circle1;
private Circle circle2;


/**
Constructs a component for showing two circles.
@param r1 the radius of the first circle
@param r2 the radius of the second circle
*/
public CircleComponent( double r1, double r2)
{
String message;

circle1 = new Circle(100, 200, r1);
circle2 = new Circle(200, 100, r2);
Color color;
if (........)
color = Color.GREEN;
else
color = Color.RED;
circle1.setColor(color);
circle2.setColor(color);
}

public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;

circle1.draw(g2);
circle2.draw(g2);
}
}



I think I have the idea of finding distance and compare it with radius, however I don't know what's the right formula for calculating distance cause I haven't touched trig since like 9th grade. Also for the if statement in the tester file, i keep having error with the parameter for the argument.


http://www.purplemath.com/modules/distform.htm

Basically:
+ Show Spoiler +
[image loading]

That image looks like aids...

D = SQUAREROOT( ( x1 - x2)^2 + (y1 - y2 )^2 )

That should hopefully get you started. You can use the java Math library to compute a square root.

*edit* If you're a beginner at programming, my suggestion to you is to NEVER spend two days trying to figure out how to do things. Ask your professors and classmates and TL for help. There is no point banging your head against the wall for two days trying to figure it out yourself. Give it an honest shot. If you can't get it, then just ask for help.

Now if you're an experienced programmer programming DLL injections which uses detours to hook to a function and redirect it to a another program whose responsibility is to send input to another program through windows messages, then you can bang your head against a wall for two days.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
March 07 2013 02:00 GMT
#5245
On March 07 2013 03:37 JonGalt wrote:
Hey guys, so I am making a website and I want to incorporate a user login system. I am using phpmyadmin, lubuntu 12.10, html 4, and mysql. The problem I am having is that whenever I try to register a user, my browser just downloads register.php instead of adding the user to the database.

I think it has something to do with my apache2 conf files, but I haven't nailed it down.

I edited etc/apache2/mods-available/php5.conf and I created a .htaccess file in the same directory as my index.html where all it has in it is: Type application/x-httpd-php5 .php .phtml

Point is, I am totally lost and would love some insight! I am new to website programming.

Are you using Xampp?

I have no idea what your problem is.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
tuho12345
Profile Blog Joined July 2011
4482 Posts
March 07 2013 02:09 GMT
#5246
On March 07 2013 10:51 Abductedonut wrote:
Show nested quote +
On March 07 2013 10:41 tuho12345 wrote:
Hi everyone, I've been spending the last 2 days try to figure out but I gave up. It looks like a simple homework except I don't know how or where to start. Please help me with this Java problem

here's the question and code
+ Show Spoiler +

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100, 200), and the second circle has center (200, 100). Draw the circles. If they intersect, then color both circles green. Otherwise, color them red. Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius. In your exercise, declare a class Circle and a method boolean intersects(Circle other).

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

/**
This class implements a Circle. It includes a method to test whether
two circles intersect.
*/
public class Circle
{
private double xCenter;
private double yCenter;
private double radius;
private Color color;

/**
Constructs a black circle.
@param x the x-coordinate of the center
@param y the y-coordinate of the center
@param r the radius
*/
public Circle(double x, double y, double r)
{
xCenter = x;
yCenter = y;
radius = r;
color = Color.BLACK;
}

/**
Sets the color of this circle.
@param aColor the color
*/
public void setColor(Color aColor)
{
color = aColor;
}

/**
Draws the circles.
@param g2 the graphics context
*/
public void draw(Graphics2D g2)
{
if (radius < 0)
return;

g2.setColor(color);
// draw the circle
Ellipse2D.Double circle
= new Ellipse2D.Double(xCenter - radius, yCenter - radius,
2 * radius, 2 * radius);
g2.draw(circle);
}

/**
Tests whether or not the two circles intersect with each other.
@param other the other circle
@return true the two circles intersect
*/
public boolean intersects(Circle other)
{

double distance;
distance =......
radius = radius + other.radius;
if (distance <= radius)
{
return true;
}
else
{
return false;

}
}
}


tester file

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import javax.swing.JComponent;
import javax.swing.JPanel;

/**
Shows two Circles and tests whether they intersect or not.
*/
public class CircleComponent extends JComponent
{
private Circle circle1;
private Circle circle2;


/**
Constructs a component for showing two circles.
@param r1 the radius of the first circle
@param r2 the radius of the second circle
*/
public CircleComponent( double r1, double r2)
{
String message;

circle1 = new Circle(100, 200, r1);
circle2 = new Circle(200, 100, r2);
Color color;
if (........)
color = Color.GREEN;
else
color = Color.RED;
circle1.setColor(color);
circle2.setColor(color);
}

public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;

circle1.draw(g2);
circle2.draw(g2);
}
}



I think I have the idea of finding distance and compare it with radius, however I don't know what's the right formula for calculating distance cause I haven't touched trig since like 9th grade. Also for the if statement in the tester file, i keep having error with the parameter for the argument.


http://www.purplemath.com/modules/distform.htm

Basically:
+ Show Spoiler +
[image loading]

That image looks like aids...

D = SQUAREROOT( ( x1 - x2)^2 + (y1 - y2 )^2 )

That should hopefully get you started. You can use the java Math library to compute a square root.

*edit* If you're a beginner at programming, my suggestion to you is to NEVER spend two days trying to figure out how to do things. Ask your professors and classmates and TL for help. There is no point banging your head against the wall for two days trying to figure it out yourself. Give it an honest shot. If you can't get it, then just ask for help.

Now if you're an experienced programmer programming DLL injections which uses detours to hook to a function and redirect it to a another program whose responsibility is to send input to another program through windows messages, then you can bang your head against a wall for two days.

thanks, I've figured out the distance, now the condition for the tester.

//btw I like to figure shit out lol, I tried to ask friends around but they all afraid of spoiling everything and gave me really ambiguous answer and professor simply never cares about the questions from student, I even tried tutor service at school but a bunch of nerds sat there and no one even cares so fuck it lol
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
Last Edited: 2013-03-07 02:51:37
March 07 2013 02:50 GMT
#5247
On March 07 2013 11:09 tuho12345 wrote:
Show nested quote +
On March 07 2013 10:51 Abductedonut wrote:
On March 07 2013 10:41 tuho12345 wrote:
Hi everyone, I've been spending the last 2 days try to figure out but I gave up. It looks like a simple homework except I don't know how or where to start. Please help me with this Java problem

here's the question and code
+ Show Spoiler +

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100, 200), and the second circle has center (200, 100). Draw the circles. If they intersect, then color both circles green. Otherwise, color them red. Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius. In your exercise, declare a class Circle and a method boolean intersects(Circle other).

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

/**
This class implements a Circle. It includes a method to test whether
two circles intersect.
*/
public class Circle
{
private double xCenter;
private double yCenter;
private double radius;
private Color color;

/**
Constructs a black circle.
@param x the x-coordinate of the center
@param y the y-coordinate of the center
@param r the radius
*/
public Circle(double x, double y, double r)
{
xCenter = x;
yCenter = y;
radius = r;
color = Color.BLACK;
}

/**
Sets the color of this circle.
@param aColor the color
*/
public void setColor(Color aColor)
{
color = aColor;
}

/**
Draws the circles.
@param g2 the graphics context
*/
public void draw(Graphics2D g2)
{
if (radius < 0)
return;

g2.setColor(color);
// draw the circle
Ellipse2D.Double circle
= new Ellipse2D.Double(xCenter - radius, yCenter - radius,
2 * radius, 2 * radius);
g2.draw(circle);
}

/**
Tests whether or not the two circles intersect with each other.
@param other the other circle
@return true the two circles intersect
*/
public boolean intersects(Circle other)
{

double distance;
distance =......
radius = radius + other.radius;
if (distance <= radius)
{
return true;
}
else
{
return false;

}
}
}


tester file

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import javax.swing.JComponent;
import javax.swing.JPanel;

/**
Shows two Circles and tests whether they intersect or not.
*/
public class CircleComponent extends JComponent
{
private Circle circle1;
private Circle circle2;


/**
Constructs a component for showing two circles.
@param r1 the radius of the first circle
@param r2 the radius of the second circle
*/
public CircleComponent( double r1, double r2)
{
String message;

circle1 = new Circle(100, 200, r1);
circle2 = new Circle(200, 100, r2);
Color color;
if (........)
color = Color.GREEN;
else
color = Color.RED;
circle1.setColor(color);
circle2.setColor(color);
}

public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;

circle1.draw(g2);
circle2.draw(g2);
}
}



I think I have the idea of finding distance and compare it with radius, however I don't know what's the right formula for calculating distance cause I haven't touched trig since like 9th grade. Also for the if statement in the tester file, i keep having error with the parameter for the argument.


http://www.purplemath.com/modules/distform.htm

Basically:
+ Show Spoiler +
[image loading]

That image looks like aids...

D = SQUAREROOT( ( x1 - x2)^2 + (y1 - y2 )^2 )

That should hopefully get you started. You can use the java Math library to compute a square root.

*edit* If you're a beginner at programming, my suggestion to you is to NEVER spend two days trying to figure out how to do things. Ask your professors and classmates and TL for help. There is no point banging your head against the wall for two days trying to figure it out yourself. Give it an honest shot. If you can't get it, then just ask for help.

Now if you're an experienced programmer programming DLL injections which uses detours to hook to a function and redirect it to a another program whose responsibility is to send input to another program through windows messages, then you can bang your head against a wall for two days.

thanks, I've figured out the distance, now the condition for the tester.

//btw I like to figure shit out lol, I tried to ask friends around but they all afraid of spoiling everything and gave me really ambiguous answer and professor simply never cares about the questions from student, I even tried tutor service at school but a bunch of nerds sat there and no one even cares so fuck it lol


if ( circle1.intersects(circle2) )
color = Color.GREEN;
else
color = Color.RED;

You need to call the intersects function of circle 1 with circle 2 passed in as the object. Depending on whether or not they intersect it will change the color. You've got all the pieces now. You know the distance they're seperated by. How do you figure out whether or not they intersect?
tuho12345
Profile Blog Joined July 2011
4482 Posts
Last Edited: 2013-03-07 03:05:11
March 07 2013 03:02 GMT
#5248
On March 07 2013 11:50 Abductedonut wrote:
Show nested quote +
On March 07 2013 11:09 tuho12345 wrote:
On March 07 2013 10:51 Abductedonut wrote:
On March 07 2013 10:41 tuho12345 wrote:
Hi everyone, I've been spending the last 2 days try to figure out but I gave up. It looks like a simple homework except I don't know how or where to start. Please help me with this Java problem

here's the question and code
+ Show Spoiler +

Write a graphics program that asks the user to specify the radii of two circles. The first circle has center (100, 200), and the second circle has center (200, 100). Draw the circles. If they intersect, then color both circles green. Otherwise, color them red. Hint: Compute the distance between the centers and compare it to the radii. Your program should draw nothing if the user enters a negative radius. In your exercise, declare a class Circle and a method boolean intersects(Circle other).

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

/**
This class implements a Circle. It includes a method to test whether
two circles intersect.
*/
public class Circle
{
private double xCenter;
private double yCenter;
private double radius;
private Color color;

/**
Constructs a black circle.
@param x the x-coordinate of the center
@param y the y-coordinate of the center
@param r the radius
*/
public Circle(double x, double y, double r)
{
xCenter = x;
yCenter = y;
radius = r;
color = Color.BLACK;
}

/**
Sets the color of this circle.
@param aColor the color
*/
public void setColor(Color aColor)
{
color = aColor;
}

/**
Draws the circles.
@param g2 the graphics context
*/
public void draw(Graphics2D g2)
{
if (radius < 0)
return;

g2.setColor(color);
// draw the circle
Ellipse2D.Double circle
= new Ellipse2D.Double(xCenter - radius, yCenter - radius,
2 * radius, 2 * radius);
g2.draw(circle);
}

/**
Tests whether or not the two circles intersect with each other.
@param other the other circle
@return true the two circles intersect
*/
public boolean intersects(Circle other)
{

double distance;
distance =......
radius = radius + other.radius;
if (distance <= radius)
{
return true;
}
else
{
return false;

}
}
}


tester file

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;
import javax.swing.JComponent;
import javax.swing.JPanel;

/**
Shows two Circles and tests whether they intersect or not.
*/
public class CircleComponent extends JComponent
{
private Circle circle1;
private Circle circle2;


/**
Constructs a component for showing two circles.
@param r1 the radius of the first circle
@param r2 the radius of the second circle
*/
public CircleComponent( double r1, double r2)
{
String message;

circle1 = new Circle(100, 200, r1);
circle2 = new Circle(200, 100, r2);
Color color;
if (........)
color = Color.GREEN;
else
color = Color.RED;
circle1.setColor(color);
circle2.setColor(color);
}

public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;

circle1.draw(g2);
circle2.draw(g2);
}
}



I think I have the idea of finding distance and compare it with radius, however I don't know what's the right formula for calculating distance cause I haven't touched trig since like 9th grade. Also for the if statement in the tester file, i keep having error with the parameter for the argument.


http://www.purplemath.com/modules/distform.htm

Basically:
+ Show Spoiler +
[image loading]

That image looks like aids...

D = SQUAREROOT( ( x1 - x2)^2 + (y1 - y2 )^2 )

That should hopefully get you started. You can use the java Math library to compute a square root.

*edit* If you're a beginner at programming, my suggestion to you is to NEVER spend two days trying to figure out how to do things. Ask your professors and classmates and TL for help. There is no point banging your head against the wall for two days trying to figure it out yourself. Give it an honest shot. If you can't get it, then just ask for help.

Now if you're an experienced programmer programming DLL injections which uses detours to hook to a function and redirect it to a another program whose responsibility is to send input to another program through windows messages, then you can bang your head against a wall for two days.

thanks, I've figured out the distance, now the condition for the tester.

//btw I like to figure shit out lol, I tried to ask friends around but they all afraid of spoiling everything and gave me really ambiguous answer and professor simply never cares about the questions from student, I even tried tutor service at school but a bunch of nerds sat there and no one even cares so fuck it lol


if ( circle1.intersects(circle2) )
color = Color.GREEN;
else
color = Color.RED;

You need to call the intersects function of circle 1 with circle 2 passed in as the object. Depending on whether or not they intersect it will change the color. You've got all the pieces now. You know the distance they're seperated by. How do you figure out whether or not they intersect?

in intersects method I need an if statement like this

if (distance <= radius)
{
return true;
}
else
{
return false;

}

the tester file will call up that statement and if it's true - turn green, else - red.

Got it, all work now. Thanks a lot man!:D
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
Last Edited: 2013-03-07 03:09:49
March 07 2013 03:09 GMT
#5249
On March 07 2013 12:02 tuho12345 wrote:
the tester file will call up that statement and if it's true - turn green, else - red.

Got it, all work now. Thanks a lot man!:D


Yeah, and just as a friendly reminder:

Always put curly braces around single-line statements (trust me, someone will write code there not realizing it's not braced)

Like so:

if ( kitty )
{
doggy();
}


And fix your allman style coding:



if (distance <= radius)
{
return true;
}
else
{
return false;
}


Happy programming.
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 07 2013 06:54 GMT
#5250
On March 07 2013 04:57 tofucake wrote:
do you have php installed and enabled?


I have php installed. I think I have it enabled, but I am unsure now.

I installed php5, mysql, and phphmyadmin through the terminal the other day. Then I made a dbconfig.php, register.php, login.php, members.php, logout.php, and integrated them with my login.html and register.html.

When I try to register a user through register.html, my browser (chromium) just downloads register.php instead of sending the data to the database. I did many searches and it seemed like I did not have the apache2 conf files correctly configured. After editing what was suggested, I still have the same problem.

And I don't think I have Xammp installed. If you need more information or I am unclear, let me know.
LiquidLegends StaffWho is Jon Galt?
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 07 2013 07:05 GMT
#5251
On a different note, I feel like even though I graduated with a degree in Computer Science last May at a good university and did well - when I go to program many times I feel lost. I usually can start a program or website or what have you, but then I just get utterly lost and confused halfway through.

I know that a four year degree can not possibly cover everything needed, but sometimes I feel all my degree gave me was a large foundation in which now I am just starting to build upon.

I also have never had a programming internship. I had two internships but neither one involved programming unfortunately.

I guess what I am saying is I feel like I should know more and I don't. I have downloaded many books in all areas of computer programming and am reading those. I am going through the various tuutorials at w3schools, got rid of windows and use linux exclusively, and have tackled various projects (2 website, and one program) to help improve. Is there any other suggestions that you guys have to help me improve more?
LiquidLegends StaffWho is Jon Galt?
Craton
Profile Blog Joined December 2009
United States17303 Posts
March 07 2013 07:16 GMT
#5252
What you're feeling is pretty typical of those in your situation. Your workplace will typically have project/technical managers that will push projects along and deal with the "what do I do now" situation.
twitch.tv/cratonz
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
March 07 2013 07:28 GMT
#5253
On March 07 2013 16:05 JonGalt wrote:
On a different note, I feel like even though I graduated with a degree in Computer Science last May at a good university and did well - when I go to program many times I feel lost. I usually can start a program or website or what have you, but then I just get utterly lost and confused halfway through.

I know that a four year degree can not possibly cover everything needed, but sometimes I feel all my degree gave me was a large foundation in which now I am just starting to build upon.

I also have never had a programming internship. I had two internships but neither one involved programming unfortunately.

I guess what I am saying is I feel like I should know more and I don't. I have downloaded many books in all areas of computer programming and am reading those. I am going through the various tuutorials at w3schools, got rid of windows and use linux exclusively, and have tackled various projects (2 website, and one program) to help improve. Is there any other suggestions that you guys have to help me improve more?

When I first learned how to do Objective-C and iOS development, I started out with a book. I read the whole book straight through, manually typing out all the examples so I could immediately get a feel for the XCode UI and experience with debugging typos. After having finished the entire book and gained a firm understanding of how iOS coding works, when it came time to actually sit down and start my first project, I honestly didn't know what to do. And this is coming from someone who's been developing for quite a while. It took a long time, but eventually I was able to make the mental connections between what I had learned and how I needed to apply it. Now it's second nature. But only because I sat down and actually tried to do something with what I've learned.

I imagine it like a big block of super awesome wizardry in your head. You have the potential to do the magic, but you have to build the mental connections to it and that can only be done with experience. I think if you just keep on going the direction you are, you'll be fine.
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 07 2013 09:26 GMT
#5254
Thanks a lot!
LiquidLegends StaffWho is Jon Galt?
disco
Profile Blog Joined June 2009
Netherlands1667 Posts
Last Edited: 2013-03-07 09:52:09
March 07 2013 09:50 GMT
#5255
On March 07 2013 15:54 JonGalt wrote:
Show nested quote +
On March 07 2013 04:57 tofucake wrote:
do you have php installed and enabled?


I have php installed. I think I have it enabled, but I am unsure now.

I installed php5, mysql, and phphmyadmin through the terminal the other day. Then I made a dbconfig.php, register.php, login.php, members.php, logout.php, and integrated them with my login.html and register.html.

When I try to register a user through register.html, my browser (chromium) just downloads register.php instead of sending the data to the database. I did many searches and it seemed like I did not have the apache2 conf files correctly configured. After editing what was suggested, I still have the same problem.

And I don't think I have Xammp installed. If you need more information or I am unclear, let me know.


Did you install libapache2-mod-php5 and not just the php cli? (If you want to run php as a apache module that is, which I am assuming you do).

Using a package manager (apt-get) makes your life so much easier. It will automatically update the configuration files for you as well.
this game is a fucking jokie
KainiT
Profile Joined July 2011
Austria392 Posts
March 07 2013 10:02 GMT
#5256
Hey guys, I have a question
I will have have to do a c++ project for university(most likely some b+ tree implementation) which needs to be able to run on Linux
The problem is that I have Windows 7 as my main OS and I don't really want to code using a virtual os, cause the whole thing seems kinda slow,
So would it be a problem to code and test, etc in Windows(probably with Eclipse) and then compile it a final time on Linux after making some hopefully small adjustements? Or would I encounter a massive amount of errors, that are hard to remove? thx for your advice
With great power comes great responsibility.
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 07 2013 10:30 GMT
#5257
On March 07 2013 19:02 KainiT wrote:
Hey guys, I have a question
I will have have to do a c++ project for university(most likely some b+ tree implementation) which needs to be able to run on Linux
The problem is that I have Windows 7 as my main OS and I don't really want to code using a virtual os, cause the whole thing seems kinda slow,
So would it be a problem to code and test, etc in Windows(probably with Eclipse) and then compile it a final time on Linux after making some hopefully small adjustements? Or would I encounter a massive amount of errors, that are hard to remove? thx for your advice


I had the same issues in university as well.

I always coded in Windows using notepad++ from home. However, I would save all my work on university account using a mapped network drive and a vpn. Then using putty, I could connect to my university's linux computers where my work was saved and run it thought the putty terminal. Win win!
LiquidLegends StaffWho is Jon Galt?
JonGalt
Profile Joined February 2013
Pootie too good!4331 Posts
March 07 2013 10:32 GMT
#5258
On March 07 2013 18:50 disco wrote:
Show nested quote +
On March 07 2013 15:54 JonGalt wrote:
On March 07 2013 04:57 tofucake wrote:
do you have php installed and enabled?


I have php installed. I think I have it enabled, but I am unsure now.

I installed php5, mysql, and phphmyadmin through the terminal the other day. Then I made a dbconfig.php, register.php, login.php, members.php, logout.php, and integrated them with my login.html and register.html.

When I try to register a user through register.html, my browser (chromium) just downloads register.php instead of sending the data to the database. I did many searches and it seemed like I did not have the apache2 conf files correctly configured. After editing what was suggested, I still have the same problem.

And I don't think I have Xammp installed. If you need more information or I am unclear, let me know.


Did you install libapache2-mod-php5 and not just the php cli? (If you want to run php as a apache module that is, which I am assuming you do).

Using a package manager (apt-get) makes your life so much easier. It will automatically update the configuration files for you as well.


I have apt-get, the problem is I don't have internet save for the few times I go to an internet cafe.

I am not sure if I have libapaxhe2-mod-php5 installed. I feel like I only installed the php5 cli, so maybe that is it. I will explore this this weekend. Thanks!
LiquidLegends StaffWho is Jon Galt?
misirlou
Profile Joined June 2010
Portugal3316 Posts
March 07 2013 11:22 GMT
#5259
On March 07 2013 19:02 KainiT wrote:
Hey guys, I have a question
I will have have to do a c++ project for university(most likely some b+ tree implementation) which needs to be able to run on Linux
The problem is that I have Windows 7 as my main OS and I don't really want to code using a virtual os, cause the whole thing seems kinda slow,
So would it be a problem to code and test, etc in Windows(probably with Eclipse) and then compile it a final time on Linux after making some hopefully small adjustements? Or would I encounter a massive amount of errors, that are hard to remove? thx for your advice


If you are using eclipse or other IDE that isn't Visual Studio you will be mostly fine. The only thing you need is compile the code on a Linux Machine after you wrote it and tested it on Windows. However, some libs and commands are Windows or Linux only and you will have to be careful with those.
Ilintar
Profile Joined October 2002
Poland794 Posts
March 07 2013 12:46 GMT
#5260
On March 07 2013 03:37 JonGalt wrote:
Hey guys, so I am making a website and I want to incorporate a user login system. I am using phpmyadmin, lubuntu 12.10, html 4, and mysql. The problem I am having is that whenever I try to register a user, my browser just downloads register.php instead of adding the user to the database.

I think it has something to do with my apache2 conf files, but I haven't nailed it down.

I edited etc/apache2/mods-available/php5.conf and I created a .htaccess file in the same directory as my index.html where all it has in it is: Type application/x-httpd-php5 .php .phtml

Point is, I am totally lost and would love some insight! I am new to website programming.


You almost answered the question yourself.

You have to copy or link php5.conf from mods-available to mods-enabled.
Former webmaster @ WGTour.com / BWLauncher developer
Prev 1 261 262 263 264 265 1032 Next
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
11:00
2026 Week 24
IntoTheiNu 633
RotterdaM262
Rex85
SteadfastSC60
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 262
ProTech139
Rex 85
Has 76
SteadfastSC 60
StarCraft: Brood War
Britney 17078
Shuttle 3128
firebathero 1890
Bisu 949
BeSt 410
Stork 261
Light 240
Rush 234
Mini 163
Last 124
[ Show more ]
Snow 96
PianO 57
hero 49
Shinee 46
Hyun 42
Sharp 39
Shine 36
ToSsGirL 34
Aegong 33
HiyA 28
JYJ 28
zelot 26
Sexy 26
Hm[arnc] 20
sorry 18
Dota 2
Gorgc5518
Dendi656
Counter-Strike
kRYSTAL_69
Other Games
olofmeister1026
B2W.Neo514
XBOCT393
Lowko301
crisheroes294
DeMusliM181
Livibee138
Mew2King80
QueenE42
Organizations
Dota 2
PGL Dota 2 - Main Stream11348
StarCraft: Brood War
Afreeca ASL 469
[ Show 12 non-featured ]
StarCraft 2
• mYiSmile126
• StrangeGG 23
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• iopq 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• WagamamaTV152
Upcoming Events
The PondCast
22h 15m
Replay Cast
1d 12h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
GSL
3 days
Yamato Cup
4 days
Replay Cast
4 days
Afreeca Starleague
4 days
Soma vs Jaedong
WardiTV Weekly
4 days
Sparkling Tuna Cup
5 days
[ Show More ]
Afreeca Starleague
5 days
Leta vs Soulkey
PiGosaur Cup
6 days
Kung Fu Cup
6 days
Liquipedia Results

Completed

Super Anchor Qualifying S3
Blizzard Classic Cup 2026
Big Dog Cup 2026 Div 1

Ongoing

ASL Season 22
CSL 2026 AUTUMN (S22)
Acropolis #5
Acropolis #5 - GSA
Calamity Invitational
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Acropolis #5 - GSB
Acropolis #5 - GSC
BSL Season 23
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Custodian Cup
Copium Cup
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.