Brookepedia - by Daniel Brooke Peig https://www.danbp.org/p/en en Galaxy S8, S9 and S10 random battery drain https://www.danbp.org/p/en/node/138 <span class="field field--name-title field--type-string field--label-hidden">Galaxy S8, S9 and S10 random battery drain</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 09/24/2019</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>If you note unusual/inconsistent battery drain in the <strong>Samsung Galaxy S8, S9 and perhaps S10</strong> phones and there is no obvious apps draining the energy in the system power consumption tool here is the fix:</p> <ol><li><strong>Old 2G networks</strong>: 2G networks use more energy for data transmission. Disable 2G fallback in the mobile networks menu.</li> <li><strong>Bluetooth:</strong> Some bluetooth network devices rely on bad protocol implementations that kill the battery of your phone even when not in use. Disable bluetooth in your phone and enjoy a much longer battery life.</li> </ol></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/63" hreflang="en">samsung galaxy</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Tue, 24 Sep 2019 22:10:12 +0000 Daniel 138 at https://www.danbp.org/p https://www.danbp.org/p/en/node/138#comments Tulip Composer 2 https://www.danbp.org/p/en/node/137 <span class="field field--name-title field--type-string field--label-hidden">Tulip Composer 2</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Fri, 08/30/2019</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>Tulip Composer is a free online software for generating road book Tulips.</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/Screenshot.PNG"><img src="/p/sites/default/files/styles/large/public/Screenshot.PNG?itok=9aVtaIlH" width="750" height="499" alt="Tulip Composer 2 - Screenshot" title="Tulip Composer 2 - Screenshot" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Tulip Composer is a free software for creating road book tulip diagrams.</p> <p>The software was updated to 2.0 in 2019, 14 years after the first release. Tulip Composer now works online.</p> <p><a class="btn btn-primary btn-md" href="https://www.danbp.org/tulipcomposer/tulipcomposer.html" role="button">Go to the Tulip Composer Online</a></p> <p>To learn more about Tulips and the Tulip Composer, visit the <a href="https://www.danbp.org/tulipcomposer">official webpage</a>.</p> <p>Tulip Composer is distributed under the <a href="https://www.danbp.org/tulipcomposer/LICENSE.txt">GNU/GPL</a> license.</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/29" hreflang="en">Trekking</a></li> <li><a href="/p/en/taxonomy/term/32" hreflang="en">JavaScript</a></li> <li><a href="/p/en/taxonomy/term/62" hreflang="en">GNU/GPL</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Fri, 30 Aug 2019 13:03:47 +0000 Daniel 137 at https://www.danbp.org/p https://www.danbp.org/p/en/node/137#comments Vanilla Marlin Firmware configured for Ender 3 + BLTouch https://www.danbp.org/p/en/node/136 <span class="field field--name-title field--type-string field--label-hidden">Vanilla Marlin Firmware configured for Ender 3 + BLTouch</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Fri, 04/12/2019</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>This is the 1.1.9 + Bugfix version of vanilla Marlin Firmware pre-configured for Creality Ender 3 printers with the <strong>original or generic</strong> BL Touch sensors. The standard configuration file from Marlin distribution was carefully reviewed to include the latest Ender 3 specific settings from the official Creality firmware. <strong>This is not for BLTouch 3.x versions.</strong></p> <h3>Features</h3> <ul><li>Official Marlin firmware with all hardware settings from Creality latest official firmware (Code <span>20181208</span> from December 2018).</li> <li>BLTouch original/generic up to 2.x configured and working. <strong>NOTE: BLTouch 3.x is not supported by this specific firmware.</strong></li> <li>No need to remove any capacitors from the board.</li> <li>Installs from the original Arduino IDE (smaller download and frequent updates from Arduino team).</li> <li>Source code modified to prevent releasing the BLTouch sensor during "beep" events triggered by LCD menus (this can't be prevented only by configuration.h modifications).</li> <li>Thermal runway protection enabled.</li> <li>Does not reset the bed level settings after the G28 (Home) command.</li> <li>Custom menu with maintenance mode, emergency mode and full auto bed leveling sequence (warmup, wait, home, level and then save settings).</li> <li>Ultra-precise bilinerar bed leveling algorithm with 25 probing points and slow probing (takes around 5 minutes to complete, 10 including the bed heating).</li> <li>Run and toggle the bed level and BLTouch tools from LCD menus.</li> <li>Slim menus enabled.</li> <li>Baby steps enabled and configured for the "Magic Numbers".</li> <li>All changes from the original Marlin config file were marked with the comment tag "Customized DBP"</li> </ul><h3>Requirements</h3> <ul><li>BLTouch installed on pin 27</li> <li>Z stop switch removed (it can block the Z axis movement)</li> <li><strong>IMPORTANT!</strong> BLTouch tip height must be adjusted according to the official <a href="https://www.antclabs.com/manual">instruction manuals</a>. There are different BLTouch sensors and the YouTube videos tips are most of the times wrong</li> <li>Bootloader installed</li> <li>Original <a href="https://www.arduino.cc/en/main/software">Arduino IDE</a> <ul></ul></li> </ul><h3>Instructions</h3> <ul><li>Configure the Arduino IDE to download the Sanguino board. Add the following URL to the board manager (File-&gt;Preferences-&gt;Additional boards manager): <ul><li><em>https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json</em></li> </ul></li> <li>Install the following libraries/boards in the Arduino IDE: <ul><li>U8Glib</li> <li>Sanguino</li> </ul></li> <li>With all requirements in place unpack this entire Marlin distribution to a folder and open the "Marlin.ino" file from the Arduino IDE.</li> <li>Look for the <em>configuration.h</em> file and change <em>X_PROBE_OFFSET_FROM_EXTRUDER</em>, <em>Y_PROBE_OFFSET_FROM_EXTRUDER</em> <em>Z_PROBE_OFFSET_FROM_EXTRUDER </em>to the relative coordinates of your BLTouch mount to the Nozzle. The actual settings are for <a href="https://www.thingiverse.com/thing:3003725">this mount</a>.</li> <li>Compile and upload the firmware: <ul><li>Board configuration: <em>ATMega 1284P 16Mhz</em></li> <li>Programmer configuration: <em>AVRISP MKII</em></li> <li>COM Port: Depends of your computer. Usually only one is available for selection.</li> </ul></li> <li>Manually pre-level the bed. This is important because the BLTouch has a limited max/min range and even if it can detect the differences, we want the Z motor to do the minimal amount of corrections to keep the print quality. <ol><li>Cool down the bed and the nozzle</li> <li>Disable stepper motors</li> <li>Place a credit card on one the bed, the thickness of the card will be used as a reference distance from the nozzle</li> <li>Turn the Z axis with your hand until the nozzle hits the credit card</li> <li>Move hot end to the right and left and the bed to the front and back. Adjust the bed level knobs until all corners and center are at the same or very close distance from the nozzle.</li> </ol></li> <li>Heat the bed to the printing temperature and run the bed level command from the LCD (Prepare -&gt; Bed Leveling -&gt; Level bed)  or using the G29 gcode. I recommend using the Arduino IDE serial monitor to check for any errors during the BLTouch probing, they are usually caused by improper wiring or height outside of the tolerances (see important note in the requirements)</li> <li>Save the settings using the LCD menu or the M500 gcode (if you used the <em>Heat and Level</em> custom command, they will be automatically saved). Note that the <em>Heat and Level</em> command waits 2 minutes after the bed is heated to allow the mounted surfaces to expand/contract as well.</li> <li>Add the following gcode to the startup code of you slicer, right after the line of the G28 command: <em>M420 S1 </em>. This will enable and load the bed level settings from the memory before starting the print. If you prefer you can enable it from the LCD menus as well.</li> <li>After enabling the bed level, print something to adjust the Z offset. The nozzle will always be far from the bed until you adjust the offset to a negative value (LCD -&gt; Prepare -&gt; Bed Leveling -&gt; Z Offset). Don't forget to save the settings after the print to keep the offset in the memory.</li> </ul><p> </p></div> <div class="field field--name-field-fileversion field--type-string field--label-inline"> <div class="field__label">Version</div> <div class="field__item">1.1.9 + Bugfix compiled in April 18th, 2019</div> </div> <div class="field field--name-field-supported-platforms field--type-string field--label-inline"> <div class="field__label">Platforms</div> <div class="field__item">Arduino IDE</div> </div> <div class="field field--name-field-download- field--type-string field--label-inline"> <div class="field__label">File size</div> <div class="field__item">4.7 MB</div> </div> <div class="field field--name-field-checksum field--type-string field--label-above"> <div class="field__label">Checksum</div> <div class="field__items"> <div class="field__item">SHA256: 4E3FB25F95412351B474F860D8FD24EC1CD0E7B910B27FFE3903B73CAB3E682A</div> </div> </div> <div class="field field--name-field-download-links field--type-link field--label-above"> <div class="field__label">Download link</div> <div class="field__items"> <div class="field__item"><a href="https://www.danbp.org/downloads/Marlin_1.1.9_Bugfix.zip">Marlin 1.1.9 + Bug Fix for Ender 3</a></div> </div> </div> <div class="field field--name-field-image field--type-image field--label-above"> <div class="field__label">Screenshots</div> <div class="field field--name-field-image field--type-image field--label-above field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/2019-04/Annotation%202019-04-12%20200135.jpg"><img src="/p/sites/default/files/styles/mt_thumbnails/public/2019-04/Annotation%202019-04-12%20200135.jpg?itok=uvhdCMFp" width="230" height="153" alt="Marlin Logo" typeof="foaf:Image" class="image-style-mt-thumbnails" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/taxonomy/term/28" hreflang="zxx">Downloads</a></li> <li><a href="/p/en/taxonomy/term/61" hreflang="en">3D Printing</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Post Categories</h3> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title">Comments</h2> <article role="article" data-comment-user-id="0" id="comment-596" about="/p/en/comment/596" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1556558478"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">mattes</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Mon, 04/29/2019 <span property="schema:dateCreated" content="2019-04-29T17:21:18+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/596#comment-596" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/596#comment-596" class="permalink" rel="bookmark" hreflang="en">Error compiling</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Hi,</p> <p>i get this error, when compiling your firmware for Ender3</p> <p> </p> <p>unterminated argument list invoking macro "_UxGT"</p> <p>what can i do ?</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=596&amp;1=default&amp;2=en&amp;3=" token="_mRgKizOWz6MUVkpHeOJX8gngIRYYQDHOoPyMSkxJEE"></drupal-render-placeholder></nav> </article> <div class="indented"> <article role="article" data-comment-user-id="1" id="comment-597" about="/p/en/comment/597" typeof="schema:Comment" class="comment js-comment by-node-author clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1556588005"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> </span> on <span class="comment__meta-item comment__meta-item--created">Mon, 04/29/2019 <span property="schema:dateCreated" content="2019-04-30T01:33:25+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/597#comment-597" hreflang="en">Permalink</a></span> <span class="visually-hidden">In reply to <a href="/p/en/comment/596#comment-596" class="permalink" rel="bookmark" hreflang="en">Error compiling</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">mattes</span></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/597#comment-597" class="permalink" rel="bookmark" hreflang="en">Error</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Hello,</p> <p>Do you have more details about this error? Did you modified any file or translation?</p> <p>This error appears when the files are corrupted or some expression was left open.</p> <p>Regards,</p></div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=597&amp;1=default&amp;2=en&amp;3=" token="YQJ7ai71FjUymByocB8Ot-X1G975IdLLnMkK5bPL4Gc"></drupal-render-placeholder></nav> </article> <div class="indented"> <article role="article" data-comment-user-id="1" id="comment-598" about="/p/en/comment/598" typeof="schema:Comment" class="comment js-comment by-node-author clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1556655696"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> </span> on <span class="comment__meta-item comment__meta-item--created">Tue, 04/30/2019 <span property="schema:dateCreated" content="2019-04-30T20:21:36+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/598#comment-598" hreflang="en">Permalink</a></span> <span class="visually-hidden">In reply to <a href="/p/en/comment/597#comment-597" class="permalink" rel="bookmark" hreflang="en">Error</a> by <a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/598#comment-598" class="permalink" rel="bookmark" hreflang="en">Retested</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Downloaded the package, rebuilt and recompiled from zero. No problems found!</p> <p>Just to make sure, here are the library versions I used used:</p> <ul><li>Sanguino 1.0.3</li> <li>U8Glib 1.19.1</li> <li>Arduino IDE 1.8.9 on Windows 10</li> </ul><p>And here is the compilation stats:</p> <pre> Sketch uses 129176 bytes (99%) of program storage space. Maximum is 130048 bytes. Global variables use 6657 bytes (40%) of dynamic memory, leaving 9727 bytes for local variables. Maximum is 16384 bytes. </pre> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=598&amp;1=default&amp;2=en&amp;3=" token="qXPO8-xGLp-_-K2OkYPEsra5TPLJxuhv5iWHlCy9XYc"></drupal-render-placeholder></nav> </article> </div></div> <article role="article" data-comment-user-id="0" id="comment-602" about="/p/en/comment/602" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1559149541"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Tobias</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Wed, 05/29/2019 <span property="schema:dateCreated" content="2019-05-29T17:05:41+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/602#comment-602" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/602#comment-602" class="permalink" rel="bookmark" hreflang="en"> thankyou</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>hi! just want to say thankyou for this. helped me get bltouch working and functioning properly!</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=602&amp;1=default&amp;2=en&amp;3=" token="-Jz5rjEF3gwJDjoVtu_GrYBlk-WDJ9x1rweMri8tAEY"></drupal-render-placeholder></nav> </article> <article role="article" data-comment-user-id="0" id="comment-657" about="/p/en/comment/657" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1575311124"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Celso Rossi</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Mon, 12/02/2019 <span property="schema:dateCreated" content="2019-12-02T18:25:24+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/657#comment-657" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/657#comment-657" class="permalink" rel="bookmark" hreflang="en">Congratulations!</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Excellent job!</p> <p>I installed on ender 3 and it was perfect!</p> <p> </p> <p>Do you have these settings for Marlin 2.0 with bug fixes?</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=657&amp;1=default&amp;2=en&amp;3=" token="imhREDZx2cDF0HK7Lu7-3T6IfCpdTg8XdRGALTFFlns"></drupal-render-placeholder></nav> </article> </section> Fri, 12 Apr 2019 21:01:02 +0000 Daniel 136 at https://www.danbp.org/p https://www.danbp.org/p/en/node/136#comments V-Car app for rear WiFi camera https://www.danbp.org/p/en/node/135 <span class="field field--name-title field--type-string field--label-hidden">V-Car app for rear WiFi camera</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Sun, 04/22/2018</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>This is just a mirror to download the app V-Car, used in Chinese WiFi rearview and front cameras. I tested it myself and it does not require abusive permissions: access to WiFi configurations, microphone (to record sounds) and storage (to save videos). It worked well on Android 8.0 in my Galaxy S8.</p> <p>Since I am not the developer of this software I will not answer any technical support question regarding this application. Download and use it at your own risk.</p> <figure role="group" class="caption caption-img"><img alt="Rear WiFi Camera" data-entity-type="file" data-entity-uuid="82ec9d52-1896-4dbf-a86c-714b4ee00847" src="/p/sites/default/files/inline-images/rear_wifi_camera.jpg" /><figcaption>Rear WiFi Camera typical box</figcaption></figure><p> </p></div> <div class="field field--name-field-fileversion field--type-string field--label-inline"> <div class="field__label">Version</div> <div class="field__item">1.0.5</div> </div> <div class="field field--name-field-supported-platforms field--type-string field--label-inline"> <div class="field__label">Platforms</div> <div class="field__item">Android</div> </div> <div class="field field--name-field-download- field--type-string field--label-inline"> <div class="field__label">File size</div> <div class="field__item">10 MB</div> </div> <div class="field field--name-field-checksum field--type-string field--label-above"> <div class="field__label">Checksum</div> <div class="field__items"> <div class="field__item">SHA256: 8987863BFFD0306567EF2C31A08EA921C3AAA7A55A61F22909D05825670255AF</div> </div> </div> <div class="field field--name-field-download-links field--type-link field--label-above"> <div class="field__label">Download link</div> <div class="field__items"> <div class="field__item"><a href="https://www.danbp.org/downloads/com.cfans.cam.ivdriver_1.0.5_5.apk">com.cfans.cam.ivdriver_1.0.5_5.apk</a></div> </div> </div> <div class="field field--name-field-image field--type-image field--label-above"> <div class="field__label">Screenshots</div> <div class="field field--name-field-image field--type-image field--label-above field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/2018-04/rear_wifi_software.jpg"><img src="/p/sites/default/files/styles/mt_thumbnails/public/2018-04/rear_wifi_software.jpg?itok=Ze8gP4p1" width="230" height="153" alt="Rear cam app" typeof="foaf:Image" class="image-style-mt-thumbnails" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/taxonomy/term/28" hreflang="zxx">Downloads</a></li> <li><a href="/p/en/taxonomy/term/60" hreflang="en">Android</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Post Categories</h3> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title">Comments</h2> <article role="article" data-comment-user-id="0" id="comment-639" about="/p/en/comment/639" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1569043479"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Nick Jones</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Sat, 09/21/2019 <span property="schema:dateCreated" content="2019-09-21T05:24:39+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/639#comment-639" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/639#comment-639" class="permalink" rel="bookmark" hreflang="en">Technical Support</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Its sensor might not pick up very small objects like your new puppy frolicking behind you as you're reversing, but you will see it on a camera. If they are clean and you are paying attention all around you, reversing cameras are very effective.</p> <p><strong><a href="https://www.techsupportdubai.com/led-tv-repair">TV Repair</a> helps you to solve your all TV issues quickly and at affordable prices. </strong></p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=639&amp;1=default&amp;2=en&amp;3=" token="yeV_XcM-h6O1yGCbJsIrZrfy4veXDJs93DRn_49G66M"></drupal-render-placeholder></nav> </article> </section> Mon, 23 Apr 2018 00:03:14 +0000 Daniel 135 at https://www.danbp.org/p https://www.danbp.org/p/en/node/135#comments Prevent Chrome from signing in Google services https://www.danbp.org/p/en/node/133 <span class="field field--name-title field--type-string field--label-hidden">Prevent Chrome from signing in Google services</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 03/01/2018</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>Describes how to use Google Chrome synchronization feature without the browser automatic login in Google services (Drive, Keep, GMail, etc...).</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/Google%20Chrome%20Logo.png"><img src="/p/sites/default/files/styles/large/public/Google%20Chrome%20Logo.png?itok=p7jQrdPQ" width="750" height="499" alt="Google Chrome" title="Google Chrome" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>When you sign in Google Chrome with you credentials it will automatically sign you in all Google services (Drive, GMail, Keep, Calendar, Search, etc...). This can be useful but can also expose your personal data since there is no default way to protect Chrome with a password.</p> <p>Google says in the help page the only way to do this is by using the Incognito Mode. That's not true. There is a way to keep your Chrome Browser signed in and at the same time be signed out of other Google services. This takes less than 30 seconds and does not require the installation of any app or plugin.</p> <h2>Instructions</h2> <ol><li>Sign in your Chrome Browser.</li> <li>Enter the Chrome flags configuration page. Type <em>chrome:flags</em> in the address box.</li> <li>Look for the <em>#account-consistency</em> flag and disable it.</li> <li>Restart Chrome.</li> <li>Go to the Chrome settings menu and go to the <em>Clear Browsing Data</em> setting.</li> <li>Erase all the cookies.</li> <li>You are now logged in the browser but not in Google services.</li> </ol><p>After doing this you still will be able to login Google services but now you can logout and stay logged out whenever you want.</p> <figure role="group" class="caption caption-img"><img alt="Chrome Account Consistency Setting" data-entity-type="file" data-entity-uuid="5a6837c6-b962-4271-b8ad-34c41e12dcce" src="/p/sites/default/files/inline-images/Chrome%20Account%20Consistency.PNG" /><figcaption>Account consistency setting</figcaption></figure><p> </p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/57" hreflang="en">Chrome</a></li> <li><a href="/p/en/taxonomy/term/58" hreflang="en">Privacy</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Fri, 02 Mar 2018 01:33:11 +0000 Daniel 133 at https://www.danbp.org/p https://www.danbp.org/p/en/node/133#comments Install DOW CADIX on Windows 10 https://www.danbp.org/p/en/node/132 <span class="field field--name-title field--type-string field--label-hidden">Install DOW CADIX on Windows 10</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Sat, 08/05/2017</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>This article describes how to install DOW Ion Exchange Design Software, CADIX on Windows 10 (64-bits or 32 bits).</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/CadixWin10.PNG"><img src="/p/sites/default/files/styles/large/public/CadixWin10.PNG?itok=iT1HEN5e" width="750" height="499" alt="CADIX running on Windows 10 64-bit" title="CADIX running on Windows 10 64-bit" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Step by step installation</h2> <p>This tutorial was written for Windows 10 64-bits but should work for Windows 10 32-bits, Windows 8.1 and Windows 7.</p> <ol><li>Download CADIX software from the official DOW Chemical website: <a href="http://www.dow.com/en-us/water-and-process-solutions/resources/design-software/cadix-software">http://www.dow.com/en-us/water-and-process-solutions/resources/design-software/cadix-software</a><br />  </li> <li>Download the <em>Visual Basic 6.0 Runtime Plus</em> package from Sourceforge: <a href="https://sourceforge.net/projects/vb6extendedruntime">https://sourceforge.net/projects/vb6extendedruntime</a><br />  </li> <li>Install the <em>Visual Basic 6.0 Runtime Plus</em> package. Select all options available in the list.<figure role="group" class="caption caption-img align-center"><img alt="Select all options for the VB Runtime Plus installer" data-entity-type="file" data-entity-uuid="170bbcd7-9d1e-4b8e-86a4-e87257cf20be" src="/p/sites/default/files/inline-images/VB6RuntimePlus.PNG" /><figcaption>Select all options for the VB Runtime Plus installer</figcaption></figure><p> </p> </li> <li>Reboot the computer.<br />  </li> <li>Run CADIX installer. Make sure you select the option to install to all users in the computer.<figure role="group" class="caption caption-img"><img alt="CADIX for all computer users" data-entity-type="file" data-entity-uuid="a4cb4c69-61ed-4399-ac22-c196afdcaf54" src="/p/sites/default/files/inline-images/CADIXInstall.PNG" /><figcaption>CADIX for all computer users</figcaption></figure><p> </p> </li> <li>Take note of the installation directory location. We will need that later.<figure role="group" class="caption caption-img"><img alt="CADIX Destination Folder" data-entity-type="file" data-entity-uuid="4e6c51e2-4181-4ead-a545-229e6652601e" src="/p/sites/default/files/inline-images/CADIXFolder.PNG" /><figcaption>Remember the destination folder</figcaption></figure><p> </p> </li> <li>Once installed, navigate do the destination folder.<br />  </li> <li>Right click on the <em>cadix.exe</em> file and from the menu select <em>Properties</em>.<figure role="group" class="caption caption-img"><img alt="CADIX.exe properties" data-entity-type="file" data-entity-uuid="7698f694-e819-48ce-8a54-b412d04d1223" src="/p/sites/default/files/inline-images/CADIXRightClick.PNG" /><figcaption>Select properties from the cadix.exe dropdown menu</figcaption></figure><p> </p> </li> <li>Navigate to the compatibility tab and check <em>Run this Program as an Administrator</em> and then OK.<figure role="group" class="caption caption-img"><img alt="CADIX Run as Administrator" data-entity-type="file" data-entity-uuid="1b44d8ff-b365-42c6-8987-3ee51450aff5" src="/p/sites/default/files/inline-images/CADIXProperties.PNG" /><figcaption>Check the Run as Administrator option<br />  </figcaption></figure></li> <li>In the installation folder, right click again in the <em>cadix.exe</em> file and then select the option <em>Pin to Start</em>, this will create a working shortcut in the Start menu. If you prefer to have a shortcut in the Desktop, keep pressed <em>Crtl+Shift</em> while drag the <em>cadix.exe</em> to the Desktop.<figure role="group" class="caption caption-img"><img alt="CADIX Pin to Start" data-entity-type="file" data-entity-uuid="b55b3e6c-76de-445b-9a11-fb3ed8ac9576" src="/p/sites/default/files/inline-images/CADIXPinToStart.PNG" /><figcaption>Pin to Start menu to create a working shortcut</figcaption></figure><h2> </h2> </li> </ol><h2>CADIX Registration</h2> <p>CADIX will run for about one month without restrictions. After this grace period you need to ask an activation key for you DOW Technical Support engineer. The activation keys are renewed every year.</p> <p> </p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/51" hreflang="en">Ion Exchange</a></li> <li><a href="/p/en/taxonomy/term/26" hreflang="en">Tutorial</a></li> <li><a href="/p/en/taxonomy/term/37" hreflang="en">Water Treatment</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/engineering" hreflang="en">ENGINEERING</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Sun, 06 Aug 2017 01:07:55 +0000 Daniel 132 at https://www.danbp.org/p https://www.danbp.org/p/en/node/132#comments PHP - CSV Viewer for Web Browsers https://www.danbp.org/p/en/node/130 <span class="field field--name-title field--type-string field--label-hidden">PHP - CSV Viewer for Web Browsers</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Wed, 07/05/2017</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>PHP script that opens and parses a CSV table file to an HTML format to be displayed in the browser.</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/csvhtmlviewer.PNG"><img src="/p/sites/default/files/styles/large/public/csvhtmlviewer.PNG?itok=XGb75R5t" width="750" height="499" alt="CSV to HTML script" title="CSV to HTML script" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Description</h2> <p>This PHP script opens and parses a CSV table file to an HTML view. It can be used together with the <a href="http://www.danbp.org/p/node/129">Internet of Things Web Logger Logger</a> script.</p> <h2>Features</h2> <ul> <li>Refresh, Download and Up/Bottom links.</li> <li>Line numbers.</li> <li>Header and footers with the column names.</li> <li>Ready for CSS customization.</li> <li>If a password is set, the GET parameter <em>?Password=yourpassword</em> will be required to read the data. Example: <em>http://www.mysite.com/csvview.php?Password=yourpassword</em>.</li> </ul> <h2>Requirements</h2> <ul> <li>Webserver with PHP 5.1.x or higher installed.</li> <li>Permissions for the script to read the CSV file.</li> </ul> <h2>Installation</h2> <p>Just edit the script configuration parameters (the CSV file name is the only required) and then put in the server and run.</p> <h2>Source code</h2> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/ * CSV Viewer</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Version 1.0 (05/07/2017)</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * This application loads and parses a CSV file in the HTML format for browser viewing.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Optionally the user can set a password in the configuration and then enter it using a GET request:</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Example: www.mysite.com/csvlogview.php?Password=mypassword </span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * </span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Developed by Daniel Brooke Peig - daniel@danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * http://www.danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Copyright 2017 - Daniel Brooke Peig</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * This software is distributed under the MIT License.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================*/</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//------------------------------------------------</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Configuration</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$fileName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;iotcsvlog.csv&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//CSV file location</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$delimiter</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//CSV delimiter character: , ; /t</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$enclosure</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//CSV enclosure character: &quot; ' </span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Optional to prevent abuse. If set to [your_password] will require the &amp;Password=[your_password] GET parameter to open the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$ignorePreHeader</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Number of characters to ignore before the table header. Windows UTF-8 BOM has 3 characters.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//------------------------------------------------</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Variable initialization</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$logLines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$tableOutput</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;b&gt;No data loaded&lt;/b&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Verify the password (if set)</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Password&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$password</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$password</span> <span style="color: #339933;">===</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// File exists</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">// Reads lines of file to array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$fileLines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #339933;">,</span> FILE_IGNORE_NEW_LINES <span style="color: #339933;">|</span> FILE_SKIP_EMPTY_LINES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Not Empty file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span> <span style="color: #339933;">!==</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Extract the existing header from the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$lineHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_shift</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$logOriginalHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> str_getcsv<span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lineHeader</span><span style="color: #339933;">,</span><span style="color: #000088;">$ignorePreHeader</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enclosure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Process the file only if the system could find a valid header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> </div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Open the table tag</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;TABLE style='min-width: 50%;'&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Print the table header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TR style='background-color: lightgray;text-align:center;'&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TD&gt;&lt;B&gt;Row&lt;/B&gt;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span> </div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TD&gt;&lt;B&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$field</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/B&gt;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Add the columns</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/TR&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Get each line of the array and print the table files</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$countLines</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Remove blank lines</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$countLines</span><span style="color: #339933;">++;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$arrayFields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> str_getcsv<span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enclosure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Convert line to array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TR&gt;&lt;TD style='background-color: lightgray;'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$countLines</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$arrayFields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TD&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$field</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Add the columns</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/TR&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Print the table footer</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TR style='background-color: lightgray;text-align:center;'&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TD&gt;&lt;B&gt;Row&lt;/B&gt;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;TD&gt;&lt;B&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$field</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/B&gt;&lt;/TD&gt;&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Add the columns</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/TR&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Close the table tag</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tableOutput</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/TABLE&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$tableOutput</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Invalid data format&lt;/b&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$tableOutput</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Empty file&lt;/b&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$tableOutput</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;b&gt;File not found&lt;/b&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">else</span> <span style="color: #000088;">$tableOutput</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Invalid password.&lt;/b&gt; Enter the password using this URL format: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;?Password=&lt;b&gt;your_password&lt;/b&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">?&gt;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;!DOCTYPE html&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;html&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;head&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;meta charset=&quot;UTF-8&quot;&gt; </div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;title&gt;CSV Viewer&lt;/title&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;/head&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;body&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;h1&gt;CSV Viewer&lt;/h1&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;a name=&quot;top&quot;&gt;&lt;/a&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;hr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;table style=&quot;width:50%&quot;&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;tr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;&quot; onClick=&quot;location.reload()&quot;&gt;Refresh&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$fileName</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;Download&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;#bottom&quot;&gt;End&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;/tr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;/table&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;hr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$tableOutput</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;a name=&quot;bottom&quot;&gt;&lt;/a&gt; </div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;hr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;table style=&quot;width:50%&quot;&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;tr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;&quot; onClick=&quot;location.reload()&quot;&gt;Refresh&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$fileName</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;Download&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;td&gt;&lt;a href=&quot;#top&quot;&gt;Top&lt;/a&gt;&lt;/td&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> &lt;/tr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;/table&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;hr&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;/body&gt;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&lt;/html&gt;</div></li></ol></pre></div></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/35" hreflang="en">PHP</a></li> <li><a href="/p/en/taxonomy/term/33" hreflang="en">Excel</a></li> <li><a href="/p/en/taxonomy/term/56" hreflang="en">Internet of Things IoT</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Wed, 05 Jul 2017 23:52:09 +0000 Daniel 130 at https://www.danbp.org/p https://www.danbp.org/p/en/node/130#comments PHP - Internet of Things Web Logger https://www.danbp.org/p/en/node/129 <span class="field field--name-title field--type-string field--label-hidden">PHP - Internet of Things Web Logger</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Fri, 06/30/2017</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>Server side PHP Script that captures any HTTP GET request data and stores in a CSV spreadsheet. Can be used with Raspberry PI circuits, Arduino, IntelGalileo, IntelEdison and even with Smartwatches that can connect to the internet using Ethernet cables, Bluetooth, USB or Wifi.</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/arduino_mega_1.jpg"><img src="/p/sites/default/files/styles/large/public/arduino_mega_1.jpg?itok=Q84EmQ29" width="750" height="499" alt="Internet of Things" title="Internet of Things" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Description</h2> <p>This is a PHP script that records data from Internet of Things (IoT) devices in a CSV spreadsheet that can be opened from Excel. If you also need a web view for the log, check the <a href="http://www.danbp.org/p/node/130">CSV Viewer for Web Browsers</a>.</p> <h2>Features</h2> <ul> <li>Input is automatically decoded from the URLs by using the HTTP GET standard (see examples below).</li> <li>Records different variable sets in the same spreadsheet, each variable goes to the column it belongs.</li> <li>If a new variable is set, a column for it will be automatically created.</li> <li>No specific order required for the input data.</li> <li>Records the timestamp of the request and the IP address of the client.</li> <li>Output in the CSV format that can be directly opened in Excel.</li> <li>Output is UTF-8 compatible (at lease should be).</li> <li>If the log reaches the maximum size, older entries will be automatically purged.</li> <li>Return TRUE if the record was set and FALSE in case of problems.</li> <li>The parameter <em>?LogClear=TRUE</em> clears the table data and columns.</li> <li>Web display for the log available in <a href="http://www.danbp.org/p/node/130">CSV Viewer for Web Browsers</a>.</li> <li>If a password is set, the parameter <em>?LogPass=yourpassword</em> will be required to allow data to be inserted in the table.</li> </ul> <h2>Requirements</h2> <ul> <li>Webserver with PHP 5.1.x or higher installed.</li> <li>Permissions for the script to read, write and delete in the target CSV folder.</li> </ul> <h2>Installation</h2> <p>Just put the script in the folder and run it. There is a configuration section in the code for further adjustments.</p> <h2>Examples</h2> <ul> <li>Request 1: <em>http://www.mysite.com/iotcsvlog.php</em></li> <li>Request 2: <em>http://www.mysite.com/iotcsvlog.php?Temperature=22</em></li> <li>Request 3: <em>http://www.mysite.com/iotcsvlog.php?Temperature=22&amp;Humidity=60</em></li> <li>Request 4: <em>http://www.mysite.com/iotcsvlog.php?Humidity=80&amp;Temperature=25</em></li> <li>Request 5: <em>http://www.mysite.com/iotcsvlog.php?Pressure=1000</em></li> <li>Request 6: <em>http://www.mysite.com/iotcsvlog.php?Temperature=30&amp;Pressure=900&amp;Humidity=50</em></li> <li>Request 7 (with password set): <em>http://www.mysite.com/iotcsvlog.php?Humidity=50&LogPass=correct_password</em></li> <li>Request 8 (with password set): <em>http://www.mysite.com/iotcsvlog.php?Humidity=50&LogPass=wrong_password</em><BR><b>Wrong pass! No data logged.</b></li> <li>Request 9 (with password set): <em>http://www.mysite.com/iotcsvlog.php?Humidity=50</em><BR><b>Wrong pass! No data logged.</b></li> <li>Request 10: <em>http://www.mysite.com/iotcsvlog.php?LogClear=TRUE</em><BR><b>New empty table is created.</b></li> <li>Request 11 (with password set): <em>http://www.mysite.com/iotcsvlog.php?LogClear=TRUE&LogPass=correct_password</em><BR><b>New empty table is created.</b></li> </ul> <table align="left" border="0" cellpadding="1" cellspacing="1" height="150" width="1134"> <caption><strong>Output table from request 1, 10 and 11</strong></caption> <thead> <tr> <th scope="col">Date and Time</th> <th scope="col">IP</th> </tr> </thead> <tbody> <tr> <td>2017-06-30 10:27:45 -0300</td> <td>192.168.1.1</td> </tr> </tbody> </table> <table align="left" border="0" cellpadding="1" cellspacing="1" height="250" width="1134"> <caption> <p>&nbsp;</p> <p><strong>Output table from requests 1 and 2</strong></p> </caption> <thead> <tr> <th scope="col">Date and Time</th> <th scope="col">IP</th> <th scope="col">Temperature</th> </tr> </thead> <tbody> <tr> <td>2017-06-30 10:27:45 -0300</td> <td>192.168.1.1</td> <td>&nbsp;</td> </tr> <tr> <td>2017-06-30 10:28:48 -0300</td> <td>192.168.1.1</td> <td>22</td> </tr> </tbody> </table> <table align="left" border="0" cellpadding="1" cellspacing="1" height="500" width="1134"> <caption> <p>&nbsp;</p> <p><strong>Output table from requests 1 to 9</strong></p> </caption> <thead> <tr> <th scope="col">Date and Time</th> <th scope="col">IP</th> <th scope="col">Temperature</th> <th scope="col">Humidity</th> <th scope="col">Pressure</th> </tr> </thead> <tbody> <tr> <td>2017-06-30 10:27:45 -0300</td> <td>192.168.1.1</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>2017-06-30 10:28:48 -0300</td> <td>192.168.1.1</td> <td>22</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>2017-06-30 10:29:32 -0300</td> <td>192.168.1.1</td> <td>22</td> <td>60</td> <td>&nbsp;</td> </tr> <tr> <td>2017-06-30 10:33:20 -0300</td> <td>192.168.1.1</td> <td>25</td> <td>80</td> <td>&nbsp;</td> </tr> <tr> <td>2017-06-30 10:48:55 -0300</td> <td>192.168.1.1</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>1000</td> </tr> <tr> <td>2017-06-30 10:55:30 -0300</td> <td>192.168.1.1</td> <td>30</td> <td>50</td> <td>900</td> </tr> <tr> <td>2017-06-30 10:59:19 -0300</td> <td>192.168.1.1</td> <td>&nbsp;</td> <td>50</td> <td>&nbsp;</td> </tr> </tbody> </table> <BR> <h2>Known issues</h2> <p>The script was designed to output the CSV in the UTF-8 format so it could support a wide range of languages and character sets. Unfortunately not all systems support UTF-8 in the same way and some characters might still be displayed incorrectly. To solve this problem, configure the PHP script to output the result file in the .txt format and then open it in Excel using the Text Import function. This way you will be able to proper adjust the importation character encoding.</p> <h2>Source code</h2> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/ * Internet of Things IoT CSV Logger</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Version 1.2 (04/07/2017)</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * This application logs any HTTP GET requests in a CSV file that can be directly opened by Excel.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * The GET variable names will be used as column headers and the values will sorted in the rows.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * The application can log completely different GET requests in the same CSV file and will automatically add the timestamp and the IP address of the client.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * In case of success return TRUE, in case of errors return FALSE.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * </span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Developed by Daniel Brooke Peig - daniel@danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * http://www.danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Copyright 2017 - Daniel Brooke Peig</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * This software is distributed under the MIT License.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================*/</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//------------------------------------------------</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Configurations</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$fileName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;iotcsvlog.csv&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'America/Sao_Paulo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$delimiter</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$enclosure</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$maxLogSize</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10000</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Most Excel versions can read only about 16000 lines</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Optional to prevent abuse. If set to [your_password] will require the &amp;LogPass=[your_password] GET parameter to allow the data to be recorded.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//------------------------------------------------</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Variable initialization</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$logLines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$inputLine</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$responseMessage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;FALSE&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;LogClear&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> <span style="color: #0000ff;">&quot;TRUE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//If this is set, the source file will not be processed and will be erased after the new log entry is created</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// File exists</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">// Reads lines of file to array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$fileLines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #339933;">,</span> FILE_IGNORE_NEW_LINES <span style="color: #339933;">|</span> FILE_SKIP_EMPTY_LINES<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Not Empty file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span> <span style="color: #339933;">!==</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Extract the existing header from the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$lineHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_shift</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$logOriginalHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> str_getcsv<span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lineHeader</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enclosure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Process the file only if the system could find a valid header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Define the new header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$logHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_combine</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span><span style="color: #339933;">,</span> <span style="color: #000088;">$logOriginalHeader</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Get each line of the array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$linesToSkip</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">&gt;</span><span style="color: #000088;">$maxLogSize</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$maxLogSize</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Trim the log size</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileLines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Remove blank lines</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$linesToSkip</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$arrayFields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trim'</span><span style="color: #339933;">,</span> str_getcsv<span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enclosure</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Convert line to array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$logLines</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_combine</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logOriginalHeader</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arrayFields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Uses the existing headers as keys for the log lines</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$linesToSkip</span><span style="color: #339933;">--;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Set the mandatory log headers (if they were not there during the file load)</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$logHeader</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Date and Time&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Date and Time&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$logHeader</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IP&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;IP&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Now process the inputs</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Performs some cleaning and adjustments</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;Date and Time&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Date and Time_user&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Prevents overwriting internal data</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;IP&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;IP_user&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Prevents overwriting internal data</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[^\w\-\s\.]/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Allow only alphanumeric characters, underscore and hyphens in the header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$enclosure</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\''</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Escape the delimiter and enclosure</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;LogPass&quot;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$password</span> <span style="color: #339933;">===</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;LogClear&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Ignore the password parameter if the password is set</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$logHeader</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$key</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Adds the new header cell if needed</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$inputLine</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Defines the input array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Set defaults to the system internal fields</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$outputLine</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Date and Time&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s O&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Set the timestamp</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$outputLine</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IP&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$outputLine</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$inputLine</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$outputLine</span><span style="color: #339933;">,</span> <span style="color: #000088;">$inputLine</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$outputLine</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Put the new output into the log array</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logLines</span><span style="color: #339933;">,</span> <span style="color: #000088;">$outputLine</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Open an output temporary file, if it does not exist create it</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$fileW</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.tmp&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;w+&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//If the system was able to open the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;LogPass&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$password</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$password</span> <span style="color: #339933;">===</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileW</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//File headers</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileW</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bom</span> <span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #208080;">0xEF</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #208080;">0xBB</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #208080;">0xBF</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//BOM for Excel UTF-8</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Write the table header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logHeader</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$headerKey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$headerValue</span><span style="color: #009900;">&#41;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$finalHeader</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$enclosure</span><span style="color: #339933;">.</span><span style="color: #000088;">$headerValue</span><span style="color: #339933;">.</span><span style="color: #000088;">$enclosure</span><span style="color: #339933;">.</span><span style="color: #000088;">$delimiter</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Create the line</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$finalHeader</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$finalHeader</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Replace the last delimiter by a new line</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileW</span><span style="color: #339933;">,</span><span style="color: #000088;">$finalHeader</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Write to the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">//Write the table lines</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logLines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$logKey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$logValue</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$finalLine</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logHeader</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$headerKey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$headerValue</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$fieldValue</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$headerKey</span><span style="color: #339933;">,</span> <span style="color: #000088;">$logValue</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$logValue</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$headerKey</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Place the content under the right header</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$finalLine</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$enclosure</span><span style="color: #339933;">.</span><span style="color: #000088;">$fieldValue</span><span style="color: #339933;">.</span><span style="color: #000088;">$enclosure</span><span style="color: #339933;">.</span><span style="color: #000088;">$delimiter</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Create the line</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$finalLine</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$finalLine</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Replace the last delimiter by a new line</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileW</span><span style="color: #339933;">,</span> <span style="color: #000088;">$finalLine</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Write to the file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileW</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Close the temporary log file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Delete the old log file since we already have the TMP file</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">rename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.tmp&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//Rename the temporary log file to the original name</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$responseMessage</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;TRUE&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//If everything went well return TRUE</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Output the HTTP response message</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: text/plain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Text output for compatibility with devices that don't process HTML</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$responseMessage</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/35" hreflang="en">PHP</a></li> <li><a href="/p/en/taxonomy/term/56" hreflang="en">Internet of Things IoT</a></li> <li><a href="/p/en/taxonomy/term/33" hreflang="en">Excel</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Fri, 30 Jun 2017 14:49:56 +0000 Daniel 129 at https://www.danbp.org/p https://www.danbp.org/p/en/node/129#comments Excel - Pivot tables with text values or numbers without calculations https://www.danbp.org/p/en/node/127 <span class="field field--name-title field--type-string field--label-hidden">Excel - Pivot tables with text values or numbers without calculations</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 06/26/2017</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>This article demonstrates how to use the Excel Power Query tool to create pivot tables that organize and display values without calculations (count, sum, average, etc..). This can be used if the table contains text data or if you need the real values displayed in the cells.</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/pivot_title_power_query.PNG"><img src="/p/sites/default/files/styles/large/public/pivot_title_power_query.PNG?itok=TMqz0dPi" width="750" height="499" alt="Pivot Table with Text Values in Excel" title="Pivot Table with Text in Excel" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>Objectives</h2> <p>Create a Pivot table that displays text data or number values that are not summarized (count, sum, etc...). This solution does not require macros or long search/replace functions, just the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=39379">Microsoft Power Query</a> tool that comes with Excel 2016 or can be installed for free as an add-on in previous versions.</p> <p>This solution is far better than Formulas or VBA Macros because the categories/columns can be auto-updated according to the data source changes. It is also much simpler than typing codes and don't require any 3rd party add-on.</p> <h2>Requirements</h2> <ul><li>Windows + Excel 2016 or</li> <li>Windows + Excel 2010-2013 with the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=39379">Microsoft Power Query</a> tool installed</li> <li>Mac users: Power Query is not available for this platform yet. Good luck with VBA macros :)</li> </ul><h2>Step-by-step</h2> <ol><li>Import the desired data to a blank Excel sheet.<figure role="group" class="caption caption-img align-center"><img alt="Source data" data-entity-type="file" data-entity-uuid="13a9f55e-9d53-4f2f-8474-37d8c37f9095" src="/p/sites/default/files/inline-images/01_powerquery.PNG" /><figcaption>Source data</figcaption></figure><p> </p> </li> <li>Select the data, click on <em>Data Menu - From Table/Range</em> (in Excel 2016 or higher) or in the <em>Power Query Menu - From Table/Range</em> (Excel &lt; 2016).<figure role="group" class="caption caption-img align-center"><img alt="Power Query data selection" data-entity-type="file" data-entity-uuid="629648ed-fc7e-4270-bb2f-d66d560fe018" src="/p/sites/default/files/inline-images/02_powerquery.PNG" /><figcaption>Power Query tool data selection.</figcaption></figure><p> </p> </li> <li>Confirm the selection and if it has headers.<img alt="Data range confirmation" data-entity-type="file" data-entity-uuid="41c30447-1ac5-4aa4-8681-fd53c9393bcb" src="/p/sites/default/files/inline-images/03_powerquery.PNG" class="align-center" /><p> </p> </li> <li>Power Query application will open. Convert the fields to the appropriate type, in this case, time.<figure role="group" class="caption caption-img align-center"><img alt="Adjust the data values" data-entity-type="file" data-entity-uuid="eb8828d8-c073-4b60-8dc2-8a8fdba9bd00" src="/p/sites/default/files/inline-images/04_powerquery.PNG" /><figcaption>Adjusting the data types</figcaption></figure><p> </p> </li> <li>Select the column that has the names of the new columns. In this case <em>"Action".</em></li> <li>Click on the <em>Transform Menu - Pivot Column</em>.<figure role="group" class="caption caption-img align-center"><img alt="Pivot Table creation" data-entity-type="file" data-entity-uuid="4ee77a96-28cd-4df5-a6d0-24341fc673f7" src="/p/sites/default/files/inline-images/05_powerquery.PNG" /><figcaption>Pivot Column creation</figcaption></figure></li> <li>Inside the Pivot Column dialog, select the column with the values that will populate the new columns to be created. In this case <em>"Time"</em> but could be any field type, including text.</li> <li>In the Advanced Options part, select <em>"Don´t Aggregate"</em> so the values will displayed without any modification.<figure role="group" class="caption caption-img align-center"><img alt="Select the source for the new column values" data-entity-type="file" data-entity-uuid="d200ea0c-5be2-4246-9643-6b283cb482a4" src="/p/sites/default/files/inline-images/06_powerquery.PNG" /><figcaption>Select the source for the new column values</figcaption></figure><p> </p> </li> <li>Check if the results are OK and then click on the <em>Home Menu - Close &amp; Load</em>.<figure role="group" class="caption caption-img align-center"><img alt="If everything is OK, just close." data-entity-type="file" data-entity-uuid="d34a2918-f715-4891-bb80-b62e2bf7eb25" src="/p/sites/default/files/inline-images/07_powerquery.PNG" /><figcaption>Final results, if everything is OK, click on "Close &amp; Load"</figcaption></figure><p> </p> </li> <li>The data is now on Excel in the form of Dynamic Data (a little more challenging to work with). If you just want plain data, you can copy and paste the values to another spreadsheet.<figure role="group" class="caption caption-img align-center"><img alt="Final data in Excel" data-entity-type="file" data-entity-uuid="80e1632b-3564-4190-8675-84b7ba625793" src="/p/sites/default/files/inline-images/08_powerquery.PNG" /><figcaption>Final data in Excel</figcaption></figure><p> </p> </li> </ol><h2>Another example</h2> <figure role="group" class="caption caption-img align-center"><img alt="Source data with textual values" data-entity-type="file" data-entity-uuid="d3b896c9-a622-4c8a-8081-26b6782d3d9e" src="/p/sites/default/files/inline-images/09_powerquery.PNG" /><figcaption>Source data with textual values</figcaption></figure><p> </p> <figure role="group" class="caption caption-img align-center"><img alt="Power Query configuration" data-entity-type="file" data-entity-uuid="670448b9-93bf-40f0-8e50-2516ef5bab44" src="/p/sites/default/files/inline-images/10_powerquery.PNG" /><figcaption>Power Query configuration for the column "Brand"</figcaption></figure><p> </p> <figure role="group" class="caption caption-img align-center"><img alt="Final results: Pivot Table with Text data" data-entity-type="file" data-entity-uuid="b1eb6e0a-3bea-476c-a1f0-05b7d3305d25" src="/p/sites/default/files/inline-images/11_powerquery.PNG" /><figcaption>Final results: Pivot Table with Text data</figcaption></figure><h2>Tip</h2> <p>If the Power Query is taking too long to load/calculate you probably selected all the thousand columns and lines (up to the XFD104856 cell). You must select only the exact the data range you have.</p> <p> </p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/33" hreflang="en">Excel</a></li> <li><a href="/p/en/taxonomy/term/26" hreflang="en">Tutorial</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title">Comments</h2> <article role="article" data-comment-user-id="0" id="comment-145" about="/p/en/comment/145" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1507072023"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Ethan</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Tue, 10/03/2017 <span property="schema:dateCreated" content="2017-10-03T23:07:03+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/145#comment-145" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/145#comment-145" class="permalink" rel="bookmark" hreflang="en">Excel Pivot with no calculations</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Thank you, thank you, thank you!</p> <p>It works perfectly!</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=145&amp;1=default&amp;2=en&amp;3=" token="wNoL77iuLREHKS5D1G78RTm817QddmyGkEDQ3XIknRY"></drupal-render-placeholder></nav> </article> <article role="article" data-comment-user-id="0" id="comment-148" about="/p/en/comment/148" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1508112634"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Anonymous</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Sun, 10/15/2017 <span property="schema:dateCreated" content="2017-10-16T00:10:34+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/148#comment-148" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/148#comment-148" class="permalink" rel="bookmark" hreflang="en">It&#039;s great ! I don&#039;t need…</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>It's great ! I don't need index match more ,thank u </p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=148&amp;1=default&amp;2=en&amp;3=" token="9pO8XuJ0em3AXaemO1hPnxgCnShUFx1dFNaFegh3_8c"></drupal-render-placeholder></nav> </article> <article role="article" data-comment-user-id="0" id="comment-160" about="/p/en/comment/160" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1514391207"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Leah</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Wed, 12/27/2017 <span property="schema:dateCreated" content="2017-12-27T16:13:27+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/160#comment-160" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/160#comment-160" class="permalink" rel="bookmark" hreflang="en">Any way to combine Rows once column is pivoted?</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>The pivoted column worked beautifully (THANKS!), but in your example, all three rows for Daniel wound up on the same single row, with the values for time in the pivoted columns.  In mine, everything wound up in the right pivoted columns, but I still have 3 rows.  The values I used for the pivoted column were text (not time) -- does this make a difference?  How can I consolidate so that I only have one row for each "person" (using your example)?</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=160&amp;1=default&amp;2=en&amp;3=" token="ApFLKdcJnYoh0o4piQBXCe_6KKPk74PFRtzD0v4-z3U"></drupal-render-placeholder></nav> </article> <div class="indented"> <article role="article" data-comment-user-id="0" id="comment-161" about="/p/en/comment/161" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1514391933"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Leah</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Wed, 12/27/2017 <span property="schema:dateCreated" content="2017-12-27T16:25:33+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/161#comment-161" hreflang="en">Permalink</a></span> <span class="visually-hidden">In reply to <a href="/p/en/comment/160#comment-160" class="permalink" rel="bookmark" hreflang="en">Any way to combine Rows once column is pivoted?</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Leah</span></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/161#comment-161" class="permalink" rel="bookmark" hreflang="en">Nevermind...</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Aha; I figured it out.  I had concatenated two other columns and not removed the originals until after the pivot, thus there was data that didn't fully match.  Once I moved up the removal of those columns, it worked like a charm!  Wonderful!</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=161&amp;1=default&amp;2=en&amp;3=" token="d31PgJjCRC48GF1IMk0xZT99CqQYEfpfTpBA4yUzgyU"></drupal-render-placeholder></nav> </article> </div> <article role="article" data-comment-user-id="0" id="comment-162" about="/p/en/comment/162" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1514393356"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Leah</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Wed, 12/27/2017 <span property="schema:dateCreated" content="2017-12-27T16:49:16+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/162#comment-162" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/162#comment-162" class="permalink" rel="bookmark" hreflang="en">Multiple values for same cell</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Alas, I have a new problem.  If I have multiple rows for "Daniel" with "created" (in other words, he created multiple times), this creates a problem.  I want the value -- not a count -- but Excel won't concatenate the values in the same cell -- it spits out an error that says:</p> <p>Expression.Error: There were too many elements in the enumeration to complete the operation.<br /> Details:<br />     List</p> <p>Suggestions for this one?  Ideally, what I want is one row for Daniel with all times he created in the same cell (with some separator between them).</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=162&amp;1=default&amp;2=en&amp;3=" token="tinC0sj3k_sGkZuvUKMpAWMRrQpJoTD9h8bv9zhGHjA"></drupal-render-placeholder></nav> </article> <article role="article" data-comment-user-id="0" id="comment-400" about="/p/en/comment/400" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1530128309"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Ari</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Wed, 06/27/2018 <span property="schema:dateCreated" content="2018-06-27T19:38:29+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/400#comment-400" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/400#comment-400" class="permalink" rel="bookmark" hreflang="en">Two sets of data value in the value area</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>I would ask, if it's possible to have two different types of values in the value area, side by side, perhaps in two columns. The first one pick up time and the second one amount of people. Thank you in advance!</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=400&amp;1=default&amp;2=en&amp;3=" token="MYOSTOF0YmiglMSlGb3n5qKMXLEXjHDrRVcWKwL7Lxk"></drupal-render-placeholder></nav> </article> <article role="article" data-comment-user-id="0" id="comment-553" about="/p/en/comment/553" typeof="schema:Comment" class="comment js-comment by-anonymous clearfix"> <span class="hidden comment__new-indicator" data-comment-timestamp="1536292258"></span> <header> </header> <footer class="comment__meta"> Submitted by <span class="comment__meta-item comment__meta-item--author"><span rel="schema:author"><span lang="" typeof="schema:Person" property="schema:name" datatype="">Pramod</span></span> </span> on <span class="comment__meta-item comment__meta-item--created">Fri, 09/07/2018 <span property="schema:dateCreated" content="2018-09-07T03:50:58+00:00" class="rdf-meta hidden"></span> </span> <span class="comment__meta-item comment__meta-item--permalink"><a href="/p/en/comment/553#comment-553" hreflang="en">Permalink</a></span> </footer> <div class="comment__content"> <h3 property="schema:name" datatype=""><a href="/p/en/comment/553#comment-553" class="permalink" rel="bookmark" hreflang="en">Thanks Saved hours of manual work</a></h3> <div property="schema:text" class="clearfix text-formatted field field--name-comment-body field--type-text-long field--label-hidden field__item"><p>Power Query worked like a charm and it save at least a minimum of 4 hours of manual work.</p> <p>The instructions are absolutely clear.</p> <p>Cheers</p> </div> </div> <nav><drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=553&amp;1=default&amp;2=en&amp;3=" token="YojBGIwgHoI1PHT-77Aneq_u46hGZt9PHMCQKZC6sxo"></drupal-render-placeholder></nav> </article> </section> Mon, 26 Jun 2017 20:28:37 +0000 Daniel 127 at https://www.danbp.org/p https://www.danbp.org/p/en/node/127#comments Drupal - Clean database cache tables automatically https://www.danbp.org/p/en/node/126 <span class="field field--name-title field--type-string field--label-hidden">Drupal - Clean database cache tables automatically</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><a title="View user profile." href="/p/en/user/1" lang="" about="/p/en/user/1" typeof="schema:Person" property="schema:name" datatype="" class="username">Daniel</a></span> <span class="field field--name-created field--type-created field--label-hidden">Sun, 06/04/2017</span> <div class="clearfix text-formatted field field--name-field-mt-subheader-body field--type-text-with-summary field--label-hidden field__item"><p>Script and instructions to manually or automatically clean the Drupal 8.x cache tables (cache_config, cache_container, cache_data, cache_default, cache_discovery, cache_dynamic_page_cache, cache_entity, cache_menu, cache_render and cache_toolbar).</p></div> <div class="field field--name-field-image field--type-image field--label-hidden field__items"> <div class="images-container clearfix"> <div class="image-preview clearfix"> <div class="image-wrapper clearfix"> <div class="field__item"> <a class="image-popup overlayed" href="https://www.danbp.org/p/sites/default/files/drupal-logo.png"><img src="/p/sites/default/files/styles/large/public/drupal-logo.png?itok=BRAQp3TP" width="750" height="499" alt="Drupal Logo" title="Drupal Logo" typeof="foaf:Image" class="image-style-large" /> <span class="overlay"><i class="fa fa-plus"></i></span></a> </div> </div> </div> </div> </div> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Drupal 8 has a <a href="https://www.drupal.org/node/2526150">known issue</a> that allows database cache tables grow to the infinite (hundreds of MB or even GB) this can slow or stop automated backups and in the worst scenario, take all available storage and put the site offline.</p> <p>The proposed solution is a temporary solution until Drupal team fixes this problem. I does not require the installation of any module or add-on, just a small PHP script that can be run manually, from a CRON task or from a Windows Scheduled event from the same server the page is hosted or from any other computer.</p> <p><b>Why not a Drupal module?</b> Because this can clean the cache tables even if the Drupal website went offline. It also can be executed remotely from your favorite task scheduler.</p> <h2>The PHP script to clear the cache tables</h2> <p>Edit your database access (db name, location, user and password) configuration in this code and then save with a PHP extension in any accessible folder in your server (Example: <i>http://www.mywebpage/myCleanCacheScript.php</i>). The script can run manually from the URL or be executed as an automated task (recommended).</p> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/ * Remote Drupal Cache Cleaner</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Version 1.1 (25/03/2019)</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * </span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Developed by Daniel Brooke Peig - daniel@danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * http://www.danbp.org</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Copyright 2019 - Daniel Brooke Peig</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * This software is distributed under the MIT License.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;"> *</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">/* =============================================================*/</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$servername</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_SQL_db_username&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_SQL_db_password&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$dbname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your_drupal_db_name&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">// Create connection</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #000088;">$servername</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbname</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">// Check connection</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$conn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect_error</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection failed: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$conn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect_error</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;BR&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Tables to truncate</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_config&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_container&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_data&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_default&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_discovery&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_dynamic_page_cache&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_entity&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_menu&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_render&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_toolbar&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cache_page&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #666666; font-style: italic;">//Run the command</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$conn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TRUNCATE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Limpeza concluída na tabela &lt;i&gt;&quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/i&gt; .&lt;BR&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Erro limpando a tabela de cache &lt;i&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sqltbl</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;: &quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$conn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/i&gt;&lt;BR&gt;&quot;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #009900;">&#125;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000088;">$conn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"><span style="color: #000000; font-weight: bold;">?&gt;</span> </div></li></ol></pre></div> <h2>The CRON command</h2> <p>This command allows scheduled events to run in Linux/Unix servers. It can be run from the same server where the Drupal site is installed or from any other computer with internet access. Replace <i>mywebpage</i> with the path to the cache clear PHP script and then configure CRON to run this command every day, week or whenever you want to clear the cache tables.</p> <code>wget -O - -q -t 1 http://www.mywebpage/myCleanCacheScript.php &gt; /dev/null</code> <h2>VB Script for the Windows Task Scheduler</h2> <p>Replace the URL in the code below with the access path of your PHP script and save it as a Visual Basic Script (Example: <i>runDrupalClear.vbs</i>). Then configure Windows Task Scheduler to run this script every day, week or whenever you want to clean the cache tables.</p> [blockcode language="vbscript"] On Error Resume Next Dim objRequest Dim URL Set objRequest = CreateObject("Microsoft.XMLHTTP") URL = "http://www.mywebpage/myCleanCacheScript.php" objRequest.open "GET", URL , false objRequest.Send Set objRequest = Nothing [/blockcode] </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above field--entity-reference-target-type-taxonomy-term clearfix"> <h3 class="field__label">Tags</h3> <ul class='links field__items'> <li><a href="/p/en/taxonomy/term/54" hreflang="en">Drupal</a></li> <li><a href="/p/en/taxonomy/term/35" hreflang="en">PHP</a></li> <li><a href="/p/en/taxonomy/term/26" hreflang="en">Tutorial</a></li> </ul> </div><div class="field field--name-field-mt-post-categories field--type-entity-reference field--label-hidden field--entity-reference-target-type-taxonomy-term clearfix"> <ul class='links field__items'> <li><a href="/p/en/it" hreflang="en">INFORMATION TECHNOLOGY</a></li> </ul> </div><section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> </section> Mon, 05 Jun 2017 00:16:57 +0000 Daniel 126 at https://www.danbp.org/p