Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. I would like to see W3Schools provide an example of a proper login system in their Php example code area.
  2. Given by who? This is terrible code. Don't learn to code like this. There are many books and tutorials available. Begin with a main() something like this... public static void main(String[] args) { gameboard = new int[SIZE][SIZE]; // board must be square int outcome; do { displayBoard(); promptUser(); outcome = winOrTie(); } while ( outcome == INCOMPLETE ); displayResults(outcome); }// end of main
  3. Main should be simple and provide an outline of what you are doing. In my version of your program it looks like this... public static void main(String[] args) { gameboard = new int[SIZE][SIZE]; // board must be square int turn = 0; int outcome; displayBoard(); do { turn = promptUser(turn); displayBoard(); outcome = winOrTie(); } while ( outcome == -2 ); displayResults(outcome); }// end of main
  4. This code is almost too horrible to fix. Are you teaching yourself Java? Do you really want a variable-sized board? That requires a fair amount of additional complexity.
  5. <script> var items = []; <?php $len = count($items); for ($i=0 ; $i<$len ; $i++) { echo 'item[' . $i . '] = "' . $items[$i] . '";'; } ?> // etc... </script>
  6. I'm not familiar with this. It looks like it will allow an HTTP server to access a Tomcat server? http://php-java-bridge.sourceforge.net/pjb/index.php
  7. Have you read through this? http://www.w3schools.com/html/html5_geolocation.asp http://www.w3schools.com/js/js_ajax_examples.asp In your above code you have a global var x declared as an element and then later you seem to think it is a string?
  8. davej

    Shifting elements

    The easy fix seems to be just to use float rather than inline-block... .summaryBox { float:left; width: 20%; height: 250px; margin: 1em 1em 1em 2em; padding: 0; border: 1px solid black; } footer{clear:both;}
  9. davej

    Shifting elements

    You should paste that code into a codeblock... Hmmm... I see what you are saying. Something odd happens when you put a block inside an inline-block. <!DOCTYPE HTML> <html lang="en"> <head> <title>Blog - Home</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <link href="_css/pj.css" type="text/css" rel="stylesheet"> <style> article { padding: 0; } .summaryBox { display: inline-block; width: 20%; height: 250px; margin: 1em 1em 1em 2em; padding: 0; border: 1px solid black; } .pgBanner { opacity: 0.5; filter: alpha(opacity=50); } /* For IE8 and earlier */ .artBanner ( position: relative; ) </style> </head> <body class="clearfix"> <header> <img src="_img/atomic_logo.png" width="100" height="125" class="pjLogo" alt="company logo"> <h1 class="pj_header">Blog Home</h1> </header> <nav id="headNav" class="upperBar headNav ulBars"> <ul id="topList"> <li><a href="about.html">About</a></li> <li><a href="blog_home.html">Blog</a></li> <li><a href="faq.html">Home</a></li> </ul> </nav> <section class="sumFont"> <h2>BLOG Under Construction</h2> <article class="summaryBox"><h3>Heading</h3></article> <article class="summaryBox"></article> <article class="summaryBox"></article> <article class="summaryBox"></article> <article class="summaryBox"></article> <article class="summaryBox"></article> </section> <footer> <nav id="footNav" class="lowerBar footNav ulBars"> <ul id="bottomList"> <li><a href="about.html">About</a></li> <li><a href="blog_home.html">Blog</a></li> <li><a href="faq.html">Home</a></li> </ul> </nav> <div id="footContact"> <br> <a style="margin: 20% 0 0 50%" target="_blank" title="Follow me on facebook" href="http://www.facebook.com/bob.kefurtii"> <img alt="follow me on facebook" src="https://c866088.sslfacebook30x30.png" border="0"></a> <p style="text-align: center"> Plutonim Jelly<br> 94 Atomic way<br> Sparkling PU, 239239<br> Office: (555) 888-8080<br> Email: <a href="mailto:someone@example.com?Subject=New%20Interest">PuJy@atomicserver.com</a> <br><br> <sub>Copyright© 2017 Bob Kefurt</sub> </p> </div> </footer> </body> </html>
  10. The w3Schools tutorial isn't terrible. I just wish it didn't use document.write() and inline javascript. Just rewrite each example so that document.write() isn't used. http://www.w3schools.com/js/default.asp One of the first few lessons explains why document.write() is inferior, so then why do they keep using it throughout the rest of the tutorial? I don't know. Also learn to use addEventListener() as a more flexible alternative to inline javascript which is embedded into the HTML. For books get... https://www.amazon.com/JavaScript-Definitive-Guide-Activate-Guides-ebook/dp/B004XQX4K0/ref=sr_1_3?ie=UTF8&qid=1485791079&sr=8-3&keywords=javascript&refinements=p_72%3A2661618011 ...and either this... https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_8?ie=UTF8&qid=1485791079&sr=8-8&keywords=javascript&refinements=p_72%3A2661618011 ...or this (they are approximately the same material)... https://www.amazon.com/JavaScript-Patterns-Better-Applications-Coding/dp/0596806752/ref=sr_1_17?ie=UTF8&qid=1485791342&sr=8-17&keywords=javascript&refinements=p_72%3A2661618011 However please realize that an entirely new and more complex version of Javascript is on the horizon... but you should probably not begin with this book... https://www.amazon.com/Learning-JavaScript-Essentials-Application-Development/dp/1491914912/ref=sr_1_3?ie=UTF8&qid=1485791459&sr=8-3&keywords=javascript+es6
  11. You could try some open-source code such as... https://github.com/areebmajeed/PHP-Login-Script
  12. Have you worked with Php and MySQL? http://www.w3schools.com/php/default.asp http://www.w3schools.com/php/php_mysql_intro.asp
  13. You should have zero errors. Your first errors are related to the fact that a meta tag doesn't like a closing slash... This is good... <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> This is bad... <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> The internet is filled with tutorials, references, and resources, or you could hire a local web-savvy teenager. http://www.w3schools.com/
  14. Try fixing the errors in the code... https://validator.w3.org/check?uri=http%3A%2F%2Fwww.roxannedavisphotography.com%2Fprice_list.html&charset=%28detect+automatically%29&doctype=Inline&group=0
  15. Hmmm... although I bought a book about Javascript promises I have to admit that I have not gotten around to learning much about this topic yet. Can you expand the example code below so that it describes your situation? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
  16. Try... <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>title</title> <style> body{ text-align:center; } </style> <script> window.onerror = function(a,b,c,d){ alert('Javascript Error: '+a+'\nURL: '+b+'\nLine Number: '+c+' Col Number: '+d); return true; } </script> <script> 'use strict'; // JavaScript Document // rot 0 starts on April 5 //12 nov rocks window.onload = getrot; function getrot() { var rotations = new Array(); rotations[0] = "AGD-KTV"; rotations[1] = "KAD-GTV"; rotations[2] = "ATD-KGV"; rotations[3] = "ADV-KTG"; rotations[4] = "KAG-TDV"; rotations[5] = "ATG-KDV"; rotations[6] = "AGV-KTD"; rotations[7] = "KAT-GDV"; rotations[8] = "KAV-DTG"; rotations[9] = "ATV-KDG"; rotations[10] = "KDG-ATV"; rotations[11] = "DTG-KAV"; rotations[12] = "GDV-KAT"; rotations[13] = "KTD-AGV"; rotations[14] = "KDV-ATG"; rotations[15] = "DTV-KAG"; rotations[16] = "KTG-ADV"; rotations[17] = "KGV-ATD"; rotations[18] = "GTV-KAD"; rotations[19] = "KTV-AGD"; var araxrotations = new Array(); araxrotations[0] = "Path 1 & 2"; araxrotations[1] = "Path 2 & 3"; araxrotations[2] = "Path 3 & 1"; var ragorotation = new Array(); ragorotation[0] = "Rocks"; ragorotation[1] = "Scopulus"; ragorotation[2] = "Vitalis"; ragorotation[3] = "Green Bomb"; ragorotation[4] = "Teamsplit"; ragorotation[5] = "Purple Bomb"; var oneDay = 24*60*60*1000; var begin = new Date(2014,3,5,13,0,0); var beginrago = new Date(2014,10,12,13,0,0); var beginarax = new Date(2014,9,18,13,0,0); var d = new Date(); var utcyear = d.getUTCFullYear(); var utcmonth = d.getUTCMonth(); var utcdate = d.getUTCDate(); var utchours = d.getUTCHours(); var utcminutes = d.getUTCMinutes(); var utcseconds = d.getUTCSeconds(); var utctime = new Date(utcyear,utcmonth,utcdate,utchours,utcminutes,utcseconds); var diffDays = Math.round(Math.abs((begin.getTime() - utctime.getTime())/(oneDay))); var diffDaysRago = Math.round(Math.abs((beginrago.getTime() - utctime.getTime())/(oneDay))); var diffDaysArax = Math.round(Math.abs((beginarax.getTime() - utctime.getTime())/(oneDay))); var diffRotations = Math.floor(diffDaysArax/4); var nextaraxrot = 4 - diffDaysArax%4; var resetstring = " reset" if(nextaraxrot > 1){resetstring = " resets"}; var currentAraxxorrot = (diffRotations%3); var currentrot = (diffDays % 20); var diffWeeks = Math.floor(diffDaysRago / 7); var currentragorot = (diffWeeks % 6); var tomorrowragorot = currentragorot + 1; if(tomorrowragorot == 6){tomorrowragorot = 0}; var tomorrowrot = currentrot + 1; if(tomorrowrot == 20){tomorrowrot = 0}; var tomorrowaraxrot = currentAraxxorrot + 1; if(tomorrowaraxrot == 3){tomorrowaraxrot = 0}; document.getElementById('cc1').innerHTML="Today: " + ragorotation[currentragorot] + "<br> Next rotation: " + ragorotation[tomorrowragorot]; document.getElementById('cc2').innerHTML="Today: " + araxrotations[currentAraxxorrot] + "<br>" + araxrotations[tomorrowaraxrot] + " open after " + nextaraxrot + resetstring; document.getElementById('cc3').innerHTML="Today: " + rotations[currentrot] + "<br> Tomorrow: " + rotations[tomorrowrot]; //alert('done'); }; </script> </head> <body> <!-- Vorago Rotation: Purple Bomb<br> Next rotation: Rocks --> <!-- Araxxor Current Path: Path 1 & 2<br>Path 2 & 3 open after 2 resets --> <!-- ROTS Rotation: KDV-ATG<br> Tomorrow:DTV-KAG --> <span class="title" id="cc1"></span> <span class="title" id="cc2"></span> <span class="title" id="cc3"></span> </body> </html>
  17. Countdown to what? This looks like quite a mess if all it does is provide a countdown to a specific date/time. Have you used the browser console to check for errors?
  18. Of course they could use e-mail or a chat application to share answers. Also-- Do you randomize the order of the questions and the order of the multiple-guess answers for each student? That might make attempts at cheating quite a bit more difficult. Just generate the page content dynamically from a randomized array.
  19. davej

    Modal boxes

    You can see that the example code doesn't do that, so how is your code different?
  20. http://www.w3schools.com/php/default.asp https://codex.wordpress.org/WordPress_Lessons
  21. You want to write event-driven javascript -- i.e. routines that are called as event handlers. See... https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
  22. Maybe they simply open another tab and google for each question?
  23. Are you reading the data from a MySQL table? See the example below. You would modify it slightly so that a table is built... http://www.w3schools.com/php/php_mysql_select.asp
×
×
  • Create New...