Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
This is probably how I would lay it out: users user_id etc. items item_id etc. item_votes vote_id user_id item_id value So item_votes.value would simply be either 1 or 0, which respectively represent thumb up and thumb down. Then you could do something like this: SELECT SUM(value) / COUNT(*) AS score FROM item_votes WHERE item_id = 123; That should give you a number between 0 and 1. So if score was then 0.47 then 47% liked it (and 53% didn't).
-
If PHP exceeds the max execution time it will result in a fatal error. Fatal errors mean a 500 error when PHP is running as CGI or FastCGI. dflow, check the error logs, they'll say which error caused the 500.
-
Copying a single file to multiple sub-directories
Daniel0 replied to johnc71's topic in PHP Coding Help
Upgrade. No excuses. -
MySpace hasn't released their source code.
-
You could write a script that checks if it's running, and if not then start it. Then add a cron entry to run it at a certain interval. So, on my Gentoo VPS, if I might do something like this: degeberg ~ # /etc/init.d/apache2 status * status: started So that tells me that Apache is running. If it hadn't returned that then I could execute /etc/init.d/apache2 start to start Apache. Do that for all of your services, make a script out of it and use cron to routinely run it. This can of course not be used to check if your cron daemon is down, but I don't think you can guard against that without having an external server check that.
-
I disagree on the Fedora part. CentOS also uses Yum and RPMs, and I think it's inferior to Debian's APT or Gentoo's Portage. Our servers here on PHP Freaks are running CentOS and I think the package manager sucks.
-
Downloading content and parsing it takes up the majority of the time it takes to load a page. According to Yahoo, around 80% (source). Unless your code really sucks, you should focus your optimization efforts on the front end.
-
Switch Decimal place using decimal numbers.
Daniel0 replied to jason97673's topic in PHP Coding Help
http://www.google.com/search?q=define%3Asarcasm -
Point being that you need the book in front of you to be able to read it, so to speak. Same goes with any type of content, be it physical or digital. You can't read the book if it's at the library and you're at home. The book must somehow be brought to you or vice versa.
-
That's difficult to say, but try to look at where the log entry says the error occurred. Maybe that'll help you.
-
Just drop it. Any programmer could easily circumvent any system you make up unless perhaps you encrypt the source code.
-
Yeah that's what we're using it for as well. We don't have that much control over SMF, so it's nice to just block all requests like that.
-
We did this to protect against what premiso just explained.
-
No, it does not. You've just set a lower error reporting level. Set it to E_ALL | E_STRICT.
-
It's because you haven't used OOP in your example. You are just applying procedural principles to an object model, but that doesn't make it object oriented. You can't just "translate" line by line like you're doing. Also, the "class oriented programming" was just something I made up. It's not something that's generally understood. I used that term because all you've been doing thus far is wrap your functions in classes, but that's nothing more than emulating namespaces in a poor way. Many people seem to do that and then go on to call it OOP, but it's not OOP unless your code revolves around objects and their logical/natural interaction with each other.
-
how to modularize php files in a web app
Daniel0 replied to BeerOclock's topic in Application Design
I really must say that I still do not see the incentive for not using the built-in session functionality that works quite fine already. -
I've been thinking about installing 7 RC on my laptop (currently running Vista). I haven't completely decided yet though.
-
Just get it from a torrent. Same thing anyway.
-
Yeah I'm just creating this topic so I have something to show the SMF team.
-
<?php function test() { echo 'this is a test'; } test(); Disregard this...
-
He would probably check the mime type or something like that.
-
I actually think the backtick is an incredibly annoying character. On Danish keyboards you don't have a key for just that, but rather a key for adding the grave accent above a letter, e.g. è. You need to use the shift key though, otherwise you'll get the acute accent. So you have to press Shift+´ and even then you don't get the char. It'll wait for the character you wish to apply it to, so you can press something like Space. It requires a minimum of three keystrokes to get that character using a Danish keyboard. I don't use it unless necessary in MySQL queries.
-
Well, yeah, if you're doing a linear search then it will obviously potentially take longer time finding what you're looking for with a larger problem size. How are you doing the search?
-
Of course it keeps the session going. That's what it's meant to do. Unless you overwrite the value or delete the value, it will persist along several requests as designed.
-
Don't rely on the referrer. It's better to set a token like that and check it on the subsequent request.