Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. What you explained here is called Use-Cases except it would be formulated in a more abstract manner and it would also include the steps when something goes wrong depending on the involved actors. Also remember that none of these documents are permanent in software development as your code changes so do these documents. They are not static. They "live" as long as the project is.
  2. Tell 'em this: They'll be sure to feel a lot safer after.
  3. Use Subversion it will tell you exactly which files are updated since the last checkout.
  4. database normalization is database independent and therefor you should not mention or write the field types only field names. After you are satisfied with the database design you can think of the database('s) you wish to support and think of the best field types according to your chosen database('s) and your application. Just like in software design you first start to identify your components, and their underlying relations in a domain-model, and afterwards you would create a class diagram which specifies the types of each field. The best would be to find a good book that describes the complete normalization process as described by Codd as Codd specified a few rules you need to adhere to, to create a fully normalized database design. Thank you. This means much to me knowing that my work is appreciated
  5. Your WMP is different if you need to first read and then type then when you just have to type what comes to your mind. Someone may score average on such a typing test but may have to buy 3 keyboard's a year because of his coding speed.
  6. LOL, what if I were to check multiple numbers? How fast does that execute actually?
  7. It was actually in response to Alex who said: "It's possible though"
  8. I said it's harder not impossible. We know this, the OP doesn't.
  9. documenting is easy. Just put all values back in to one table (NF0) and then start to separate again, create relations and explain your steps. Until you reach the NF3 you currently have.
  10. As the error says you are either passing in to many values or to few in your INSERT query.
  11. Reference operator (&) is not necessary here. MySQLi is an object and all objects are passed by reference. You will still need it in a() though as the variable does not yet hold a reference to a class and is thus passed as a copy. As shown in: function a1(&$dbc) { $dbc = new StdClass(); } function a2($dbc) { $dbc = new StdClass(); } $dbc1 = null; a1($dbc1); var_dump($dbc1);//Returns: MySQLi Object $dbc2 = null; a2($dbc2); var_dump($dbc2);//Returns: NULL Anyway it's silly explaining this as it's bad to write your code like that.
  12. It's for example harder to accomplish the below with a switch statement: $value != 50 $value < 50
  13. With "When the user clicks the print preview button you direct them to a PHP page" I mean: <a href="print.php?articleID=$id">Print this article</a> print.php has only the print stylesheet loaded (which will make it look the same as the print preview). Remember to include your print stylesheet on all pages as the user may aswell just press File > Print Preview.
  14. If it were for students only then it would have been on a more private URL like ict.students.school.edu but it's not and the information is specific to the school and thus is to convince parents to send their children to that school because it's great because of x and y reasons.
  15. OOP gives you no gain if the project is to small or the deadline to short. Maybe CRC cards is what you need. http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card Writing effective OOP is not taught by going over someone else's code, for example: Teaches you nothing if you don't understand the motivation. First you must have a good understanding of the SOLID principles (http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29) and OOP patterns (http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29#Classification_and_list) and OOP anti-patterns (http://en.wikipedia.org/wiki/Anti-pattern) and good practices. OOP is not taught in merely days or weeks.
  16. How does he access $result then? You could also just write: function a() { return new MySQLi('localhost', 'root', '', 'db'); } function b($db_conn){ return $db_conn->query("INSERT INTO users(name) VALUES('$name')"); } $dbc = a(); $result = b($dbc);
  17. - Nothing about this website tells it's about a school. - The image above the content isn't going to convince parents to send there children to that school more likely keep them away from it. As who wants to go to a school that has graffiti all over it and looks like it could collapse any minute? - Your website does not indicate on which page the user is currently on. - You used images for text, use image replacement techniques. - Your third menu item has the :hover image missing on http://xgimnazija.edu.rs/Aktivnosti.html.
  18. It sure does, besides I believe the OP actually isn't aware of __set($key, $value), __get($key), __isset($key), and __unset($key) or ArrayAccess.
  19. That said, there are a few neat things you can do with it like highlighting keywords if they came from google.
  20. Because it isn't. DRY nor KISS is an ideology specific to OOP but to general programming. Imagine yourself using filter_var in different modules (not in a function of course, that's stupid) and you get a new client who has his own server running some CMS system and is interested in buying your product (a CRM system for example) however your client happens to run a PHP version smaller then 5.2 (which does not have filter_var()) and due to the CMS he runs refuses to upgrade, now you have to go through all your code to change all occurrences of filter_var with validEmail() as I bet you don't want to lose ~$2000 over filter_var() do you? All I want to say is that you can have multiple reasons for wrapping something in a function and it's ALWAYS a good idea to wrap it inside a function if you are to use it in MULTIPLE places to make problems like the above easier to CHANGE. Your application is subject to change and you should make it as easy on yourself to these changes. NOW it may seem like a bad idea to wrap filter_var() in all these locations but you will be happy to have done so when the above client passes. Another scenario may be where a client requires custom rules to apply to an e-mail, like where it would only be considered valid if it does not contain hotmail, gmail, .. No one can predict the future but you can write your software to more easily incorporate possible changes.
  21. doesn't mysql_real_escape_string() cover that? Yes but in order for it to work you will need to actually use it. In your entire code you only use it once on $nick while you perform queries using $email which is left unvalidated. And the MVC architecture isn't that hard, a sample (basic) OOP implementation: class FrontController { public static function run() { $controllerName = isset($_REQUEST['controller']) ? $_REQUEST['controller'] : 'main'; $actionName = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'index'; //validation and stuff $controller = new $controllerClass(); //*snip* call_user_method($controller, $methodName); } } class SomeController extends BaseController { public function indexAction() { //*snip* $this->view->some = $someService->findSomeBySome($query); $this->view->render('path/to/script.phtml'); } } If you want to add-in template support just use the two-step view pattern: class View extends ViewAbstract {} class TwoStepView extends ViewAbstract {} class FrontController { public static function run() { //*snip* $controller = new $controllerClass(new TwoStepView()); //*snip } } Your controllers still think they are using a normal view while in fact they are using a TwoStepView pattern that wraps a normal View. abstract class TwoStepViewAbstract extends ViewAbstract { private $view; // overwrite methods and pass it to $view public function __set($key, $value) { $this->view->__set($key, $value); } } class TwoStepView extends TwoStepViewAbstract { public function render($script) { ob_start(); $this->view->render($script); $this->content = ob_get_contents(); ob_end_clean(); include('template.phtml'); //<div id="content"><?php print $this->content; ?></div> } }
  22. Why make a function that would be called like this: if(validEmail($email)){ }//end if when you can save overhead and just do this: if(filter_var($email, FILTER_VALIDATE_EMAIL)!==false){ }//end if As you may want to vary the implementation, at some point you may want to ditch filter_* and use something different (like an on-line service for example) which would require you to hunt down all files that use filter_* instead of just modifying the validEmail function (as it may be used at multiple locations, newsletter, registration, login, ..). It's always better to write a function once you start to need something at multiple places, chances are you will be needing it in more places later on.
  23. Dreamweaver? About the only visual editor I know
  24. do you mean 1===true|1|'1' Shouldn't 1==true evaluate to true? No I really meant 1 == true|1|'1' which all evaluate to true.
×
×
  • 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.