Jump to content

j.smith1981

Members
  • Posts

    333
  • Joined

  • Last visited

    Never

Everything posted by j.smith1981

  1. No no I appreciate your replies. On a larger context though is there any really good guides on the basis for the fetch execute cycle also? I just am going through some old things I studied at University and haven't looked at for ages, just some I have found tended to be quite confusing, it's really entirely out of fascination to be brutally honest. Thank you though really appreciate those above replies! Jeremy.
  2. I am wondering I used to be really good at doing the more Computer Science stuff with regards to converting Decimal (what PHP uses for floats), to Hexadecimal and then Octal and all that stuff. I seem to have lost the ability to do this but just wondered if anyone knows of any good guides on the web that teach this? Looked through many but it's just not clicking at all, any reply is much appreciated infact massively appreciated. Thank you so much and I look forward to any replies, Jeremy
  3. Oh nice one will definately give those a look! Thank you so much, Jeremy.
  4. I am interested in making a really good FULLTEXT searching capability within a system I am trying to develop for work. I have a list of products I think from memory around 2,300 approx products on our ecommerce. The problem is, it only matches on certain fields but I have seen a few examples (I think even Google do this) where they highlight what has actually been matched to make it easier to comprehend what's actually been matched against what the user has inputted or queried on rather. Is there any good tutorials on how to do this even adding in did you mean examples? Just thought I would go out and ask rather than going around on the web, I mean I just can't for the life of me find any real tutorials on this subject, just guides on FULLTEXT searching but not about query match showing etc. Any help is not massively more hugely appreciated! I look forward to any replies, Jeremy.
  5. Much appreciate that reply as I said originally! Haha I do that sometimes myself no worries at all, I mean think someones talking in one context and means another lol. But no I every time I have tried doing that myself it never seems to work but going to give that another bash nesting functions, it makes sense if the child function as you so rightly put it isn't going to get called from outside the parent function, makes sense I suppose. It's just due to one not working before I though it was incorrect syntax in a book, but will do an exact example but by nesting them to the example I was working on before, the reason why I asked this question. Thanks ever so much again! Jeremy.
  6. I wasn't talking about OOP at all with this post. Recursion is purely a function that is called that within that function, that data's meets a certain critera then another function is called based upon that criteria and then sends that result back to the function which was called in the first instance (I actually missed the latter part out) and then sends the data back to the logic of your application obviously. All I was asking can you put a function within a function or is this illegal syntax? That's all sorry for any confusion but that's all I was asking.
  7. Hi there, I don't know if this is the correct part of the forum but I am wanting to figure out something about recursion, kind of questioning someone elses code. It's just a general rule though so there's no real need to display it I don't think. However when I say I want to get a function to call another function, would I need to declare (write) the 2nd function within the function that called it? I just am questioning what I saw in another book whereby what I create does not work on my own basis but does when someone else shows an example in a book, where the author created a function that called a function that was written within another, is this legal syntax though is my main question? Kind of looked somewhat like this (very basic and no actual commands or instructions here): <?php function myfunction() { // if whatever condition is true, call the second function just below me: function mysecondfunction() { } } Does that make any sense to you? Or would I just go off the book I am reading now where the 2 of them are completely seperated and the first function calls the 2nd, but not actually putting a function within another? Any advice is much helpful, Jez.
  8. Sounds almost exactly the same problem I was having a good few years ago. With that said, if you're trying to setup on your own LAN do you have a DNS server (such as Bind9 is a good one to go for, the most popular or even tinyDNS which doesnt require a reboot when you add your own zones) on your network? If not then this will not be possible externally! Your IP address could be such like 80.6.15.205 (just as a random example of a public IP address), your network will only allow for 192.168.xxx.xxx right? You need to either look at a few tutorials on the web regarding caching in a service like Bind9 or keep records updated of your changes in your domains and zones file. A valid domain would be something like (without the www or pop3 smpt etc), mydomain.com, but you have prefixes ontop of this like for example www then using a Conical (I think that's what it's called) name or CNAME record pointing to your nameserver maybe, it entirely depends upon what you want to set your DNS up like. But you will then need to set your computers up for resolving to that, or it won't work, when you go on the Internet, you ask for say www.mydomain.com, what it will do is send off a query to your ISP's DNS server, if they can't find it, it will consult a number of databases that have hopefully been kept up to date (called propogating), if your ISP's doesnt have that record you want, then it will come up as a non authorative answer, so it with any luck (rarely happens with ISPs since they usually turn this feature off on their servers) will cache the request. It then sends the IP address back to the DNS server notifying you (I think this is the sequence of events the requesting of resources off the web runs by) but then you're computer then will go off and send off a request to the IP address of the node that has that document file or whatever it may be, a video stream for the most complex one. It's not the best system in the world, by that I mean it's very slow but it works and there's no way of making any better solution, DNS's have always been slow, that's just fact! Now what you're likely to be having problems understanding (I was the same), your DNS server will go off to that DNS service you signed up to and it will say something like your domain is at IP 80.6.15.205 but your computer will say hang on, we don't have any nodes (computers on your network) with that IP, ok this won't work and won't show you the results of what you want, is this understandable? So to get around this what do we do? We ideally would need to setup a working DNS server for your own Local Area Network, that caches what your paid for or free dns service on the net works to, the dns server on your lan will then allow you to convert that IP (above) the ISP's one you have to 192.168.xxx.xxx so you can do what you want. In virtual hosts within Apache though there's a hash just before the virtual hosts to use name based virtual hosts. If you only have 1 IP address coming into your own router, then you will have to (there's no other option) use namebased virtual hosts, so you can have (like myself) 5 websites say (I only have 3) that work off the same one IP address. Hope this makes sense? The biggest part for your own computer you are working on is to get the web server (well doesn't have to do this, but I do this anyways) to resolve to the LANs DNS server. It's allot of fun to get one created because you understand how DNS's work, I spent over a year trying to get one working, then it suddenly clicked I needed to get my node I was working from to resolve (going into your network configs and changing the dns settings for the first one to use 192.168.0.1 for example of mine which works). To get it working externally get a friend maybe once you've opened port 80 and if you want SSL port 443 by default to allow people into your own local area network by those ports only, you will then need to if you have a firewall enabled on your vm application then you will need to open those ports on there too, or you won't be able to connect to those services, adding more if you want say port 81 for a website your working on other than port 80. Not forgetting to open those ports if you want to use them on your router. I really hope this makes sense? This might be the reason why no one can ping your node, I would be careful in making sure no ones trying to maliciously create a DOS attack against you (something snort I use as an IPS/IDS to prevent network attacks), DOS stands for Denial Of Service attack, it's to hog your bandwidth so you can't do anything with your resources, sometimes even crashing your node, it's quite a worry really! All the very best to you and good luck with it! Jeremy.
  9. I was just wondering if anyone knows of any good PHP tutorials where I can learn about PHP's precedence? I mean I know for certain things how to do mathematical calculations but when doing them say without brackets, is there any decent guides that explains how the PHP parser calculates these expressions please? Any replies are much appreciated in advance, Jeremy.
  10. It's definitely doable. I've actually done that exact thing: PHP socket server and a flash client. The game I created wasn't particularly network heavy, fairly light actually, but I learned the hard way that PHP definitely isn't what you want to use for this kind of thing. I'm not sure on how many players you intend on having, but I was seeing a big performance drop as low as 8 players, and I'm sure the network wasn't the bottleneck. I didn't do much research to find specifically what was the issue in PHP (I just assumed it was something slow in the way they handled something in the socket functions), but I ended up just rewriting the server in C++. That fixed all the performance issues. It was still fun to experiment with sockets in PHP. Good luck with your project. That is exactly what I want to play with lol, see at which point it breaks lol, or becomes slow rather. For the start off just 2 players though, keeping it as simple as possible, got a single player shoot 'em up that I fancied just making into a multiplayer game, I mean I am not sure what I want to progress it to just yet for the eventual bottleneck issue, but I had a strong feeling someone would tell me PHP isn't best suited for a vast amount of users, but will be interesting to see when under certain conditions when it should slow down etc. As I said I want to then progress this to another programming language, kind of been thinking of C# but I really want to do this in C++ (traditional me, making things as complex as possible lol), well taking an idea that is and just seeing how far I can push something or what I can do and learn from. It's the reason why I do actually really enjoy programming/scripting in PHP, but have a real interest in C and C++, even done a very small amount of assembly too, when you start doing assembly (though I have only done a simple hello world application output), you learn what C++ C and the like do for you as it where. It's really quite interesting lol.
  11. I wanted to try and remember various things I had learnt off those sites and their really good. But what I found and I keep going back to (less and less now) is the Zend one Down the Rabbit Hole set of tutorials. Has a load of user replies too, for each section: http://devzone.zend.com/node/view/id/625 It's just a beginners tutorial in PHP, not to do with the actual Framework, just basic PHP but does touch on some of the more advanced things like Regular Expressions and things like that. I thought it was a really good series!
  12. The part I am most excited about though is the possibility (whether or not PHP can actually do this, in theory it should be able to as it's just data that's been sent around on a network, or not) is the possibility of using say a service part of PHP to make a continuously running service that would allow 2 players on a flash game to play each other over a network. Got one service working once and fancied tying the 2 together and also making a game that would allow people to play each other, one of the (if not the) biggest project I have ever wanted to do. That is very cool!
  13. Ahh cool I will but really what I am trying to do is do stuff like that myself, just out of pure interest. Always thought the TCP server that the tutor did was quite cool when I was at University, sadly I lost it somehow during a drive failure and my old DVD breaking not sure entirely what happened to it, so either going to try and go for an older version of the backup util I used and use the same version it was created in, failing that try and rescue it, lost allot of work from doing that, but in a sense that's a good thing in some ways. Makes me want to try and do it myself, I like turning a bad situation into a good one lol.
  14. I did say embedded and in the form of '' that meaning MySQL is not a language. But I was meaning in the sense of triggers that MySQL has to have something happened to that data to make the trigger work, MySQL can not do this on it's own, if a user for example is added to a users table, the trigger occurs after that. You could in Oracle (did this at University myself), you could get the Oracle services (not sure which one would actually do this or which ones), to go through on a specified time to say remove any users that have not been logged in, without having to put that in your application logic, that's what I mean by lack of invoking triggers on it's own.
  15. MySQL strictly speaking does have programming embedded into it in the form of Stored Procedures, it just lacks any real triggers, Oracle and Informix have great support for triggers, but comparing how much you spend on Oracle (in the thousands of $ or £ mark) or Informix for that matter you'd expect that to be a well maintained system and with some huge support for them! To trigger a stored procedure you'd need to attach PHP or another language to invoke that stored procedure. Mine are: PHP Perl MySQL C++ (more or less in that order too) C++ and C (couldn't see C in the list) are just out of pure interest, want to try and create a socket server in C or C++ eventually, what I am writing in PHP at this very moment, want to allow Flash to connect to a TCP socket and play network multiplayer games!
  16. I wish I could work at Google, only because their offices look simply amazing. They have relaxation rooms lol, or something like that I have heard. At Pixar, one of the companies I would kill to work at, love animation myself so would kill to work there, although their actual animators work usually on a freelance basis, the staff at Pixar are the people that come up with the storyboard ideas and do the things to pull the whole projects together. They have Costa Coffee @ their HQ Offices in Emeryville CA and a whole like open hall in the front of the main building, it's amazing! Such a shame the company I work for their American office is based there, but their moving soon to Chicago (soooo unfair!!) THATS AWESOME THOUGH VERY WELL DONE!!
  17. Sorry UDP is not connectionless, I meant it's stateless, so a video stream for example would only output at that time, you just pick up that datastream when you want to, won't do any error checking hence the sometimes pixelation of such a video or audio stream (muffled audio) in the data transmission across the web. TCP would really hammer such a connection where this would always be waiting for retransmission of corrupted packets), Youtube will only use TCP since Flash can not use anything other than TCP!
  18. Just basically PHP Sockets, very experimental (the functions could change) but it's allot of fun. Want to try and build up (providing PHP has the capability of acting as the server, you need a quick actioning piece of software to run a TCP networked game!) a Flash multiplayer network game, I doubt my connection speed on my broadband would allow for this but we will see, I just want to keep dabbling with really TCP sockets but want to go into other protocols too like UDP (used for video streaming since it's actually technically connectionless, i.e. there's no error checking like TCP has, great for video/audio streaming). Got a basic chat client working though from Linux to Linux but I have tried Windows (client) to Linux (server) and it appears not only to treat each time you hit a key which it sends through to the server but also breaks out what you have put for each character as a new line, I think that's because of me not actually using socket_stream() (least I think its that function) at all lol. I will but try, need to start learning how to do this in Flash, I don't like using existing servers or software for things like this, I like to delve right in at the deep end and carry on with what I was doing at University (network multimedia based role playing games lol).
  19. Ahh I know how this works now, done a few additions to this just using Linux though! <?php $simple_socket = socket_create_listen("1024"); // simply opens a port! if(!$simple_socket) { echo "Failed to open socket: 1024 please make sure it's not in use by another service\n"; exit; // exit script when socket was not openable } // if socket was created: echo "Socket was created on Port: 1024\n"; while(true) { $client = socket_accept($simple_socket); // what the user goes into when a client connects? $welcome = "\n Welcome to my test CLI client for hsmedia.co.uk\n"; $welcome .= "Type '!close' to close this connection, or type '!halt' to halt the server\n"; $exit = "You are being exited from this message service, please come back soon!\n"; $close = "You have closed down this service, goodbye!\n"; socket_write($client, $welcome); // writes what ever data is in the socket, so if a client has written output to the socket, this displays that or vice versa, ie sends that data to the client? while(true) { // while reads 1 $input = trim(socket_read($client, 256)); // save what's in the socket for that user, or the person seeing the server connected rather! if($input == '!close'){ socket_write($client, $exit); break; // if the user has sent a command then make the loop exit client but won't disconect from service, see below logic! } if($input == '!halt') { socket_write($client, $close); socket_close ($client); break 2; // putting 2 makes this work, how? } // whilst in the loop display all messages: echo "Them: $input\n"; } socket_close($client); // when using '!halt' as a command this seems to bring up an invalid resource, ask! } socket_close($simple_socket); Now it reads back results if the user !halts (stops the service) or closes their connection (when leaving the service running on the server), though I am testing on the same machine using telnet localhost then the port no of that! Makes sense now!
  20. I am interested in learning about PHP sockets. I am reading from the O'Reilly book titled 'PHP in a Nutshell' on Chapter 20 'Sockets' and have done my own variation of this code (not that this is complete but just wanted to ask a question about this', used comments to explain gotcha's kind of what I think a function I am not sure about does: <?php $port = 1024; $simple_socket = socket_create_listen("$port"); // simply opens a port! if(!$simple_socket) { echo "Failed to open socket: 1024 please make sure it's not in use by another service\n"; exit; // exit script when socket was not openable } else { // if socket was created: echo "Socket was created on Port: $port\n"; while(true) { $client = socket_accept($simple_socket); $welcome = "\n Welcome to my test CLI client for hsmedia.co.uk\n"; $welcome .= "Type '!close' to close this connection, or type '!halt' to halt the server\n"; socket_write($client, $welcome); // writes what ever data is in the socket, so if a client has written output to the socket, this displays that or vice versa, ie sends that data to the client? } } socket_write() (in this case only) sends data to the client presumably (though this examples extremely vaige!) of what they have entered? Just out of interest basically, because I spent some time writing client apps in Flash to do with network games and fancy having a bash at using Linux to write my own services to do with multiplayer games in Flash Action Script, just thought it'd be allot of fun to continue on with some of my University work on my own, since I sadly lost the tutors server application. Any feedback will be interesting and much appreciated, Jeremy.
  21. I must apologise, this has been solved before by my own question woops! Really not awake today: http://www.phpfreaks.com/forums/index.php?topic=325907.msg1534555#msg1534555
  22. I am sorry if this has been covered before just the examples given are way more complex than what I need really. I was wondering how I would go about sorting the following list here (as it's displaying at this very moment): Original Product 1 Original Product 2 Compatible Product 1 Compatible Product 2 I would like (or need rather) the products to be displayed like so: Original Product 1 Compatible Product 1 Original Product 2 Compatible Product 2 (essentially the Original appears first for that given product and then the comparitive Compatible, I am dealing with Printer Cartridges here, but this should be enough of an example to illustrate what I am aiming for). How would the ORDER BY clause look, I mean I know it's a substr on the first space, just not exactly sure about how to go about getting this clause working, tried a few times but it fails each time. Any helps massively appreciated! Jeremy.
  23. I thought so just wanted to clarify why you'd use that outside of a loop. All the very tiny snippet of code would do is read down a given directory shown within the opendir() function. Then list them in a drop down box and include those (which are style sheets in this case I am working on) to show different arrangements of colours and even positioning on boxes should the user change which style sheet they want to see the page in. In a sense a version of true web development, changing content or layout presentation in this case using PHP. No real point in this but just having some fun with PHP.
  24. Ahh ok thank you ever so much! I mean the example in the book made sense to me however I was going off the PHP manual to really get to grips with the books example in Hacks in PHP Thanks ever so much again though, Jeremy.
×
×
  • 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.