Jump to content

corbin

Staff Alumni
  • Posts

    8,102
  • Joined

  • Last visited

Everything posted by corbin

  1. Well, Store can't equal two values at the same time unless the two values are equal, and they're not. So, sounds like maybe you're looking for an OR? SELECT * FROM extreme where `State` = 'AK' and (`Store` = 'B & R' OR `Store` = 'Extreme') order by City By the way, ` are used only in the MySQL SQL dialect, and they're only useful if the object is a reserved word, so they should typically be avoided. (They detract from SQL compatibility, and reserved words shouldn't ever be used anyway.)
  2. I would do it with iptables personally.... (Assuming it's a linux box.) That way the request never reaches Apache and you avoid the overhead of the request. Just drop all packets from that IP address. iptables -I INPUT -s 0.0.0.0 -j DROP (Where 0.0.0.0 is a real IP address) If the IP address changes, you'll need to make rules based on requests per second. (Don't know if that's possible or not with iptables since I've never looked into it.) (P.S. if the server is running Windows, Windows Firewall should work fine.) If the problem is going to be long term and especially if you expect it to become more of an issue (for example if someone starts a decent size DDOS attack), you might want to look into blocking on a router level. (Probably not worth the effort unless it becomes a big problem or if it's easy to do with your router.)
  3. I don't think it's possible, but I'm not sure. I typically just bookmark (as in the "Add Bookmark" link, not my browser's favorite feature) posts I want to come back to then delete the bookmark if it's not that interesting after all.
  4. It reminds me of the lawsuit a few months ago against MS involving the importation of XML into an object... Just another retarded lawsuit because of a patent so loose it never should have been granted. (Well, really I'm just assuming that since I didn't read anything in detail.)
  5. Should have been 100%-10% = 90 (Technically 90%.)
  6. There is one problem with hashes though. Uh, well I forgot the term, but its when there are two somethings with the same hash. I suppose the odds wouldn't be great to any degree. As corb calculated it to 73786976294838206464 different hashes which would bring the chances to near 0. So I suppose they hashed it. Hash collision? When generating unique identities, avoiding collisions is fairly easy: do { code = generate code; } while(code exists); (There are of course locking problems since theoretically in the time that code was said to not exist and actually inserted the same code could have been generated.) As far as collisions go, imagine how unlikely a collision would be on this: md5(video name . microtime(true)); (Of course they're not using md5 since the format doesn't match it, but you get the point.)
  7. How would you do it on paper? 100% - 10% = 10 So... since the units are the same, it's just: 100-10 100-$percent
  8. Ahhhh.... I read the generate part then entirely forgot about it when I read the 180 million part .
  9. I'm not sure exactly what you're trying to do, but it sounds like basic math: percent1 - percent2 Or, if you're trying to retain the weight of them: (val1+val2)/(max1+max2)*100
  10. watch?v=ewfFcmdSdck The codes are case sensitive and appear to be 11 characters that can be a-zA-Z0-9_-. So, 26*2 + 10 + 2 = 64 64^11 options: 73786976294838206464 That's how they do it .
  11. ASP.NET only has like 2k, but lots of major websites exist in it....
  12. You could get ideas from curriculum from somewhere else (get ideas, not steal ). For example, I don't know what country you're from, but in the US there are AP (advanced placement) classes that count towards college credit if the student gets a certain grade on an exam. You could look over the AP Computer Science curriculum. (Should be somewhere on collegeboard.com.) By the way, are you struggling with the syntax of PHP? Design patterns, or what? Not trying to patronize, but if you're struggling with the basics you should probably avoid teaching a class. Struggling with syntax and design is different though, and it sounds like you're good with Java so that's probably not going to be a problem.
  13. The default cookie path could've gotten changed. Try passing the path as an argument to set_cookie and you might also need to find the command that controls how session cookies are set and use that.
  14. I sure wish that PHP had a standard about function names/arguments... lol. Every damn time I use in_array I have to look it up.
  15. corbin

    OPENID

    Have you read the docs on the OpenID website?
  16. There is nothing morally wrong about boasting. Although, I did say "whatever makes you seem best that is legal" which would imply that anything, and in which case, I would agree that it would not always be morally right, but as far as boasting goes, nothing wrong. But at what point does boasting become lying? Technically I've been coding PHP for ~4 years. Would it be right to tell someone that when looking for a job though? What does that even mean in terms of qualifications? That I've been "trying" to learn PHP for 4 years. Portraying one's self in the best manner possible while remaining honest is perfectly fine. Misleading even the slightest though when done intentionally is not quite as fine. Well, I didn't mean quite that controlled. Just like a +- system or something. (I was mainly just thinking about the deals falling through part of your post.)
  17. Just because it's legal doesn't make it morally ok. Then again, I guess the client can always ask the person what exactly those X years of experience entail. Eh, since PHPFreaks is aimed at helping people and not at finding work, I doubt that will ever happen.
  18. RewriteRule ^admin/?(.+)$ admin.php [L] I should've seen that earlier... While /? means that the trailing / is optional, .+ means that 1 of any character is required. (You'll notice that if you go to admin/ it will probably work.) Anyway, I would try: RewriteRule ^admin admin.php [L] (Unless you want to capture what comes after admin it doesn't matter.) If that doesn't suit your needs: RewriteRule ^admin/?(.*)$ admin.php [L]
  19. What does your database layout look like?
  20. A character set is essentially a way for a computer to know how to display stored strings. http://www.w3.org/International/questions/qa-what-is-encoding Explains it fairly well. There's a link I saw a while back that explains it really well, but I can't find it. If you need more info, I'll try to find it for you. Edit: Oh, by the way, as to which charset to use, you need to use which ever one can store all of the data you want to store. For example, ASCII is only 1 bytes (8 bits), so it can only hold 255 characters. So ASCII and any charset that uses ASCII (for example, "US-ASCII") is pretty much only good for English. UTF-8 on the other hand is expandable. It has only 7 bits available for use, but that's because the last bit of the byte is reserved to mark whether the next byte is the same character or a different one. In other words, UTF-8 can expand. It can have between 1 and 4 bytes, meaning it can have up to 2^(7*4) characters (about 250 million).
  21. Ahhh, I forgot that RewriteConds only apply to the closest rewrite rule. RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f Rule1 RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f Rule2 I'm sure there's a way to do it less redundantly, but I don't remember how off the top of my head.
  22. Hrmmm, kind of. In PHP 6, I want to think that the default charset PHP uses is the one that the source file is in, but I don't think it really matters much. Also, when saving source files in UTF-8, you have to be careful to save without BOM or the PHP engine stutters a bit. The important part is making sure not to manipulate the data with a function that is not designed to handle that charset, and making sure the web browser knows what charset it is.
  23. *Googles "PHP Platinum"* Ohhhhhh! I'm sure foxnews.com's scripts are all custom written. Just as someone writes the PHP Platinum source code, Fox most likely paid someone to write code for them. (And unfortunately for you, I'm sure it's not available for download.)
  24. No, UTF-8 data will be fine as long as you don't do any non-binary or non-UTF-8 safe operations on it. When ever a variable holds something, PHP is pretty good about storing the value as expected and leaving it alone regardless of the data. If you want to use functions on the data or something though, you'll have to make sure the function is multibyte safe. For example, instead of strlen, you would have to use mb_strlen. As for outputting, you'll have to make sure that the client knows it's UTF-8 by the way. Usually something like the following works fine: header("Content-Type: text/html; charset=UTF-8");
×
×
  • 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.