collapse collapse

* Who's Online

  • Dot Guests: 83
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11163
  • stats Total Topics: 1699
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 248

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - GodLord

Pages: [1] 2 3 4 5 6 ... 15
1
Project Advertisment / Re: Celestial Coding Tutorial Center
« on: February 24, 2011, 07:52:23 pm »
Since we had problems with us MSN before, could I just give you an email address for you to send it to?

2
General Talk / Re: The date has been set!
« on: February 17, 2011, 08:07:25 pm »
Hope to be there with you soon.

3
C++ / Using variables from header files?
« on: February 17, 2011, 08:04:15 pm »
header.h
Code: C++
  1. #ifndef
  2. #define HEADER_H
  3. class myClass{
  4. public:
  5.       int j;
  6. };
  7. #endif
main.cpp
Code: C++
  1. #include <iostream>
  2. #include "test.h"
  3. int main(int argc,  _TCHAR* argv[])
  4. {
  5.       cout << test::j << endl;
  6.       return (0);
  7. }

What is the problem with this? Also what is the difference between:
Code: C++
  1. #include <test.h>
And:
Code: C++
  1. #include "test.h>

4
Physics / Magnitude of a Net Charge within a closed surface
« on: February 13, 2011, 08:59:29 pm »
1. The problem statement, all variables and given/known data

A closed surface with dimensions a = b =
0.254 m and c = 0.4064 m is located as in
the figure. The electric field throughout the
region is nonuniform and given by ~E = (α +
β x^2)ı where x is in meters, α = 4 N/C, and
β = 6 N/(C m2).

Picture of object attached.

What is the magnitude of the net charge
enclosed by the surface?
Answer in units of C.

2. Relevant equations

Gauss's Law: flux = integral(E dA) = Q/permittivity constant

permittivity constant(epsilon naught) = 8.85E-12

3. The attempt at a solution

I know that the object doesn't not have any flux through any of the sides except the left and right sides(those parallel to the electric field). So I thought to find net flux and multiply that by the permittivity constant and find the net charge enclosed.

Flux1 = (α +β (a+c)^2)*(a*b) = electric field * area of the side(right)
Flux2 = (α +β (a)^2) * (a*b) = Electric field * area of the other side(left)

Then:
Flux1 + Flux2 = 0.709925351759
Therefore I multiply by epsilon naught:
net flux * epsilon naught = 6.28283939307E-12

However this is wrong, I believe I am messing up because of the weird way they are giving the electric field as, or possibly my entire calculations or process?

5
General Talk / Re: Words With Meaning
« on: May 14, 2010, 09:50:06 pm »
113. GodLord
114. Celestialkey
115. eczuo
116. NightSky
117. IonDuel
118. wersD
119. Azrathud
120. isaro

6
Java / Event Handlers -- Java
« on: April 25, 2010, 01:26:53 am »
In the last tutorial I showed how to make a basic GUI system. It wasn't anything great but I will use that same code because it has already been explained.


To start off event handlers are basically listeners which wait for something to happen in your GUI then do something else!

The event handlers which buttons use is called the ActionListener. You must implement this class into your's and then define it's only abstract method called:

actionPerformed(ActionEvent)

