Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Try that: if ($form['#options'] == 'Please create Role' || $form_state['values']['usergroup'] == 0) {
  2. Same problem here with French, German, Dutch and English it can get confusing
  3. Doesn't matter the comment is still valid in order to install PEAR download go-pear.phar from the php.net website. Place it into your PEAR directory. You can find PEAR in the same directory as php.exe (if not, create it). Open the CLI through pressing Start and typing cmd then hit CTRL+SHIFT+ENTER, in the next dialog, select Yes. Navigate to your PEAR directory in the CLI and type php go-pear.phar (if php is not installed in C:\php then you may want to adjust the paths when it asks you if they are correct).
  4. Try using EXPLAIN EXTENDED SELECT .. on your bigger queries, this will tell you among other things the Cardinality of your indexes. You also may want to try SHOW INDEXES FROM .. PS This is an English speaking forum. Could you translate to English please so that everyone can follow?
  5. At a table, on a chair Then figure out how you can get the information from their website, do they have API's to retrieve the information? You could scrape their website but most likely it's against their ToS, so you want to minimize that. Store the information you get into a database and show it to any visitors any and all links they click should have your referrer number in it. Not really complex but you'll need to think it through.
  6. euhm? Database? What map data are you talking about? latitude, longitude? You can also use KML for it!
  7. The reason you would not expose a class variable is that you have no control over the assigned value while through a method you do.
  8. You do no error-checking like: public function charAt($index){ return new String(substr($this->value,$index,1)); } If I pass in $index >= $str->length() it returns false, resulting in: return new String(false); Not all methods are fully implemented: public function split($delimiter,$limit=false){ $limit = $limit ? $limit : strlen($this->value); $primitive = explode($delimiter,$this->value,$limit); $list = array(); foreach($primitive as $str){ } }
  9. If you are wondering how you would model this at a DB-level: driver (driver_id, ..) bus (bus_id, num_passenger_seats, ..) tour (tour_id, ..) schedule (tour_id, bus_id, driver_id, date, price) customer (customer_id, ..) booking (customer_id, schedule_id, ..) This should get you started.
  10. I can view the website now too but very slow, it took like 5 minutes just to load the frontpage and it was than still missing most images.
  11. Sure you can, many others do it. Some even go as far as telling us to do THEIR work. Welcome aboard!
  12. No, that should display whichever anything else is wrong due to the lazy initalization as you are actually doing this: $resources->getString()->replace('whatever', 'whichever')->replace('whichever', 'whichever')->show(); // should display "whatever" again You see This is also not true since str_replace accepts an array. Very few people seem to know this feature exists. str_replace(array("what", "name", "blah"), array("is meant","randomer", "hello"), $string1); echo resources::getString("alpha") // alpha ->replace("lpha","bravo") // abravo ->replace("vo", resources::getString("charlie")->show()) // should be abracharlie ->show(); // charlie This doesn't work because when you replace "vo" you set the static value of $string to "charlie" effectively trying to replace "vo" in "charlie".
  13. account_number = account_id? Clearly customer and account are one and the same yet they share account_type and account_balance? And for some reason transaction has the same information? If one customer can have multiple accounts and that depends on your Business Requirements then the DB design should be something like: customer (customer_id, ..) account (account_id, customer_id, ..) If the customer and the account are the same thing then drop one of both and merge the columns with the other (or create an account_detail table). account (account_id, account_type_id, balance) account_detail (account_id, nic, full_name, initial, phone_number, address, gender, dob) This doesn't pass Normal Form 2 since not all data is atomic: full_name, phone_number, and address. I left interest_rate and fd_period out because I don't know what fd_period means and interest_rate seems to me something about the account_type_id but I'm not sure about this since I don't know anything about your actual Business Requirements. Transaction table then looks like: transaction (transaction_id, transaction_type_id, from_account_id, to_account_id, amount, log_date)
  14. Now you realize where your thinking went wrong it's time to ponder further and question your current design. Since you could make this mistake someone else using your API will too. How to solve? This of course depends on how you want your design to behave. You could implement Lazy Initialization, since you suggested a Singleton I think this is the way you want to go without actually implemeting the Singleton of course. class Foo { private $_string; public function getString(){ if (is_null($this->_string)) { $this->_string = xmlfile(); } return $this; } } This has a drawback that once the value is loaded from the XML it's not "refreshed" on subsequent calls. $resources->getString()->show(); // bla $resources->getString()->replace('bla', 'foo')->show(); // foo $resources->getString()->show(); // foo In contrast to your current design where it loads bla from the XML on each call to getString()
  15. class Foo { private $_original = ''; private $_dirty = ''; public function getString() { $this->_original = 'whatever'; $this->_dirty = $this->_original; return $this; } public function show() { return $this->_dirty; } public function replace($thisstr, $thatstr) { $this->_dirty = str_replace($thisstr, $thatstr, $this->_original); return $this; } } #Use-Case 1 $resource->getString()->show(); // whatever $resource->getString()->replace('whatever', 'whichever')->show(); // whichever $resource->getString()->replace('whatever', 'what-eva')->show(); //what-eva Derived from: Which is different from: class Foo { private $_string = ''; public function getString() { $this->_string = 'whatever'; return $this; } public function replace($thisstr, $thatstr) { $this->_string = str_replace($thisstr, $thatstr, $this->_string); return $this; } public function show() { return $this->_string; } } #Use-Case 2 $resources->getString()->show(); // whatever $resources->getString()->replace('whatever', 'whichever')->replace('whichever', 'what-eva')->show(); // what-eva
  16. http://pear.php.net/manual/en/installation.getting.php If you use XAMPP or WAMP or some other of these be sure to delete go-pear.phar and get the latest from http://pear.php.net/go-pear.phar
  17. Your DB is lacking a proper design that's why it's so hard to retrieve the information. tv_show (tv_show_id, ..) tv_show_character (tv_show_character_id, tv_show_id, played_by, ..) actor (actor_id, ..) To get the TV characters and the actor information. SELECT .. FROM tv_show_characters T1 LEFT JOIN actor T2 ON T2.id = T1.played_by WHERE T1.tv_show_id = ?
  18. Creating a game is much more than just bashing out code. Among other things you'll also need to learn how to model and apply animation. You may be better off starting with Unity3D which has both free and commercial packages and provides you with an IDE to develop your game in. It has a decent rendering engine that supports most of the complex features you find in a game and it has a community from which you can "borrow" models, maps, .. Unity 3D Game Development By Example may be worth a look. A nice extra about Unity 3D is that it runs from within a web-browser (after installing the Unity client) so you can show your class-mates how cool you are from any PC
  19. no that isn't normal as a result I can't visit your website as it can't translate the hostname to an IP-address.
  20. Alternatively you can use extract which does somewhat the same thing like variable variables. Can you post the code that follows your while statement? Having more relevant code we maybe can give you even better advice as avi_0, avi_1 implies a bad DB design.
  21. In your case I would go for the Abstract Factory or the Registry these are more flexible then your current designs.
  22. Since you are so keen to keep it all centralized you can either use an Abstract Factory or a Registry. The Abstract Factory going something like this: class ASF_Factory { public static function getConfig() {/*code*/} public static function getDb() {/*code*/} } In your application you would use this like: $confg = ASF_Factory::getConfig(); $database = ASF_Factory::getDb(); This is more specialized then a Registry which is more generalized: $config = ASF_Registry::get('Config'); $database = ASF_Registry::get('Database'); Both inject the dependency and hides the real implementation of your Config object and Database which means that when at some point you want to switch your implementation of either the Config object or the Database object you can replace the lines of code in getConfig() or getDb() with the new object without you having to change any application code or create bugs. However both of course impose a global object and a hard coupling between ASF_Factory or ASF_Registry and the calling class since it doesn't necessarily need the ASF_Factory and ASF_Registry.
  23. return $config = 'Config Var'; is the same as return 'Config Var';
×
×
  • 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.