Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. It isn't obvious to me what you want. The use of media queries is quite simple. http://www.w3schools.com/cssref/css3_pr_mediaquery.asp @media screen and (max-width: 480px) { body { background-color: green; } } @media screen and (min-width: 481px) and (max-width: 800px) { body { background-color: red; } } @media screen and (min-width: 801px) { body { background-color: blue; } }
  2. checkstr(''); checkstr(' '); checkstr('procedure '); checkstr(' procedure '); checkstr(' xxxxxxxxxx procedure / /'); checkstr('xxxxxxxxxx procedure / /'); checkstr('Echo procedure 12/20/2016 12:05:32 PM'); function checkstr(str){ 'use strict'; if (str){ // eliminates null, undefined, and empty string var offset = str.indexOf('procedure'); var firstblank = str.indexOf(' '); if(offset != -1 && firstblank + 1 == offset && str[offset + 12] == '/' && str[offset + 15] == '/'){ alert('['+str+']\nmatch'); }else{ alert('['+str+']\nfail'); } }else{ alert('invalid'); } }
  3. What is the effect of producing a false positive? var str = 'Echo procedure 12/20/2016 12:05:32 PM'; var offset = str.indexOf('procedure'); var firstblank = str.indexOf(' '); if(offset != -1 && firstblank + 1 == offset && str[offset + 12] == '/' && str[offset + 15] == '/'){ alert('match'); }else{ alert('no match'); }
  4. I don't think your question entirely makes sense. Variables are initialized if the code needs them to be initialized, to a value that makes sense for that code, but not all variables need to be initialized. It all depends on how the code is written and how the variable is used.
  5. You initially set a variable to something reasonable for its intended use. False is a boolean while '' is an empty string.
  6. davej

    Session Query

    Start with a working example... http://www.w3schools.com/php/php_sessions.asp
  7. I would suggest the tutorial... http://www.w3schools.com/HTML/html5_video.asp http://www.w3schools.com/Css/css_rwd_intro.asp
  8. She should study the programming examples until she understands them. She will also need to learn SQL to do much of anything. http://www.w3schools.com/js/js_examples.asp http://www.w3schools.com/php/php_examples.asp http://www.w3schools.com/sql/
  9. You can search for yourself... https://www.google.com/?gws_rd=ssl#q=innodb+vs+myisam
  10. InnoDB has a better reputation -- but do you really need to store the images in a database? If you don't need the images to be secure then you can simply store them in the filesystem.
  11. Is there a need for these images to be secure?
  12. Use media queries... http://www.w3schools.com/Css/css_rwd_mediaqueries.asp
  13. My code does not really satisfy the problem requirements stated in the original post, but it does demonstrate the use of a function. If you want to have a function that returns a boolean you might do something like this... function vowel(ch){ 'use strict'; if (typeof ch != 'string' || ch.length != 1){ console.log('Internal error in vowel'); } var chu = ch.toUpperCase(); if(chu == "A" || chu == "E" || chu == "I" || chu == "O" || chu == "U") { return true; }else{ return false; } }
  14. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Function</title> <script> window.onerror = function(a,b,c){ alert('Javascript Error: '+a+'\nURL: '+b+'\nLine Number: '+c); return true; } </script> </head> <body> <h1>Function</h1> <input type="text" id="intxt"/> <input type="button" id="btn" value="Run"/> <div id="outtxt"> </div> <script> 'use strict'; document.getElementById('btn').onclick = getinputtxt; function getinputtxt(){ var outtxt = document.getElementById('outtxt'); outtxt.innerHTML = ''; var t = document.getElementById('intxt').value; var o = vowels(t); outtxt.innerHTML = o; } function vowels(raw){ var vowels = 0; var nonvowels = 0; var sent = raw.trim().toUpperCase(); for (var i=0 ; i<sent.length ; i++) { if(sent[i] == ' '){ // do nothing }else if(sent[i] == "A" || sent[i] == "E" || sent[i] == "I" || sent[i] == "O" || sent[i] == "U") { vowels++; }else{ nonvowels++; } } var str = "Number vowels = " + vowels + "<br/>Number non-vowels = " + nonvowels; return str; } </script> </body> </html>
  15. davej

    Index vs Key

    An index is generally an integer column in a table where each integer value is unique and can be used to identify that row. Since a primary key must uniquely identify each row a surrogate index is often created and used as a primary key. A primary key can be anything that uniquely identifies each row but an index is a convenient solution. For the gory details of surrogate keys, primary keys, foreign keys, etc... you should read more about relational database theory. https://en.wikipedia.org/wiki/Unique_key Perhaps I am not being completely accurate in my above semantics. You can also apply an "Index" to important columns in a table to speed up searches related to those columns. This is a different sort of "index" than what I was thinking of above. It will accelerate searches but will slow writes to the table. See... http://www.w3schools.com/sql/sql_create_index.asp
  16. Has the Booking class been declared as an entity and annotated?
  17. The tutorials are essentially ES5. ES6 is a massive change in the language.
  18. Perhaps it is stored because the upload may take a long time?
  19. Do you understand the concept of a client-server architecture? NodeJS is a special implementation of Javascript that runs on the server -- but NORMALLY Javascript only runs on the client.
  20. davej

    Virtual Directory

    Try adding an index.html file in C:\inetpub\wwwroot
  21. Server-side languages generally require a page reload to do something. Javascript is client-side code and runs in the client browser and can do things quickly without reloading the page or bothering the server. Javascript code can also minimize the server workload by only requesting the portion of the page that needs to be updated rather than reloading an entire new page.
  22. See... http://www.w3schools.com/cssref/sel_hover.asp
  23. It makes little or no sense to create a property with embedded spaces.
  24. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test</title> <style> </style> <script> window.onerror = function(a,b,c){ alert('Javascript Error: '+a+'\nURL: '+b+'\nLine Number: '+c); return true; } </script> </head> <body> <h1>Test</h1> <script> counter(); counter({mode:"stopped"}); counter({ min:0, max:200, mode:"increment" }); function counter(o){ if( o instanceof Object ){ if(o.min != undefined && o.min != null){ alert('min= ' + o.min); } if(o.max != undefined && o.max != null){ alert('max= ' + o.max); } if(o.mode != undefined && o.mode != null){ alert('mode= ' + o.mode); } }else{ alert('Error: counter parameter ['+ o +'] is not an object'); } } </script> </body> </html>
×
×
  • Create New...