The best way is to learn by example:
Code: Java
  1. /*
  2. //mainGUI.java
  3. //@author: GodLord
  4. //
  5. */
  6.  
  7. import javax.swing.*;//all required to use the correct classes to create a
  8. import java.awt.*;//healthy GUI system
  9. import java.util.*;
  10. import java.awt.event.*;//imported to allow events!!!!!!
  11.  
  12.  
  13. //ADDED!!!!!!!!!!!!!!!!!!!!!!! implementing ActionListener below!
  14.  
  15. public class mainGUI extends JFrame implements ActionListener{//extends is Java's way of inheriting other classes
  16.        
  17.         Container context = getContentPane();//places the Container inside the JFrame
  18.        
  19.         JButton button = new JButton("BUTTON");//creates a button!! and names it "BUTTON"
  20.         JButton button2 = new JButton("BUTTON2");//same same
  21.         JButton button3 = new JButton("BUTTON3");//same same
  22.        
  23.         mainGUI(){//constructor IMPORTANT!! you MUST place ALL formatting of you GUI in the CONSTRUCTOR!!
  24.                 context.setLayout(new FlowLayout(FlowLayout.CENTER));//sets the layout of the GUI to a center flow, meaning
  25.                         //everything will be in the center of the GUI
  26.                        
  27.                 context.add(button);//places the button inside of the GUI
  28.                 context.add(button2);//same same
  29.                 context.add(button3);//same same
  30.                
  31.                 //ADDED!!!!!!!!!!!!!!!
  32.                
  33.                 button.addActionListener(this);//IMPORTANT this places a listener on the button
  34.                 button2.addActionListener(this);//same same
  35.                 button3.addActionListener(this);//same same
  36.                 //if the actionlistners are not added it will NOT work
  37.                
  38.                 //IMPORTANT the order you place the components in the GUI is the order they APPEAR!!
  39.                
  40.                 //EXTRA!!!!
  41.                
  42.                 //FUN with colours!
  43.                
  44.                 context.setBackground(Color.pink);
  45.                 button.setBackground(Color.red);
  46.                 button2.setBackground(Color.blue);
  47.                 button3.setBackground(Color.green);
  48.         }
  49.        
  50.         public void actionPerformed(ActionEvent ae){           
  51.                 if(ae.getActionCommand()=="BUTTON"){context.setBackground(Color.green);}//if a button with the text BUTTON is pressed change the background color
  52.                 if(ae.getActionCommand()=="BUTTON2"){context.setBackground(Color.red);}//almost same derive
  53.                 if(ae.getActionCommand()=="BUTTON3"){context.setBackground(Color.blue);}//almost same derive
  54.                 //getActionCommand allows the program to read which button text is being pressed
  55.         }
  56.        
  57.         public static void main(String args[]){
  58.                 mainGUI main = new mainGUI();// when this is run from here it executes your CONSTRUCTOR
  59.                                 //bascially it MAKES the GUI
  60.                                
  61.                 main.setVisible(true);//you have to be able to SEE it
  62.                 main.pack();//makes it pretty
  63.                 main.show();//updates the GUI to show everything
  64.                 main.setResizable(false);//EXTRA makes it so that you can resize DUH!!
  65.                 main.setTitle("TITLE HERE");//obvious...
  66.                
  67.                 main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//makes it so that when you press the X it closes
  68.         }
  69. }
  70.  

Remember you MUST add the ActionListener to each and every button.

Comments, Questions, Concerns post 'em below.

7
General Talk / Re: Whats your personality type?
« on: April 24, 2010, 09:46:34 am »
Mind posting your results Godlord?  :)
And w/b, haven't seen you around lately.

Updated my previous post. Nice to see you too.

8
Java / Re: Beginning of GUI -- Java
« on: April 24, 2010, 09:27:30 am »
It automatically spaces them out in the FlowLayout, however there are some layouts which can only take one component at a time, these will be discussed later. If the case is that the layout only accepts one element then it would overlay the rest, however in a FlowLayout they all "flow" together. It is the easiest layout to start with to explain the concept of frontends in Java GUIs.

9
Java / Beginning of GUI -- Java
« on: April 23, 2010, 07:56:08 pm »
A GUI or Graphics User Interface is pretty pictures which the user sees when interacts with your program for example the boxes you press in Minesweeper is a GUI.

One of the biggest advantages of Java is that it is very simple to create a front end or GUI. The only real big hurtle in doing so in Java is learning the classes and all the components as well as the order which it must be coded.

Well to start off you must know the symantics and the lingo of the setup of a GUI in Java.

In Java there is something called a "JFrame" which the basically the box border which you view everything in. Then there are "JPanel" which is what holds all your components and interfacing devices. The last most important component is the "Container" which holds the JPanels inside of the JFrame.

Let's jump into some code!!!

