Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Thanks for the link
  2. interface MyBatchService { public function someMethod(); } class SomeService1 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } class SomeService2 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } class SomeService3 implements MyBatchService { private $successor; public function __construct(MyBatchService $successor) { $this->successor = $successor; } public function someMethod() { if(!$this->canHandle()) { if($this->successor) return $this->successor->someMethod(); throw new Exception('Failed to handle the request'); } } } try { $batch = new SomeService1(new SomeService2(new SomeService3())); $batch->someMethod(); // initialize the chain } catch(Exception $e) { echo $e->getMessage(); } I assume each service returns the same information. The interface declares the common interface eg getUser(..) If a service fails to be able to handle the request (due to overload) it will try it's successor until the request is successfully handled or an exception is thrown.
  3. SELECT amount, quantity, amount * quantity AS total FROM orders WHERE customer_id = .. GROUP BY amount, quantity WITH ROLLUP *MAGIC*
  4. I'll need some more information. The above form is filled out by the customer? Each company has different plans? You want to find matches for each selected company and criteria?
  5. Yes, your comments are correct.
  6. fetchDelicious() takes a JSON encoded string and transforms it to a list in html. The .replace(':u', ..) and likes seem overhead IMO. var config = {}; Creates an object literal like [] creates an array literal. window.onload = function() {}; Attaches a function to execute upon window has been loaded. The function used is a closure: any variables that exists within it's parent scope are automatically copied into the function's scope. var helloWorld = 'Hello!'; var hello = function() { alert(helloWorld); }; hello();
  7. Or a better example: At some point in time you write: if(isset($_POST[txt_username])) { // bla } At some later point in time you add translations to your code: define('TXT_USERNAME', 'Type your username:', true); And now your code breaks. if(isset($_POST['Type your username:']))
  8. I found a bug: When I try to register it says: So, when I try to recover my password I get:
  9. Can you provide us with some test data (create table, insert into) so we can experiment to get the correct values?
  10. Like he said, it can no longer be manipulated
  11. I agree with monkeytooth. Make sure you have proper validation set up.
  12. Use SQL_CALC_FOUND_ROWS to find out how many exactly are in the result.
  13. I haven't been able to test it but try and experiment with this: SELECT cust.id, cust.name, (SELECT date FROM payment AS t1 WHERE t1.item_id = item.id AND t1.customer_id = cust.id ORDER BY date DESC LIMIT 1) AS last_payment, (SELECT sum(amount) FROM payment AS t2 WHERE t2.customer_id = cust.id AND t2.item_id = item.id) AS total_paid ((item.price / item.weeks) * 4) AS monthly, (item.price - total_paid) AS left_to_pay, item.weeks AS max_weeks FROM customer AS cust JOIN item ON customer.id = item.customer_id JOIN payment AS pay ON customer.id = payment.customer_id
  14. Try that again but this time use: It will show you: Which means the query was invalid and mysql_query() returned false. It also means there is no validation on the result between the query part and mysql_num_rows() part. To the OP: I didn't hack your website or caused any damage I merely entered some information of which I know MySQL won't execute.
  15. Pikachu don't get greedy, you already asked one from Santa-Claus.
  16. Should be straight-forward: members (member_id) friends (member_id, friend_id, status) It should also be noted it works in both ways: if you and a friend both state you are friends then he will not only appear on your profile but also you will appear on his.
  17. I have encountered the same problem. Making the path absolute instead of relative solved it.
  18. http://framework.zend.com/manual/en/zend.form.html I wrote this just for you, took me a day or two of serious typing. I also created an entire framework to accompany it.. while I was at it.
  19. And to lose all static that you may be carrying
  20. Damn, you beat my high score. I wrote a quick java robot program to click on the screen for 10 seconds... got a couple thousand. Great minds think alike? LOL I had the same idea until I discovered that I could enter my own. Edit: apparently I am no longer the only one who discovered that you can manipulate the game easily.
  21. I think you need to think some more about security I just beat your high-score with 999999999999999999999999999999999999999999999999
  22. They are not mutually exclusive. A Service Layer could use a Data Mapper for example. A Service Layer encapsulates your services like a Facade encapsulates your sub-system(s).
  23. Non-functional is sometimes referred to as Technical Requirements and in some cases it's just everything else that is not part of the Functional Requirements document. A view of used requirements: http://www.usabilityfirst.com/about-usability/requirements-specification/
  24. No with both keys are primary I really meant both keys are primary. Primary has nothing to do with whether they auto_increment or not. CREATE TABLE animal_show ( animal_id INT UNSIGNED NOT NULL, show_id INT UNSIGNED NOT NULL, PRIMARY KEY (animal_id, show_id) );
  25. Did you also fix the above?
×
×
  • 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.