Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by ignace

  1. If you have the finances you can find someone to develop it for you but then of course you need to be sure of a return on investment. Otherwise it becomes a blackhole where you throw money at. There are more efficient ways to make money with money (investing et al). If you want to learn how to develop a game go to https://unity3d.com/learn/tutorials. It contains tutorials on how to get started. If you need models you can also buy them here: https://www.assetstore.unity3d.com/en/ Though I would keep it 'free' for as long as possible (having 2 squares fight each other is fine for a prototype). A game that costs you thousands but never provide any returns isn't a good investment even if you have a great cashflow.
  2. If the problem persists to elude you. You can take the agile approach and use iterative development to get to the solution. What this means is that you start with very simple code that could work. For example a simple array with a mapping between products and tags/categories: <?php $tags = array( 'woman' => 'Woman (16 - 35)', 'infant' => 'Infant (0 - 1)', 'child' => 'Child (1 - 4)', .. ); return array( 11 => array( // assume 11 = product baby cream $tags['woman'], $tags['infant'], ), .. );Then in your code: <?php class ShoppingCartEvaluatorImpl implements ShoppingCartEvaluator { public function __construct(array $mappings) { $this->mappings = $mappings; } public function evaluateShoppingCart(ShoppingCart $cart) { // .. } } // in your shopping cart $evaluator = new ShoppingCartEvaluatorImpl(require '/path/to/product-mappings.php'); $evaluator->evaluateShoppingCart($cart);
  3. OT: It's less work and more precise to simply link your products to possible advertising directly. Instead of using pseudo-meta information that has several conceptual flaws. Like requinix pointed out that baby cream could be linked to either a mother between the age of 16 and 35 and an old man of 60+. This couldn't be more far apart. I understand this is homework and you won't have any say in the matter but nonetheless. Requinix already gave you the solution though I wouldn't generalize. So instead of simply stating Woman as a profile. I would add 'Mother (16 - 35)', 'Elderly man (60+)' etc.. Then for each new product that gets added like diapers for example will only contain 'Mother (16 - 35)' and do a array_intersect. So that 'Elderly man (60+)' gets excluded. As where Cane for example would exclude Mother. I wouldn't simply drop the excluded tags but keep them in a separate array as a second source of meta information (hard versus soft tags). For baby cream and diapers: Hard tags: Mother (16 - 35), Baby (0 - 4) Soft tags: Elderly man (60+)
  4. There's no need to re-invent the wheel: APIgility provides an API out-of-the-box. RESTler transforms your classes into REST objects. DREST does the same thing but for Doctrine entities. If you use Symfony, you can add the SyliusResourceBundle which is similar to DREST as it provides CRUD for Doctrine entities.
  5. Your application should only be database aware, not be the database. Define your database with proper referential integrity, events, views, and procedures as the database is optimised for this type of task. Your application should only know it's interface like every other REST API out there. If you use a (powerful) ORM you'll be able to translate these procedures and views to entities using a ResultSetMapper. Just like you would map an entity from a request when interfacing with a REST API. Now that you know this on to your question. ON DELETE [CASCADE|RESTRICT|SET NULL] depends on how the relations between your rows exists: ON DELETE CASCADE: You use this when it makes no sense to keep the child row if the parent row is removed. For example an OrderLine and an Order. If you don't have the Order, then having the OrderLine's makes no sense. ON DELETE RESTRICT: Like was already explained it simply prohibits you to delete a parent if it has childs. Just like you can't delete a directory if it contains files. You need to move or delete the dependent rows first in order to remove the parent. This is the default behaviour and you'll get a "Cannot add or update a child row: a foreign key contraint fails" if you do. ON DELETE SET NULL: This is useful for optional relationships. For example between a Customer and a Cart. If the Customer currently has a Cart the field contains a FK to the Cart.Id. If the Customer on the other hand does not have a Cart this is simply NULL and a Cart can be assigned. The Customer can exist regardless if he has a Cart or not. In order to impose theses restrictions you need to know how the relationships are between your data.
  6. I think most people simply misunderstood MVC because it's so dead simple. Only the View and Model part are significant, the Controller is nothing more but glue between them. In my career I never met anyone who understood MVC (and I simply assumed I understood by assuming that if their controllers had more code then their models, they were wrong). Even in the academic sphere when I was taught Java and .NET, their controllers were littered with model logic and their models mere data placeholders. One of those teachers even went as far as simply making every class static and just call them anywhere, everywhere. At that point I knew that self-taught was the way to go. And not all frameworks break the rules (I think none of them do). The one I show above is Symfony. Of course anyone can abuse a framework and put their model logic in their controllers. But I get why you think that, because a framework caters to all. And when you create something very simple there's no need to be all architect about it.
  7. Should validation be handled by your controller? No, because depending on the number of systems there may be more then 1 controller accepting the same data. Is validation part of the model? Yes. Don't get caught up on details. - View is what shows the response to a request of the user. - Controller is what accepts requests and acts upon them. - Model is everything else. That said, you should keep in mind to keep your controller code to a minimum. Because too much code in the controller means that you'll be copy-pasting a lot between controllers. Encapsulate (that means put it in a class) if you write something more then 2 times. You'll probably have come across services (if you are into SOA, (pun side note: in Belgium this is short for STD)). These services are a Facade to the model and mostly accept scalars (think productId). class UserController { public function registerAction(Request $request) { $service = $this->get('service.registration'); $form = $this->createForm('signup_form'); // another service $form->handleRequest($request); if ($form->isValid()) { $service->register($form->getData()); } return $this->render('register.html'); // return Response object } }Suppose that at some time you switch to AngularJS and use a REST back-end your code won't look much different: class RESTUserController { public function postUserAction(Request $request) { $service = $this->get('service.registration'); $form = $this->createForm('signup_form'); $form->handleRequest($request); if ($form->isValid()) { $service->register($form->getData()); } return $this->redirect('users_list'); }I say the $form is a service here, even though conceptually it's a client thing, it models how a client enters information into the system. It validates and turns the scalar input of the client into a model your system can work with.
  8. Our database only has that yes. requinix however has everything else. he knows where you live!!!!
  9. You don't need to worry about someone copying your code. We all suffer from Not Invented Here syndrome, so rest assured. And I am the guy who constanly keep telling everyone they SHOULD use other people's code (if available, well-tested, and adheres to some standard). Like minded people created an entire tool for plagiarists to do plagiarism and then sell it off as their own: $ composer require your/code
  10. Congratulations, you now know how the law works!
  11. So you want to school us on security. Let me school you how this works: 1. This website is owned by this guy and hasn't been around like forever and we have basically zero access to the server. 2. We are volunteers and do not get paid (that means people like you or those that cook soup for the homeless) 3. This is a forum for which the license costs 175$ which we need to pay for, while all profits of the ads go directly to no-show. 4. Be grateful you piece of sh*t instead of trying to school professionals that have lives just like you and donate their time and money to help people like you ALL FREE OF CHARGE!!! You are that homeless guy that complains when he finds a fly in his soup!
  12. Makes your requests per minute go over 9000!
  13. Here are the answers for reference: There are 4 in total: 1. Abstraction 2. Inheritance 3. Polymorphism 4. Encapsulation USE database_name; SHOW TABLES;
  14. $tmp = tmpfile(); fwrite($tmp, 'Hello, World!'); readfile(stream_get_meta_data($tmp)['uri']); fclose($tmp);
  15. Just add this to your code. GetSomeActualDeveloper()->solve($problem);
  16. There have been efforts to create a new front-end but we had to realize we all have busy lives. There is currently a private repo on github for the new front-end but nothing is happening currently.
  17. Can you show us your PHP project? And is this $99 per hour or per 10 hours? If this is per hour for a junior developer, then good luck landing a job. Also do you have a VAT registration number?
  18. "Your line has been disconnected due to increased complaints."
  19. Then you need to stop copy-pasting code and actually learn what the code does that you write. Take the code that you already have and learn what each line does. And then try to alter the code slightly and check if it works as expected. Keep repeating until you have mastered PHP.
  20. I also wouldn't show the overlap in the middle calendar. I confused the 8 and 9 in july with the one in august. Maybe also increase the number of reps you can compare with. Currently it is set to max. 10 while people who train on strength go for much higher reps. And is this tool meant to log what you did on a day or is this to plan your week/month too? EDIT: I noticed I can't log out nor can I manage my account? Also why don't you ask for gender, bodyweight, waist, fat percentage on registration? You need gender for most calculators like Wilks and Sinclair. The bodyweight is useful so you don't have to ask it on every log entry.
  21. Also what is the Volume meant to do? It shows 4800kg, so can I now lift my car? I did 4 sets of 20 push-ups with a weighted vest of 60kg? Also how do I specify when I have no weight? 0x20x4 is kinda a problem
  • 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.