Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Ingolme

  1. The last example I wrote is a bit more complicated at the processor level, I was just showing an alternative way to do things. It is probably best to have the declaration inside the each() callback as I said initially. You're mostly correct, with a couple of differences due to the way scope and references work. 2) If the space does not have an object yet, it behaves as you said and puts the object in that space. If there was already an object in that space, the variable entry is changed to point to a new space in memory and the new object is placed there instead. The old object remains exactly where it was as long as there is a pointer to it from somewhere, like the entryArr array. 3) The value is not retrieved from the storage space, instead the array just contains a reference to that space in memory telling it that the object is there. This distinction is important, because the error you had initially occurs because all of the array elements had pointers to the same piece of memory meaning that changing one of them would change all of them. I've attached a short diagram explaining basically how the memory works in this situation. It's not 100% accurate, but it would take at least a semester course to teach the details.
  2. No, it is the same function. Every time the program enters a function, new memory is allocated for it. When the program leaves the function all of the memory used by the function is freed unless there are pointers to it from another part of the program, such as the array that was declared outside.
  3. Ingolme

    Table has error

    The leading slash is looking for the file at the root of the server. You almost never need to start a path name with a slash. You have to replace that with the actual path to the file. If the file is in the same directory as the current PHP file, then removing the slash will fix the problem. If it is in a sub-directory then you need to put the name of the sub-directory in the path. Where is connect_db.php in relation to the current PHP file you are writing?
  4. The problem before is that you created only one object and on each iteration you changed the properties of that object and added a new pointer to it from the array. What you really need to do is to create a new object on each iteration. You can recreate the variable every time because it is inside its own function. Another option would be to declare the object outside and initialize it inside the loop: var entry; // Reserve memory for storing objects $.each(inputArr, function(key, object) { entry = {}; // Create a new instance of an object and place it in the reserved memory for(var property in propertyArr) { var prop = propertyArr[property]; entry[prop] = object.prop; // Set the properties of the object } entryArr.push(entry); // Add a pointer to the new object at the end of the array }); return entryArr; They both do the same thing but for different reasons.
  5. Ingolme

    Table has error

    This line is probably causing the program to halt because it cannot find the file: require('\connect_db.php'); Starting with a backslash on Linux will not work correctly, and on Windows it will look for the file at the root of your computer, which is probably directly under C:\ depending on how Windows was set up.
  6. The variable entry should be declared inside the .each() callback.
  7. Ingolme

    Table has error

    The code from your first post is PHP code, not SQL, but you seem to be running it in an SQL environment. It should be in a PHP file. The code also is missing a "." at the end of the first line to concatenate it with the next line. I'm under the impression that the duplicate first_name is a result of not copying what was in the book correctly.
  8. Ingolme

    check if server and client are connected

    You can send an XMLHttpRequest periodically and check that the HTTP status is 0. Building up on the line of code you provided earlier. // ... More code xhttp.open("GET", "online_check.txt", true); xhhtp.onreadystatechange = function() { if(xhttp.readyState == 4) { if(xhttp.status == 0) { // Show disconnected message } else { // Show connected message } } } // ... More code To save on server resources, you probably should not make requests more frequently than once every 5 seconds.
  9. Ingolme

    "var" keyword not used with =+ operator?

    You declare a variable only once, then use it as many times as you need to. Using the var keyword creates a new variable. It doesn't make sense to create a variable that already exists.
  10. Ingolme

    embedded TrueType font not working

    Which browser has the issue? I know that Internet Explorer / Edge will refuse to show certain fonts if you haven't obtained a licensed version of it. You can tell if that's the case because The browser's console will show an error message about the font. If this is your problem, the solution to the problem is to modify the font file, here's a tool that can help fix font files: https://www.fontsquirrel.com/tools/webfont-generator
  11. Ingolme

    How to check if a string is empty

    You're calling the subroutine passing in variables that have not been initialized. Initialize the variables first, then call the subroutine.
  12. Ingolme

    check if server and client are connected

    In what way? In HTTP, the connection between client and server ends as soon as the page finishes loading.
  13. Ingolme

    W3CSS sidebar stopped closing

    The Javascript console says that "w3_close" does not exist. I checked your function definitions and they are inside the following script tag: <script type="Javascript"> That syntax will probably not work, the browser thinks it's not Javascript so it won't run it. Either omit the type attribute or set it to one of the valid values: "application/javascript" or "application/ecmascript"
  14. Ingolme

    Working with require and typeof

    Is it not possible to just include the Javascript file with a <script> tag?
  15. Ingolme

    How to Discipline a Misbehaved iPhone Keyboard

    That's a feature that only kicks in when the font in your dropdowns is smaller than the standard for accessibility, it was designed to help people with poor vision. You can prevent that by making sure that your dropdowns have a font size of 16 pixels or greater. I advise against changing the value of any meta tag, these are read once when the page loads and are never expected to change. I can't answer your question about the iPhone keyboard since I don't have the means to reproduce it right now and I don't fully understand the issue. I would expect the keyboard to span the full width of the phone's screen, there's not much space on it and there are a lot of letters to cram into there. Given that you mention that the issue is similar to the dropdown one and that it occurs when focusing the search field, I would suggest making your search field larger as well.
  16. Ingolme

    Line Break in email not working

    That's because you're using mysqli_real_escape_string. You don't need that function, that's only for databases and it's also only used in really old code. If all you're doing is sending an e-mail, remove the entire database connection file. For escaping things in an HTML e-mail, use htmlspecialchars(). That semi-colon is correct, it separates two of the components of the Content-Type header.
  17. Ingolme

    HTML and CSS

    Add "clear: both" to the CSS of your footer. Content that follows a floated element will try to go next to it.
  18. Ingolme

    Javascript command for finish the program

    There is no command to end the program, but if there are no event listeners, you can wrapall of your code in a function and call "return" when you want it to end. If you do have event listeners then you will have to remove all of the event listeners before stopping the program.
  19. If you want to detect that a string has a line break, you just search for "\n". In the following code, the variable "hasLineBreak" will be true when the string has a line break in it. var hasLineBreak = str.indexOf("\n") >= 0; You might want to split a string by its line breaks. The following code creates an array of strings, each string is one of the lines of the first string. var lines = str.split("\n"); When printing a string to HTML, if you want the line breaks to still be visible, you have to replace them with <br> tags. Here's how you would do that: var output = str.replace(/\n/g, "<br>"); element.innerHTML = output;
  20. Ingolme

    AJAX post method

    Most browsers do not allow AJAX to work on the local filesystem by default due to security settings, it has to be from a server. You can install a test server on your computer using XAMPP or WAMP and test AJAX on the localhost domain.
  21. Ingolme

    w3schools.invisionzone.com SSL issue?

    It would be a good idea if they could update the forum to use a secure connection. Right now it's all over plain HTTP.
  22. Ingolme

    HTML Symbols: displaying a text as it is

    You just need to encode the "&", like this: &amp;amp;
  23. Ingolme

    Modifying the value of a global variable

    That's ASP, it makes sense in the context of ASP. It is server-side Javascript. I have not worked much with ASP, so I don't know exactly the problem, but it is likely because you are mixing up server-side Javascript with client-side Javascript. The client does not have direct access to variables that have been declared on the server.
  24. For security reasons, Javascript is not allowed to write to files. If Javascript could write to files then websites would use that to install viruses onto your computer.
  25. Ingolme

    Please help; nav bar stuck and won't move with page

    Your HTML tags are mixed up, so the browser is interpreting them wrong. There is at least one closing </div> tag that shouldn't be there. You should correct the validation errors: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.cornerstonevaluationllc.com%2FindexBAKUP.html&amp;charset=(detect+automatically)&amp;doctype=Inline&amp;group=0