Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


iwato last won the day on August 14

iwato had the most liked content!

Community Reputation

13 Good

1 Follower

About iwato

  • Rank
    Dedicated Member

Contact Methods

  • AIM
  • Website URL
  • Yahoo
  • Skype

Profile Information

  • Gender
  • Location
    Seattle, Washington USA 98104

Previous Fields

  • Languages
    HTML, CSS, Javascript, PHP, MySQL and Spoken Language

Recent Profile Visitors

15,521 profile views
  1. JSG: Actually there is still another function that is included in the countValueFrequency() function that converts the objects of the resulting array of the countOccurrence() function into arrays. I just needed to know whether this is an acceptable procedure, and it appears that it is. Thank you. Roddy
  2. ~Code&Anime~: I am not familiar with your syntax, and it is therefore difficult for me to comment on it, but it does appear to oversimplify the task. Please correct me, if I am wrong. The countOccurrence() function receives as input an array that appears as something akin to the following: Array [ "キャップチブ", "proposition", "Grammar Captive", "proposition", "文法", "Grammar Captive", "proposition", "Grammar Captive", "proposition", "文法" ] The elements of this array are the values of a property called target found in each of the objects of the initial inputArr of the external function named countValueFrequency(). The countOccurrence() function counts the number of times that each of these values occurs in newly formed array and returns the result in the following format. Array [ Object, Object, Object, Object ] for which each object is of the following form: count: 1 value: "キャップチブ" count: 4 value: 'proposition' etc. Although somewhat awkward, these resulting objects must then be converted into arrays, so that they can be fed into the wordcloud2.js script for the creation of a word cloud. Roddy
  3. BACKGROUND: I have created two functions of which the return value of one becomes the input value of the other. This other then returns a value that is the desire goal of the two functional procedures. So long as I run these functions separately, they produce the desired output. When I attempt to combine them, however, I inevitably fail. Please find below the successful procedure. I will not bother you with my unsuccessful attempts. INPUT ARRAY: var searchItems = [{category:'Search Podcast',count:'1',target:'キャップチブ'},{category:'Search Newsletter',count:'3',target:'proposition'},{category:'Search Podcast',count:'0',target:'Grammar Captive'},{category:'Search Podcast',count:'1',target:'proposition'},{category:'Search Podcast',count:'1',target:'文法'},{category:'Search Newsletter',count:'1',target:'Grammar Captive'},{category:'Search Podcast',count:'2',target:'proposition'},{category:'Search Podcast',count:'0',target:'Grammar Captive'},{category:'Search Podcast',count:'1',target:'proposition'},{category:'Search Podcast',count:'1',target:'文法'}]; The selectAndList( ) Function function selectAndList(propertyName, inputArr) { var propertyArr = []; inputArr.map(function(item) { propertyArr.push(item[propertyName]); }); return propertyArr; } The countOccurrence( ) Function function countOccurrence(inputArr) { var occurrenceArr = []; var copy = inputArr.slice(0); for (var i = 0; i < inputArr.length; i++) { var myCount = 0; for (var w = 0; w < copy.length; w++) { if (inputArr[i] == copy[w]) { myCount++; delete copy[w]; } } if (myCount > 0) { var a = new Object(); a.value = inputArr[i]; a.count = myCount; occurrenceArr.push(a); } } return occurrenceArr; }; Independent Calls Procedure: var selectedPropertyArr = selectAndList('target', searchItems); var occurrenceArr = countOccurrence(selectedPropertyArr); console.log(occurrenceArr); The result is an array with four objects each containing two properties (count and value) with their respective values. Indeed, it is the desired outcome. QUESTION: How to I combine the above two functions into a single function called countValueFrequency( ) with two arguments including propertyName and inputArr? OK. The following works, but is this the most efficient way of achieving the desired result? function countValueFrequency(propertyName, inputArr) { var propertyArr = []; inputArr.map(function(item) { propertyArr.push(item[propertyName]); }); function countOccurrence(inputArr) { var occurrenceArr = []; var copy = inputArr.slice(0); for (var i = 0; i < inputArr.length; i++) { var myCount = 0; for (var w = 0; w < copy.length; w++) { if (inputArr[i] == copy[w]) { myCount++; delete copy[w]; } } if (myCount > 0) { var a = new Object(); a.value = inputArr[i]; a.count = myCount; occurrenceArr.push(a); } } return occurrenceArr; }; return countOccurrence(propertyArr); } var newSelectedPropertyArr = countValueFrequency('target', searchItems); Roddy
  4. So, it is false the first time around, performs the else-statement, loops through again, but on the second loop is a true expression. Is this it? Roddy
  5. iwato

    Juggling Dimensions in Responsive Design

    Dsonesuk, what I understand from the discussion thus far, is that you believe that I know next to nothing about the use of margins and padding. Your criticism is well taken, since I am not completely comfortable with them. Still, I can use them quite successfully at times. It is also surely true that my webpage has been built in piecemeal fashion over a very long period of time. Had I known everything, that I know now, when I began, I surely would have built it differently. This confession, however, does not help me with my current dilemma. The DILEMMA: Although it is true that the middle section of my webpage is filled in a variety of ways, the end result is always a replacement of the current content of the #main div. Where this content comes from and in what viewport it is viewed has, unfortunately, resulted in major confusion in alignment. Now, you have been very helpful in the past, and if I have taken your goodwill for granted, I deeply apologize. Can you be clearer in your solution? Roddy
  6. ACKNOWLEDGMENT and RESULTS: Let me begin by announcing my success in having merged Matomo and wordcount2.js into a dynamically loading word cloud that reflects visitor use of Grammar Captive's local search engines. It is a little slow in loading, but unfortunately everything related to Matomo is slow at this point -- this, despite my recent server upgrade that has sped everything up. If you would like to see the result, simply click on the menu option Word Cloud under Visitor Profile in the navigation bar on the Grammar Captive mainpage. And, now back to Javascript. Thank you everyone for your effort. BACKGROUND: In an effort to distinguish between visitor desire and Grammar Captive's ability to meet this desire, I am seeking to create another word cloud that measures only visitor behavior. The aforementioned word cloud reflects a matching of visitor desire with Grammar Captives ability to match it. It is not a true reflection of visitor desire. In order to achieve this latter I must count not the number of hits that visitors receive when they make a search, rather I must count the number of searches for a particular item. In order to do this I found a function on Stack Overflow that will likely be of help, if only I could understand it. The FUNCTION: function checkDuplicateInObject(propertyName, inputArray) { var seenDuplicate = false, testObject = {}; inputArray.map(function(item) { var itemPropertyName = item[propertyName]; if (itemPropertyName in testObject) { testObject[itemPropertyName].duplicate = true; item.duplicate = true; seenDuplicate = true; } else { testObject[itemPropertyName] = item; delete item.duplicate; } }); return seenDuplicate; } MY QUANDARY: The condition of the above function's if-statement appears to be self-defeating. Still, the function works, for I have tested it with my own data. Specifically, the variable testObject appears to contain an undefined object. It would appear then that the condition of the if-statement would always return false. As this is definitely not the case, I am at a loss as to how to interpret the condition. QUESTION: How is it that testObject can be empty and the condition still return true? Roddy
  7. iwato

    Javascript Timing

    It turns out that Matomo updates the tracking script on a a regular basis, else it could not be recording the events that it has recorded in the absence of repeated use of the tracking script. Thank you for making it clear that this option exists. Roddy
  8. iwato

    Juggling Dimensions in Responsive Design

    It appears that Dsonesuk has no patience for amateur developers. It is unfortunate, because he has such a good understanding of CSS and working with CSS is sometimes very difficult. Roddy
  9. iwato

    Inserting a Higher Software Version

    I have managed to get wordcloud2.js to interact effectively with the Matomo database. Very soon Grammar Captive will have its own word cloud. Thank you! Roddy
  10. iwato

    Juggling Dimensions in Responsive Design

    I have actually tried to remove the pop-up for repeat visitors on several occasions, but have yet to succeed in the task. This said, it only takes two clicks to remove and the first pop-up is a genuine "Hi!". I do thank you for your suggestion and someday I will surely achieve the task. For the moment, however, I find proper alignment of my div tags in my iPhone viewport more important, and truly hope that it does not dissuade you from offering further suggestions in this regard. Roddy
  11. iwato

    Juggling Dimensions in Responsive Design

    dsonesuk: What is obvious to you is not obvious to me. I have taken your suggestion with regard to the negative margins and the appropriate place to change the width of my middle panel as suggested by the Furtive Fox. All of this combined has mostly resolved the problem of the middle section on my computer's Firefox and Chrome browsers when the width of the viewport is changed. You can check the results by opening to the Grammar Captive mainpage and clicking on the About and Free Consultation menu options under the heading Introduction in the navigation bar. What I have sacrificed in so doing, however, is the alignment in my Safari browser on my iPhone for the same main div panels and other similarly constructed main div panel inserts. Now, perhaps you can better understand what I meant by the title word Juggling. Surely, this problem can be overcome without my having to redesign my entire webpage. Well, at least, it is my hope. Roddy
  12. iwato

    Juggling Dimensions in Responsive Design

    OK, Dsonesuk, it fixes the problem in my browser window, but creates a problem on my iPhone. Is there a way to achieve the same goal on both apparati? Roddy
  13. iwato

    Javascript Timing

    Is it possible for the Matomo application to trigger the Javascript? Let me provide a more concrete example of what I mean. On the Grammar Captive mainpage is a standard Matomo tracking script that appears as follows: <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//.../matomo/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> Indeed, the above script is on every webpage whose visitor behavior I wish to track. On the mainpage in particular various events are triggered using Javascript after the page has loaded. Each of these events includes a piece of code similar to the following: _paq.push(['trackEvent', 'Gate One', 'Click', fileName]); The consists of the pushed array element consist of a Matomo method called trackEvent(). Associated with each such event are three parameters used to identify the event. Now, with the exception of the four standard Matomo methods that fill the _paq array when the page is first loaded, every additional event triggered by Javascript and containing a _paq.push({...}); statement occurs after the page has been loaded. Does this imply that these latter events will not be properly tracked unless I reload the first script with each and every new triggered event? Roddy
  14. iwato

    Juggling Dimensions in Responsive Design

    OK. It appears that I have been able to salvage my intended format with a minimum of secondary, negative effects. What I cannot seem to achieve, however, is uniformity in width among my center panels. Please perform the following experiment. The EXPERIMENT After opening to the Grammar Captive mainpage proceed to the navigation bar and find two menu options: About and Free Consultation! Click on each and notice that the background color does not fill across the entire width of the center panel. QUESTION: What is prohibiting the background color from filling the entire width of the center panel? Roddy