Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. BACKGROUND: Between one and two moons ago I inquired about a strategy for speeding up my Matomo processing time, whereupon both Funce and Dsonesuk provided excellent insight in this regard. I am now on the verge of setting up a CRON Job to perform scheduled calls to the Matomo data base. Before implementing the scheduler, however, I must be clear about the format that I am to use to handle the data. As I am provided with a variety of formats, I decided to explore those that I thought would be useful before deciding on one. To my dismay I am overwhelmed with what I discovered. Both of the following responses represent the first few lines of the same cURL request. The only change when making these requests was the indicated formats. The problem is that I have no idea how to handle data in these formats. PHP a:100:{ i:0;a:96:{ s:6:"idSite";i:1; s:7:"idVisit";i:914; XML 1 914 205.175.107.119 ... action http://www.grammarcaptive.com/podcast_hostpage.php?hash=30a6836a3f7c5fc57751a61098e5c2fc&podcast_no=92 Grammar Captive Weekly Podcasts 14 wYBSoJ Nov 14, 2018 08:47:46 25338 25 25s 1824 1.82s 1 1542185266 action https://www.grammarcaptive.com/overview.html Grammar Captive Overview 6 CLxGe9 Nov 14, 2018 08:48:11 25339 1 1s 2419 2.42s 2 1542185291 action http://grammarcaptive.com/_gates/gate1/gate1.html Gate One - What Makes Grammar Captive Different 33 aXaszd Nov 14, 2018 08:48:12 25340 0 0s 262 0.26s 3 1542185292 action https://www.grammarcaptive.com/_gates/gate3/gate3.html Gate Three - Is Grammar Captive for You? 50 The three dots (...) represent sensitive data values. The indendation and line spacing was added by me. Although the first set of data resembles very closely that of JSON, the second set of data is completely lacking in the metadata required to understand what is being returned. Unfortunately, I have no idea how to handle either in the given formats. Please advise. Roddy
  2. iwato

    header info query

    Here is what I obtain 0: HTTP/1.0 301 Moved Permanently 1: Date: Sun, 11 Nov 2018 22:52:03 GMT 2: Strict-Transport-Security: max-age=31536000 3: Via: http/1.1 media-router-fp1002.prod.media.ne1.yahoo.com (ApacheTrafficServer [c s f ]) 4: Server: ATS 5: Cache-Control: no-store, no-cache 6: Content-Type: text/html 7: Content-Language: en 8: Connection: keep-alive 9: X-Frame-Options: SAMEORIGIN 10: Expect-CT: max-age=31536000, report-uri="http://csp.yahoo.com/beacon/csp?src=yahoocom-expect-ct-report-only" 11: Location: https://www.yahoo.com/ 12: Content-Length: 8 13: HTTP/1.0 200 OK 14: Cache-Control: no-store, no-cache, max-age=0, private 15: Content-Encoding: gzip 16: Content-Type: text/html; charset=UTF-8 17: Date: Sun, 11 Nov 2018 22:48:04 GMT 18: Server: ATS 19: x-amz-server-side-encryption: AES256 20: Age: 239 21: Via: https/1.1 media-ncache-fp29.prod.media.gq1.yahoo.com (ApacheTrafficServer [cMsSf ]), http/1.1 media-ncache-fp29.prod.media.gq1.yahoo.com (ApacheTrafficServer [cSsSfU]), http/1.1 media-ncache-fp29.prod.media.gq1.yahoo.com (ApacheTrafficServer [cRs f ]), http/1.1 media-ncache-fp34.prod.media.gq1.yahoo.com (ApacheTrafficServer [cMsSf ]), http/1.1 media-router-fp1009.prod.media.gq1.yahoo.com (ApacheTrafficServer [cMsSf ]) 22: Content-Length: 226066 23: P3P: policyref="http://info.yahoo.com/w3c/p3p.xml, CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV 24: Expires: -1 25: Strict-Transport-Security: max-age=31536000 26: Content-Security-Policy: sandbox allow-forms allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-presentation; report-uri https://csp.yahoo.com/beacon/csp?src=ats&site=frontpage®ion=US&lang=en-US&device=&yrid=dfh5u61duhckj&partner=; 27: X-Frame-Options: SAMEORIGIN 28: X-XSS-Protection: 1; report="https://csp.yahoo.com/beacon/csp?src=fp-hpkp-www" 29: Expect-CT: max-age=31536000, report-uri="http://csp.yahoo.com/beacon/csp?src=yahoocom-expect-ct-report-only" when I run $url = 'https://yahoo.com'; $output = get_headers($url); foreach ($output as $key => $value) { echo $key . ': ' . $value . '<br />'; } Note: X-Frame-Options: SAMEORIGIN Roddy
  3. CONCERN: The following function does what it is suppose to do -- namely, select at random and without duplication a given number of elements from an array of elements. However, I fear that it is hopelessly awkward and would like your professional assessment of its construction. You will likely not find another like it on the internet, but parts of it were obtained therefrom. function selectCubes(gates) { function onlyUnique(value, index, self) { return self.indexOf(value) === index; } var cubes = ['cube_one', 'cube_two', 'cube_three', 'cube_four', 'cube_five', 'cube_six', 'cube_seven']; var selectedCubes = []; var filteredCubes = []; var n = 0; while (n < gates) { selectedCube = cubes[Math.floor(Math.random()*cubes.length)]; selectedCubes.push(selectedCube); if (filteredCubes.length < gates) { var filteredCubes = selectedCubes.filter(onlyUnique); n++; } } return filteredCubes; } console.log('selectCubes(3):' + selectCubes(3)); Please comment and have a great weekend! Roddy
  4. This has already been achieved elsewhere, separately and differently, for each case. I am sure that the five lines of code of which you speak are included in the code that I have described above, else the code would not perform its most essential task. These lines of code, however, are hardly the purpose of my having gone through the trouble of writing the code. This said, do you find any errors in that what I have presented beyond those which Funce has already addressed? Roddy
  5. Ingolme, I hope to correspond with my visitors in a variety of ways, and I find the language of PHPMailer awkward and confusing. I am trying to rewrite it in a way that I can understand quickly what is going on and make changes without a lot of research each and every time that I need to modify it. If the above can eventually be made to work, then I am very comfortable with the new structure. Where for example do you think the trait use SmtpServerConfig; should be entered? I have entered it in two places, and it likely needs to be entered only once. Roddy
  6. Thank you, Funce. Both of those were silly errors on my part. I have been a little overwhelmed with this entire task, and if this is all the errors that can be found, then I will be most elated. Already you have earned a trophy. Simply I have not added it yet out of fear that everyone will stop looking for more holes to poke. :-) Roddy
  7. Is the $.when() function what you are looking for? This function provides a way to execute callback functions based on zero or more Thenable objects. These latter are usually Deferred objects that represent asynchronous events. Roddy
  8. OK. I have tried to follow your factory design model as best as I could. Does the following look like it might have a chance of successful execution? Please pay careful attention to the use of the include and require_once commands, the $this variable, visibility issues, class hierarchy, trait insertion, and the overall effective strategy. And, please, if I have omitted anything or become redundant in some manner, bring it to my attention. NOTES: The three dots indicate that information must be entered. The double hash marks represent omitted files or lines of code that will be added later. The CODE /*********************************************/ ./global.init.php <?php error_reporting(E_ALL ^ E_STRICT); ini_set('error_log', __DIR__ . '/error.log'); include './php_mailer/PHPMailerAutoload.php'; include './classes/trait.smtpserver_config.php'; include './classes/php_mailer/phpmailer_abstract.php'; include './classes/class.phpmailer_newsletter_config.php'; // include './classes/class.phpmailer_verification_config.php': // include './classes/class.phpmailer_confirmation_config.php'; include './classes/class.phpmailer_factory.php'; ?> /*********************************************/ trait.smtpserver_config.php <?php trait SmtpServerConfig { static $smtp_server = ''; static $smtp_port = ''; } ?> /*********************************************/ class.phpmailer_abstract.php <?php class PHPMailerAbstract extends PHPMailer { use SmtpServerConfig; protected $charset = ''; protected $smtp_debug = 0; protected $smtp_output = 'html'; protected $smtp_auth = 'true'; public function __construct($username, $email, $charset='UTF-8', $debug=0) { parent::__construct() $this->addAddress($email, $username); $this->CharSet = $this->charset; $this->Host = self::hostserver; $this->Port = self::smpt_port; $this->isSMTP(); $this->SMTPDebug = $this->smtp_debug; $this->Debugoutput = $this->smtp_output; $this->SMTPAuth = $this->smtp_auth; $this->Username = $this->email_account_name; $this->Password = $this->email_account_pswd; $this->setFrom($this->sender_addr, $this->sender_name); $this->addReplyTo($this->replyto_addr, $this->replyto_name); $this->Subject = $this->subject; $this->msgHTML($this->html_message); $this->AltBody = $this->alt_message; } public function set_charset($charset) { $this->charset = $charset; } public function get_charset() { return $this->charset; } } ?> /*********************************************/ class.phpmailer_newsletter.php <?php class PHPMailerNewsletter extends PHPMailerAbstract { use SmtpServerConfig; private $email_account_name = '...'; private $email_account_pswd = '...'} private $sender_addr = '...'; private $sender_name = '...'; private $replyto_addr = '...'; private $replyto_name = '...'; private $subject = '...'; private $html_message = '...'; private $alt_message = '...'; public function set_letter_contents($subject, $html_message, $alt_message) { $this->Subject = $subject; $this->msgHTML($html_message); $this->AltBody = $alt_message; } } ?> /*********************************************/ class.phpmailer_factory.php'; <?php class PHPMailerFactory { public static function create($use_type, $username, $email, $charset='UTF-8', $debug=0) { switch ($use_type) { case 'newsletter': return new PHPMailerNewsletter($username, $email, $charset, $debug); // case 'verification': // return new PHPMailerVerification($username, $email, $charset, $debug); // case 'confirmation': // return new PHPMailerConfirmation($username, $email, $charset, $debug); default: throw new Exception('Invalid PHPMailer type.'); } } } ?> SAMPLE IMPLEMENTATION <?php $username = '...'; $email = '...'; $subject = '...'; $html_message = '...'; $alt_message = '...'; require_once = global.init.php $newsletter = new PHPMailerFactory('newsletter', $username, $email); $newsletter->set_letter_contents($subject, $html_message, $alt_message); $newsletter->send(); ?> Roddy
  9. So, why must the parent class be abstract? For each abstract method that I put in the class I must duplicate that method in each of the child classes. Where is the gain in this? Roddy
  10. Then too, you could use jQuery, it will do the counting for you. document.getElementById("Test1").value = Dotoff; document.getElementById("Test2").value = Dotoff; document.getElementById("Test3").value = Dotoff; <element1 class='test'></element1> <element2 class='test'></element2> <element3 class='test'></element3> $('.test').val('Dotoff'); Roddy
  11. BACKGROUND: I have recently discovered GreenSock AP that is an interesting blend of Javascript and CSS for the purpose of producing animation. Like all new such discoveries I spend a lot of time exploring before I begin coding, and as a result learn a lot of new code and make more robust what I already know. In particular, I am curious about the value of the y parameter in the following .from() tween specification. TweenLite.from($box, 1, {y: '-=40', autoAlpha: 0, ease:Power4.easeInOut}); Now, $box refers to a jQuery object where $box = $('#box') and #box refers to a div whose id attribute has been set to box. QUESTIONS: 1) In the absence of the tween could the expression y: '-=40' be rewritten as box.y = '-=40'; box.y = '-=40'; 2) When the tween is invoked there is a downward vertical displacement of the object. The statement appears to set the starting position of the tween 40 pixels higher than its final position. In discursive English what exactly does the expression '-=40' say? I am baffled by the -= syntax. Roddy
  12. iwato

    Installing MeCab

    Please ignore this question. I just discovered the source of my problem. I was not logging in at the top of folder hierarchy. Yes, that was it. Will it, however, overcome the problem that I am having accessing my hostserver? Write now I am working with both BBEdit and FETCH, but am limited in my ability to access those folders closest to my root. Roddy
  13. iwato

    Installing MeCab

    Thank you. Yes, really that was all that I was asking. Now, I recall sometime back that you recommended a terminal editor that would not cost me and arm and leg in learning costs. What was it again, please? Roddy
  14. iwato

    Installing MeCab

    OK. So, how would you determine the "install path" of any installation, if you yourself did not perform the installation? Roddy
  15. iwato

    Installing MeCab

    Firstly, thank you for your response. Now, I understand what an environmental variable is. Unfortunately, the environmental variable MYSQL_HOME is not defined for my system. The MySQL statements mysqladmin global variables and mysqladmin variables show no variable with the name MYSQL_HOME, and the list for each statement is quite long. Please consider carefully the following and advise again: The Absolute Path to the mecabrc File is: /usr/lib64/mysql/mecab/etc/mecabrc The Absolute Path to the MySQL Application is: /usr/bin/mysql What I want to know is how to fill in MYSQL_HOME in the phrase MYSQL_HOME/lib/mecab/etc/mecabrc as designated by the following MySQL directive: /usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab /etc/mecabrc Could you write the phrase based upon what is given? Roddy
  16. iwato

    Installing MeCab

    The Absolute Path to the mecabrc File is: /usr/lib64/mysql/mecab/etc/mecabrc The Absolute Path to the MySQL Application is: /usr/bin/mysql What I want to know is how to fill in MYSQL_HOME in the phrase MYSQL_HOME/lib/mecab/etc/mecabrc as designated by the following MySQL directive: /usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab /etc/mecabrc Could you write the phrase based upon what is given? Roddy
  17. I don't get it. Please, if you would, give me one example as how to get from if ($this->use = 'newsletter') { use PHPMailerNewsletterConfig; } else if ($this->use = 'verification') { use PHPMailerVerifyConfig; } else if ($this->use = 'confirmation') { use PHPMailerConfirmConfig; } else { die('Please designate an appropriate trait'); } } to what it is that you are describing. Roddy
  18. iwato

    Installing MeCab

    Installation path? I think in terms of relative and absolute paths. What exactly do you mean by installation path? In any case, the problem in utmost clarity is the following: The Absolute Path to the mecabrc File is: /usr/lib64/mysql/mecab/etc/mecabrc The Absolute Path to the MySQL Application is: /usr/bin/mysql What I want to know is how to fill in MYSQL_HOME in the phrase MYSQL_HOME/lib/mecab/etc/mecabrc as designated by the following MySQL directive: /usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab/etc/mecabrc Roddy
  19. Where and how have you stored the images? In a folder or in a data base? If in a folder does each image have a filename that reflects the order in which it was saved? If in a data base, are you using a time stamp with each entry? Roddy
  20. OK. So, I have verified what you stated, but I am not very happy with your remedy, for the whole purpose of my design was to eliminate having to create new variable names for each set of mailing uses, on the one hand, and not have to enter each and every value for each and every use as an argument of a constructor function on the other. What if I were to enter the values as elements of a unique array -- one for each use -- via the constructor function. In this way I could still use the same variable names for all uses, but perform the logic within the constructor function. How then would I access the arrays? Could I include a path to each via the global.init.php file? How would this work? Roddy
  21. iwato

    Installing MeCab

    And, if it is the location, how would you write it relative to /usr/bin/mysql? Or, would you use an absolute URL? Or, does it even make a difference? Also, I have chosen to use the mysql_config_editor, because I am not permitted to enter the required directories with my usual editing software. Moreover, I do not want to learn still another Terminal editor; they are simply cumbersome and so infrequently used. I would venture to guess that this is the reason mysql_config_editor was created. Roddy
  22. Certainly not without the required data. For the moment I am only concerned about the overall concept. With the exception of my if-else statements I have adhered very closely to the manual's restrictions with regard to the use of traits. There was no example for my use of the if-else statements. This I invented on my own. As far as I can tell, the trait is little more than a code-assisted cut-and-paste -- well, this is least how it has been interpreted by several PHP manual contributors. It is not a precise analogy, because traits have class-like stand alone functionality, as well. Roddy
  23. BACKGROUND: After a careful study of the use of traits I have come up with the following schema for PHPMailer factory class to cover a large variety of circumstances. ./global.init.php <?php error_reporting(E_ALL ^ E_STRICT); ini_set('error_log', __DIR__ . '/error.log'); include './php_mailer/PHPMailerAutoload.php'; include './classes/class.phpmailer_factory.php'; include './classes/trait.smtpserver_config.php'; include './classes/trait.phpmailer_newsletter_config.php'; include './classes/trait.phpmailer_verification_config.php': include './classes/trait.phpmailer_confirmation_config.php'; ?> trait.smtpserver_config.php <?php trait SmtpServerConfig { static $smtp_server = ''; static $smtp_port = ''; } ?> trait.phpmailer_newsletter_config.php <?php trait PHPMailerNewsletterConfig { use SmtpServerConfig; private $email_account_name = '...'; private $email_account_pswd = '...'} private $sender_addr = '...'; private $sender_name = '...'; private $replyto_addr = '...'; private $replyto_name = '...'; private $subject = '...'; private $html_message = '...'; private $alt_message = '...'; public function set_letter_contents($subject, $html_message, $alt_message) { $this->Subject = $subject; $this->msgHTML($html_message); $this->AltBody = $alt_message; } } ?> class.phpmailer_factory.php <?php class PHPMailerFactory extends PHPMailer { error_reporting(E_ALL ^ E_STRICT); ini_set('error_log', __DIR__ . '/error.log'); use SmtpServerConfig; private $use = ''; if ($this->use = 'newsletter') { use PHPMailerNewsletterConfig; } else if ($this->use = 'verification') { use PHPMailerVerifyConfig; } else if ($this->use = 'confirmation') { use PHPMailerConfirmConfig; } else { die('Please designate an appropriate trait'); } private $charset = ''; private $smtp_debug = 0; private $smtp_output = 'html'; private $smtp_auth = 'true'; public function __construct($use, $username, $email, $charset='UTF-8', $debug=0) { parent::__construct() $this->use = $use; $this->addAddress($email, $username); $this->CharSet = $this->charset; $this->Host = self::hostserver; $this->Port = self::smpt_port; $this->isSMTP(); $this->SMTPDebug = $this->smtp_debug; $this->Debugoutput = $this->smtp_output; $this->SMTPAuth = $this->smtp_auth; $this->Username = $this->email_account_name; $this->Password = $this->email_account_pswd; $this->setFrom($this->sender_addr, $this->sender_name); $this->addReplyTo($this->replyto_addr, $this->replyto_name); $this->Subject = $this->subject; $this->msgHTML($this->html_message); $this->AltBody = $this->alt_message; } public function set_charset($charset) { $this->charset = $charset; } public function get_charset() { return $this->charset; } } ?> Please comment on its efficacy. Your criticism and praise are both welcome. Roddy
  24. iwato

    Installing MeCab

    Much research and exploration later I believe that all I really have to do is connect the dots. In https://dev.mysql.com/doc/refman/8.0/en/fulltext-search-mecab.html I am told Now, I have discovered the location of mecabrc /usr/lib64/mysql/mecab/etc/mecabrc Also, I have found something called /usr/bin/mysql_config_editor This program is in the same folder as mysql and the mysql_config and mysql_config-64 files Further, I have been told Further, the help manual to the mysql_config_editor provides the following MySQL Configuration Utility. Usage: mysql_config_editor [program options] [command [command options]] -#, --debug[=#] This is a non-debug version. Catch this and exit. -?, --help Display this help and exit. -v, --verbose Write more information. -V, --version Output version information and exit. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ---------------------------------------- verbose FALSE Where command can be any one of the following : set [command options] Sets user name/password/host name/socket/port for a given login path (section). remove [command options] Remove a login path from the login file. print [command options] Print all the options for a specified login path. reset [command options] Deletes the contents of the login file. help Display this usage/help information. Now I am inclined to call the mecab_config_editor with the following command, but am unsure how to interpret MYSQL_HOME /usr/bin/mecab_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab/etc/mecabrc relative to /usr/bin/mysql QUESTION: How would you write the above mecab_config_editor command? Or, would you do something completely different? Roddy
  25. iwato

    Installing MeCab

    More multi-tasking BACKGROUND: I discovered the following passage at <https://dev.mysql.com/doc/refman/5.7/en/fulltext-search-mecab.html> and would like to know clearly what it means The reasons that I do not understand it are several, but the primary results from this discovery within my on system. /usr/lib64/mysql/plugin/libpluginmecab.so /usr/lib64/mysql/mecab The above suggests that MeCab is already installed, does it not? However, when I try to alter my current table to accommodate the MeCab functionality, I am rejected with an error that reads MeCab is undefined. This suggests that it is not installed. Please advise. Roddy
×
×
  • Create New...