Jump to content

iwato

Members
  • Content count

    1,321
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by iwato

  1. 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
  2. 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
  3. 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
  4. 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
  5. iwato

    Installing MeCab

    OK. So, how would you determine the "install path" of any installation, if you yourself did not perform the installation? Roddy
  6. 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
  7. 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
  8. 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
  9. iwato

    A Flexible PHPMailer Factory Class with Traits

    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
  10. 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
  11. iwato

    Getting the last 4 uploaded images from a directory

    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
  12. iwato

    A Flexible PHPMailer Factory Class with Traits

    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
  13. 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
  14. iwato

    A Flexible PHPMailer Factory Class with Traits

    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
  15. 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
  16. iwato

    A Nested Class? Or, Inheritance?

    BACKGROUND: I am creating a custom class for use with PHPMailer that will hopefully eliminate redundancy in its application and even facilitate my use of the class. One of my questions deals with inheritance and the other has to do with scope. My current use of PHPMailer is quite simple. It consists of a folder containing four files: three of these are PHP class definitions and one of them is an autoloader. PHPMailer is called in the following manner: require_once '../../../PHPMailerAutoload.php'; $mail = new PHPMailer; Once the instance $mail has been created I have access to a large number of public functions that I have thought to consolidate into a single class of my own making called PHPGlobalMailer. My construction of this class appears awkward, and I would like to solicit your feedback in an attempt to remove its clumsiness. class PHPGlobalMailer { private $mail; private static $char_set = 'UTF-8'; private static $smtp_debug = 0; // SMTP::DEBUG_OFF (0): Disable debugging (default). // SMTP::DEBUG_CLIENT (1): Output messages sent by the client. // SMTP::DEBUG_SERVER (2): as 1, plus responses received from the server. // SMTP::DEBUG_CONNECTION (3): as 2, plus more information about the initial connection (used to diagnose STARTTLS failures. // SMTP::DEBUG_LOWLEVEL (4): as 3 (Verbose). private static $debug_output = 'html'; // 'echo': Plain text output (default). // 'html': Browser output. // 'error_log': Output to php.ini configured error.log. // function($str, $level) {echo "Debug Level: " . $level; "Error Message: " . $str;} private static $hostserver = '...'; private static $server_port = ...; private static $smpt_auth = 'true'; private static $mail_account_name = '...'; private static $mail_account_password = '...'; private static $from_mail_address = '...'; private static $from_mail_name = '...'; private static $reply_to_address = '...'; private static $reply_to_name = '...'; public $email = ''; public $name = ''; public $subject = ''; public $html_message = ''; public $alt_message = ''; public function __construct($email, $name, $subject, $html_message, $alt_message) { if ($this->mail new PHPMailer) { $this->mail->CharSet=self::$char_set; $this->mail->isSMPT(); $this->mail->SMTPDebug = self::$smpt_debug; $this->mail->Debugoutput = self::$debug_output; $this->mail->Host = self::$hostserver; $this->mail->Port = self::$server_port; $this->mail->SMPTAuth = self::$smpt_auth; $this->mail->Username = self::$mail_account_name; $this->mail->Password = self::$mail_account_password; $this->mail->setFrom(self::$from_mail_address, self::$from_mail_name); $this->mail->addReplyTo(self::$reply_to_address, self::$reply_to_name); $this->mail->addAddress($this->email, $this->name); $this->mail->Subject = $this->subject; $this->mail->msgHTML($html_message); $this->mail->altBody = $alt_message; } else { echo "Error: Failure to create new PHPMailer instance."; } } public function get_character_set() { return self::$char_set; } public function set_character_set($char_set) { self::$char_set = $char_set; } public function get_smtp_debug() { return self::$smtp_debug; } public function set_password($smtp_debug) { self::$smtp_debug = $smtp_debug; } public function get_debug_format() { return self::$debug_output; } public function set_debug_format($debug_output) { self::$debug_output = $debug_output; } public function get_debug_format() { return self::$debug_output; } public function set_debug_format($debug_output) { self::$debug_output = $debug_output; } public function get_mail_instance() { return $this->mail; } } The AWKWARDNESS 1) In order to make it work I must include PHPMailerAutoload.php file. Is there someway that I could avoid this, say through inheritance? 2) Notice that I am creating an instance of PHPMailer inside my class and then using the instance's public functions to modify it. Is this proper? If not, what would be a more appropriate way of constructing my class. 3) I am concerned that adjustments to an instance of PHPGlobalMailer will affect other instances created in a similar manner. For example, were I to change the value of $smpt_debug for a particular instance of PHPGlobalMailer would it not effect the value of that same parameter for other instances of PHPGlobalMailer? In effect, I would like full control of each instance, but still maintain constancy with regard to the $account_name and $account_password and other values across all instances. Could you please comment on each of three points. Roddy
  17. iwato

    A Nested Class? Or, Inheritance?

    Actually, I cannot test it -- well, at least not on my own machine. Traits were introduced with PHP 5.4, and I am currently running with PHP 5.3.6. The test will have to wait until I upload my completed files to my host server. Thanks, anyway. I thought you might know. Roddy
  18. BACKGROUND: I am using AJAX to make a call to my Matomo database. This call runs in PHP and returns a set of data far too large for any particular use. This said, it can satisfy a lot of different needs separately. As I would like to provide users with the ability to build their own dynamic graphs from this very large data set I must plan an efficient strategy. From my still very naïve understanding of web applications I envision two possible scenarios only one of which is likely correct -- probably the second. AJAX calls PHP. PHP calls the Matomo reporting API Matomo reports and fills the PHP file with data Scenario One: AJAX makes makes a new call for the generation of each dynamic graph. Scenario Two: AjAX is only called once, and the same data set is used over and over again. QUESTION: If Scenario Two is the preferred method, as I strongly suspect is true, what is the best way of dealing with the data set? Do I reassign its contents to a separate file and then retrieve that portion of its contents required to build a new and different graph each and every time a new and different graph is desired? Or, do I simply leave the data where it is, and perform all subsequent calls to the PHP file from within the AJAX success function? Please elaborate your response. Roddy
  19. iwato

    AJAX - A Question of Strategy

    I would like to thank you both for the wonderful suggestions, clarifications, and implementing strategies. This topic must now wait, however, while I attend to other matters that are equally, if not more, pressing. Long turn-around times between questions-asked and questions-answered have taught me to appreciate multi-tasking. In this particular instance, I discovered that some of my already implemented code was not robust. It worked in one instance, but not in another. I finally replaced it, but in the meantime several answers to questions for other tasks entered in, and I set this task on hold weary of my misfortune. Roddy
  20. iwato

    A Nested Class? Or, Inheritance?

    I followed up on your link and discovered something that was invented after I left Thailand. I believe this is the path that I will take. I do have one remaining question, though. Is the absence of parentheses in the following sample code a misprint. If not, when are the parentheses required and not required? <?php trait PropertiesTrait { public $x = 1; } class PropertiesExample { use PropertiesTrait; } $example = new PropertiesExample; $example->x; ?> The Suspicious Line of Code $example = new PropertiesExample; Roddy
  21. iwato

    A Nested Class? Or, Inheritance?

    So, if one places all of the non-volatile data in a PHP configuration class file what are the best ways to include the information contained within into the PHPMailerFactory class? Having to include all of the non-volatile information in the factory class via a constructor function is awkward at best. As a general practice can/does one extend to the factory class the configuration class? Say, class PHPMailerFactory extend PHPMailer PHPConfig { ... } Roddy
  22. iwato

    A Nested Class? Or, Inheritance?

    OK. In the following block of code, for example, I assume that create() is a static function defined in a class called PHPMailerFactory that inherits the class PHPMailer from a file that has been included by your global.init.php file. Also, I can understand that your create() function takes a series of arguments that are used to satisfy the specifications of an instance of PHPMailerFactor aka PHPMailer and the eventual sending of an email. What I do not understand is how the values of those arguments are assigned. $newsletter = PHPMailerFactory::create( $config::NEWSLETTER_HOST, $config::NEWSLETTER_USER, $config::NEWSLETTER_PASSWORD, $to, $from ); To what, for example, does $config::NEWSLETTER_HOST refer? Is it a constant predefined in PHPMailerFactory that you are accessing by a variable called $config to which you assigned the class PHPMailerFactor something on the order of $config = 'PHPMailerFactory'; where class PHPMailerFactory { ... const NEWSLETTER_HOST = 'some_hostname.com'; const NEWSLETTER_USER = 'some_accountname'; const NEWSLETTER_PSWD = 'some_password'; ... create( ..., ..., ...) {...} } Or, does $config refer to some sort of configuration class in which the values of some_hostname.com, some_accountname, and some_password are stored on the order of class ConfigureThisHost { const NEWSLETTER_HOST = 'some_hostname.com'; const NEWSLETTER_USER = 'some_accountname'; const NEWSLETTER_PSWD = 'some_password'; } $config = 'ConfigureThisHost'; $config::NEWSLETTER_HOST; Please clarify and explain why you have done what you are suggesting. Roddy
  23. iwato

    A Nested Class? Or, Inheritance?

    Yes, I have reviewed your most recent post and can understand well the gist of what you are proposing. I am at a loss, however, when it comes to your first line of code -- namely, require_once 'include/global.init.php'; What is the purpose of this statement? Roddy
  24. iwato

    working with session

    The Console is found differently in different browsers. In my old Firefox browser I simply click on the wrench in the bottom-right corner of my browser window. You can also find it in the Web Developer submenu of the Tools menu. It will say Web Console. In my old Chrome browser I click on the Developer submenu of the View menu and then on Javascript Console. Your initial view of the Console page will likely be intimidating, but do not be put off, for the Console page is far too powerful a tool to simply discount, because you do not understand it at first. After you have opened the Console page look for your cursor and enter some Javascript that includes some of the variables on your loaded page and watch what happens. Then go to your source code and enter the following with the appropriate substitutes into the body of your script. It will have no effect on your script, but it will tell you whether your script is doing what you think it should. console.log('variable_name: ' + variable_name); The result will appear in your Web Console page. From this you can determine the values of your variables as they are being created. Roddy
  25. iwato

    A Nested Class? Or, Inheritance?

    COMMENT: Based upon the above discussion, my desire to accommodate my site's own specific needs with a minimum of additional study I have come up with the following tentative solution. As my site will send mail for a variety of purposes from a variety of email accounts -- some of which are repeatedly used, some of which are not, I have decided to create a different class for each purpose. The underlying logic is that it is easier to copy classes than it is to write a multi-purpose class that satisfies all of my PHPMailer needs. PURPORTED SATISFIED OBJECTIVES -- CONVENIENCE If ever there is a change of server, I can enter into the class and change the values of two constants knowing well that the changes will be passed along to all instances of PHPMailer. I can use the same class structure to create new classes for new default email accounts by simply changing the name of the class and the default values of the corresponding email account name and password. I can use the same class for a variety of different messages from the same email account and for a large number of different users with different email addresses. I can change the password at any time for all instances of the class no matter where they are employed within my site. I have full access to the content of any single instance where access would likely be advantageous to have including changing the subject heading of the mail or the content of the message. With three simple lines of code I can employ PHPMailer in nearly any place that I desire. <?php class PHPLetterMailer extends PHPMailer { const hostserver = "vps.antistate.io"; const smtp_port = 587; private $charset = 'UTF-8'; private $smpt_debug = 0; private $smpt_output = 'html'; private $smpt_auth = 'true'; private $email_account = '...'; private $password = '...'; private $sender_addr = 'newsletter@grammarcaptive.com'; private $sender_name = 'Grammar Captive'; private $replyto_addr = 'admin@grammarcaptive.com'; private $replyto_name = 'Grammar Captive Administration'; public $this->subject = ''; public $html_message = ''; public $alt_message = ''; public function __construct($username, $email) { parent::__construct() $this->addAddress($email, $username); $this->Host = self::hostserver; $this->Port = self::smpt_port; $this->isSMTP(); $this->SMTPDebug = $this->smpt_debug; $this->Debugoutput = $this->smpt_output; $this->SMTPAuth = $this->smpt_auth; $this->Username = $this->email_account; $this->Password = $this->password; $this->CharSet = $this->charset; $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_letter_contents($subject, $html_message, $alt_message) { $this->Subject = $subject; $this->msgHTML($html_message); $this->AltBody = $alt_message; } public function get_letter_contents() { return array($this->$subject, $this->html_message, $this->alt_message); } public function set_mail_account($mail_account, $password) { $this->mail_account = $mail_account; $this->password = $password; } public function set_sender($sender_addr, $sender_name) { $this->sender_addr = $sender_addr; $this->sender_name = $sender_name; ) public function get_sender() { return array($this->sender_addr, $this->sender_name); } public function set_replyto($replyto_addr, $replyto_name) { $this->replyto_addr = $replyto_addr; $this->replyto_name = $replyto_name; } public function get_replyto() { return array($this->replyto_addr, $this->replyto_name); } public function set_charset($charset) { $this->charset = $charset; } public function get_charset() { return $this->charset; } public function set_smpt_debug($debug, $output, $auth) { $this->smpt_debug = $debug; $this->smpt_output = $output; $this->smpt_auth = $auth; } public function get_smpt_debug() { return array ($this->smpt_debug, $this->smpt_output, $this->smpt_auth); } } ?> SAMPLE EXECUTION require_once('./_utilities/php/PHPMailerAutoload.php'); require_once('./_utilities/php/class.phplettermailer.php'); $email = 'name@sample.addr'; $username = 'sample_name'; $subject = 'Effortless Deployment'; $html_content = '<!DOCTYPE html><html> ... <table><tr><td>Content Here</td></tr></table ... </html>'; $alternate_message = 'Content Here'; $anInstance = new PHPLetterMailer($username, $email); $anInstance->set_letter_content($subject, $html_content, $alternate_message); if (!$anInstance->send()) { echo "PHPLetterMailer Error: " . $anInstance->ErrorInfo; } else { header('Location: ./gate_confirmation.html'); echo "Message sent!"; } QUESTION: Have I achieved my purported objectives?
×