Posted on Leave a comment

DIY Analytics – Matomo Install for WordPress

Get the latest Matomo ( Piwik ) code

wget https://builds.matomo.org/matomo-latest.zip

Place this file into your Apache2 httpd “Document” directory and unzip/untar

unzip matomo-latest.zip

Set permission to the owner of the httpd process ( www-data in my case )

chmod -R www-data:www-data matomo

Check the permissions

ls -l 

Make it accessable

I like to just place a symbolic link in the Documents directory of the Virtual Host I am using it with. I don’t know what the security ramifications of this might be. You, of course, will have to discern the paths for your particular setup. I keep my Virtual Hosts and Matomo at the same level.

ln -s ../matomo matomo

Browse to the newly installed system, and work through the installation. You will likely have to install some PHP extensions to get the system working fully. I had to install mbstring.

Update you apt so you get that latest

apt update

First find the package

apt-cache search mbstring

php-mbstring - MBSTRING module for PHP [default]
php-patchwork-utf8 - UTF-8 strings handling for PHP
php-symfony-polyfill-mbstring - Symfony polyfill for the Mbstring extension
php-symfony-polyfill-util - Symfony utilities for portability of PHP codes
php7.2-mbstring - MBSTRING module for PHP

What PHP Version

php -v

PHP 7.2.24-0ubuntu0.18.04.3 (cli) (built: Feb 11 2020 15:55:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.3, Copyright (c) 1999-2018, by Zend Technologies

Ok install the correct one

apt install php7.2-mbstring

Restart the web server

systemctl restart apache2

Once you have worked through all the PHP extensions fin the link for continueing over SSL:

Next, to the database setup, bring up a console to create a user for Matomo:

Modern distrubutions allow root to connect from a local terminal instance ( ssh ) without user name and password, type mysql at the console to get the mysql-client command prompt:

Create the database:

CREATE DATABASE matomo;

Add a user

CREATE USER ‘matomo’@’localhost’ identified by ‘agoodpasswordgoeshere’;

Give the user permissions on the database

GRANT ALL ON matomo.* to ‘matomo’@’localhost’;

Head back to the Matomo installation wizard and Complete step 5 through 8 for your website. I am using WordPress so I only need the tracking code to plug into the WordPress Plugin.

The office WordPress Plugin for Matomo Let’s simply add the plugin and Activate. Using the default tracking option you should be good to go!

Posted on Leave a comment

CNCjs – Gcode Sender

The magical language that runs most 3D Printers and other CNC machines are called g-code. G-Code is a language that describes positioning and actions to be taken by many types of CNC machinery. In lower-end machines and in earlier 3d printers, the machine was unable to hold and process these instructions on its own and needed a computer to complete that work. Thus we have the G-Code sender and a modern incarnation CNCjs.

The g-code sender speaks to the CNC machine over a USB/Serial connection. It communicates motion and actions while negotiating how much data to send and when to send it.

CNCjs is a web based G-Code sender. It can run on a variety of computers including the Raspberry-Pi. This article will be installing the CNCjs onto a Linux Mint machine. It will be focused on installing the software for use from a web page and with a degree of permanance.

Try it out First

If you want to try the software out before doing a full installation you can use the AppImage. This is a self-contained bundle of all the software and dependencies needed to run the title. You can download the AppImage, use it from the list below.

Pre-paring your machine

The only listed requirement is nodejs version 4 or higher, and npm if you are not installing from git

For nodejs, you can check which versions are available on your repository by typeing

apt-cache show nodejs | grep Version

If the versions shown are greater than 4 you are good to install by typing:

sudo apt install nodejs

If you think it is already installed just type:

nodejs --version

For npm you can do the sam process

apt-cache show npm | grep Version
sudo apt install npm 
npm --version

Obtain the Software

If you would like to run the software on your desktop like a piece of regular software ( not web-based ) there is a version that treats the entire cncjs web service as a desktop App. It uses something called Electron, and is avaiable in Windows, Mac and Linux

https://github.com/cncjs/cncjs/wiki/Electron-App

Then pick the download in the “Asset” list. There are debs for Debian Linux, rpms for Redhat based, Windows exe, and Mac dmg

For the AppImage you can use the linux-x86_64.AppImage

For running on a server:

The easiest way to install this software is via npm

Use the following command

npm install -gcncjs@latest

The comand will retrieve the software and isntall it

To run the software use:

cnc

Then visit

http://127.0.0.1:8000/

It’s that simple!

Posted on 2 Comments

Annoying Math Puzzle #1

Why EVERYONE is wrong about this post. First, I will let you off the hook by saying I got it wrong at first. I love math but I am not particularly skilled at math.

I don’t particularly like this puzzles because they are almost always not about the math but are more about distraction and attention span. My attention span is particularly low so I usually get them wrong.

Here is the text posted with the image

Deals a deal! I lost to XXX XXX
What's the total of the last column? Post your response only, not your math. If you guess and answer wrong, you have to re-post the same and to whom you lost to.
Comment your answer! If your wrong you need to repost and I'll send you the answer key

First here are the values:

  • Man = 5
  • Weight = 2
  • Shoe = 5

The Correct Answer

First, let’s look at the standard “correct” answer:

10 + 10 + 10 = 30
 5 +  5 +  5 = 20
 4 +  4 +  5 = 13
 5 + 19 x  2 = 43
             ----
              106

To get to this answer you have to notice that the man is wearing shoes and weights. The rest is following PEMDAS.

Technically Correct Answers:

A good friend of mine pointed out that the instructions simple state to Total the last column. As the instructions do not explicitly state to perform operations on the fourth row we end up with this.

10 + 10 + 10 = 30
 5 +  5 +  5 = 20
 4 +  4 +  5 = 13
 5 + 19 x  2 =  ?
             ----
             63 + ?

I took it as tep further to be even more techincally correct :

Incomplete Answers ( last row only ):

Adding up only the final row:

5 + 19 x 2 = 43

Not noticing the Shoes or the Weights on the Man

and also not noticing the instructions to Total the last Column

        5 + 5 * 2 = 15

Using Two Weights on last line

      10 + 10 + 10 = 30
       5 +  5 +  5 = 20
       4 +  4 +  5 = 13
       5 + 19 +  2 = 26
      10 + 10 + 10 = 30
         5 + 5 + 5 = 20
         4 + 4 + 5 = 13
         5 + 5 x 4 = 40
                  -----
                    103

Missing the Multiplication on Last :Line

      10 + 10 + 10 = 30
       5 +  5 +  5 = 20
       4 +  4 +  5 = 13
       5 + 19 +  2 = 26  
                   ----
                     89

Using addition instead of multiplication on the last line.
And using mistaking one weight for two.

      10 + 10 + 10 = 30
       5 +  5 +  5 = 20
       4 +  4 +  5 = 13
       5 + 19 +  4 = 26  
                   ----
                     93

And the most convoluted answer:

Re-moving presumption of addition, considering each item as a number.

Shoe = 3.16227766, ( 3.16227766 X 3.16227766 ) = 10
Person = 5
Lace = 1.414213562

3.16227766 + ( 1.414213562 X 5 X 1.414213562 / 3.16227766 ) x 2 = 72.486832952
63 + 9.486832952 =  72.486832952

Please feel free to comment below as to why I am wrong or if you have an even more convoluted answer.