Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Was thinking the same thing..
  2. If your hoping on your player's being honest about this, think again. They will not accept losses (or atleast most of 'em won't). You can link tables together with constraints (http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html). You would create a new record (row) for each new player (not an entire table). This is done through .htaccess and mod_rewrite Take a look at session_start and sessions in general http://php.net/manual/en/features.sessions.php Remove the p out of the h2
  3. If you use Firefox and have the add-on Firebug installed then you can monitor how this is performed most likely: polling.
  4. Store there last click when they login verify that the time between now and the last click is greater then a certain treshold.
  5. You may want to explain what this code is supposed to do because as there are a few mistakes in your code: $counter0 does not exist also after you code has run your variables contain: So what should be the opposite?
  6. Yeah however I would remove Member_to_Cities as Member_to_Areas allows you to retrieve the city. If you are unsure on your db structure you can always draw a ERD to verify all relations are correct or needs adjusting. http://en.wikipedia.org/wiki/Entity-relationship_model
  7. Zend_Navigation will look for an item Zend_Navigation in the registry if you don't pass it explicitly.
  8. Actually your idea only works if there are many users on your website. If there are only a few users on your website, guess what happens when no user logs on for 2 or more hours?
  9. This is a scenario where you would use CRON. To update player stats (+1000 gold) based on a few criteria (has a market?). Not to immitate the building process.
  10. Choices, Choices and more choices.. Why is life so hard?!? Try that at the checkout And see if you afterwards find a safe house to hide from the cops And once in jail hope "The Family" wants to bust you out!
  11. I want to earn money, but what's the point if you don't have anything to spend it on, right? Saving! Until you have build up such a great amount you can life of the yearly intrest
  12. Modify this line $this->setAnswers($possibleAnswers); $this->setAnswers($possibleAnswers ? $possibleAnswers : new ArrayObject()); Please note that the provided code is just an example and was not intended for production usage.
  13. Post your code
  14. HTML specifies your website's structure not it's presentation use CSS for that: a img { border: none; } Or better yet use Eric Meyer's Reset Reloaded (http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/) altough I would disadvice as it probably will create more work. Just remember to use it in future projects.
  15. If the Scheuleder handles all tasks, than users dont matter. as you only want 1 scheduler running. All You have to do is check if your Scheuleder is running, if not, start it up. And it wont use up all resources. It doesn't matter if you use Scheduler. Each new task will eat up more resources. It's not because you only use one instance of something that apparently uses 50 MB after startup that if you initialize 10k of tasks on this instance the amount of RAM used won't increase. It's not because windows uses 2GB of ram that if you launch each and every game you own your RAM usage won't increase because it runs in Windows. Imagine what would happen if I would launch Avatar, The Saboteur, Star Wars: TFU, TF2, Operation Flashpoint, DIRT 2, Left 4 Dead 2, Left 4 Dead, COD MW 2 all simultaneous... It doesn't matter if the user is offline or not. Your database keeps track when which building is completed which is when build_complete_time <= now() Ajax and Flash are just a fancy way of displaying the building process and can aswell be done without.
  16. Forum threads; posts, Blog posts; comments, .. they have lots of commonalities for example: A blog post contains a title, publish date, content and has an author. A comment contains a title (Re: ..), approved date, content and has an author. Using this information and our knowledge of SQL allows you to form a more effective application, for example we can create these tables: CREATE TABLE blog_post ( id integer not null auto_increment, author_id integer, title varchar(128), title_slug varchar(128), publish_date datetime, content text, is_published boolean, KEY blog_post_author_id_fk (author_id), UNIQUE blog_post_title_slug_un (title_slug), PRIMARY KEY (id)); CREATE TABLE blog_post_comment ( id integer not null auto_increment, blog_post_id integer, title varchar(128), author varchar(32), approved_date datetime, content text, is_approved boolean, KEY blog_post_comment_blog_post_id_fk (blog_post_id), PRIMARY KEY (id)); Our normal 2-step query is now: SELECT title, user.username AS author, publish_date, content FROM blog_post JOIN user ON blog_post.author_id = user.id WHERE is_published = true AND title_slug = $slug UNION SELECT title, author, approved_date AS publish_date, content FROM blog_post_comment JOIN blog_post ON blog_post_comment.blog_post_id = blog_post.id WHERE is_approved = true AND blog_post.title_slug = $slug Your result now looks like: title | author | publish_date | content Hello World | ignace | 2010-01-10 15:02:05 | Lorem ipsum dolor sit amet consectetuer adipiscing elit.. Re: Hello World | robin | 2010-01-10 15:59:01 | Wow, great article LOVE IT!! PHP: $blogPost = mysql_fetch_array($result, MYSQL_FETCH_ASSOC); .. while ($comment = mysql_fetch_array($result, MYSQL_FETCH_ASSOC)) { ..
  17. You need a many-to-many table: CREATE TABLE clubs_has_users ( users_id .., clubs_id .., PRIMARY KEY (users_id, clubs_id) ); If you could provide us with your database table structure then we may be of further assistance as to what should come on the ..
  18. First of that Db_MySQL should be Db_Adapter_MySQL (cf Adapter Pattern). Second you need something to build the appropriate adapter Db::factory(..) (cf Factory Pattern) I highly recommend you stop trying to build your own DBAL. Because: 1) pre-made solutions are already available (PDO, ODBC, Zend_Db, Doctrine 2) 2) They will turn up rather complex quite fast What behavior do you wish to add to PDO?
  19. This gives you a line number which is it and what code is there on this line + surrounding lines? Also what is in: W:\Nielsen13_Data\upd_20090527c.txt?
  20. These people probably never heard of the words: Game, High-End PC, Surround-Sound and Multiple Monitors Besides Pandora is not to last as such a happy place especially not 200 years after they find the Vault. Clue: "It's time to get, my pound of flesh"
  21. For the homepage I would create something like: These keywords address a broad audience which is actually not so good because most of these keywords have high-value. So it would be better to focus on specific keywords for which you want to rank high. You can do this by including the area's your company delivers to (if any) which is called geo-targeting.
  22. I really hate that pathatic retarded kind of people. To dumb to study but all of a sudden they have wonderfull idea's.. (Probably got these while reading the Playboy on the John). Sue you for each and every thing on you. If you make a buck then they want 99% of that buck for them. You worked 100% for each buck and they did nothing to deserve it and yet they think they earned it.. I really truly HATE these kind of people and if I ever get so much money I'll let it turn into gold bars and then dig a deep whole put them all in and instead of cement I'll bury them in GOLD!! See how much of it they want then...
  23. I know it's invalid. I ran it through the validator more times than I can count and every time I fix one thing it flags two new issues. One step forward and two steps back....really annoying! A gent told me a while ago that if I used xhtml transitional instead of strict it'd be much easier to fix but might cause IE to produce some unexpected behavior. But yes, it's a problem that I'm aware of and really should be addressed. Don't change from strict to transitional just to make it easier on yourself. Keep it strict! And learn to properly write and close your tags. Ok, so I would need to change the titles on each page to home, products, services, etc? Yes. I would do more then that - SEO wise. That's odd. The links are supposed to show up as white on blue. Looks fine locally on firefox and IE6. Had a few friends look at as well, and this issue never came up. Maybe it's related to issue #1 in some way. It is not related to #1. Your links turn up white once visited. Clear your cache and you'll see to fix, write: a { color: #FFF; } a:visited { color: #..; } Make sure the color of :visited is different to create a clear indication towards your users they have already visited the page. I'm not totally sure I understand what you mean by this comment. Every page should be accessible from every other page. Not every user can or will use his mouse to navigate your website. 1) Load your website 2) Press tab and look at your status bar 3) Note that when products gets selected your flyout menu does not appear
  24. I advice you not to add the answer in the source code (true, false) Anyone with a little understanding of HTML can easily see which are the correct answers. <form action="" method="post" id="quiz"> <div class="question">What is your name?</div> <div class="answer"> <label><input type="radio" name="a[0]" value="A" /> A</label> .. </div> <div class="question">What is your country name?</div> <div class="answer"> <label><input type="radio" name="a[1]" value="1" /> 1</label> .. </div> .. </form> <?php if ('post' === strtolower($_SERVER['REQUEST_METHOD'])) { require_once('class.quiz.php'); require_once('class.question.php'); require_once('class.answer.php'); $question = new Question('What is your name?'); $question->addAnswer(new Answer('A')); $question->addAnswer(new Answer('B')); .. $question->setAnswer(new Answer($_POST['a'][0])); $question->setCorrectAnswer(new Answer('B')); $quiz->addQuestion($question); echo $quiz->getCorrectAnswersTotal(), '/', $quiz->getQuestionsTotal(); }?> I build my quiz after the user submits his answers however normally you would build it from a SQL query and use it to render your form. Below are the classes used: class Quiz { protected $_questions; public function __construct(ArrayObject $questions = null) { $this->setQuestions($questions ? $questions : new ArrayObject()); } public function setQuestions(ArrayObject $questions) { $this->_questions = $questions; } public function addQuestion(Question $question) { $this->getQuestions()->append($question); } public function addQuestions(ArrayObject $questions) { foreach ($questions as $question) { $this->addQuestion($question); } } public function getQuestions() { return $this->_questions; } public function getQuestionsTotal() { return $this->_questions->count(); } public function getCorrectAnswersTotal() { $correctAnswers = 0; foreach ($this->getQuestions() as $question) { if ($question->answeredCorrect()) ++$correctAnswers; } return $correctAnswers; } } class Question { protected $_questionText; protected $_answers; protected $_correctAnswer; protected $_answer; public function __construct($questionText, ArrayObject $possibleAnswers = null, Answer $correctAnswer = null) { $this->_questionText = $questionText; $this->setAnswers($possibleAnswers); } public function setCorrectAnswer(Answer $correct) { $this->_correctAnswer = $correct; } public function setAnswer(Answer $answer) { $this->_answer = $answer; } public function setAnswers(ArrayObject $answers) { $this->_answers = $answers; } public function addAnswer(Answer $answer) { $this->getAnswers()->append($answer); } public function addAnswers(ArrayObject $answers) { foreach ($answers as $answer) { $this->addAnswer($answer); } } public function getAnswers() { return $this->_answers; } public function answeredCorrect() { return $this->_correctAnswer->equals($this->_answer); } } class Answer { protected $_answerText; public function __construct($answerText) { $this->_answerText = $answerText; } public function getAnswerText() { return $this->_answerText; } public function equals(Answer $answer) { return $this->getAnswerText() === $answer->getAnswerText(); } } You may also want to add a serialize magic method to store them in the database.
  25. That is a PHP error not a SQL error. You have an error in your PHP syntax. Provide your PHP code and we may be able to pinpoint the location of the problem. In addition to cags suggestion: INSERT INTO .. ON DUPLICATE KEY UPDATE I like to note that this will only work if you want to insert a value in a column which is a primary key or unique index and will otherwise not work. As per the manual:
×
×
  • 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.