Jump to content

YigalB

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Everything posted by YigalB

  1. I wrote a short quiz in which PHP code creates a mathematical question based on random parameters. The intention was to let JS to check the user's answers (via form) and compare it to the required results. How can I pass the required data from PHP to the JS? After all, PHP variables are not recognized by the client side when executing the JS.
  2. Thanks! Looks like a nice start. I will try using it as a base example.
  3. I think that Fusion can display graphs that are only on the positive edges of the X & Y. I didn't find a way to display the negative sides as well, and also to display the scaling.
  4. Thanks, I understand. I was sure there is a "ready to use" graph drawing function, but I guess I was wrong. So if i need to step back and learn, what would you recommend a newbie like me to do in order to reach the graph drawing? BTW - the target is educational.
  5. Thanks. I would appreciate a simple example I can use as a jump start.
  6. I would like to show a function graph embedded with other content on the web page. At first, it should be a linear line, such as y=aX+b. later I would like to extend it to parabola, sinus etc. Can someone recommend how to do it (hopefully with example), with ability to set start point, end point, the resolution of the function (every integer, every tenth of integer etc), and also how to draw the X & Y axis.
  7. Thanks! I am using XAMPP. I followed your guide lines and got: Then I re-entered the original password - and it worked! Thanks ! I am not sure what happen, because I marked "no password" and "go" at phpMyAdmin, but now it seems the need for password is still there.
  8. I am learning mysql using an example. According to the guidelines, I created a table and I was trying to access it with the following code: <?php define("MYSQLUSER", "php24sql"); define("MYSQLPASS", ""); define("HOSTNAME", "localhost"); define("MYSQLDB", "smithside"); $connection = @new mysqli(HOSTNAME, MYSQLUSER, MYSQLPASS, MYSQLDB); if ($connection->connect_error) { die('Connect Error: ' . $connection->connect_error); } else { echo 'Successful connection to MySQL <br />'; if ($result = $connection->query("SHOW TABLES")) { $count =$result->num_rows; echo "Tables: ($count)<br />"; while ($row = $result->fetch_array()) { echo $row[0]. '<br />'; } } } I got the following error: At first, I was sure it's the password, so I changed to "no password" using phpMyAdmin, but I still get the above error. Here is what I see at phMyAdmin:
  9. I am trying to ramp up Geany on Win7. Geany & XAMPP already installed. I can write code and compile it, but when I try to execute I get: The executable command in build->set build commands is: Any idea?
  10. Running this JS code: <script type="text/javascript" language="javascript"> document.write("Using: " + navigator.appName + "</p>"); document.write("Version: " + navigator.appVersion + "</p>"); The result was: Using: Netscape Version: 5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2 Why did I get Netscape when I am actually using Chrom? And the version response includes Apple?
  11. problem solved. Wrong quotation marks were used.
  12. While trying to run very simple code of javascript from within PHP, it runs when the code is: <h2>My header</h2> <script language = 'javascript'>; alert('here I am'); </script> <?php echo "starting Now <BR>"; But when the code is: <h2>My header</h2> <script language = 'javascript'>; document.write(“xxxx”); alert('here I am'); </script> <?php echo "starting Now <BR>"; It fails to run the js code, and also the alert is not executed. The only thing I added was document.write(“xxxx”); What did I miss?
  13. Good idea, but why to do in on word basis? why not sentence?
  14. Thanks. I like the idea, and I will try it. What about the text itself? For example, on a certain page I will need to display a content/ For example, write a "Hello" in case of L2R, or the same word in a different language R2L. Should I have many "if" statements in the code, so the server will send the right word according to the $direction variable? O
  15. A math quiz is presented and the user should fill the form cells with the answers. So far I did it with PHP and it works well, until I learned about Ajax existence. But I failed to make it work. I would appreciate an example of code for the following: - A form with two cells for numerical: a, b. - Once the user press "submit", each cell is tested for the expected results: a should be 5, be should be 7 - if a is correct, the boundary of the cell becomes green, and the grade 50% appears in a circle near by. If not, the boundary becomes red and the grade appears 0. - same for b - bellow both appears the final grade a+b in circle - 2 parameters are sent back to the the PHP code: true/false for a, and true/false for Thank you!
  16. Thanks. It is useful. But the main challenge I have is how to approach the web site design when it could be used by R2L or by L2R users. Should I duplicated the pages? this will cause maintenance to be painful. Should I have a parameter which will indicate R2L or L2R and have many IF with in the pages? This will make the code less readable. Is there a recommended solution?
  17. In order to display an equation of parabola, I copied from somewhere <span style="font-size: 200%"><span class="math"><b><var>y</var> = <var><?php echo "$a" ?></var><var>x</var><sup>2</sup> <?php echo "$sb"?> <var><?php echo "$b" ?></var><var>x</var> <?php echo "$sc"?> <var><?php echo "$c" ?></var></b></span></span> </p> <br> It doesn't look nice, and also it doesn't know how to eliminate parts when the parameter is zero. For example, in the case of y=ax^2+bx+c, and a=1 b=0 c=5, it would print y=1x^2+0x+5, instead of y=x^2+5 I could do pre-processing and solve it, but I was wondering if there is a nicer way to do that?
  18. Is there a recommended way to code in order to have a dual language support, especially when one is English (left to right), and the other is Hebrew (right to left)? Should I design every page twice or is there a ready made solution?
  19. round is risky because of the gray area between rounding up and down. how is rounding to the hundredths place any more risky then multiply the number by 100? Maybe I am wrong, but if multiply by 100 and truncate after the dot, I get exactly the same digits as was in the source. I am not sure what would round do if the exact result should be 14.055 and the user types 14.05. would it round the same? One thing is sure - if I multiply both by 100 and truncate, the result would be 1405 for both.
  20. round is risky because of the gray area between rounding up and down.
  21. The reason I can;t compare the floats is that the "correct answer" may have endless digits after the point. I.e the correct answer is: 42.377764 I don't want the user to type all the least significant digits, so it seems to me that two are enough. If I compare 42. 37 and 42.377764 it would be considered as different answer.
  22. A form needs to get answers of math quiz, returning numbers, up to 2 digits after the point. In all form examples I noticed the usage of: ...<input type="text" name="name" /... Cant it be a number? floating or integer? why "text" ? Also, can I limit the form to accept numerical input only or would I need to learn Ajax for that? Once I have the answer, I need to compare it to the correct answer. The method I have in mind is to multiply the answer and the correct one by 100 and compare the integer part. Is there a pre-made function that can do the same?
  23. I noticed I have two php.ini: one in: /etc/php5/apache2 the other in: /etc/php5/cli Which one is the used one? How can I tell?
  24. It depends on 'ignore_user_abort' setting in php.ini. If it's set to TRUE your script would work until processing is finished. If set to FALSE processing is terminated. You may change default behavior via function ignore_user_abort() http://www.php.net/manual/en/function.ignore-user-abort.php In your case when you noticed that "the program continued from where it stopped"... Maybe your browser took it from the cash? It could be the browser took it from the cache. How can I prevent that? Also, i just added a "die" statement in my code, and was hoping that after that, if I refreshed the browser window, it would go back to the beginning. The browser actually continued executing the code. Is it again because of the cache?
×
×
  • 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.