|
Wikipedia is opensource, why not just look at the subroutines that handle diff straight from the horse's mouth?
|
# ¿ Mar 31, 2008 10:45 |
|
|
# ¿ Apr 30, 2024 13:14 |
|
Zorilla posted:Well, the conclusion I think I just came to hours earlier (with some help) is that you should check to see if magic quotes is enabled, then either don't escape if it's on or do escape if it's off. While I've never heard of it causing problems, it is recommended to unescape it and use the MySQL extension's escape function if magic quotes is on.
|
# ¿ Apr 7, 2008 08:38 |
|
Grigori Rasputin posted:2) Have html file stubs stored on the disk to read in and print. Hits the disk, might be a slight security risk. If this is a serious issue for you, you can use memcache or (harder to write, more optimized) write php that generates php code based on the contents of the db. The risk of somebody rewriting the .html files isn't any more than the risk of someone rewriting the code that includes it in a properly secured system.
|
# ¿ May 7, 2008 22:46 |
|
duz posted:Or just use readfile which doesn't execute anything. memcache doesn't execute anything either, and has a lot less overhead than reading from disk.
|
# ¿ May 8, 2008 00:19 |
|
Anveo posted:It is stored in memory, but you have the overhead of TCP to access it, plus network latency if the server you are accessing isn't the local one. Bah, poo poo like this is why I prefer to use FastCGI+C. There is no reason for something like memcache to run slower than a flat file read. At least if you roll your own poo poo you know exactly how fast it's gonna be. hallik posted:So $bar = 'yo'; if $bar = "lol" and $lol = "wut" then $$$bar == $wut
|
# ¿ May 11, 2008 08:43 |
|
Quote != edit.
|
# ¿ May 11, 2008 08:45 |
|
Anveo posted:Memcached is pretty efficient C, you just need to remember it is by design a network distributed memory cache and not a local memory cache, so it makes perfect sense it will be slower than a local file read. It is still fast and awesome. Well yeah but still in the degenerate case of one machine in the distribution, it should just degrade into normal memory caching. Of course, it doesn't matter anyways because we're piddling over what probably winds up being a small fraction of the execution time anyways.
|
# ¿ May 12, 2008 09:34 |
|
Zorilla posted:One thing I've never found documentation on is what the &= assignment operator is supposed to be. Or why I sometimes see functions as ___somename(). Can somebody tell me what the purpose of these are? &= is "bitwise AND" assignment. $a = $a & 16; $a &= 16; are equivalent statements. Functions like __function() are so-called "magic functions" and are reserved for future use by PHP. No user-defined function, constant, or method should start with "__". e:f;b. edit: Ha I was right though. "&=" != "=&"
|
# ¿ Oct 18, 2008 00:32 |
|
$a = 3; $b = $a; //$b is a copy of $a; $b++; //changing $b does not change $a echo "$a != $b"; //Prints 3 != 4 $a = 3; $b =& $a; //$b is a reference of $a; $b++; //changing $b DOES change $a echo "$a == $b"; //Prints 4 == 4 edit: gently caress BEATEN AGAIN YOU ASSHOLES. Atom fucked around with this message at 01:03 on Oct 18, 2008 |
# ¿ Oct 18, 2008 01:01 |
|
fletcher posted:Do you guys typically put a function that returns a collection of objects inside the class for the object it returns? I do this and it works just fine for me. Makes the most sense that a function related to a certain functionality should be in the namespace of the corresponding data structure. I have no problem calling user::get_users() unless I'd be doing it some non-static way like $search_engine->get_users();
|
# ¿ Dec 22, 2008 23:24 |
|
fletcher posted:Let's say you have a User class and an Article class and you want a function that returns all the articles a user has written. Does it go in the Article class as something like Article::getArticlesByUser($user) or in the User class like $user->getArticles()? What makes more sense? I would do it the latter way. No reason to do a static function when you can have one less parameter.
|
# ¿ Dec 28, 2008 11:00 |
|
KuruMonkey posted:i.e. how about 2 classes; Article and Articles; the former to abstract an individual and specific article, the second to abstract the colection of all articles, and provide functions that produce sub-collections (as, say, arrays of Article) What's the point of having a seperate class for "Articles?" I can't see what data this object would contain except that of an array of objects of type "Article"... I fail to see the necessity of creating something like Articles::most_recent(int) when Article::most_recent(int) would make just as much sense. It seems like OOP dogma more than anything practical imho.
|
# ¿ Dec 29, 2008 21:32 |
|
KuruMonkey posted:I've certainly never considered myself dogmatic about OO (slack about it, yes, dogmatic - no) I gave an answer of how I would do it, why I would do it that way, and why I wouldn't do it the other way - and a suggestion to go look at other ways - where the dogma at? Forgive me perhaps dogma was not the correct term. I just can't see a reason for doing it that way other than for adherence to a self-imposed standard.
|
# ¿ Dec 30, 2008 01:58 |
|
Murodese posted:You could always just accept arrays as input. Yeah but if you're going to use an associative array you might as well use an object imho. I hate looking at code that takes associative arrays as input because an associative array doesn't have an explicit structure where an object does.
|
# ¿ Jan 5, 2009 20:33 |
|
|
# ¿ Apr 30, 2024 13:14 |
|
Zorilla posted:Since I don't really know for sure, can somebody more knowledgeable say how you would evaluate whether a variable assignment has succeeded or not based on whether or not $source is null? Would something like this work? Since assignment returns the assigned value, wouldn't is_null($target = $source) work? I have no idea why you'd want to do this however.
|
# ¿ Jan 7, 2009 19:36 |