Jump to content
xisto Community

Mordent

Members
  • Content Count

    424
  • Joined

  • Last visited

Everything posted by Mordent

  1. Strangely, I was just playing this game yesterday on the XBox 360. I know I've said a lot about playing first-person-shooters with the WASD and mouse controls being my favourite, but as neither the console nor game is mine I feel justified in saying that I'm still a true PC-game fan.Anyway, I've managed to complete the entire storyline in Veteran difficulty (after many, many attempts on some levels, waiting for extraction as waves of enemies swarm over your position being one of those) and found it to be fantastic fun. I've yet to dabble in the multiplayer game, but if it's anything like the previous CoD releases (which I have for PC, by the way) then I don't really feel a need to. The single-player campaign was long enough for me to have a great time playing it, and although the storyline was a little "standard" it had enough twists in it for me to not be able to completely predict what was going to happen.Visually, the game is relatively stunning. The only quarrel I had was, as Herbert mentioned, the explosions did seem a little flat. The shadows and other general lighting is done fantastically in my opinion. Interestingly I seem to remember that you didn't actually have a shadow yourself, but other than that it was perfect.As for the bonus mission, Herbert, try doing it on Veteran difficulty, I haven't managed to get anywhere near the end in the 60 seconds you're given.
  2. No doubt that the very crux of creating artificial life would be creating artificial intelligence. By the very name, artificial life has to be created by another entity. How the first lifeform came in to being is a huge debate in itself, but if we can the idea of creating a purely mechanical being that is, in itself, able to grow, develop and replicate then things would become very interesting indeed. For example, if we assume that the AI is developed in such a way that it is capable of making simple choices between its next action based on past events, it's 'knowledge' and multitude of other factors, evolution would most likely occur from the different "starting" points of each individual robot. Effectively, to create artificial life we need an initial mechanical body capable of manipulating itself and the environment (as well as moving), but more importantly the initial intelligence to go with it, which strikes me as far harder to develop. I think another, simpler way of looking at the idea is that artificial life is artificial intelligence with an artificial body.
  3. Ah, the old gigabyte versus gibibyte argument. Reminds me of this webcomic, which sums up the confusion between "kilo" and "kibi" nicely. It's not until you start getting up to the ridiculous levels of storage in the terabyte range (or so) that it really kicks you in the teeth, though. 1 terabyte = 1,000 gigabytes = 1,000,000 megabytes = 1,000,000,000 kilobytes = 1,000,000,000,000 bytes1 tibibyte = 1,024 gibibytes = 1,048,576 mibibytes = 1,073,741,824 kibibytes = 1,099,511,627,776 bytesSo 1 tibibyte has 10% (or near enough to) more storage than a terabyte. I hate to think what happens when pibibytes and beyond come in to play, as people are going to start asking why their harddrives are substantially smaller than they believed advertised. Got to love consumer ignorance.
  4. Artificial life is certainly a very different idea than artificial intelligence. AI is something that a vast majority of people are vaguely understanding of: some kind of supercomputer that is capable of making decisions of its own accord and learning as it does so. The act of creating life, however, is certainly trickier. From wikipedia, I've rummaged up a definition of what life is: While not fully agreed on, working on the list above to make some form of artificially created being have 'life' we can speculate on what we need to look for. Clearly an artificial intelligence would be useful in the extreme, as that would deal with the "response to stimuli" criteria, and if initially given a method of performing growth and adaptation (perhaps simply a toolset that it could manipulate and therefore allow it to make changes to itself? This would also allow reproduction to take place, as it could physically create new beings) with a way of taking in metals and other materials (for mass) and fuel (for energy) and adapting it to its needs then surely the AI becomes the most challenging part? The homeostasis would be dealt with by cooling fans (or liquid coolant) until it comes up with something better, the organisation easy enough to accomplish with having separate parts to perform separate tasks. Metabolism I've already mentioned, as with growth, adaptation, response to stimuli and reproduction. Now we just need to come up with an AI that's smart enough to go with it.
  5. The physics of that strikes me as dodgy at best. The idea of "storing" light by reflecting it around in a permanent circle/sphere is surely more of a "delaying" tactic? Let's say you work out a way of reflecting a beam of light in what is, effectively, a big hollow spherical mirror indefinitely. Getting the light out by opening a small part of the mirror would just cause the light beam to come out at the same rate it went in, surely? Assuming no energy is lost by reflecting it time after time, why not just have solar panels in the first place, or am I missing some key point to your idea? Still, I think the idea of harnessing the Sun's energy (whether via solar panels of some description, or via mass usage of plant material to generate energy) in some form is the only way we're going to be able to sustain our energy levels for any real length of time. Plants are perhaps one of the best means of this idea, if not also due to the fact that they "recycle" the carbon in the process.
  6. Agreed, although Richard Hammond is a generally awesome presenter. He's possibly the only exception, however.
  7. Ah, a good old screenshot from Urban Dead (or a Firefox addon thereof). I love that game, still have 2 active characters in it ticking away. Out of idle curiosity are you planning on making something similar (the game, I mean, not the graphics)? Clearly a little off topic, but you've sparked my interest.
  8. Agreed on the Brainiac front. From a science perspective they don't really offer much by way of explanation for why what happens actually happens. A large number of their "experiments" don't really offer an overly scientific view on...well, pretty much anything. They just do some vaguely humorous experiment, and base their entire conclusion on that. Most of their experiments are rarely even the sorts of things you'd want to know, whereas Mythbusters often has the sorts of things in it which you've actually heard to be either true or false, but no real evidence has been given for either case (hence the fact that they bust the myth). As for how much science the presenters actually know, does it really matter? While I'm certain they have an interest in the physics, chemistry and so on of their subject matter, the point is that someone in the show (behind the scenes or otherwise) actually understands a reasonable amount of the science involved, making the experiments fairly accurate. If I had to say which of Mythbusters and Brainiac that I preferred, Mythbusters would win hands down. It's just a shame we don't get to see it all that much on UK television.
  9. I'll admit, it's stories and breakthroughs like this that make me wonder if I should have followed the biology/chemistry route instead of the physics/electronics one that I'm currently working my way down. I'm not going to comment on the science of the idea - as I'm horribly inexperienced in the fields needed - but the economic impact and implications of that process are colossal. On the scaling sense of things, I understand docduke's thoughts about scaling the process down to make it usable by households/communities, but surely having dedicated plants where the process takes place would be far more effective? The way I see it, a vast majority of an organic product is wasted before it reaches our homes: unused plant material from a crop; in the areas where the raw foodstuff is processed, and so on. Once this sort of thing has hit industry in general (making J.C.Bell ridiculously rich in the process, of course ), and I'd imagine the sort of financial backing the process will get will be more than enough to make that pretty rapidly should it turn out to be a success, and the effects seen I'd imagine more localised and smaller (whether that be citywide plants or household waste processors) will certainly be the next step. Regardless, this sort of discovery could well be one that does indeed change the world as we know it. Well within my lifetime the energy crisis will be sorted one way or the other, so here's to it ending up with mankind finally producing its own fuel!
  10. I'm curious as to the best methods of letting users submit data to a MySQL database, displaying that data, and removing any unwanted tags etc. from it. Currently, there's a handful of PHP functions that I know of to help with this: mysql_real_escape_string() - perhaps the best known and most commonly used function, it should be used in pretty much any MySQL query. It escapes characters that have SQL significance. I like to think I made a pretty good attempt at finding out what \x00 and \x1a are, but I can't find anywhere that will simply tell me. I'd assume that one of them is a hyphen (-), as that has special significance in SQL? strip_tags() - removes all HTML tags (including malformed ones) except those given in the second argument. nl2br() - converts all newlines (i.e. "\n") to "<br />" htmlspecialchars() - converts characters that have HTML significance (i.e. ", ', &, <, >) in to ones which will simply display instead of having any HTML meaning. htmlentities() - any idea what the difference between this and htmlspecialchars() is? Anyone care to comment on how that would handle a string differently from htmlspecialchars()? addslashes() - adds "\" before quotes (both ' and "), other backslashes and NUL. According to php.net the function should be used when <i>entering</i> data into a database, although if magic_quotes_gpc is on (which, I believe, is the case both by default and on Xisto's servers) then it is entirely unnecessary, as apparently: stripslashes() - effectively reverses (?) addslashes(). So, given the function arsenal above, what can we get out of it? Clearly we could apply a lot of overkill to some strings, which would be unnecessary, but what's the minimum that needs to be done to make user-inputted data secure and still output what you want? Let's say we have a textarea which the user can input whatever they like in to, and in all cases the data will be stored in a MySQL database and can be displayed exactly as typed (mainly because that's the bit I'm working on ). Take this forum, as an example. I can quite happily type things such as "<b>foobar</b>" and they display exactly as entered. The quotation marks are left in, the bold tags are displayed, but not carried out. All formatting such as using bold text is done on the user's side with BB Code, which uses square brackets. For now, however, I want to leave this additional formatting alone, and just show precisely what's typed in. So, back to the textarea idea, let's say we have a form as below: <fieldset><legend>Update Text</legend><form action="update_text.php" method="post"><textarea cols="100" rows="10" name="text"></textarea><br /><input type="submit" name="update" value="Update" /></form></fieldset>So whatever the user types in is sent (via POST) to the script update_text.php. In that file we want to store it in a MySQL database. Given that we have a method of identifying the user by an ID (via sessions, most likely), and that the required file connects to the database. ...// process input$text = $_POST['text'];// access databaserequire('includes/db.php');mysql_query('UPDATE members SET text = "' . mysql_real_escape_string($text) . '" WHERE id = "' . mysql_real_escape_string($id) . '"') or die(mysql_error());...So, correct me if I'm wrong, but that would store the text so it can be recovered as entered? Newlines ("\n") would be put in, naturally, and any relevant characters would be escaped so that they're stored in MySQL correctly, and the possibility of SQL injection here would be low, right? The data would now be stored, theoretically exactly as inputted. If we want to get that data back out, so that it's shown by default in the form we could do so as shown below: ...// access databaserequire('includes/db.php');$getMember = mysql_query('SELECT text FROM members WHERE id = "' . mysql_real_escape_string($id) . '"') or die(mysql_error());if (mysql_num_rows($getMember) == 1){ // member found $row = mysql_fetch_array($getMember); $currentText = htmlspecialchars($row['text']);}......and then echo $currentText between the textarea tags in the form? htmlspecialchars() would need to be used, I believe, to stop people from closing the textarea early themselves and going on to do anything else they want. I'm pretty sure no other functions in the list above need to be used, but I'd like to confirm that. Then, when displaying the text (i.e. not in the textarea), I assume something like this could be used: ...// access databaserequire('includes/db.php');$getMember = mysql_query('SELECT text FROM members WHERE id = "' . mysql_real_escape_string($id) . '"') or die(mysql_error());if (mysql_num_rows($getMember) == 1){ // member found $row = mysql_fetch_array($getMember); $text = nl2br(htmlspecialchars($row['text']));}......which is identical to the previous method except for the use of nl2br() as well. Note that it's used after htmlspecialchars(), as otherwise the "<br />" tags would else be converted to "<br />" afterwards. Would any other functions need to be used, or would that simply do the job to a high enough level of security and still give the desired result? Thanks in advance for any feedback or comments, Mordent
  11. No idea what's up with your code that's making it not work, but on a fairly important issue I notice you're not doing any kind of escaping on the posted variable. Even if it's a simple mysql_real_escape_string(), it should stop a large portion of problems with people managing to insert horrible little bits of code in to your queries.
  12. *nods* That'd be the way I described above, but in code format. One point to bear in mind is that you'd need to define the access code once only per page (if you have more than one include). I doubt it would hurt to define it more than once, but it's just messy coding in my opinion.
  13. I'm no expert, but surely a simple check to see if the include is being accessed from another page on your site would be enough? If so, just define a variable at the start of the script in which you use the include. Then, in the included file, check that whatever variable you used is defined, and if not simply die() (i.e. don't process the script). Possible error messages would include "This file cannot be directly accessed!" or the like.Anything wrong with this method of doing things?
  14. Pass as to why the first one doesn't work, but the second is because "=" isn't a way of comparing two variables. It sets the first one ("$userfinal") to the second ("$user['to_user']"), which then comes back as "true" (or so I believe), so it carries on with the code you've put in the brackets. The first code segment - with the "==" in it - is the correct syntax, so it's something to do with another aspect of the code. As I'm not exactly a veteran PHP programmer, I suppose I'll let someone else field the rest of this one.
  15. I'd say it's something to do with the character collation. From the little I know about SQL databases, some are case sensitive (the problem I think you're having) and others are case insensitive. In phpMyAdmin you can look at the collation there, and it should be one that has "_ci" (case-insensitive) on the end. Hopefully I'm not talking complete garbage and this'll help solve your problem. EDIT: Or you could do what the guy who beat me to the reply said. After thinking about it, I'd say that one's got the disadvantage of thinking two people with differently capitalised names are the same person, but then again so would altering the case-sensitivity of the database, and you probably wouldn't want two users to have the same username except for capitalisation anyway...
  16. Ah, quantum computing. For those who aren't quite sure just how revolutionary it will be, this paragraph from wikipedia should make a pretty impressive point. Point made, aye? If and when quantum computers kick off then "regular" computers will disappear soon afterwards, I reckon. Sure, it'll be experimental for a while, and only affordable by overly rich individuals/businesses, but once they hit the home-user market the results will change the world. Let's hope we've got the processor barrier crossed by then, blasted physics stopping them working fast enough ...
  17. The World Meteorological Organization? The Worldwide Missionary Outreach? Two of the top results from Google, and nothing else on the front page that looks like a game. I get the impression that you might have to tell us what WMO is, jordan.
  18. Wait...Alt+Tab is a useful key combination? *tries* ...why has no one informed me of this before? Heck, even without this powertoy thing (which I'll almost certainly end up downloading shortly) I can tell it's going to be damned useful. A big thanks for pointing this one out to me.
  19. *facepalm*...for the love of...okay, so there's me thinking that some subdirectories inherited permissions. Works an absolute treat. '757' turned out to be the magic number there.Cheers for pointing out the obvious. I have my little moments.
  20. Warning: move_uploaded_file(images/profile/Mordent.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/mordent/public_html/withvalour/edit_image.php on line 42Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpOWVz7o' to 'images/profile/Mordent.jpg' in /home/mordent/public_html/withvalour/edit_image.php on line 42 Any ideas? The code seems fine, as it works a treat when I run it locally (on WAMPServer), but as soon as I try to run it on the server I get this horrid error. I'm guessing some weird permission problem that I have no idea how to get around.
  21. I reckon it depends almost entirely on the subject in question whether homework's actually useful. The age (and therefore, in theory, the maturity) of the student plays a key part, too. In subjects that are almost entirely practical - Drama, Art, so-called "Design and Technology" - it's difficult, at least in my mind, to set specific homework assignments. As coursework (another fun debate in the UK) makes up a majority of marks in these subjects then I can see why working on that can be a fine replacement for homework (provided it is, of course, monitored).One important aspect of homework - in general - is improving time management. Being able to get work done for a certain deadline is an art form, certainly, especially when it starts piling up. Once in college (in the UK) or high school (I believe that to be the US equivalent), free time during the "school day" is there to do work. The temptation to spend that time doing next to nothing productive is huge (believe me, I know), but learning to use that time to get work done is a valuable skill alone.Homework's there to check understanding of a topic, not to just bore the student. Sure, it's often seen as a chore, but it does let the learning/teaching happen during the school day and the teacher's able to make sure the student grasps the topic by setting a homework assignment on it. Personally, I think that's a pretty good use of resources, with teachers teaching rather than sitting there while the students do the work in the lesson itself. It's useful to have a teacher on hand to ask about any problems that come up as you do the work, but meh.So anyway, as long as homework's set for a reason rather for the sake of giving out X hours of work per week, I quite honestly don't see the problem. I've heard mention of various ideas that involve making the school day longer and having all work done during those hours, but I can't see that being all that beneficial. Once the extra hour or two are up, the students quite simply wouldn't have any incentive to learn time management skills, as they'd have no commitments outside of that time. That might be beneficial to those who have other activities that they enjoy doing, like sport, music, and the like, but I still can't see it working out in the long run.
  22. While I'll give you that that's certainly one way of doing it, it doesn't strike me as the most graceful. The corners themselves would be practically hard-coded in to your site, meaning if you wanted to change their radius, background colour etc. you'd have to go generate a whole load more images. I'm almost certain that there's a way of rounding corners in the proverbial works for CSS (and us fortunate Firefox users can round the corners already, I believe), and once I find the link I'll stick it here. In short, I don't think using images really is the way we should be doing things, even if it is one of the easiest at the current time.
  23. I did something very similar to this just yesterday, in fact. I'll see if I can rummage up my little snippet of code for you and tweak it to make it more generic. *rummages* The code below should be all together, but I've stuck a load of comments and whatnot before each 'chunk' to explain a little more about what I'm doing. First, we access the database. I did this in a seperate file, which I used require to open up here. Note that I defined a variable (not actually 'SomeAccessCode', but even that would work), which db.php checks whether or not is defined. If it is, it connects to the database etc. <?php// access databasedefine('SomeAccessCode',true);require('includes/db.php');The next chunk runs a query on the database table 'members', ordering them by id and retrieving the username. Technically you don't need to order them, but it makes sense to do so for me. This bit also counts up how many rows (i.e. members) you have, ready for the loop next... // get the usernames of the members$getMembers = mysql_query('SELECT username FROM members ORDER BY id') or die(mysql_error());$numMembers = mysql_num_rows($getMembers);This bit here irked me for a while, and still does to some extent. Using a for loop probably isn't the best way, but it works for one thing. Anyone care to mention a neater way of doing this? Anyway, the point is that it cycles through the members, each time creating an array with the data in that row and using echo to put that in an unordered list with each member on their own line. The link will point to a page called member_profile.php, where their name can be extracted using $_GET['username'], and on that page further queries can be made to the database to get whatever information you want to show about them. Note that I put a new line after each echo, but that's just me being fussy. // display each member's name, with a link to their profileecho '<ul>';for($count = 1; $count <= $numMembers; $count++){ $row = mysql_fetch_array($getMembers); echo '<li><a href="member_profile.php?username=' . $row['username'] . '">' . $row['username'] . '</a></li>';}echo '</ul>';?>If you wanted, you could point the link to index.php instead (with the username still given) and check at the beginning if $_GET['username'] is set (using the isset() function), which I think should deal with it nicely. Bear in mind the security implications of the whole thing, of course, which I only really just touched on here by having db.php check if it was being called by an 'internal' script. As for making the pages .html, if you're worried about SEO then I'll let someone else take over, as it really isn't my field. Hope this helped!
  24. Agreed on pretty much all points. I use Notepad++ exclusively for web development, simply because you can get exactly what you want with full control over every aspect. One major advantage of Notepad++ (link for those who have yet to be enlightened) is, in my opinion, the sheer simplicity of it. There's no work done on your files "behind the scenes", which keeps them nice and clean of poorly formed code. It also lets you have multiple tabs open in one window, so you can flick between files (such as HTML files, CSS ones or PHP) all within the same application and develop all of them equally well. That, and I have a love of plaintext editors. Seriously, though, for templated work you're best off trying something a little more Dreamweaver-y. Working from scracth with Notepad++ and the like works great if you're trying to get to grips with the languages and helps keep you in good practice with properly created files, but it can take a good while to get something half-decent out of it. Personally, I still prefer building my sites from the very first character of the first index page, but that's just me.
  25. Ah, how I wish I'd taken up the Nuclear Physic options instead of Cosmology for my Physics A Level, it looks far more entertaining. Still, hindsight is a wonderful thing, isn't it? Anyway, good old quantum mechanics and whatnot still gives me an insight in to Heisenberg's cat paradox (as well as an almost unhealthy number of physic-y programs on television), and even that worries my mind just a little bit.Still, on the plus side, I've managed to read textbooks over the shoulder of those lucky individuals who ended up with an option that isn't (in my opinion) pretty dull (and the textbook even has prettier pictures!) so I do have some kind of rough idea of what the whole thing's all about, but I wouldn't overly fancy having any kind of debate about whether it's "real" or not. Personally, I find the whole Xth dimension aspect a lot more interesting, with dimensions layering up to give those multiple universes. How string theory relates to that, I'm not entirely sure, but I'm certain there's some link in there somewhere. ;)Anyway, that's my (mildly ignorant) two pence on the matter.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.