Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. No, they are not. You can either use the GClientGeocoder and use AJAX to store the returned values or use their Geocoding webservice API directly from PHP. Yahoo! also provides a Geocoding service among others.
  2. Full of fail. I vote to revoke the badge. Said Miss Sunshine.
  3. Have you looked into Magento as I would almost swear it supports all the above.
  4. You don't need to do anything new because it's a touchscreen. Instead of clicking on buttons with a mouse your now tapping on a screen. PHP is probably not the best language for this since it runs in a browser (unless they are fine with just launching a browser on the touchscreen system and pressing F11 for full-screen). VB.NET will help you hit the ground running, same goes for Java+Swing. You could also try Ruby or Python.
  5. DI is nothing new, it's just a name for something that exists since there are 3rd generation programming languages. The DI in your example is the array you pass in, and the mailTransport you pass into Zend_Mail. I could be wrong though, DI doesn't have that much shine, and anything that doesn't shine enough, I'm not interested in.
  6. A model class does not explicitly have to be named a model to be a model. You don't call your framework classes infrastructure either, right? You can use a Registry to share the config. class League { private $_db = null; public function __construct() { $cfg = Registry::get('DbConfig'); $this->_db = DB::factory($cfg->adapter, $cfg->params); } public function fetchAll() { /*your code here*/ } }
  7. SELECT .. INTO OUTFILE is just one way of backing-up your database. You could also use replication.. but that may be a little far fetched at this point. There is an article in the MySQL manual.
  8. You can str_replace all you want until you'll have to deal with the truth: encoding. Don't plan around the problem, solve it. Obviously you are reading the file in a different encoding than the encoding your database is using to store the data. Find out in what encoding the file was written and adjust your database table accordingly.
  9. So what is it that do you do then now? Just a plain mysql_connect()? If that's the case make sure you have 2 connections: one to the read database, and one to the write database. $rdb = mysql_connect('sql-read.domain.top', 'reader', 'password'); $wdb = mysql_connect('sql-write.domain.top', 'writer', 'password'); Then look up all UPDATE/INSERT/DELETE statements you have in your code and change them to: $res = mysql_query('UPDATE ..', $wdb); All reads would look like: $res = mysql_query('SELECT ..', $rdb); Preferable you should only open a connection to the write database when you actually need it.
  10. Your view should be protected not private if you intend to use it in the child classes. Your code previously worked because you created a new public variable view on your child object in the constructor.
  11. I know what you mean I get this when I am creating a UML model, it takes a few moments before I actually get this strong focus and ideas start flowing... Once I am on a roll I can really feel a great design sliding off my pen. I don't get this feeling always of course, sometimes I don't fully understand the big picture and then I need to go back and try to break up the system further. I can "ride/surf" this feeling if after the design session I get to actually code it.
  12. Leave the constructor out of the child class. It will automatically call the parent constructor. Use the below trick if you for some reason still would need to overwrite the parent constructor: public function __construct() { $this->view = new Smarty(); $this->init(); } public function init() {/*overwrite this method in the child class*/}
  13. No. I just gave it as an example. I also gave you http://www.howtoforge.com/loadbalanced_mysql_cluster_debian. These are some examples I found using Google, I have no personal experience with a cluster setup, although we use clustering extensively where I work, and IMO it's probably currently too expensive than what you currently actually need. One of our applications has the same setup, it writes to the master, and reads from a slave (in our setup both masters and slaves are behind different load-balancers I think). Reading/writing is handled in our models, in CI it would look something like this: class Customers extends Model { public function addCustomer(array $details) { $db = $this->load->database('mightymaster', true, true); $db->insert($this->tableName, $details); } public function getCustomer($id) { return $this->db->get($this->tableName, array('id' => $id)); } } By default $this->db would point to the read load-balancer. No. I don't know, we probably use NDBCLUSTER or something like that.
  14. Since you are already using a framework, I don't see what the problem is? Separating reads/writes should be easy but should not be done at the application level but at your model layer.
  15. Write to the master, read from the slave. Or what do you mean? By using a load-balancer (a proxy that redirects traffic between slaves). http://dev.mysql.com/downloads/mysql-proxy/ http://www.howtoforge.com/loadbalanced_mysql_cluster_debian
  16. The reason being that you shouldn't have a Model base class to begin with... The models that require a database connection can retrieve/make one when needed and those that don't, just don't. class User { public function __construct(Zend_Db_Adapter_Abstract $adapter) { $this->adapter = $adapter; } } class ContactEmail { public function __construct($charset = 'UTF-8') { $this->emailer = new Zend_Mail($charset); } } 2 model's and only tied to the components they actually need.
  17. MVC doesn't literally mean that you need to have a Model, View, and Controller class. They are just concepts which you need to understand before you can use/implement an MVC architecture. You could have a BlockAd class with a method getRandomAd() to get a random ad, and a VideoCategory model with a getCategories() method to get all categories. BlockAd and VideoCategory are your models.
  18. I can't blame ya! I'm spamming my way onto 5k as we speak Here's yet another one! So close now...
  19. That's a perfect analogy for the law, right there!
  20. Of course it will be mercilessly abused, you really think CV made 12k+ posts??? Admins have DB-power, and they are not afraid to use it..
  21. I don't know about you, but if I were to run a forum, I would like to see lots of activity on it regardless of how advanced the questions asked are. It beats the hell out of a forum with five active users a month asking maybe 1 or 2 advanced questions every 3 months or so. Talking about activity, not so long ago we had to switch servers due to the load the forum generates while your "advanced" forum can be easily run on a Commodore 64. Don't hate! Participate.
  22. This is the way to go, not SELECT count
×
×
  • 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.