Code: Java
  1. /*
  2. //mainGUI.java
  3. //@author: GodLord
  4. //
  5. */
  6.  
  7. import javax.swing.*;//all required to use the correct classes to create a
  8. import java.awt.*;//healthy GUI system
  9. import java.util.*;
  10.  
  11.  
  12. public class mainGUI extends JFrame{//extends is Java's way of inheriting other classes
  13.        
  14.         Container context = getContentPane();//places the Container inside the JFrame
  15.        
  16.         JButton button = new JButton("BUTTON");//creates a button!! and names it "BUTTON"
  17.         JButton button2 = new JButton("BUTTON2");//same same
  18.         JButton button3 = new JButton("BUTTON3");//same same
  19.        
  20.         mainGUI(){//constructor IMPORTANT!! you MUST place ALL formatting of you GUI in the CONSTRUCTOR!!
  21.                 context.setLayout(new FlowLayout(FlowLayout.CENTER));//sets the layout of the GUI to a center flow, meaning
  22.                         //everything will be in the center of the GUI
  23.                        
  24.                 context.add(button);//places the button inside of the GUI
  25.                 context.add(button2);//same same
  26.                 context.add(button3);//same same
  27.                
  28.                 //IMPORTANT the order you place the components in the GUI is the order they APPEAR!!
  29.                
  30.                 //EXTRA!!!!
  31.                
  32.                 //FUN with colours!
  33.                
  34.                 context.setBackground(Color.pink);
  35.                 button.setBackground(Color.red);
  36.                 button2.setBackground(Color.blue);
  37.                 button3.setBackground(Color.green);
  38.         }
  39.        
  40.         public static void main(String args[]){
  41.                 mainGUI main = new mainGUI();// when this is run from here it executes your CONSTRUCTOR
  42.                                 //bascially it MAKES the GUI
  43.                                
  44.                 main.setVisible(true);//you have to be able to SEE it
  45.                 main.pack();//makes it pretty
  46.                 main.show();//updates the GUI to show everything
  47.                 main.setResizable(false);//EXTRA makes it so that you can resize DUH!!
  48.                 main.setTitle("TITLE HERE");//obvious...
  49.                
  50.                 main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//makes it so that when you press the X it closes
  51.         }
  52. }

NOTE: This was just made in a few minutes, if it doesn't work respond otherwise:

Comments, Questions Concerns Below.

10
General Talk / Re: Whats your personality type?
« on: April 23, 2010, 07:24:19 pm »
Mastermind -> INTJ

Introverted: 27%
Intuitive: 99%
Feeling: 90%
Judging: 97%



11
Java / Re: Introduction to Graphics -- Java
« on: February 02, 2010, 05:18:12 pm »
Are you using the AP java book?


Bingo.

12
Java / Introduction to Graphics -- Java
« on: January 11, 2010, 06:20:50 pm »
In Java you can create applications called Applets they are basically what most Java programs are made up of. Applets are used for GUI and such making your text based Java programs pretty.

Thus far we have been only making text based Java programs now if you were to make that into an executable jar file it wouldn't run on a JavaRunTime Environment on your standard box. So in order for the Environment to see the code and display it to your screen you have to make use of Applets or using some Window Panel that are put into the Java library.

However if you understand how Applets work you can create your own sort of panel.

Without further to do the code:

Code: Java
  1. /*
  2.  * Demonstrates a basic applet
  3.  *
  4.  * @author GodLord
  5.  */
  6.  
  7.  
  8. import java.applet.Applet;//Imported to be able to use applets very important
  9. import java.awt.*;//Import so you can use the standard drawing library
  10.  
  11. public class Einstein extends Applet{//Notice there is an "extends Applet" syntax this tells the compiler it is to be
  12.                                                 //an Applet~~~~~~~~~~
  13.         //-------------------------------------------------------
  14.         //Draws a quotation by Albert Einstein among some shapes
  15.         //-------------------------------------------------------      
  16.         public void paint(Graphics page)//Notice there is NO main method invoked, instead there is this syntax
  17.         {
  18.                 //Here are the draw methods they are obvious
  19.  
  20.                 page.drawRect(50, 50, 40, 40);
  21.                            //the parameters for Rect(x-coord, y-coord, width, height)
  22.                 page.drawRect(60, 80, 225, 30);
  23.                             //the parameters for Rect(x-coord, y-coord, width, height)
  24.                 page.drawOval(75, 65, 20, 20);
  25.                             //the parameters for Oval(x-coord, y-coord, width, height)
  26.                 page.drawLine(35, 60, 100, 120);
  27.                             //the parameters for Line(x1-coord, y1-coord, x2-coord, y2-coord)
  28.                
  29.                 page.drawString("Out of clutter, find simplicity.", 110, 70);
  30.                                                                               //the parameters String("String", x-coord, y-coord)
  31.                 page.drawString("-- Albert Einstein", 130, 100);
  32.                                                                               //the parameters String("String", x-coord, y-coord)
  33.         }
  34.        
  35.  
  36.        
  37. }
  38.  
