Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

Posts posted by burtybob

  1. Hi,

     

    I think I understand this but want to check. If I have files register, user.class and dbconnect.

     

    If both register and user.class use require_once dbconnect will the dbconnect still only be required on the first time?

     

    Ben

  2. hmm That is a good idea to have a tile class. It would definantly make it easier. I have problems with OOP sometimes as when I first started programming they taught us procedural and I am now trying to learn OOP style.

     

    Thank you for the advice.

     

    Doing it with a tile class also means there is no worrying about the syntax error.

  3. I am wanting to create a game and this is the only thing that I have found hard.

     

    The map is of an area of land. Each tile will hold information like what is on that tile such as whether is a building and if so what building or if it doesn't have a building on it then does it have building rights.

     

    The first index would be the tile ID and then the second one would be the actual stuff there.

    So like:

     

     

    map[] = {true,none, false};

     

    where the first value is if it is owned, the second is what is built there and the final one is the status of building rights.

     

     

    Hope that makes sense. I have a horrible tendancy to waffle and make no sense.

  4. I am guessing that I did confuse everyone :(

     

    Here is what i have been playing with:

     

    Object map[mapSize][];
    
    for(int i=0;i<mapSize;i++) {
    
    map[i][] = {"Element 1","Object 2","Item 3"};
    }
    

     

    But the code errors at the map[] ={...}; bit.

     

     

    The error is "Syntax error, insert "}" to complete Block"

     

    Hope that clarifies things now.

  5. Firstly I shall presume that you have put "mysite.com" to prevent spam and that in your real shell script you have put the proper one.

     

    My second question, although maybe obvious, is does the file exist inside the folder? "No such file or directory" is generally when a file or folder is not located where you tell it to be? So have you tried navigating to that file manually? If that works then I am lost :(

     

    Also the folder being 777 doesn't mean the file is 777 ;)

  6. This is probably a really newbie question but what is the best way to do a map that has to contain two arrays.

     

    I will try to clarify. I have a map that is X squares wide and X squares high (X = a variable passed to it which can change).

     

    I was thinking that the easiest way would be something like an array or vector with X*X elements and then each element having an array of what the map tile holds but different map tiles can hold different amounts of data.

    I have two vectors:

    mapArray and mapSquare.

     

    I add elements to mapSquare (a and b plus the number the loop is on) so a0 and b0 then a1,b1 etc.

    The only problem is that every element in the primary array/vector is the exact same if I do .clear() on the vector.

    If i don't do .clear() on the mapSquare then the mapSquare works but has the previous elements plus all the new ones so a0,b0 even when I want the mapSquare to contain only like a1,b1.

     

    Oh dear I don't think anyone is going to be able to understand this :(.

     

    I will try to clarify any bits that anyone is still confused on.

  7. To add to the confusion:

     

    Server running: Website says it can connect and the server does acknowledge it.

     

    Server not running: Website says it can't connect.

     

    I love creating the impossible problem. Thanks for the huge amount of time you have given to trying to help me with this.

  8. I have apache running on port 80 and so I thought for a laugh I will see if it can connect to it via the outside IP.

     

    So changed the port to 80. Hit run. No errors.

     

    That is where I got confused because it would appear that neither server OR client are at fault. The router can be ruled out to some degree because the apache port with apache running works. An outside website can connect to the server code.

     

    Internal IPs work as well which pushes the blame onto the router but then how does the apache one work.

     

    Disabled my firewall, anti virus both together. Nada. Then disabled one and left the other enabled. Nada.

     

    Tried changing the ports to no avail :(.

     

    Thanks for your time.

     

     

     

     

    ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=90]  <= Server socket.

     

    Couldn't get I/O for the connection to: xx.xxx.xx.xxx

    Connection refused: connect                                              <= The clients I/O error message if that is any help. I googled it but couldn't find any help as everyone else with this said the error was that the server wasn't running and they had proved it by using other means like the website to see :(.

     

  9. The Server

    package main;
    import java.net.*;
    import java.io.*;
    
    public class KnockKnockServer {
        public static void main(String[] args) throws IOException {
            ServerSocket serverSocket = null;
            Socket clientSocket = null;
            try {
            	serverSocket = new ServerSocket(90);
            	System.out.println(serverSocket);
            } catch (IOException e) {
                System.err.println(e.getMessage()); 
                System.exit(1);
            }    
            try {
                clientSocket = serverSocket.accept();
                System.out.println(clientSocket);
            } catch (IOException e) {
                System.err.println("Accept failed.");
                System.exit(1);
            }    
            PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            String inputLine, outputLine;
            KnockKnockProtocol kkp = new KnockKnockProtocol();
            outputLine = kkp.processInput("hi");
            out.println(outputLine);
            while ((inputLine = in.readLine()) != null) {
                 outputLine = kkp.processInput(inputLine);
                 out.println(outputLine);
            }
            out.close();
            in.close();
            clientSocket.close();
            serverSocket.close();
        }
    }

     

    The Client

    package main;
    
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    
    public class EchoClient {
        public static void main(String[] args) throws IOException {
        	String host = "88.108.76.198";
        	//host = "192.168.0.2";
            Socket echoSocket = null;
            PrintWriter out = null;
            BufferedReader in = null;
            try {
                echoSocket = new Socket(host, 90);
                out = new PrintWriter(echoSocket.getOutputStream(), true);
                in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream()));
            } catch (UnknownHostException e) {
                System.err.println("Don't know about host: "+host+".");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection to: "+host);
                System.err.println(e.getMessage());
                System.exit(1);
            }
    BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
    String userInput;
    while ((userInput = stdIn.readLine()) != null) {
        out.println(userInput);
        System.out.println("echo: " + in.readLine());
    }
    out.close();
    in.close();
    stdIn.close();
    echoSocket.close();
        }
    }

    These are both from the suns tutorial.

  10. I have two parts of java code one part connects to a server and the other is the server.

     

    I start the server part. Ouput in the console in eclipse confirms this.

    I then start the client with localhost as the connection host and it works again confirmed by no output in the console. I stop both restart the server and try starting the client with localhost replaced with my global IP and it can't connect.

    The server is definatley running as if I goto can you see me dot org and put in the port (90) it says the port is open and connectable and the server tells me that it recieved the connection.

    Then I try to connect the client to my HTTP port (80) via the global IP address and it works fine.

     

    This has thoroughly confused me.

     

    Does anyone have any ideas?

  11. Hi,

     

    I don't know if this should be here or in the regex help section so if it is in the wrong section please move it.

     

    I have this preg_match("/\/warn (.*)/",$shout,$matches)

     

    I understand almost everything in there except the ""/\/warn (.*)/"" section...

    It takes input from a shoutbox input. So you put in "/warn burtybob" and it will warn burtybob and I understand all the rest of the script that does that.

     

    I would like to know what the "/\" is for, I presume it is something to do with character escaping.

    I would like to know what the "(.*)/" stuff does as well. I would like to say thanks in advance for explaning this to me.

     

    Thanks in advance,

     

    Ben

     

  12. Hi,

     

    I am Ben. I have a moderate amount of PHP knowledge. I can create MySQL secure scripts. I will work on any job that you offer me as long as I believe that I am capable of doing the work that you require. If I am, or think I am, unable to do the job you are asking for I will state this.

    My skills:

     

    2 Years of PHP & MySQL (Self Taught).

    2 Years of HTML (Self Taught).

    6-12 Months CSS (Self Taught).

     

    I would prefer small projects over larger ones as I am studying in college for a BTEC level 3 in ITP. I would also like to be able to work as part of a small team on a long term project such as an MMORPG site.

     

    I would love to work in a team with more and less experienced team mates as I would be able to learn from those with more experience and also pass on my experience to those with less experience than me.

     

    I will take both paid and unpaid work as long as for the unpaid work if your asked if you know someone who can do some work you point them towards me.

     

    Contacts:

    E-Mail: lealtagaming@gmail.com

    MSN/Live: bobbob24@hotmail.co.uk

    PM: burtybob

  13. echo "<script type='javascript'>openRequestedPopup();</script>";

     

    Why do you have this in the php page? Why not have an

    onClick="javascript: openRequestedPopup;"

    on the submit button or are you doing checking in the php page of whether to show the popup or not?

     

    Also the <script type='javasscript'></script> tags are not needed around the function call. All you are doing is echoing the name of the function. You need to put it in an attribute eg <body onload=""> or onClick or onUnload etc.

     

    Hope that helps.

  14. Hi all,

     

    I am trying to get it so that if i insert data into form field 4 then radio box 4 is automatically slept, however i can not find the right bit of code, the code i am using now works but it requires a lot more manual work from the user and i wish to do this so that A The user does not need to do as much to do the same job AND it lowers the chance of mistakes.

    Please can any one help?

    Thanks everyone,

    Ben

  15. They are changing values in the RAM. I did this once, but it was for educational proposes only, I didn't submit anything. Basically, there is a program out there, which name escapes me right now, that lets you change values in RAM. t isn't as easy as you might think.

     

    I did it with desktop tower defense, which I found to have excellent cheat protection. It actully locks up if you give yourself too much money, and you tyr to spend it and buy too many towers.

     

    Chris 

     

    The locking up might not be anti-cheat but rather the fact that the processor cant deal with the larger amounts or the flash cant deal with it rather then well desgined protection.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.