Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Synook

  1. Unshuffle this for me: "wisadfpovsavnkkslda"! (Hint: the answer is "vnkksldavsaisadwfpo".) :P (Technically, the point is that shuffle() is not bijective and thus not invertible, that is, there is no "unshuffle" function shuffle-1() such that shuffle-1(shuffle(x)) = x for all x. Of course, shuffle() isn't even deterministic.) If you mean, how can you arrange the characters of a string in alphabetical order, then you may want to try something involving sort(). ... as Ingolme said, and I didn't see :P.

  2. You can use the file_get_contents() function or a HTTP library like cURL to retrieve the content from the third-party website. If they publish their statistics in RSS or another XML-based format, then of course you can use an XML library like DOMDocument to parse the results, otherwise if the information is only available on their HTML site, you can try using the XML library on the HTML anyway, but if that doesn't work your best best would probably be regular expressions. Once you have the data you can just insert it into your database as normal. To make the script run every day you can use cron (Unix) or Scheduled Tasks (Windows).

  3. Assignment is just a normal statement that returns the value that was assigned — there is no requirement that it goes on a line by itself. This is why things like

    for ($row = mysql_fetch_assoc($query)) ...

    work. You could do anything:

    $a = "a" . ($a = 5) + ($a = 10) ? $a = 10 / $a = 5 : $a = "thing";

    Maybe you are thinking about list()?

  4. The W3C HTML validator doesn't "validate" your Javascript — the CDATA markup declaration indicates that the contained text is just text, not HTML, and so it doesn't care anymore. Similar with the comment markup declaration (except that tells the parser the contents is a comment).P.S.: XHTML is a dialect of XML, and HTML is a dialect of SGML, so when it checks well-formedness it will use the relevant one.

  5. What do you mean by a "real link"? Your code seems to be checking whether the URL is well-formed or not (though I can't tell whether the regular expression is correct), but http://www.9as0danotwaebsite.ca is perfectly well-formed too (just that no one seems to have registered it yet). If you want to check whether there is a web server at the given domain, or that it returns 200 for the given URL, you will need to co-opt your server using AJAX.

  6. If you used Dreamweaver, well, then you would know you've used Dreamweaver, mm? If the Javascript component of your assignment is being assessed, and you copied code from other sources, then that's already plagiarism, regardless of whether it was programmatically generated or not.

  • Create New...