Questions, comments and such below.

13
Java / The for loop - Java
« on: January 09, 2010, 01:04:38 am »
All right like many loops such as the while loop the for loop has four major parts: initialization, condition, increment and the code body here is the basic syntax:
Code: Java
  1. for(initialization; condition; increment;)
  2. {
  3.         code body;
  4. }

So lets say we want to count to 10 and print out all the values, lets start counting say at 0:
Code: Java
  1. public class ForLoops
  2. {
  3.         public static void main(String args[])
  4.         {
  5.                 for(int x = 0; x<=10; x++)
  6.                 {
  7.                         System.out.print("Counting: " + x);
  8.                 }
  9.          }
  10. }

There you have it this code will now create an integer called "x" then check to see if "x" is less than or equal to 10 if it is then it shall execute the code body once then increment "x" by one(which means adds 1 to x) and checks the condition again, and loops and etc. As long as the condition is true it'll keep looping until it's false then fall through.

There you have it similar to the other loops the for loop.

Questions, comments and such post 'em below.

14
Java / Re: Error for program.
« on: January 09, 2010, 12:46:23 am »
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassNotFoundException.html

That may help but it basically says that:

ClassNotFoundException is thrown when an application tries to load in a class through its string name using:

The forName method in class Class.
The findSystemClass method in class ClassLoader .
The loadClass method in class ClassLoader.

Which is the exception you're getting display your exact code maybe, there is something syntactical. Only thing I can think of is that you didn't save the file and tried to compile it, which means that it tried to link itself while it was in static mode, so it tried to link itself to itself which doesn't exist, yet, which is impossible.

Other than that...it may be that you don't have BOTH the JDK(Java Development Kit) and the JRE(Java RuneTime Environment) installed.

15
General Talk / Re: Artificial Intelligence Tutorials?
« on: January 08, 2010, 11:29:39 pm »
I am interested, lots of logic.

16
Request A Program or Tutorial / Re: Creating a picture.
« on: January 07, 2010, 08:12:39 pm »
Code: Java
  1.  
  2. Image pic = Toolkit.getDefaultToolkit().getImage("gui1.gif");  
  3.  if(pic != null) painter.drawImage(pic, 15, 5, this);  

17
C++ / Read/Write to a text file?
« on: January 06, 2010, 04:50:43 pm »
How would you accomplish reading a .txt file then writing to the .txt file changing it, etc.

18
General Talk / Re: Java to .exe?
« on: January 04, 2010, 09:01:50 pm »
I am still confused on how this JAR file making works, could you please provide an example?

19
General Talk / Java to .exe?
« on: January 01, 2010, 11:12:21 pm »
Does anyone know if it's possible to make a java class file into a .exe program? This is one of my major reasons for wanting to switch to a C language. I'll continue to learn java however I'm just curious as to if it's possible, it would be really nice if it was.

20
General Talk / Is Java Dead?
« on: December 30, 2009, 05:29:36 pm »
There seems to be the ever lying fact that languages do die, beginning that I program in Java I'm worried about this. I like the language it is simple and many of the tasks you want to do can be found already in prebuilt classes, it's nice. I just want the views of this community on the subject: Do you think Java is dead, dying? How long do you presume it'll last? Is it still used in the real world?

http://madbean.com/2003/mb2003-42/

21
General Talk / Re: Merry Christmas, Happy Holidays!
« on: December 30, 2009, 05:12:29 pm »
----- --------

22
Humor / Re: Facebook addiction taken to a new level?
« on: December 30, 2009, 05:08:59 pm »
Eczuo if you choose to be closed minded that's you're problem.

American is never going to end up like that movie because of people like you.

Most of what you said could of been summed up in about four to six sentences; rather than congest up the forum with your views.

You're right they're YOUR opinions so please keep them to YOURSELF.

