-
Posts
3,988 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Events
Posts posted by davej
-
-
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');
}
}
-
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'); }
- 1
-
I meant one example of when would I use $a = NULL; instead of $a = '';
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.
-
You initially set a variable to something reasonable for its intended use. False is a boolean while '' is an empty string.
-
Session Query
in PHP
-
-
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
-
-
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.
-
Is there a need for these images to be secure?
-
-
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; } }
-
<!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>
-
Index vs Key
in SQL
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...
-
Has the Booking class been declared as an entity and annotated?
-
The tutorials are essentially ES5. ES6 is a massive change in the language.
-
Perhaps it is stored because the upload may take a long time?
-
I'm not familiar with Node JS. What I am trying to get at is that if there is a block of code written in PHP7, and the same block is written in JS. If both are made to run on the same server, which technology executes such code and outputs result faster?
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.
-
Try adding an index.html file in C:\inetpub\wwwroot
-
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.
-
-
It makes little or no sense to create a property with embedded spaces.
-
<!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>
-
So what is the problem?
How to keep the main menu in the same section in responsive site
in CSS
Posted
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