• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:29
CEST 15:29
KST 22:29
  • 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
[ASL21] Ro4 Preview: On Course0Code S Season 1 - RO8 Preview6[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
RepMastered™: replay sharing and analyzer site BGH Auto Balance -> http://bghmmr.eu/ Quality of life changes in BW that you will like ? [ASL21] Ro4 Preview: On Course Why there arent any 256x256 pro maps?
Tourneys
[ASL21] Ro8 Day 3 [Megathread] Daily Proleagues [ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Muta micro map competition What's the deal with APM & what's its true value
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread Daigo vs Menard Best of 10 OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1986 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
Hyrule19210 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 States17282 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
Portugal3300 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
WardiTV Invitational
12:00
Wardi Spring Cup
ByuN vs Rogue
Solar vs Ryung
Zoun vs Percival
Cure vs SHIN
WardiTV887
IntoTheiNu 675
TKL 228
IndyStarCraft 219
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Ryung 377
IndyStarCraft 219
TKL 211
Rex 137
Railgan 98
Vindicta 4
StarCraft: Brood War
EffOrt 1572
BeSt 969
ZerO 391
Mini 360
Rush 224
Last 170
Mind 131
hero 117
Pusan 112
ToSsGirL 64
[ Show more ]
Nal_rA 56
Sea.KH 52
Movie 39
sorry 38
Backho 35
Shinee 31
Shine 28
GoRush 20
yabsab 17
IntoTheRainbow 13
Rock 11
Noble 10
Icarus 7
Dota 2
Gorgc5168
monkeys_forever143
XcaliburYe133
Counter-Strike
x6flipin246
Heroes of the Storm
Khaldor228
Other Games
gofns29423
singsing2163
B2W.Neo1283
Liquid`RaSZi902
DeMusliM434
KnowMe194
ArmadaUGS52
ZerO(Twitch)21
MindelVK20
elazer11
Organizations
Counter-Strike
PGL35667
Other Games
gamesdonequick2869
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Adnapsc2 30
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1758
• TFBlade1186
Other Games
• WagamamaTV347
Upcoming Events
BSL
5h 31m
Dewalt vs DragOn
Aether vs Jimin
GSL
18h 31m
Afreeca Starleague
20h 31m
Soma vs Leta
Wardi Open
22h 31m
Monday Night Weeklies
1d 2h
OSC
1d 10h
CranKy Ducklings
1d 20h
Afreeca Starleague
1d 20h
Light vs Flash
Replay Cast
2 days
Replay Cast
3 days
[ Show More ]
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
Korean StarCraft League
5 days
RSL Revival
5 days
BSL
6 days
GSL
6 days
Cure vs TBD
TBD vs Maru
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
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.