23
Technology / Re: New computer setup
« on: December 29, 2009, 06:54:54 pm »
Someone's rich...

24
Introductions / Re: Hey Celestial Coding :D
« on: December 23, 2009, 03:13:38 pm »
RAWR

25
Java / Re: The while loop -- Java
« on: December 22, 2009, 01:31:53 pm »
In java, does Post and Pre increment cause a change?

I know in C#, when user does a something such as below
Code: C++
  1. int x=1;
  2. PrintLine("{0}",x++);
  3.  
It will print the value, THEN increment, although if you flip it.

Code: C++
  1. int x=1;
  2. PrintLine("{0}",++x);
  3.  
It will increment before printing.

Is java different?
Short answer: no.

26
Java / Conditional modifiers -- Java
« on: December 21, 2009, 10:02:19 pm »
Before we continued on our journey through the Java language I felt it necessary to familiarize you with the conditional modifiers that are mostly universal to all languages. These will become necessary when starting logic statements. In order to make these, make sense it would be best to present them in an example rather than a list to see the practicality.

Code: Java
  1. public class conditionalModifiers
  2. {
  3.         public static void main(String args[])
  4.         {
  5.                 int x = 0;
  6.                 int y = 0;
  7.                 int z = 0;
  8.                 if(x == 0)
  9.                 {
  10.                         System.out.println("X is equal to 0");
  11.                 }
  12.                 if(y != 1)
  13.                 {
  14.                         System.out.println("Y is not equal to 1");  
  15.                 }
  16.                 if(x == 0 || y != 0)
  17.                 {
  18.                         System.out.println("X is equal to zero OR Y is not equal to 0");
  19.                 }
  20.                 if(x == 0 && y == 0)
  21.                 {
  22.                         System.out.println("X is equal to zero AND Y is equal to zero");
  23.                 }
  24.                 while(z == 0 && z != 1)
  25.                 {
  26.                         System.out.println("Z is equal to zero AND Z is not equal to 1");
  27.                         z = 10;
  28.                 }
  29.         }
  30. }

Hope this clears up some things.......probably more questions now....

Questions, comments and such post below.

27
General Talk / Are there any Java programmer left here?
« on: December 21, 2009, 09:42:12 pm »
I am 100% willing to teach young aspiring Java programmers. However I am seeing that no one seems to have interest in them. I will continue to post them whenever I have free time, but I want to know is there is actually anyone who wants to learn left.

Questions, comments and such post below.

28
General Talk / Re: What is your favorite instrument?
« on: December 21, 2009, 09:39:44 pm »
SAXOPHONE

29
Java / The while loop -- Java
« on: December 21, 2009, 09:36:27 pm »
In Java, much like in every other language, you have loops. Loops are constantly reoccurring code which keep replaying over and over until the statement in the condition area is turned false. Before I go further here is the syntax:
Code: Java
  1. while(condition area)
  2. {
  3.         loop this while condition is true;
  4.         once false drop out of loop;
  5. }

Whenever loops are introduced it is normal that they are showed as a counter. Let's get into the code:
Code: Java
  1. public class usingWhileLoop
  2. {
  3.         public static void main(String args[])
  4.         {
  5.                 int x = 0;//initialize integer to be used in the loop as the condition
  6.                 while(x!=10)//this says to loop the code in the block while x is not equal to 10
  7.                 {
  8.                         System.out.println("Counting: " + x);//this displays "Counting: " with the integer value following in the first case it'll be 0
  9.                         x++;//this adds one to the integer x so that the loop eventually becomes false and drops through
  10.                 }
  11.                 System.out.println("Done...");//displays "Done..." once the loop falls through
  12.         }
  13. }
There you have it a basic counter in Java, play around with the values of x and change the conditional if you wish, just become comfortable with this until you move on to more complicated loops.

Questions, comments and such post below.

30
Beta Releases / Re: C++'s Random Song.
« on: November 28, 2009, 08:18:29 pm »
Since when did Beep have 3 parameters? O_O
Frequency, Duration, Volume

Pages: [1] 2 3 4 5 6 ... 15

Donate


* Search


* Recent Posts

Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]


Re: Client-Server Messaging by Nathan
[October 25, 2015, 05:48:57 pm]