
ignace
Moderators-
Posts
6,448 -
Joined
-
Last visited
-
Days Won
25
Everything posted by ignace
-
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.
-
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);
-
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+)
-
Secure API and JSON to show content on another domain?
ignace replied to Cobra23's topic in Frameworks
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. -
Who uses ON DELETE CASCADE in a PHP application?
ignace replied to NotionCommotion's topic in MySQL Help
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. -
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.
-
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.
-
A problem with emails fixed; registration CAPTCHA working again
ignace replied to requinix's topic in Announcements
Our database only has that yes. requinix however has everything else. he knows where you live!!!! -
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
-
is this forum on UNMODDED IPB4?
ignace replied to ollie007's topic in PHPFreaks.com Website Feedback
Jacques forgot his <sarcasm> tags again. -
Congratulations, you now know how the law works!
-
How to Safely Store a Password
ignace replied to voodooKobra's topic in PHPFreaks.com Website Feedback
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! -
How to Safely Store a Password
ignace replied to voodooKobra's topic in PHPFreaks.com Website Feedback
-
Makes your requests per minute go over 9000!
-
Here are the answers for reference: There are 4 in total: 1. Abstraction 2. Inheritance 3. Polymorphism 4. Encapsulation USE database_name; SHOW TABLES;
-
Skinning a cat (Or how many ways to output "Hello World!")
ignace replied to benanamen's topic in Miscellaneous
$tmp = tmpfile(); fwrite($tmp, 'Hello, World!'); readfile(stream_get_meta_data($tmp)['uri']); fclose($tmp); -
Skinning a cat (Or how many ways to output "Hello World!")
ignace replied to benanamen's topic in Miscellaneous
file_put_contents('php://output', 'Hello, World!'); -
HDFC Payment Gateway Integration - Response Handling
ignace replied to jothianand89's topic in Applications
Just add this to your code. GetSomeActualDeveloper()->solve($problem); -
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.
-
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?
-
curl isn't responding the same on different hosts
ignace replied to BurtLo's topic in PHP Coding Help
Run curl_error. -
"Your line has been disconnected due to increased complaints."
-
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.
-
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.
-
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