Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Protecting your kid as well as his privacy is the best thing. I personally think you need to have a talk with him, let him know which kind of sites will harm him, and you also need to tell him the reason. It better to educate him rather than control him. And of course, if you failed to have a talk, you can use the parental control sogtware. I agree. Talk to him instead of trying to be his puppeteer, you'll fail in the latter anyway.
  2. You could create a procedure in MySQL for it so you only get the records that actually rhymes with the word instead of finding a word that rhymes in PHP. If that sounds too difficult you could try mysql_unbuffered_query which, unlike mysql_query, does not store all 400k+ records in-memory. Create a lookup table that stores all rhymes when one is found (word_id, rhymes_with_id) to speed up future searches. Currently you have used an auto_increment as a primary key maybe you could convert every word to an integer (since it's a limited set although you could get a collision so backup before you do). // for a 32-bit signed integer, use 15 if you are running PHP under x64 architecture (and use a BIGINT in MySQL) $word_id = hex2int(substr(md5($word), 0, 7)); Or in MySQL using: UPDATE words SET word_id = conv(substr(md5(word), 1, 7), 16, 10) You don't need MySQL then to find the ID of the word as you can calculate it's ID in PHP (saving a round-trip). $word_id = hex2int(substr(md5($_POST['search_word']), 0, 7));
  3. It loads an URL through either an iframe or an img. The website it loads is: nanitos99142.co.cc/main.php?page=a911bd6268796cac Delete the file and any occurences of the filename and change your FTP password to something with upper and lower case letters + numbers + special characters. Also contact your webhosting provider. It's possible that they were able to install the script through another user on the shared hosting machine.
  4. In what format did you save the spreadsheet? http://devzone.zend.com/27/reading-and-writing-spreadsheets-with-php/ is a good tutorial on how to read data from an Excel file for example. Buy Beginning Google Maps Applications with PHP and Ajax as it will teach you everything you need to know to create your complete custom map in Google Maps.
  5. I've delved into the code. <sarcasm>Thank you for providing a link BTW.</sarcasm> $character = $armory->getCharacter($charname) if ($character->isValid()) { // character was found } else { // character was not found... redirect } Try that. http://sourceforge.net/p/wowarmoryapi/home/Home/ -- WoW Armory API docs.
  6. Can you post the entire script so others may use it/learn from your experience?
  7. It was late when I posted this. I now realize a far better option would be to not expose the API at all and let the API return a path to an image. Something like: $image_url = file_get_contents('http://my-api-website.com/adverts-api.php?host=the-host-website&session=' . $somesessionid); echo '<img src="', $image_url, '" alt=""/>';
  8. Yes, even 3D (WebGL rendering) games if you use the new HTML5 elements. http://playwebgl.com/
  9. <img src="http://yourwebsite.com/adverts-api.php?key=123" alt=""/> Verify if the referrer(?) matches the 123 key.
  10. Your DB design is off. 1 race has * classes. 1 class has 1 race (at least I didn't find any shared classes). 1 class has * skill types 1 skill type has * classes There are skill types and sub skill types (eg Scion). 1 skill type has * skills. 1 skill type has 0..* sub skill types. 1 skill has 1 skill type. This should be closer to the design you wanted to create. CREATE TABLE races ( race_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, race_name VARCHAR(11) NOT NULL ); CREATE TABLE classes ( class_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, class_name VARCHAR(6) NOT NULL, race_id TINYINT UNSIGNED NOT NULL, KEY (race_id) ); CREATE TABLE class_has_skill_type ( class_id TINYINT UNSIGNED NOT NULL, skill_type_id TINYINT UNSIGNED NOT NULL, PRIMARY KEY (class_id, skill_type_id) ); CREATE TABLE skill_types ( skill_type_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, skill_type_name VARCHAR(7) NOT NULL, skill_type_parent_id TINYINT UNSIGNED NOT NULL, KEY (skill_type_parent_id) ); CREATE TABLE skills ( skill_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, skill_name VARCHAR(7) NOT NULL, class_id TINYINT UNSIGNED NOT NULL, skill_type_id TINYINT UNSIGNED NOT NULL, FOREIGN KEY (class_id, skill_type_id) REFERENCES class_has_skill_type (class_id, skill_type_id) ) ENGINE=INNODB;
  11. Either through: Browser.php Or get_browser Mind though that for get_browser to work your browscap should be up-to-date, the latest version can be found here: http://browsers.garykeith.com/downloads.asp
  12. No offense, but if you can't answer that question you should consider looking for another job. if ($status['latitude'] && $status['longitude']) { Will skip the users with no valid latitude & longitude although you probably should put this in your query. WHERE latitude > 0 && longitude > 0 Which negates the need for an if statement in your foreach.
  13. Optimize your images, the background loads slowly.
  14. The ReportModel (maybe a wrong choice of words on my part) would do all the queries and the Report (or ReportView) would do the actual rendering.
  15. 1. Abstract your database, even if you make it as simple as just a Database class it allows for more flexibility to allow your report to work with more than just MySQL [OR] 2. Better yet, create a new class that uses a Database and let the report query to that new class: public function getPopularTopics($limit) { $sql = "*******"; if (($res = $this->queryDB($sql)) === false) {$this->error = "There was a problem with the database"; return false;} while ($row = mysql_fetch_assoc($res)) { $topics[] = $row['Category']; } return $topics; } So instead of having a function getPopularTopics in your Report you would put the function in ReportModel: $this->getPopularTopics(); Then becomes: $this->reportModel->getPopularTopics(); *TADA* all query related material is now outside your report class and the code becomes less cluttered. Keep identifying responsibilities and figure out who should carry that responsibility, use GRASP to guide you. If GRASP is going above your hat, then try to get familiar with the concept through CRC cards.
  16. Yes that was the idea but it's an early sketch since there isn't much to go on. Maybe Employer and Family should also be separate classes since either would generate a different report? The report should also be flexible in that it will look different for each company or family (Composite and Decorator come to mind). You would then fill the Report with all the necessary data and use Decorators to render the report. So that by feeding different decorators you would get different reports (themes). If you have experience with Zend_Form you get what I mean. A generate(RenderEngine $e) could be used to tell what rendering engine should be used, the rendering engine would then inject the decorators to create PDF, DOCX, or simple HTML documents. I'm just rambling here but you can see that there are a lot of opportunities here.
  17. Your class has too much knowledge of everything. Since you are keeping track of Employee information (lastLogin, loginCount, sex, ..) and want to calculate totals, you could add an Employee and EmployeeCollection class. class EmployeeCollection implements Iterator, Countable { public function add(Employee $e) {} public function getAt($offset) {} public function setAt(Employee $e, $at) {} public function removeAt($offset) {} } class Employee { private /*@EmployeeSex*/ $_sex = null; private /*@DateTime*/ $_lastLogin = null; private $_loginCount = 0; } class EmployeeSex { // who said programming isn't sexy? ;-) const MALE = 'm'; const FEMALE = 'f'; const UNKNOWN = 'yet to be determined'; private $_sex = self::UNKNOWN; public function __construct($sex) {/*$sex can't be UNKNOWN*/} public function isMale() {} public function isFemale() {} } class Report { private /*@EmployeeCollection*/ $_collection = null; } You would query the collection for the necessary information: - total number of activated employees - total number of activated family members - count of male users - ..
  18. That's why this forum exists in the first place ;-) To help/advice people when they are stuck on some code.
  19. The pages are really heavy and load slow. Optimize the images by using an online service like SmushIt!
  20. ignace

    Zend search?

    No. Searching is done by querying your database. Lucene is just some product you can use as a front-end with your database to speed up full-text searches.
  21. Clearly having one class that has validation code for nearly everything is not gonna be too efficient, I'm not saying it will slow down your system just that it's not efficient. It would be better to have one class for each specific validation like Zend Validate does. http://framework.zend.com/manual/en/zend.validate.set.html
  22. $query = "select zone from delivery where country = '{$_POST['country']}";
×
×
  • 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.