Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. province (province_id, ..) city (city_id, province_id, ..) model (model_id, age, height_in_cm, hair_color, measurements, eye_color, description, ..) model_in_city (model_id, city_id)
  2. Also so much more inaccurate (or vital bits & pieces missing). Having a book from a respected author like Martin Fowler, Robert Martin, Kent Beck, Grady Booch, .. gives you the guarantee that the information you are reading is accurate, and you support the author to produce more quality books. I read a lot while I'm travelling and having a book like xUnit Test Patterns (900 pages) in your hands isn't really comfy, so I bought myself a Kindle. Besides the advantage that you can still read in the sun and it's lightweight, the books are also only half the price which you can download wirelessly (Wi-Fi, 3G) from the Kindle Store built-in your Kindle.
  3. Start here: It takes your server 20 mins because it can't find a valid index and thus creates a temporary table which it joins with all other temporary tables and creates you a nice cartesian product to process. Post your table/queries here and we can give you some advice on which indexes you need.
  4. Yes, if each parent object was a stand-alone class. But you can create a class that holds all parent objects and upon retrieving a parent from the object it would load all applicable child objects and populate the parent object. class FooRepository { public function getBar($i, $loadChildren = true) { if(!array_key_exists($i, $this->bar)) { $this->bar[$i] = $this->_loadBar($i, $loadChildren); } if($loadChildren && !$this->bar[$i]->hasChildren() && $this->bar[$i]->hasFuckBuddy()) { // Found that in "God's Stuff/Earth/mating.source" $this->bar[$i]->setChildren($this->_getChildren($i)); } return $this->bar[$i]; } }
  5. Who say's you can't load them all at once using Lazy Loading? The technique just delay's the read to the DB until you actually need them.
  6. We decided to remove it since no one seems to click it!
  7. To get the results from a website, you'll need to scrape it from the website. When web scraping you should read the terms of use before doing so otherwise you may face a lawsuit. You can scrape the content using DOMDocument or using regular functions like file_get_contents() and fopen(). $content = file_get_contents('http://www.domain.tld'); Using this or the DOMDocument technique is memory intensive as it loads all content into memory. I prefer to use a combination of fopen() and fread() to read the data into chunks and conserve memory in the process.
  8. What's the definition of the fields you are searching upon? Are they VARBINARY? Or do they have a *_bin collation?
  9. $this->islive; http://www.php.net/manual/en/language.oop5.basic.php
  10. if(isset($variable)) { // only executes when $variable IS NOT NULL } if($variable) { // executes when $variable != false, 0, '', array(), .. }
  11. ignace

    Zend Date

    $date = new Zend_Date($row['db_date']); echo $date->get('YYYY-MM-dd HH:mm:ss'); More information can be found at: http://framework.zend.com/manual/en/zend.date.html
  12. Lazy Loading is as simple as: public function getFoo() { if(is_null($this->foo)) { $this->foo = $this->_getFoo(); } return $this->foo; } This way you will load Foo objects when you actually need them (when you call upon them)
  13. I'm sure those who started Facebook never guessed they would invite the whole world in on their crappy site.
  14. Fenway said that data duplication should be something you need to consider when things get really heavy not at the start of your project. MySQL can easily handle a few million records (with proper indexing). And if you then would feel the need you can create a summary tables with optimized indexes, or partition your tables, or ..
  15. Site versions are managed with release planning. On each iteration you decide what features will be built in the software. At the end of an iteration and prior to the actual release, you have a deployment procedure which depends on the project and your hardware architecture (it may be as simple as a SCM push to your GIT/Mercurial repo). Sometimes the release procedure is more involved and you have to do some manual editing like minifying JS and CSS files. The actual release is usually done overnight.
  16. Base your reasoning on facts not merely believes. Putting data in another table because one field would cost you severly in performance is nonsense.
  17. Have you uploaded the directory Zend into library? Do you overwrite the include_path in your application through set_incude_path()?
  18. Have you uploaded Zend framework to your webhost? Is this path available in the include_path?
  19. return ($_SESSION['validate'] == $this->_generateHash()) ? true : false; You don't need this extra typing $_SESSION['validate'] == $this->_generateHash() will return a boolean true if they match or a boolean false if not. So ? true : false; is redundant, don't state the obvious.
  20. for($i = 1; $i <= 12; ++$i) printf('%02d', $i);
  21. Add Lazy Loading to your Data Mapper. That way you only retrieve the course objects if you actually need them.
  22. Apparently you missed the point of programming. You can write a script that does this for you, as write the PHP include in the correct place, replacing whatever was there first. glob DOMDocument
×
×
  • 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.