Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Yes, you need to modify createMarker(). And load() too. createMarker() needs another parameter so it can know what the URL is. It could be passed the whole URL that it uses verbatim, or just an ID number which it turns into a URL. Doesn't matter. Then load() needs to grab that information from the XML (or wherever) and pass that to createMarker().
  2. Use doubles for everything, then round all numbers to some maximum degree of precision. 1 + 2 might turn out to be 2.999999999978 so you round and end up with 3.
  3. The code you posted... It has nothing to do with putting stuff into the database. Isn't that where the problem really is? Getting it into the database?
  4. Let them classify themselves. Present three challenges ranked low, medium, and high, and open enrollment to everybody. I like to think the staff knows enough people well enough that we could tell when an A-rank coder solved the C-rank challenge. With that said, if there were badges respective of the challenge then that coder bragging about the "I can solve basic math equations" badge might not look for good for them.
  5. Define "doesn't work".
  6. This topic has been $verb->toPastTense() to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=354538.0
  7. mod_rewrite cannot do substitutions like that. Technically it can, but it's absolutely ridiculous and should not be done.
  8. Not really. SMTP is a protocol for moving emails between servers. Programs use this protocol to send (and thus receive) email. There are many programs that handle either/both sides of that transaction. POP3 and IMAP are protocols for accessing stored emails. Both allow for retrieving email without deleting, both can keep or delete emails after the user has "deleted" them. IMAP is "better" because it has more features and fewer limitations.
  9. requinix

    syntax

    The errors I see aren't syntax errors.
  10. Math.random is the main part, the rest is just details.
  11. Off the top of my sleep deprived head (I'm at 21 hours I think): SQL injection, XSS injection, cross-site request forgery, SSL, and encryption practices to start. There are also a few nuances with PHP like the downsides of loose typing, how form variables are strings, scalars versus arrays from forms and how PHP can barf on them.
  12. Only include the conditions if you actually need them. // multiple statements $query = "SELECT ..."; if ($condition) $query .= " AND table.field LIKE '%foo%'"; // one big query $query = " SELECT ... " . ($condition ? "AND table.field LIKE '%foo%'" : "") . "
  13. The LEFTness only influences the join condition - if a WHERE condition excludes something, it'll be excluded. Does it show up if you drop all the worthless LIKE '%%' conditions?
  14. Can you describe your situation more? It almost sounds like you're being a bit paranoid.
  15. Sometimes yes, sometimes no, and it depends on the system. Assume the worst: you'll have the same file open by multiple processes all doing different things at the same time. You can, however, lock the file and eliminate the guesswork.
  16. You're a bit right but mostly wrong. static is an object-oriented thing, yes, but <?php blocks are not classes. If you're staying in the same file you don't need to "static" anything. The <?php blocks only control when PHP works; leaving one and entering another later won't affect your variables.
  17. Do you know what "static" does?
  18. Why are you using "static"?
  19. You can't. Which is why you'll have to come up with something that lets you (and mod_rewrite) tell the difference.
  20. Use a JOIN, like JOIN this table again ON this table's parentid = the joined table's id and include this table again.name as one of the fields you retrieve. Throw in a few aliases while you're at it.
  21. Do you have access to anything related to cron?
  22. Which API is that?
  23. Can you not fix the links to output in the right form?
  24. Case-insensitive
  25. Good, because I didn't want to try explaining things if you didn't care about it (no offense, I'm just lazy). You're looking for the exact string "" (case-insensitive). Regular expressions are overkill for that, but you need a count of matches and there is no built-in PHP function that can do that*. So now you have to create a regular expression meaning "literally ''". Two things: expressions need delimiters and [ and ] are special characters. What you had before "worked" because preg_match() accepts a [] pair as delimiters, but that meant you were actually only searching for "img". If you had the string To use img tags use "[img]". there would have been two matches. So the slashes in the expression are the new delimiters, preg_quote() turns an arbitrary string into something safe for regular expressions (turning the [ and ] into \[ and \]), and the /i flag means case-insensitive. Now that you're in the Regex forum, take a look at the stickies we have here. * substr_count() is case-sensitive.
×
×
  • 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.