Jump to content

iwato

Members
  • Content Count

    1,496
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. Hi, Dsonesuk. When I enter values other than 100% and auto for the height and width into the <div> tag that identifies the location of the map on the webpage, the map appears, but it is no longer responsive. It seems that I can have the map without responsive design, or responsive design without the map. This is the problem. Roddy
  2. BACKGROUND: I am introducing a new jQuery plug-in into my website, but it enters without any height -- this despite the fact that the width of the SVG object is fully responsive. You can see the problem on the Grammar Captive mainpage by clicking in the navigation bar under Visitor Profile / World Map. WEB INSPECTOR RESULTS: <div style="position: relative; overflow: hidden; background-color: rgb(165, 191, 221);" id="vmap"> <svg height="0" width="513"><g transform="scale(0) translate(Infinity, 0)"> <path class="jqvmap-region" id="jqvmap1_id" original="#f4f3f0" fill="#f4f3f0" stroke-opacity="0.25" stroke-linejoin="round" stroke-linecap="round" stroke-width="1" stroke="#818181" d="..."></path> <path class="jqvmap-region" id="jqvmap1_pg" original="#f4f3f0" fill="#f4f3f0" stroke-opacity="0.25" stroke-linejoin="round" stroke-linecap="round" stroke-width="1" stroke="#818181" d="..."></path> . . . <path class="jqvmap-region" id="jqvmap1_gr" original="#f4f3f0" fill="#f4f3f0" stroke-opacity="0.25" stroke-linejoin="round" stroke-linecap="round" stroke-width="1" stroke="#818181" d="..."></path></g> </svg> <div class="jqvmap-zoomin">+</div> <div class="jqvmap-zoomout">−</div> </div> PROPOSED STRATEGY Target the height and scale attributes of the SVG object with some jQuery. For some reason I believe that there is a more civil less intrusive way to fix the problem. Simply after several hours of experimentation I have run out of ideas. QUESTION: Can you provide a likely explanation as to why the scale attribute is registering as zero? Can you come up with a solution. SPECIAL REQUEST: If you could explain the following line of code console.log('Map Size: ' + width + 'x' + height); in https://www.grammarcaptive.com/_utilities/javascript/worldmap_filler.js it would be greatly appreciated. HINT: https://github.com/10bestdesign/jqvmap/blob/master/examples/responsive.html As always, you are the rising sun on my horizon of relentless frustration, Roddy
  3. So, why is it that the dateCounter() function only returns one name-value pair in a single object, if the initial empty object is left out? The empty object appears to induce recursion, but I do not understand why. Roddy
  4. OK. you have adequately explained the following line of code. countDates[date] = ++countDates[date] || 1; Can you now explain this line of code. (countDates, date) => {...; return countDates;},{}) The result set, by the way, appears to be an object of name-value pairs which is exactly what I was hoping for when I introduced the function into my code. Object { 2019/01/01: 2, 2019/01/03: 4, 2019/01/04: 2, 2019/01/05: 2, 2019/01/06: 1, 2019/01/07: 2, 2019/01/09: 6, 2019/01/11: 1, 2019/01/18: 3, 2019/01/20: 2, 60 more… } Roddy
  5. BACKGROUND: Recently I discovered a nifty Javascript function that counts the like values of an index array and returns as its value an object whose property-value pairs consist of a single repeated value and its corresponding frequency. Unfortunately, I am having trouble understanding how the function works. As I have adapted it to fit my own needs I have changed the variable names. Indeed, this change may be the source of my own confusion. The FUNCTION: function dateCounter(dates) { return dates.reduce( (countDates, date) => { countDates[date] = ++countDates[date] || 1; return countDates; }, {} ); } REQUEST: Please write in plain English what the so-called reducer function of the reduce( ) function is achieving with each iteration. I am baffled. Roddy
  6. If you like my suggestion, pass your cursor over the heart and select the trophy. Roddy
  7. I suppose that the conclusion to this discussion is that anything sent via an HTTP request is vulnerable and that one should protect one's MySQL database from potential threats with the use of prepared statements. This said, I am confused about their use. Is it sufficient to prepare and bind a statement only once, and then execute the prepared and bound statement with fresh data as many times as one wants? Roddy
  8. Have you tried tipue? Roddy
  9. Hi, JSG! Understood. Thank you. Access to neither the local Matomo server, nor the local Grammar Captive database is direct. The Matomo server is located in one domain and the PHP class documents and PHP data fetch, translation, and storage code document are located in another domain on the same server. The Matomo server is accessed using a cURL routine and Matomo authentication key. The translated data is stored in data tables that are accessed with two MySQLi objects constructed with two separate SQL queries using password authentication. In brief, both the Matomo API and the GC datatables are accesses with HTTP requests. Once again, the Matomo database from which the Matomo server fetches its data and the GC database to which the data is ultimately stored are located on the same server. Roddy
  10. BACKGROUND: As always I am concerned about security on the one hand, but do not wish to over-code on the other. In the following outlined procedure the data is fetched from the super secure, vast thicket of layered PHP and sent after translation THE PROCEDURE: Create two MySQL tables linked with a foreign key. Make a method call to the Matomo API and retrieve a four tiered nested array containing two tiers of visitor data. The first tier consists of an indexed array whose 100 elements each corresponds to a single visit to the Grammar Captive website. The second tier consists of an associative array, one for each of the 100 elements of the first tier. The third tier consists of an indexed array of varying length corresponding to one of the elements of each of the second tier arrays. Each element of this third tier array contains an associative array of varying length whose elements correspond to different actions and/or events associated with the respective visit. The fourth tier contains the data for each recorded action or event. Generate two classes: one for the visit data (2nd tier), and one for the action/event data (4th tier). Translate the keys of the key-value pairs of the two aforementioned tiers so that their values can be properly inserted into either of the two data tables. Insert the translated data into the two data tables via two separate objects created from the two classes. With the exception of the creation of the data tables Steps 1-5 are all performed within the context of the same PHP document. QUESTION: Do you see any security risk in the above? Roddy
  11. Hi, Funce! Thank you for your quick response. It was you who gave me the idea of creating a data table. And, now I have two: one for each visit and one for all of the actions and events associated with each visit. Hooray! Hooray! In regard to the TranslateMatomoAction class I understand now clearly about the __contructor() function. I was trying to make it do something that it was not intended to do. This said, I was unable to get the __invoke() function to work as you suggested. So, I moved the contents of the __constructor() function outside of the class and changed the variable names. My object is now fully complemented with the desired information is ready for MySQL insertion. Many thanks! Roddy
  12. BACKGROUND: Many moons ago it was suggested that I create a CRON job that would read into a MySQL table the results of a method call to a Matomo API call and thereby speed up the rendering of data for visitors to the Grammar Captive website. I have since come to learn that this technique is called data translation. The following code creates a class object that when inserted into a foreach loop is suppose to fill the properties of the object for further manipulation. Unfortunately it does perform the intended task. THE CLASS class TranslateMatomoAction { public $mysqli_obj; public $visitID; public $type; public $serverTimePretty; public $timestamp; public $url; public $generationTime; public $pageTitle; public $pageID; public $pageView_ID; public $pageID_Action; public $timeSpent; public $eventCategory; public $eventAction; public $eventName; public function __construct($property, $value) { if ($property === 'type') { $this->type = $value; } else if ($property === 'serverTimePretty') { $this->serverTimePretty = $value; } else if ($property === 'timestamp') { $this->timestamp = $value; } else if ($property === 'url') { $this->url = $value; } else if ($property === 'generationTimeMilliseconds') { $this->generationTime = $value; } else if ($property === 'pageTitle') { $this->pageTitle = $value; } else if ($property === 'pageId') { $this->pageID = $value; } else if ($property === 'idpageview') { $this->pageView_ID = $value; } else if ($property === 'pageIdAction') { $this->pageID_Action = $value; } else if ($property === 'timeSpent') { $this->timeSpent = $value; } else if ($property === 'eventCategory') { $this->eventCategory = $value; } else if ($property === 'eventAction') { $this->eventAction = $value; } else if ($property === 'eventName') { $this->eventName = $value; } } public function set_visitID($visitID) { $this->visitID = $visitID; } public function set_mysqli_obj($mysqli_obj) { $this->visitID = $visitID; } } THE INSERTED CLASS AND ASSOCIATED CODE if (is_array($value1) && ($key1 === 'actionDetails')) { foreach($value1 as $key2 => $value2) { //LEVEL 2 - This foreach statement traverses the set of indexed arrays whose elements are a key-value pair of indices and arrays. Each array is a value of the actionDetails element of a visit. if (is_array($value2)) { $matomo_action = new TranslateMatomoAction($key3,$value3); foreach($value2 as $key3 => $value3) { //LEVEL 3 - This foreach statement traverses the elements of the associative array corresponding to the value of $key2. $matomo_action($key3, $value); } } } } DILEMMA: Unfortunately, the above procedure fails to fill the values of the object's property as expected. QUESTION: Where have I gone wrong? Roddy
  13. So, in the end, the table was corrupted, and I had no back up. Alas, I reconstructed the entire table with UTF-8 encoding. The result was nothing but spectacular. I now have an in-tact Mecab parser that parses Japanese. Not only this, but the Mecab parser does not interfere with the parsing of French, English, and German., or likely any other language that using blank spaces to separate words. Arabic will be my next challenge, but I am fairly confident that it will work just like English with no additional encoding required. Roccy
  14. Thank you, JSG. I do not know a thing about C, let alone the argv and argc parameter. This said, I can well imagine. No, no, no. I am not eager to learn still another computing language! I am having enough trouble with the ones, that I have already attempted. It has never been my goal to become an online developer. It just sort of happened out of curiosity and in self-defense. Roddy p.s. Great Link!
  15. Yes, your link is the same that caused me to ask the question. I will explore a little further with the idea of looking for a command. Thank you for responding. Roddy
  16. GREETING: I would like to wish everyone at W3Schools a very Happy New Year! BACKGROUND: In an effort to speed up Matomo's performance without having to create a routine that will retrieve, save, and call the desire data -- a procedure suggested earlier by others -- I am seeking to set up a Matomo CRON job that apparently does the same with no additional coding on my part. Unfortunately, I am confused by the syntax. CODE (RECOMMENDED BY MATOMO): 5 * * * * www-data /usr/bin/php5 /path/to/piwik/console core:archive --url=http://example.org/piwik/ > /home/example/piwik-archive.log QUESTION: To what refers the phrase core:archive in the above code segment? NOTE: Within the path/to/piwik folder there exists a document file called console. Within the path/to/piwik/core folder there exists a file called Console.php, a folder called Archive, and a file called Archive.php. There are various files in the Archive folder, but none of them resemble very closely any of the folders and files just mentioned. Roddy
  17. In most languages individual words can be sought and found because all words in a text are separated by blank spaces. For example, I have no trouble performing search and find operations for Arabic, Korean, or English. Chinese and Japanese words, however, are not separated by blank spaces and are impossible, as a result, to distinguish from their neighbors. The ngram and mecab parsers do not depend on blank spaces to perform their search, rather they search according to the number of bytes that typically make up Japanese and Chinese words: one, two, three, four, and at most five characters, generally speaking. One and two character words are the more common. The word 日本語 (Japanese language) is returned because it appears with a space before and after. The word 本質, however, is surrounded by text on either side. It is not delimited by spaces. Now, I just performed the additional MySQL command and discovered the following: SHOW STATUS LIKE 'mecab_charset'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | mecab_charset | utf8 | +---------------+-------+ 1 row in set (0.03 sec) This is additional proof that there is nothing wrong with my installation. My intuition suggests that the problem may lie with the DEFAULT CHARSET of my data table that is set to Latin. This said, changing the character set of a table can be problematic, and the columns themselves are correctly set to UTF-8. Thus, before proceeding I would like to ascertain the character set requirements for the InnoDB MySQL table when using the mecab parser. This, however, I have been unable to find. Roddy
  18. I have just run TEST THREE above in the MySQL console. It produces the same result as in the SQL menu of phpMyAdmin. mysql> SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC; Empty set (0.68 sec) This would explain why, in part, that no complaint is received from either PHP or MySQL, everything appears to be running fine -- simply it is not. Roddy p.s. As far as the character code is concerned the table is set to Latin, but the columns/fields in the table that are being search are set to UTF-8.
  19. The code that I ran with phpMyAdmin and the code that I run with PHP when I make AJAX calls are the same. Simply, I had to substitute the ? mark with an actual term and was compelled to enter the quotation marks manually. Roddy
  20. Thank you for the suggestion. This is what I discovered. The ORIGINAL SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC TEST ONE: Insert a Japanese word that requires use of the Mecab parser to parse. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (本質 IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (本質 IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT ONE: Error - The Japanese word is recognized as an unidentified field or column. TEST TWO: Insert the same Japanese word delimited with single quotation marks. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ('本質' IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ('本質' IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT TWO: No error is generated. Neither, however, is a match found. TEST THREE: Insert the same Japanese word delimited with double quotation marks. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT THREE: No error is generated. Neither, however, is a match found. Please advise further. Roddy
  21. 0 down vote favorite BACKGROUND: I have built a custom search engine that works fine in English, but fails in Japanese, this despite confirmation from my host server that I have performed the installation of the Japanese mecab parser correctly. My own checks reveal the following: 1) SHOW CREATE TABLE: FULLTEXT KEY search_newsletter (letter_title, letter_abstract, letter_body) /*!50100 WITH PARSER mecab */ ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 2) SHOW PLUGINS: ngram | ACTIVE | FTPARSER | NULL | GPL | mecab | ACTIVE | FTPARSER | libpluginmecab.so | GPL IMPLEMENTATION 1) MYSQL Statement: $sql ="SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC"; 2) CUSTOM SEARCH ENGINE: See under Local Search / Newsletters at https://www.grammarcaptive.com/overview.html 3) DOCUMENT SEARCHED: See under Regular Updates / Newsletter / Archives / Japanese at https://www.grammarcaptive.com/overview.html COMMENT: Neither PHP, nor MySQL complains. Simply any Japanese word search that needs to be parsed is not returned. For example, the word 日本語 can be search and found, but does not require any parsing to be retrieved. The search for any other Japanese word in the newsletter fails. REQUEST: Any troubleshooting tips would be greatly appreciated. Roddy
  22. Dsonesuk: I am not sure that I understand what you are recommending. Is it Create a div and a function on the current page that is triggered when this div is clicked. Load with this click only that portion of the page to which the current page links and contains the link whose normal functioning I wish to suppress and replace with some other function. Activate this some-other-function. If it is not, please elaborate further. If it is, please confirm. Roddy
  23. The reason for this assumption is that I have run into a lot of junk in my brief two years of coding. In any case, the problem has been resolved by resetting the PHP bin path for my server's CRONTAB. Further, my first scheduled email using Peppe Occhi's CRON Scheduler has been received along with the output for my newly installed CRON Scheduler CRON job. Finally, a credit on the Grammar Captive webpage has been posted for both Peppe Occhi and Symphony under the headings CRON Scheduler and SwiftMailer in the CREDITS section of the Grammar Captive mainpage. Hooray! Hooray! Once again, thank you W3Schools. Roddy
  24. No, I did not look up the operator, for it made no sense. What did make sense was a typo. Then, I looked at the surrounding code and tried to understand what was going on. After which I played with it until I found something that made sense and PHP no longer complained. I made a dozen other similar corrections on a variety of pages before I finally stumbled with PHP rejecting its own CORE function. Roddy
  25. $this->addressEncoder = !empty($addressEncoder) ? $addressEncoder : new Swift_AddressEncoder_IdnAddressEncoder(); This is exactly what I did do and moved onto the next error and correction, but before going any further let us wait until I have clarified with my host provider why all of my CRONTAB jobs are pointed to 5.6 and my default and domain settings are pointing to 7.2. This now appears to be the likely source of the problem, for after all, the scheduler.php that I set up depends on the CRONTAB for its existence. Roddy
×
×
  • Create New...