Jump to content


  • Posts

  • Joined

  • Last visited

About AElliott

  • Birthday 11/03/1989

Previous Fields

  • Languages
    html, css, php, sql, javascript

Contact Methods

  • Website URL
  • ICQ

AElliott's Achievements


Member (2/7)



  1. Oh, a graphics tablet, not a tablet computer - nevermind me then. What with all the hype about the iPad I forgot there was another kind of tablet. :)That'll depend on the manufacturers, I don't have any experience myself, but you should be able to find out from the manufacturer's website whether they produce drivers for Windows and OSX. I expect they do support both.
  2. Well, Apple does not authorise use of their operating system on any hardware not developed by them, so legally: no.
  3. I have to agree with previous comments saying it could do with some more padding. There are some places where the text hits the edge of it's container, which is a bit off-putting. This seems to appear with slightly larger text.And yeah, those "standard" club websites aren't great - though it does seem to depend on club to club as to how well they're run. In general I like it, a bit more spacing is the only major thing.Here's to Danny Ward not impressing enough for first team football. We want him back at the County Ground for another season.
  4. As mentioned in the first reply, you can still get to the constant value using the constant() function, it still isn't a good idea though for the reason that the previous example demonstrates.The PHP grammar defines tokens starting with a $ to be T_VARIABLE, and because of that it is misleading to have a constant with a name starting with $, and the behaviour of the PHP interpreter does not allow it to act the same way as a normal constant - as it would require some significant changes to the interpreter to make this behaviour consistent.As it stands you can do: <?phpdefine('$foo', 'foo');$foo = 'bar'; // allowed, creates a separate variable unrelated to the constantecho $foo; // returns 'bar'echo constant('$foo'); // returns 'foo'?> This is not ambiguous, because $foo in the assignment and the first echo are only allowed to be T_VARIABLE tokens, and as such the defined constant named '$foo' is not considered. If you changed it to allow '$foo' as a constant to be treated like normal constants, then you would have to add in checks to make sure the '$foo' constant is not declared in the same scope as a $foo variable, and would have to add extra logic into the parser to determine whether the $foo found in echo is a variable token or a constant token, or if neither exist.So... I would consider it more likely that PHP would remove the capability to name constants containing $ characters than change the grammar to allow them completely. In any case, I can't think of any real reason why you would want to do it. Deirdre's Dad mentions that this is possible - and if you were to do that it would make more sense to remove $ as a character with special meaning in the grammar as it loses its usefulness. But considering how much stuff it would break, and the unnecessary complication it adds to the parser, I don't think it's sensible.As to whether it's a PHP design error, I would say: no. Any change to make it disallowed would be purely cosmetic. The way the grammar works means that allowing it is harmless really, it's something that would have to be intentionally misused by a programmer to cause any issues.EDIT: Oh, and one reason why it isn't syntactical sugar really in my opinion: take the example: <?phpfunction bar() { echo 'foobar'; }$var = 'bar';echo $var(); // outputs 'foobar'?> That kind of syntax is possible because of the way PHP handles variables, if you didn't have a $ denoting variables, that would not be a valid way of calling the 'bar' function, though I admit that's a fringe use-case.
  5. Of course, if uniqueness is very important you can work out an encoding of the string as an integer that is unique (I'm assuming that the end result is just a unique string containing only 0-9 digits?). This would be particularly simple if we specify that the encoding works on ASCII characters only because you can just loop over the string concatenating the ASCII decimal value (padded to three digits in every case), or a more direct conversion using the binary representation of each character.That would give you (for all ASCII strings) a unique encoding in just decimal digits. Though I have to wonder why you wouldn't just have the string representation - these integers are going to get huge very fast. The encoding of this paragraph as a unique integer would be enormous.A hash which doesn't enforce uniqueness would be more practical for large inputs.
  6. Best concurrency you can do with PHP is using stream_select() or pcntl_fork(). The above is true though, fork would be a multi-process model.
  7. @Mencarta: cheers @MrFish: Well, if you're interested you can see for yourself, the example there is minified jQuery. http://jquery.com/ has links for both minified and uncompressed source files to download. Download both and see the difference in practice.
  8. Enclose the text of the link in a <a href="URI"> tag, with "URI" as the link in question i.e. "http://site.com/". So if you currently output: http://website.com/ You want to instead output: <a href="http://website.com/">http://website.com/</a> This is fairly basic HTML, I recommend you get a book on the subject or read through the w3schools information on HTML.
  9. @Synook: Thanks, yeah, I should. May get to that today, it's a quick fix. Done. Yeah, I noted it lacked detail previously. That being said, the portfolio section is probably the least important bit to me, because I'm not using this to drum up business (it's just a record of things I've done). I'm planning on getting a job on the basis of my eventual degree instead. Anyway, more detail is planned for those pages, I intend to add extra relations to the project database so I can relate various other things to the information shown.EDIT: External links section added to project/portfolio pages.As to speed, I think that's just a case of my VPS being sluggish, I may migrate elsewhere at the end of this payment cycle. (can't say I'm liking CentOS much for one thing - awful having come from a nice clean Slackware ) For me it's not too slow, takes a second to think about it then loads the page, if you check your ping latency that might suggest that it's a network issue. As noted above this is minified JS (and third-party at that), they're useful JS libraries, though I realised I don't really need most of them around all the time, so highcharts isn't on the main pages any more. Certainly do, check out the source.
  10. Alex-elliott.co.uk is my personal website, mostly just a collection of information about my projects and a blog. It has been online for a while, but I haven't actually gotten most things working until recently (I got the blog up and then had a long break for university work). There's still more that I want to add for the project pages, like references to categories in the blog, and links to external sites.For now it mostly suffices, it's just the page on Expression Editor that suffers from lack of detail (if you're interested, it's a Regular Expression editing tool [screenshot] hosted in a public git repository - you may or may not find it useful, but I had to make it when KRegExpEditor wasn't ported to KDE4).Comments welcome on the site or the projects.
  11. You end your string there with \", that's escaped the double quote.
  12. The documentation for mysql_fetch_array has several examples of how to visit every row returned in the result resource using a while() loop structure. Examples #2-4 all do it, though example #3 is closest to the behaviour you want.
  13. You note the change yourself, when you have "TestSearch.php?Search", there is a "Search" URL variable, and so $_GET['Search'] is a valid index. When you visit it without "?Search" there is no such index in the $_GET superglobal array. And the line that is triggering the error is where you do: <?php echo $_GET['Search']; ?> This will always give you an E_NOTICE level error in cases where 'Search' is not a defined index, and by default it is only a defined index when "?Search" or "?Search=anything" is in the URL query string when using $_GET as you are. Now, in the first reply it was suggested that you do not use $_GET['Search'] directly, except once at the beginning of the document where you could have: <?php $search = (isset($_GET['Search'])) ? $_GET['Search'] : ''; /* ... more code perhaps ... */ ?> And use $search anywhere you are currently using $_GET['search']. That line of code will never trigger an "undefined index" notice, because isset() does not have that behaviour. But it's important to remember, if you don't use $search from then on instead of $_GET['Search'], then you're not going to make any change to the notice you are currently triggering.One last thing to note, you should not directly echo out $_GET input, ever. You need to sanitise it first, you should actually have something like this (as well as the previous code sample at the beginning of the document): <input name="Search" type="text" id="Search" value="<?php echo htmlspecialchars($search, ENT_QUOTES); ?>" /> That will protect you from a XSS vulnerability that was in your code. See the documentation on htmlspecialchars for more detail on what it does.
  14. There are some very nice captcha services you can use to protect your site, one of which is reCAPTCHA, it's a well implemented (strong) captcha, includes audio for the sight impaired, difficult for machines to read because of the warped/distorted characters, plus the extra word is part of a large distributed system aimed at translating books that OCR can't read.I'd probably recommend this over writing your own, because it's not trivial to make a captcha of equivalent strength.
  15. I would probably recommend utilising mod_rewrite if you can to rewrite your .xml paths to a .php file which handles the generating. An example would perhaps be this .htaccess: RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-f # if file doesn't existRewriteRule ^([a-zA-Z][a-zA-Z0-9_-]+)\.xml$ xmlgenerator.php?string=$1 # replace the regular expression with whatever you need Or something like that, it doesn't break any .xml files you want to hardcode, it only works for valid inputs if you can express validation as a regular expression (they can still access the .php file directly, so you should check correctness in both).With that scheme, the user will see say steve_04586.xml but to the server it's xmlgenerator.php?string=steve_04586.
  • Create New...