Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. realpath returns the "real" absolute path of whatever you put in. If you pass it a relative path it turns it into an absolute one: realpath('/User/Ignace/PhpStormProjects/foo/baz/../../foo'); // returns /User/Ignace/PhpStormProjects/foo If the passed in argument points to a linked directory then it resolves the link and return the underlying directory, for example on my Mac the directory php5 points to the latest php5 version: realpath('/usr/local/php5'); // returns /usr/local/php5-080920122231 Since all IO operations are "slow" realpath() caches everything it resolves. It uses APC for example if you have it enabled to speed up lookups across all visitors. That's what I heard/know about realpath().
  2. You should get yourself a decent IDE, they tell you where you have an error.
  3. I never said it were entire pages. Just a few here or there. It does not really bother me although I think they can easily and should filter them out.
  4. lol @ the comments on the article.
  5. Or Google is trying to tell the user something.. "Have you been baptised?"
  6. This is mostly when I am searching for software architectural articles or methodologies (I think I had it last with domain-driven design). So I guess it's with more exotic search terms. I think it is funny how you actually implied that I am a liar ("I've NEVER gotten a result in korean or chinese.") and a pervert? ("it makes me wonder what you are searching for"). Great to see to get this kind of respect from fellow members. When it does not satisfy the user's expectations (ie bible phrase for a community logo)
  7. Just because you NEVER get a wrong result from Google means that everyone else does too. I am not claiming all the results I get from Google are wrong it's just that they can easily filter out languages I most likely do not speak and even if there is no 100% way at the very least they could remember the language filters I set so I don't have to repeat them every time.
  8. Did you look at the results? The reason is pretty obvious. Yes, I did. And yes I know why. Probably a bad example on my part but a problem I believe many of us faced before either ending giving up or keep adding -somekeyword. I tried adding "relevant:" once but that did not work And for christ sake Google "I DO NOT SPEAK CHINESE/KOREAN/JAPANESE !! So filter these too so that I don't have to manually enter a language filter EVERY TIME!" I even properly configured Chrome so that it has the Accept-Language header set to the languages I speak/understand: French, German, Dutch, English.
  9. I like neither. As a general purpose search engine they are both probably GREAT! But when you want to search for something specific you more often then not get non-relevant links (like when I searched earlier for "community logos" it gave me results related to baptism and the bible... dafuq!). This is just one example we can thank all those SEO consultants for worldwide... Which is another issue I have with both search engines. It would be really great if Google,Bing,<competitor name here> would take the same route stackoverflow takes with their communities (*.stackoverflow.com). So that when I am looking for programming related stuff I don't end up getting bible phrases... and that's probably a million-dollar niche idea I just flapped out in the open! I also found it very hard to simply navigate to a service/product on Google's website, before their entire overhaul, without having to resort to their own search engine to find the damn product/service..
  10. i want that xml to be sent to the client side and then another page will use that XML to display the data... Back to my original answer: Or use XSLT. If this is not what you want then you are gonna have to clarify yourself properly.
  11. Oops misunderstood your question. Why don't you just let the user upload the file? Otherwise you'll have to reference it through file:/// but then it'll have to be at an exact location and the client must allow it.
  12. Ajax: Using jQuery: $.get("path/to/xmlfile.xml", function(xml) { console.dir(xml); }, 'xml');
  13. I use phpDoc for a very long time now. Never heard of Natural Docs before but it looks really good.
  14. Here's an article describing divers methods to hide the referrer. http://lincolnloop.com/blog/2012/jun/27/referrer-blocking-hard/
  15. Only cake for badged members
  16. ignace

    _magic_

    http://php.net/mysql-real-escape-string Look at the big red box
  17. ignace

    _magic_

    That's how it should be done: if (get_magic_quotes_gpc()) { $_POST['subjects'] = stripslashes($_POST['subjects']); $_POST['codeA'] = stripslashes($_POST['codeA']); } $update = sprintf("INSERT INTO newdb (subject, code) VALUES ('%s', '%s')", mysql_real_escape_string($_POST['subjects']), mysql_real_escape_string($_POST['codeA'])); $result = mysql_query($update);
  18. +1
  19. No......
  20. ignace

    _magic_

    mysql_real_escape_string will add slashes for any character's (' and ") which could break your SQL. That said relying on mysql_* functions should be avoided and you should use the mysqli_* functions instead or PDO. http://php.net/mysqli-real-escape-string
  21. No. You only load what you need. Your factory will build the proper objects in the form of a Proxy or a Ghost object if need be. So that if for example you need the profile information, but you did not load it the first time (a Profile object with only an ID aka Ghost object) it will hit the database and load the profile information. http://en.wikipedia.org/wiki/Lazy_loading#Ghost
  22. Or if you just want it copy another: $('#menu1, #menu2').change(function(e) { var $this = $(this), other = $($this.attr('id') === 'menu2' ? '#menu1' : '#menu2'); other.val($this.val()); }); http://jsfiddle.net/DdCpX/
  23. Your real question is: how do I cleanly separate an SQL query from the code that creates the objects. There are a few ways you can do this, here is one: class UserRepository { private $dbAdapter; private $factory; private $identityMap; public function findProfileById($id) { if ($this->identityMap->has($id)) { return $this->identityMap->get($id); } $sql = $this->dbAdapter->select('..')->from('..')->join('..', '..')->where()->equals('id', $id); $row = $this->dbAdapter->query($sql); $inst = $this->factory->newInstanceFromDbResult($row); $this->identityMap->add($id, $inst); return $inst; } } class UserFactory { public function newInstanceFromDbResult(DbResult $foo) { // creation code return $instance; } } The factory creates the aggregate root and any relating objects like UserAccount, Profile, and UserContactDetail. The Repository is an in-memory collection of aggregate roots. It hits the database whenever you try to load a root it does not contain. Even if you would opt to go with Doctrine, you would still at some point have to write the query and do all the necessary joins because if you don't and trying to access a not-yet-loaded field will hit the database to load ALL the necessary data.
  24. If they do that they may aswell add support for: class Foo { private $bar = new Bar; }
×
×
  • 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.