Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. You can't convert RGB to CMYK as your RGB values will be an approximation. This article discusses the subject and also gives you a solution that comes close to the actual CMYK values. http://developer.loftdigital.com/blog/cmyk-rgb-and-php
  2. For an editor I really recommend PhpStorm link in my sig as for the framework I would suggest Zend it taught me a lot and has great potential
  3. ignace

    OOP Help

    You can't be serious. You will lose a lot of clients if you pursue this. Server administrators for example buy motherboards which have 2 sockets which means they also will buy 2 CPU's. Not to mention gamers which now standard buy 2 GPU's for SLI/CrossFire.
  4. Quoting is simply guesswork, you can't tell someone it will take you x hours because it won't take you x hours, it will take you x + y hours where y is the number of hours your client suddenly realizes also they are gifted with a brain and (for the short span it will remain active) abuse it in various ways reducing you to a mouse cursor controlled by the client. So, if you told them it will take x hours they honestly believe it will remain x hours regardless of how many changes they propose. So a few pointers when you next time talk to your client: 1. http://theoatmeal.com/comics/design_hell 2. "never talk to an idiot, he'll drag you down to his level and beat you with experience." PS it's not always like that of course but it happens once in a while
  5. class ClassLoader { public function __construct() { spl_autoload_register(array($this, '__autoload')); } public function __autoload($class) { //logic } } class MyApplication { private $autoloader; public function __construct() { $this->autoloader = new ClassLoader(); } public function bootstrap() { //logic $this->registerParam('MyApplication', $this); $this->boot($this->getParams()); } } MyApplication wraps the entire application much like Zend_Application does, the advantage is that your otherwise global variables are now wrapped in an object which are accessible throughout your entire application and accessible through some mechanism in the Zend framework you would access the application object by using: $this->_getParam('bootstrap')->getApplication(); However to design your application in such a way will require a good deal of design pattern knowledge (GoF, Martin Fowler, Craig Larman, Eric Evans, ..)
  6. For question #2 I would store it like: id, host, path 1, www.phpfreaks.com, logo.png
  7. use strcmp: Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
  8. 108 Errors, 7 warnings http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.wljol.com%2F It'll increase with every post
  9. I think the parser catches that, not sure though.
  10. l1: JMP l2 l2: JMP l1 Ought to do the trick
  11. I think Eric stores his email in /dev/null though He probably considers any electronic mail junk
  12. $first_date = mktime ( 0,0,0, intval($on_month), intval($on_day), intval($on_year) ); $second_date = mktime ( 0,0,0, intval($date_month), intval($date_day), intval($date_year) );
  13. array_keys -- gives you the array keys (name, ..) array_values -- gives you the array values
  14. You can write the array information using: file_put_contents('myfile', implode(PHP_EOL, array_values($row)));
  15. You should have created it under the correct directory this would be either under ZendServer/www or under your predefined www-location
  16. The suggested will save the dump file to the location in which mysqldump was called. You will need to set the correct headers and readfile to display the file as a download.
  17. No. What are you actually trying to accomplish quite possible there is just a problem with your app design and we can correct it.
  18. What is eggs? Part of an age old question which came first? The chicken or the ..
  19. No. The variable $species does NOT exist within Human to show you try: $mammal->age = 1;//Fatal Error $mammal->species = 'Whale';//Fatal Error $human->age = 1;//Fatal Error $human->species = 'Boy';//Undefined Only public and protected fields are passed by inheritance private are NOT. Also you can only access variables directly if you declare them public (in which case they are called properties): $human->name = 'George'; However you should avoid this and use setters (mutators) and getters (accessors) instead. And declare your class members private (only in rare cases should you use protected) class Mammal { private $name; private $age; private $species; public function setName($name) { $this->name = $name; } public function setAge($age) { $this->age = $age; } public function setSpecies($species) { $this->species = $species; } } class Human extends Mammal { } $human = new Human(); $human->setName('George'); $human->setAge(13); $human->setSpecies('Boy'); var_dump($human); Works with no errors. To understand why this works and the other didn't is because of scope resolution the below example also works: class Person { private $name; public function equals(Person $p) { return $p->name === $this->name; } }
  20. You'll have to think this through very carefully. IMO should you create a separate table for both teacher and student because a student is not a teacher although data may be in some circumstances similar (name, birthdate) between both, a student does not have an employment record (in normal circumstances) nor does the teacher get graded. In OOP terms it also does not make any sense as: class Student extends Teacher {} class Teacher extends Student {} In the first scenario is a student capable of more then the teacher while in the other you would have an overhead (getGrades(), getTimesFlunked(), ..) functions that make no sense in a Teacher context. In OOP it is a good practice to use Value Objects (or Active Records) class Student {} class Teacher {} Consider for example: public function setGrades(Teacher $t, Student $s, array $grades) Now assume you said a Student is-a Teacher which assumes this is equally true: public function setGrades(Student $t, Student $s, array $grades) And to prevent this from happening you would always have to write: if ($t instanceof Teacher)
  21. Zend uses: define('APPLICATION_PATH', dirname(__FILE__)); $app = new Zend_Application(APPLICATION_ENV, 'path/to/config.ini'); $app->bootstrap('FrontController')->run(); The constant APPLICATION_PATH is used/resolved within the config.ini like so: resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  22. At best PHP can "close" the div after it received the first request (on which the div will be closed on any subsequent requests) Off course this is in the science that the user may not have read nor have actually closed it. You just assume that the user has read it before he clicks on any link on your website. A more effective way would be to use cookies (as both PHP and JS can set them) and set the cookie whenever the user actually clicks close then whenever he returns JS checks if any such cookie has been set and if it is then keeps the div closed, opened otherwise. PHP at that point can read the cookie and update the user table (if a login system is present) stating that the message was read and should not be displayed on any subsequent logins.
×
×
  • 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.