Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. OK. That was helpful. I was, indeed, confusing language with encoding. By the way, all of my documents are opened and saved with UTF-8. QUESTION ONE: So, does the following correspond with a appropriate HTML 5 header, and QUESTION TWO: Can it be interpreted to mean: "This page is encoded with UTF-8 and should be read in UTF-8. In addition, the primary language used on this page is English." <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> ... </head>
  2. By the way, does the following mean that you are matching against two separate tables in the same database? ( MATCH (c.title, c.code, c.description, c.keywords) AGAINST (?) OR MATCH (child.title, child.code, child.description, child.keywords) AGAINST (?) ) Roddy
  3. Do you use the innoDB engine? The code that I am using to produce the visible effects observable on the Grammar Captive mainpage by clicking on Newsletter under the Search Grammar Captive heading in the page's navigation bar is the second of the two code entries of my initial entry to this discussion -- namely, Roddy
  4. No, it does not work. I tried it. The option must be enclosed in parentheses with the AGAINST string. When you replace the string with a question mark in combination with the option, the SELECT statement fails. Any other suggestions? Roddy
  5. Yes, of course, else I would have mentioned it. The phrase "seven gates" only exits in two of eight (25%). What is more you cannot add the IN NATURAL LANGUAGE MODE to the SQL statement when using the unknown ? token. Not that it should make a difference, because according to the manual the IN NATURAL LANGUAGE MODE is the default mode. Roddy
  6. Unfortunately, I do not know how to target a chained event in jQuery. Is it even possible. Or, must I break the chain and repeat the selector. Notice where the .click() method occurs in the following code. $("#search_letter").mouseover(function() { $(this).css({"cursor": "pointer", "font-weight":"800"}); }) .click(function() { if (window.selfSearchResults !== null) { $('#main').html(selfSearchResults); $.getScript('_utilities/javascript/search_second_go.js'); $.getScript('_utilities/javascript/search_letter.js'); } else { var searchLetterContent = $("#search_letter_div").html(); $("#main").html(searchLetterContent); $("#main .error").hide(); $.getScript('_utilities/javascript/search_letter.js'); } }) .mouseup(function() { $(this).css({"color": "#fadb9d","font-weight": "normal"}); $('body, html').animate({scrollTop: $('#main').offset().top},800); }); Roddy
  7. QUESTION ONE: So, by simply changing the lang property in the <html> element from "en" to "utf-8" will my goal be achieved? QUESTION TWO: Can it then be assumed that all modern browsers are capable of handling any character found within the utf-8 character set? QUESTION THREE: Is it possible to enter more than one value for the lang property? Say, lang="en, utf-8"? Roddy
  8. BACKGROUND: Browsers have come a long way over the years, and it is likely that what I am about to ask may appear silly to many. However, I was weened on the internet in Japanese while in Japan, and all of my operating systems since 1994 have been fully equipped to handle CJK fonts. In contrast, in the early years my online readership was nearly always those whose operating systems and browsers were not equipped to handle CJK fonts, and I was forever compelled to find work arounds for the proper display of CJK fonts in non-CJK operating systems. QUESTION: Today, what is the best to insert CJK fonts into an all-English web-application so that they will display properly for users no matter the language of their operating system. For example, is there some way that I can compel a browser to read in UTF-8, or is it even necessary. CAUTION: In answering this question please understand that nearly every page of the Grammar Captive website begins with the following <head> element notation: <!DOCTYPE html> <html lang="en"> Roddy
  9. Yep, I bundled it on my own. Nearly two days of work. Please see my entry in the Javascript forum on simulating a button click with the Enter or Return key. It is my last issue with the set up. Roddy
  10. Yeah, i discovered that Firefox has the element locked. Does this mean that I have to reformat the background color in order to get the element to perform? The text is simply impossible to read. Roddy
  11. The following script was found on StackOverflow. It is suppose to simulate a button click with the up-tick of an Enter key. $("#id_of_textbox").keyup(function(event) { if (event.keyCode === 13) { $("#id_of_button").click(); } }); Now, I am not using it for a textbox, but for a search box. In order to get it to work I have tried the following: Used the <form> element as the selector for the keyup() function. Used the <input> element of the search box as the selector for the keyup() function Entered the code in various places within my script including the html and the called javascript documents that make the search engine work. To no avail. Now, it is true that I have not been entirely methodological in my selection of HTML elements and code placement. Still, ss many times as I have tried, however, you would think that Lady Luck would be on my side. Any hints? Please advise. Roddy
  12. Yes, I read that as well, but this is clearly not the case with the phrase "Seven Gates". It would, of course, be true with the phrase "lorem ipsum", for there are only 8 documents in the entire data base, and all of them contain the words "lorem ipsum". Note that, in both cases -- "seven gates" and "lore ipsum" -- nothing is returned. Roddy
  13. What page are you looking on? My primary source is given below. https://dev.mysql.com/doc/refman/5.7/en/fulltext-natural-language.html My database engine is InnoDB. Roddy
  14. Yes, I have tested it, and it works -- sort of. According to the manual, however, "IN NATURAL LANGUAGE MODE" is the default option for AGAINST arguments. Further according to the manual, when search entries IN NATURAL LANGUAGE MODE are placed in double quotation marks the exact phrase is sought. This does not appear to be the case. Please go to the Grammar Captive main page and find the heading Search Grammar Captive in the navigation bar. Click on the word Newsletter and perform a search for the following two words -- once enclosed in quotation marks and once not: Seven Gates. With quotation marks the search fails. Without quotation marks the search succeeds. Either the manual or I is in error. Roddy
  15. BACKGROUND: i have created a search box for users to query the Grammar Captive database with Natural Language functionality. As the query string results in a single variable that is read into an AGAINST statement (see below), I am concerned about the overall safety of my database and web application. QUESTION ONE: Is it possible to write a prepared statement with the value of an AGAINST clause as an unknown? If not, what must one do in order to prevent against SQL injection? WHAT I HAVE CREATED SELECT letter_no, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ('$search_input') AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ('$search_input') ORDER BY letter_score DESC WHAT I WANT TO CREATE SELECT letter_no, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ('$search_input') AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (?) ORDER BY letter_score DESC QUESTION TWO: Will the "What I want to create" version fly? Roddy
  16. Aha!. Now I understand the purpose of the FULLTEXT INDEX option. Alas, I thought that I had finished structuring my tables the last time that I renovated. One last question before you depart for the weekend, if you have not done so already. Do you know of any open-source software, such as a jQuery plug-in, that will generate a search-box of the type that we have been corresponding? Roddy
  17. I will not bother with the topics in which we are talking past one another, but I do thank you for your insistence that I and whoever else is reading our discussion understands correctly. Truly it is helpful. I do want to make clear, however, that I always have error reporting on when I am writing code, and the only reason that the code had been turned off was because the document functioned in the end as I wanted. Clearly, though, an error, a notice, and a warning are three different kinds of messages, and never before have i had my code interrupted by a notice or a warning. Hence, my concern. I am still unclear about one matter. It would appear that a superglobal is fundamentally an object-type variable that contains property-value pairs. The requirement that I check every key-value pair appears, therefore, excessive. This suggests that superglobals are, indeed, a special kind of variable -- neither an array, nor an object. And this, despite the fact, that in many cases they behave identically to an object or an array. Is this a proper understanding. Roddy
  18. "First, I'm not sure why being a superglobal is significant.": Because the $_GET, $_POST, and $_COOKIE containers that Ingolme mentioned are all superglobals and there are other superglobals such as the $_REQUEST superglobal that do the same thing. The word "and" in the phrase "All variables contained in a superglobal and sent from one document to another ..." is very important in this regard. Yes, I understand what you mean, but the end result is a transfer of information between documents. OK. So, what is the point of asking whether or not the variable has been defined? Are you suggesting that all form input controls -- be, they select, input, textarea or whatever -- should be assigned a default value before being sent? Roddy
  19. This is my understanding of your discussion. All variables contained in a superglobal and sent from one document to another should be checked for initialization in the sending document before being processed in the receiving document. All variables that are used out of scope -- namely, globally -- should be initialized (assigned some value or non-value) at the outset. Is it accurate? One often sees in both Javascript and PHP the following sort of initialization. Is it correct? PHP: $search_engine =; and Javascript: var searchEngine = ; Roddy
  20. OK. I was not thinking in those terms, but I very much like the idea, for it seems that searching a database would be far quicker than searching all of the files of a website -- something that a public search engine can do easily, but whose results would vastly diminish the eventual true value of my site. Now, I am used to searching field values based on the known value of a particular field, but I have no experience in searching all values of all fields for a select number of tables. This is, indeed, the task that I would want the user to be able to perform. What is such a procedure called? What would a typical SQL statement look like? Roddy
  21. I am a little confused by your answer: 1) Recall that all I did was upgrade from PHP version 5.5.38 to 5.6.33 on my local server. 2) Further, understand that my error reporting was turned off both before and after the upgrade, and that the error messages only began appearing after the upgrade. 3) In addition, please note that my 3rd-party host server, where the relevant PHP files are set identically with those on my local test server, also uses 5.6.33. There, no error messages are reported. Finally, I do not understand why the following code produces the undefined notice. if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } My UNDERSTANDING: If there is a value registered for $_GET['refer_type'], the variable is obviously set, and the value is assigned to $refer_type. If there is no value, it matters not whether the variable is set or not, for the value 0 is assigned to $refer_type, no matter whether $_GET['refer_type'] is set or not. REQUEST: How would you write the same code to avert the error message, if indeed, it is the code that is creating the message and not something else. ? Roddy
  22. BACKGROUND: I recently upgraded my version of PHP from 5.5.38 to 5.6.33. PHP code that functioned perfectly well now fails with imposed notifications complaining about undefined variables. Mind you, my error logs and notifications are turned off. This suggests that I must either learn how to turn off these imposed intrusions or learn to write PHP properly and modify all of my PHP processing files accordingly. In the belief that I will be better served by the latter, I am appealing to W3Schools to set me straight. REQUEST: Please examine the following two pieces of code and correct then so that I do not receive a notice from PHP telling me that the variable is undefined, when indeed no value was intended. This is just a sampling of the problem that I am now confronted with. Sampling One - The CODE My Action: I selected webinar, but not newsletter before the form was submitted. <?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require_once '../../_utilities/php/php_mailer/PHPMailerAutoload.php'; // var_dump(class_exists('PHPMailer')); $name = $email = $newsletter = $webinar = $language = $error_msg = '' ; /* function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } */ if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['language'])) { $error_msg = "Please select your first language or add another, if yours is not listed."; } else if ($_POST['language'] == 'other_tongue') { if (empty($_POST['other'])) { $error_msg = "Please enter your first language."; } else { $language = filter_var($_POST["other"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } } else { $language = filter_var($_POST["language"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } if (!($_POST["newsletter"]) && !($_POST["webinar"])) { $error_msg = "Have you forgotten to select a gift?"; } else { $newsletter = filter_var($_POST["newsletter"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $newsletter = !empty($newsletter) ? "$newsletter" : 0; $webinar = filter_var($_POST["webinar"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $webinar = !empty($webinar) ? "$webinar" : 0; } ... The ERROR MESSAGE: Sampling Two - The CODE My Action: I opened the page directly. There was no referral. <?php /* ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); */ if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } ... The ERROR MESSAGE: Please advise. Roddy
  23. Prepared statements are more difficult to implement. Match the method with the task. Prepared statements are only required when security is an issue. Roddy
  24. BACKGROUND: I am in the process of integrating Matomo website analytics into my web application and stumbled across an important functional element that is missing on my main page -- namely, an onsite search window that delivers information about the site to the page. Not only would such an element provide valuable information about what users are looking for on my site -- this, as opposed to what I am offering --, but it would also provide them with a reason to tarry just a little longer on my site. QUESTION: Can you provide me with some leads into setting up such functionality. As most of my content is delivered dynamically, this need not be anything as elaborate as that provided by the InvisionZone domain. Roddy
×
×
  • Create New...