Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by JohnD

  1. Do an assignment to a $row_count variable Instead of evaluating mysqli_num_rows($r) inside an 'if'. if (mysqli_num_rows($r) > 0) //replace this line $row_count = mysqli_num_rows($r); //(line1) with these 2 lines if (($row_count) > 0) // (line 2) You could also echo $row_count before the 'if' to see what it has.
  2. This was a good thread. It does a good job of illustrating the sometimes arbitrary and confusing changes introduced into a development platform.
  3. Larry, In ch 7 Design Patterns I am a little uncertain how to fit the UML diagram on p234 to the Strategy example. I realize that it is a generic conceptual model. I think the Context box could represent the intereface iSort, the Strategy box could represent Both Class MultiAlphaSort {} and Class MultiNumericSort {} and the ConcreteStrategyA{} ... C{} would be represented by Class StudentList{}, if fitted to the Strategy pattern example on pages 235 to 240. Is this correct? I do understand the implementation of the Strategy Pattern example. The reason I am bothering with the UML diagram here is that these diagrams have helped me a great deal when included with the oop chapters. Also, a slightly unrelated comment. If you ever decide to write the fourth edition of this book (which I would buy in a heart beat), I think it would be enhanced by an Appendix devoted to a listing of all the UML syntax. Of course keep the in-context examples of UML as well. Thanks, JohnD.
  4. Thanks for the reply Antonio. Nice to know my ideas weren't totally out in space.
  5. This question regards application design and does not have a source code component. Is it common practice, or good practice, to use an abstract class and and multiple interfaces (small i) together in the same application? Consider the example of an abstract class automobile. This general class would enforce the "is a" constraints of all automobile types. Several different interface(s) would be defined and applied to the subclasses of automobile based on the type of automobile being defined. Does this seem reasonable? Or does defining an abstract class and multiple interfaces seem like over-kill?
  6. Nice work! Thanks for the detailed post on how to configure this. You have saved me a lot of trial and error.
  7. I just wanted to put this out there in case anyone is having similiar problems with XDebug running in Netbeans 8. When I was stepping through the code in register.php Netbeans running XDebug debugger was reporting a 'value not available' or some similiar message on the form validation pass, line 98, [First Name]. When I chose Run File from Netbeans (without the debugger) everything worked fine. This appears to be a case of XDebug acting buggy. I was running it with the Debugger to resolve file locations, db name, passwords, etc., just to get the script working. Hope this saves someone some time.
  8. HTML_QuickForm2 is awesome! I will definitely be using it in my projects.
  9. Yes, I see now. I think was confused by the object variable $CONFIG having the same name as the class. Thank you both for the help.
  10. I was curious what instanceof would return here. It's strange because I can't do a print_r() or a var_dump() of $TEST. Also, I thought the whole point of the example was that in the "Singleton pattern is a creational pattern pattern that will restrict an application to creating only a single instance of a particular class type." (p216) I'm just trying to make sense of the models and see if there are cases where the php's behavior is counter-intuitive.
  11. This is the only way I could get it to work. I tried it both ways. Maybe it's just my PHP v5.3?
  12. When I user the instanceof keyword for the Singleton class in Ch07 page 218, it is returning true. See below. // Create a second object to confirm: $TEST = Config::getInstance(); // see what instanceof thinks... if ($TEST instanceof Config) { echo '<pre>$TEST IS instance of Config</p>'; } else { echo '<pre>$TEST IS NOT instance of Config</p>'; } It is echoing that $TEST IS instance of Config. Am I doing something wrong?
  13. I can't change my dev version to php5.4. I'm stuck with php5.3. Can someone help me change the tDebug trait into a class that I can use to debug classes? I have tried myself. I can't figure it out. Thanks, JohnD
  14. Page 211: [Tip] PHP allows you to more quickly reference namespaces...use keyword: Book says (incorrect): use MyNameSpace\Company; Should be (corrected): use MyNameSpace\Company\Department; use MyNameSpace\Company\Employee; All class names used must be included at the end of the namespace.
  15. I think your code is ok. I believe you are stuck on a functional issue. When you click on the Logout link your session data (displayed on the screen) is deleted from the database - session destroyed. You need to close your browser without Logging out - session will still be active...in the database because you didn't Logout. Then run sessions.php script. You'll see 'sessions exists' because you didn't formally logout. I apologize if I'm telling you what you know already. I had to run the script a few times before I figured it out.
  16. In header.html of Chapter 2, the class="logo_colour" is not found. I used the only style.css that came with the download/zip. Could someone provide me with the correct style.css or mock up a simple logo_colour class so I can test all the integration/functional aspects of this example? Thanks, JohnD.
  17. I'm looking for a work-around for the tDebug trait. In my dev environment, I am using php 5.3. In my production environment I am using php 5.4. Can you suggest a way of testing and developing traits in 5.3 that can then easily be converted to an actual trait in 5.4? Thanks, JD.
  • Create New...