scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
I'm interested in the difference in "randomness" between the two. Obviously you get a 4 digit random number either way, but is there a difference? Any math wiz's on?
-
The third parameter makes mkdir recursive. mkdir
-
I don't really like that. The code will run and work fine as it stands, except it won't be a real session. Plus, it's not immediately obvious that this snippet of code is actually the start of an application. Maybe I'm just nitpicking now.
-
Because it's like anything: you get what you pay for. You can expect a non-free CMS to be of higher quality. This isn't necessarily the case, but it often is. A paid CMS probably has full time, dedicated developers, rather than random commits from the community like with an open source CMS. This is sometimes a good thing, and sometimes not.
-
Technically, var $var = 0; is valid for class variables. Foreach also works with objects. Ehhhhhhh. I don't know about this one. It's not strictly about defining a function. But, I digress. This is only valid for PHP >= 5.4, so it might confuse some beginners. I'm not sure var_dump() is meant for debugging. It is helpful, sure. echo's can be just as helpful, depending on the situation. Other things like print_r or var_export() can be useful as well. This is a little vague if not inaccurate. break exits from a loop at the current iteration and proceeds through the rest of the code. continue breaks from a loop at the current iteration, and begins the next iteration. EDIT: Damn, kicken beat me on a few of these.
-
That doesn't really make sense. The obvious answer would be that no, not every line would end in a semi colon. People will get this wrong simply because they will think you mean something else. Change the question to, "All statements MUST end with a semi-colon"
-
What is the difference between == and ===? Assuming $var has a value of 1, which statements evaluate to true? [*]$var == true [*]isset($var) [*]empty($var) [*]$var === true Assuming $var has a value of 0, which statements evaluate to true? [*]$var == false [*]isset($var) [*]empty($var) [*]$var === false
-
Keep in mind that a CMS will (probably) never be as fast as something custom coded. This is because most CMS's (like frameworks) are made to be useful for a lot of different applications. When you have cut and dry specifications, you can often optimize it to a greater degree. With that said, Drupal is a good platform because of its massive amount of community plugins and modules. You can pretty much make any kind of application with Drupal just by using existing plugins.
-
You can probably get a ton of ideas here: http://www.reddit.com/r/dailyprogrammer/
-
The big line spanning the whole width of the post isn't prominent enough?
-
For what it's worth, you can just do this: $country = trim(shell_exec('geoip-lookup '.$_SERVER['REMOTE_ADDR']));
-
There's no reason at all to put sensitive information within the web root. Why even give the opportunity to parse it? Barring some serious flaws in your code, there's no way to output the contents of a PHP file by executing it on the webserver. If there was, a lot of websites would be in deep trouble. So, while I do agree with you, there isn't an immediate cause for concern by storing a password in a php file. After all, that is how nearly every PHP CMS and framework stores database credentials.
-
Can we see the code for the geoip-lookup program?
-
Yup, this doesn't make much sense. You already know if the user is who the user is.
-
Well this one is just about one year old... I guess laptops are just not suitable for video gaming. They can be. It just depends what you buy. Even gaming laptops kinda suck. Small form factors don't deal well with heat - a pretty common by-product of processor-intensive activity. If you want to game, a laptop is generally a bad idea. Melted components SUCK. Yeah, but laptop components are designed to handle more heat than desktop components. It's usually no biggie to get your GPU upwards of 80-100*C on a laptop. Plus, most true gaming laptops have more room for components and bigass exhaust fans. However, I'm not going to argue that gaming on a laptop is ever going to be as good as gaming on a desktop.
-
Well this one is just about one year old... I guess laptops are just not suitable for video gaming. They can be. It just depends what you buy.
-
yes, but / is root is root is root. it doesn't matter if you're 15 levels deep, / is le whole enchilada! I'm not talking about just root. For example let's say you wanted to delete a whole directory from the web directory. If you accidentally ran rm -rf /var/web you have just deleted the entire contents of the web directory. If you used ls first, you might realize your mistake.
-
It would have if you ran it on the path, ie: ls /. Then, just uparrow and change the command. It makes more sense if you were working with a longer path.
-
And ls But hey, we get cocky sometimes.
-
HAHA! That's awesome. By the way, that is a good book.
-
LOL. *NIX needs a, "are you sure you want to execute this command that is about to pwn your server?" confirmation.
-
I don't think he knows that OOP is anyway. He probably does this and thinks he's an OOPer: class Hello { public function world() { return 'hello world!'; } } $hello = new Hello; echo $hello->world();
-
Interesting, I wonder if someone needs to start looking for a new job. Either way it's going to cost gdaddy some customers. It brought sopa to light for those who didn't know gdaddy's stance on this issue and it also brought other gdaddy performance issues to light. Firing the sysadmin depends on the severity of the error. I once typed > instead of >> in a cronjob and we lost about $4,000,000. We had another guy make a router route to itself (he thought he was logged in to the one in the other room) and that took down a whole datacenter for a few minutes. Sometimes shit happens. It probably wasn't malicious, like the press release said, I bet they had a typo in the routing table. Remember when Google went down for an hour because someone had disallowed their entire database with a typo? I am not, nor have I ever been, a sysadmin, but I can't see a small typo taking entire datacenters offline for a whole day. Maybe a few minutes until you go, "oh shit, what have I done?!" and fix it. But a day? Why would it take that long?
-
SMF is procedural because it is intended to be a small, lightweight forum system. It is great for small communities or simple needs. It seemingly lacks scalability, which is the main reason PHPF is upgrading.
-
header("Content-Type: image.jpeg") not working
scootstah replied to krash11554's topic in PHP Coding Help
You can't output anything else except for the image. Content-Type: image/jpeg means the page will be an image. HTML is not an image.