ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Anyone know of a php script that auto-maps locations?
ignace replied to wolfcry's topic in PHP Coding Help
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. -
Full of fail. I vote to revoke the badge. Said Miss Sunshine.
-
Open Source Shopping Cart Suggestion - some abnormal requirements
ignace replied to lampstax's topic in Miscellaneous
Have you looked into Magento as I would almost swear it supports all the above. -
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.
-
It's a joke.
-
C+?? did I miss the memo?
-
Dependency Injection, trying to understand it...
ignace replied to MasterACE14's topic in PHP Coding Help
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. -
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*/ } }
-
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.
-
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.
-
Best Architectures for Separating PHP/MySQL Reads/Writes
ignace replied to webbysanchez's topic in Application Design
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. -
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.
-
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*/}
-
Best Architectures for Separating PHP/MySQL Reads/Writes
ignace replied to webbysanchez's topic in Application Design
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. -
Best Architectures for Separating PHP/MySQL Reads/Writes
ignace replied to webbysanchez's topic in Application Design
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. -
Best Architectures for Separating PHP/MySQL Reads/Writes
ignace replied to webbysanchez's topic in Application Design
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 -
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.
-
I like Yahoo RTE
-
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.
-
I can't blame ya! I'm spamming my way onto 5k as we speak Here's yet another one! So close now...
-
That's a perfect analogy for the law, right there!
-
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..
-
How about changing the forum structure ?
ignace replied to Morg.'s topic in PHPFreaks.com Website Feedback
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. -
This is the way to go, not SELECT count