Advertise Here

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 - Mdog

Pages: [1] 2 3 4
1
Java / Re: Void troubles....
« on: October 15, 2009, 09:46:48 pm »
I know this thread is dead (like this entire section sadly), but I'll answer your question anyways.  On the line
Code: [Select]
World2.addActionListener (new ActionListener() {you are missing a ")" after ActionListener().  So your fixed code would be this
Code: [Select]
World2.addActionListener (new ActionListener()) {I hope you have already figured this out by now, but in case you didn't, have fun.

2
General Support / Re: Is it hacking?
« on: June 19, 2009, 12:09:27 pm »
According to dictionary.com, yes.

7.    Computers. to devise or modify (a computer program), usually skillfully.
http://dictionary.reference.com/browse/hacking

But, giving someone administrator rights is like giving someone the source of your software.  You are basically giving them the rights to make changes.  So is it hacking?  Yes.  Is it illegal hacking?  No.

3
General Support / Re: How do I add this?
« on: June 12, 2009, 02:20:25 pm »
Those are all for SMF forums that you download and install.  The portal is available here though.  Just enable EzPortal.

4
General Discussion / Re: SMF began
« on: June 12, 2009, 12:12:07 am »
SMF For Free, the service, started about 8 days earlier ;)

Quote
Registered through: GoDaddy.com, Inc. (http://www.godaddy.com)
Domain Name: SMFFORFREE.COM
Created on: 01-Aug-05
Expires on: 01-Aug-09
Last Updated on: 04-Nov-07
Just because the domain was bought on August 5th, doesn't mean the service started then ;).  For all we know he could have bought it on August 5th and not set anything up for a week.

5
Java / Useful Links
« on: June 11, 2009, 10:18:56 pm »
Well guys, I have a feeling that the reason a lot of people don't learn a language is because they don't know where to look.  So I went around gathering links that I feel may help you guys learn.  Please don't take this as advertising, most of these can be found with a quick Google search.


If you would feel a link needs to be added to this list, just tell me.

6
General Chat / Re: about runescape
« on: June 11, 2009, 10:10:16 pm »
They removed it quite a while ago, but I found one way to contact them.  Mod MMG or whatever the CEO of JaGEx is keeps his Clan Chat open to the public.  If you lurk his Clan Chat you are more than likely to see him in there which you can contact him and what not there.

7
Java / Switch Statements
« on: June 11, 2009, 10:04:51 pm »
The most common form of the switch statement takes an integer type argument (or an argument that can be automatically promoted to an integer type) and selects among a number of alternative integer constant case branches:

Code: [Select]
public void switchStatement(int expression)
{
switch( expression )
{
case int constantExpression:
statement;
[ case int constantExpression:
statement; ]
...
[ default:
statement; ]
}
}

The case expression for each branch must evaluate to a different constant integer value during compiling.  An optional default case can be specified to catch unmatched conditions.  When executed, the switch simply finds the branch matching its conditional expression (or the default branch) and executes the corresponding statement.  The switch statement can then continue executing branches after the matched branch until it hits the end of the switch or a special statement called break.  Here are a couple of examples:

Code: [Select]
public void test(int value)
{
switch ( value ) {
case 1:
System.out.println( 1 );
case 2:
System.out.println( 2 );
case 3:
System.out.println( 3 );
}
// prints 2, 3
}

Using break to terminate each branch is more common:

Code: [Select]
public void test(int retVal)
{
switch ( retVal )
{
case MyClass.GOOD:
...
break;
case MyClass.BAD:
...
break;
defult:
...
break;
}
}

In this example, only one branch: GOOD, BAD, or the default is executed.  The "fall through" behavior of the switch is justified when you want to cover several possible case values with the same statement, without resorting to a bunch of if-else statements:

Code: [Select]
public void test(int value)
{
switch( value ) {
case 1:
case 2:
case 3:
System.out.println("3" );
break;
case 4:
System.out.println("4" );
break;
case 5:
case 6:
System.out.println("6" );
break;
}
}

This example effectively groups the six possible values into three cases.

I hope this has helped you.  Please post comments.

8
Java / Simple Buffer class
« on: June 11, 2009, 10:00:39 pm »
Well I am working on a multiplayer game type thing and this is a class I made for sending bytes to clients.  All the methods and what not are documented, but the class isn't completely finished.  All that is really left is looping through the bytes array sending what is needed (easy, but I haven't bothered to put it in). 

Code: [Select]
import java.util.Arrays;

/**
 * User: Matthew
 * Date: Jun 8, 2009
 * Time: 12:49:04 AM
 *
 * Handles bytes that need to be written to the clients.
 */
public class Buffer {
    /**
     * This is our array of bytes in the buffer.
     */
    public byte[] array;
    /**
     * The position of where in the array to place the byte
     */
    public int position;
    /**
     * How many bytes are in the buffer.
     */
    public int length;
    /**
     * If the reset method is called, the buffer will only be reset to here.  Everything after it will stay the same.
     */
    public int mark;
    /**
     * The initial capacity of our buffer.  Basically how many bytes it can hold at once.
     */
    public final int initialCapacity;

    /**
     * Creates a new buffer with 100 available spots.
     */
    public Buffer() {
        this(100);
    }

    /**
     * Creats a new buffer with * amount of slots.
     * @param length  the amount of available slots we want.
     */
    public Buffer(int length) {
        this(new byte[length]);
    }

    /**
     * Creates a new buffer from an existing array of bytes.
     * @param array The array of bytes we want to start with.
     */
    public Buffer(byte[] array) {
        this.array = array;
        this.length = 0;
        this.mark = array.length;
        this.initialCapacity = array.length;
    }

    /**
     * Sets how many bytes we want to reset.
     * @param mark the amount of bytes.
     */
    public void setMark(int mark) {
        this.mark = mark;
    }

    /**
     * Resets everything before our mark.
     */
    public void reset() {
        for(int i = 0; i > mark; i++) {
            array[i] = -1;
        }
        position = 0;
    }

    /**
     * Tells us how many remaining slots we have.
     * @return the remaining slots we have.
     */
    public int getRemainingSlots() {
        return (initialCapacity - length);
    }

    /**
     * Adds a byte to the buffer.
     * @param b the byte to add to the buffer.
     */
    public void addByte(byte b) {
        try {
            if(position == (initialCapacity + 1)) {
                throw new Exception("Buffer full.");
            } else {
                array[position] = b;
                position++;
            }
        } catch(Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }

    /**
     * Resets the position back to 0
     */
    public void resetPosition() {
        position = 0;
    }

    /**
     * Removes everyting from the array.
     */
    public void empty() {
        Arrays.fill(array,(byte)0);
    }
}
Have fun.

9
General Chat / Re: Steelers have won the Super Bowl!
« on: February 01, 2009, 09:59:46 pm »
I know for a fact that Cardinals have earned a lot of my respect.  One thing I hate about the Steelers is that they get ahead, and then get very lackadaisical until the opposing team has them almost up against the wall before they do anything.

10
PC Games / Re: RS2 or RSC?
« on: February 01, 2009, 09:57:12 pm »
I would have to say RSC.  <3 the classics.

11
General Chat / Re: Simple machines
« on: February 01, 2009, 09:52:07 pm »
It's a whole team that makes the forum.

http://www.simplemachines.org/about/team.php

12
General Chat / Re: Steelers have won the Super Bowl!
« on: February 01, 2009, 09:51:18 pm »
I will admit, Arizona did play one heck of a game.  I had nearly given up on the Steelers after half time. 

13
General Chat / Steelers have won the Super Bowl!
« on: February 01, 2009, 09:47:55 pm »
I would just like to announce and brag to sibyl that the Pittsburgh Steelers have won Super Bowl 43!  Feel free to discuss the game here!

14
General Support / Re: raid calendar
« on: January 31, 2009, 06:06:46 pm »
That would be a problem with the script you are using.

15
General Chat / Re: Favorite sports team
« on: January 28, 2009, 02:08:33 pm »
I know it doesn't mean we will win.  I truthfully do not think the Steelers will.  This whole season has been luck for them.  Sadly, the Super Bowl is not at Lambo though.  Steelers always seem to play much better in cold weather :p.

Pages: [1] 2 3 4