Set Axis Label Color in ChartJS

 https://masteringjs.io/tutorials/chartjs/axis-label-color

https://stackoverflow.com/questions/35383677/change-color-of-x-and-y-axis-values-in-chart-js

Okay, so I figured it out. It's the ticks property I'm looking for...see code below.

See updated jsfiddle: https://jsfiddle.net/o534w6jj/1/

var ctx = $("#weekly-clicks-chart");
var weeklyClicksChart = new Chart(ctx, {
    type: 'line',
    data: data,
    scaleFontColor: 'red',
    options: {
            scaleFontColor: 'red',
        responsive: true,
        tooltips: {
            mode: 'single',
        },
        scales: {
            xAxes: [{ 
                gridLines: {
                    display: false,
                },
                ticks: {
                  fontColor: "#CCC", // this here
                },
            }],
            yAxes: [{
                display: false,
                gridLines: {
                    display: false,
                },
            }],
        }
    }         
});

With ChartJS 3, you can change the color of the labels by setting the scales.x.ticks.color and scales.y.ticks.color options. For example, below is how you can make the Y axis labels green and the X axis labels red.

Note that the below doesn't work in ChartJS 2.x, you need to use ChartJS 3.

const ctx = document.getElementById('chart').getContext('2d');

const chart = new Chart(ctx, {
  // The type of chart we want to create
  type: 'bar',
    data: {
    labels: ['A', 'B', 'C', 'D', 'E', 'F'],
    datasets: [{
        label: 'Example Data',
        data: [12, 19, 3, 5, 2, 3],
    }]
  },
  // Configuration options go here
  options: {
    responsive: true,
    scales: {
      y: {
        ticks: { color: 'green', beginAtZero: true }
      },
      x: {
        ticks: { color: 'red', beginAtZero: true }
      }
    }
  }
});

Below is a live example.

You can use any color format supported by ChartJS, including hex codes. For example, below is an alternative approach for setting the Y axis ticks to red and X axis ticks to green.

options: {
  responsive: true,
  scales: {
    y: {
      ticks: { color: '#00ff00', beginAtZero: true }
    },
    x: {
      ticks: { color: '#ff0000', beginAtZero: true }
    }
  }
}


How to Use chown

 https://linuxize.com/post/linux-chown-command/

Before going into how to use the chown command, let’s start by reviewing the basic syntax.

The chown command expressions takes the following form:

chown [OPTIONS] USER[:GROUP] FILE(s)

USER is the user name or the user ID (UID) of the new owner. GROUP is the name of the new group or the group ID (GID). FILE(s) is the name of one or more files, directories or links. Numeric IDs should be prefixed with the + symbol.

  • USER - If only the user is specified, the specified user will become the owner of the given files, the group ownership is not changed.
  • USER: - When the username is followed by a colon :, and the group name is not given, the user will become the owner of the files, and the files group ownership is changed to user’s login group.
  • USER:GROUP - If both the user and the group are specified (with no space betwen them), the user ownership of the files is changed to the given user and the group ownership is changed to the given group.
  • :GROUP - If the User is omitted and the group is prefixed with a colon :, only the group ownership of the files is changed to the given group.
  • : If only a colon : is given, without specifying the user and the group, no change is made.

By default, on success, chown doesn’t produce any output and returns zero.

Add user to group - change group ownership

 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html

  1. Add your user (in this case, ec2-user) to the apache group.

    [ec2-user ~]$ sudo usermod -a -G apache ec2-user
  2. Log out and then log back in again to pick up the new group, and then verify your membership.

    1. Log out (use the exit command or close the terminal window):

      [ec2-user ~]$ exit
    2. To verify your membership in the apache group, reconnect to your instance, and then run the following command:

      [ec2-user ~]$ groups ec2-user adm wheel apache systemd-journal
  3. Change the group ownership of /var/www and its contents to the apache group.

    [ec2-user ~]$ sudo chown -R ec2-user:apache /var/www
  4. To add group write permissions and to set the group ID on future subdirectories, change the directory permissions of /var/www and its subdirectories.

    [ec2-user ~]$ sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
  5. To add group write permissions, recursively change the file permissions of /var/www and its subdirectories:

    [ec2-user ~]$ find /var/www -type f -exec sudo chmod 0664 {} \;

Now, ec2-user (and any future members of the apache group) can add, delete, and edit files in the Apache document root, enabling you to add content, such as a static website or a PHP application.

What is the www-data user?

 https://askubuntu.com/questions/873839/what-is-the-www-data-user

www-data is the user that web servers on Ubuntu (Apache, nginx, for example) use by default for normal operation. The web server process can access any file that www-data can access. It has no other importance.

From the base-passwd documentation (/usr/share/doc/base-passwd/users-and-groups.txt.gz):

Some web servers run as www-data. Web content should not be owned by this user, or a compromised web server would be able to rewrite a web site. Data written out by web servers will be owned by www-data.

Access first item of array using async pipe in Angular 2

 https://stackoverflow.com/questions/42614267/access-first-item-of-array-using-async-pipe-in-angular-2

Found an even easier way of doing it (without creating a custom pipe): add a map to the observable.

component.ts

this.activeTab$ = this.pageTabs$.map(x => x[0]);

component.html

<nav-tabs
   [tabs]="(pageTabs$ | async)"
   [activeTab]="(activeTab$ | async)">
</nav-tabs>

[CentOS 7 Apache]: Permission denied: file permissions deny server access

 https://techglimpse.com/apache-webserver-permission-denied-error/

[CentOS 7 Apache]: Permission denied: file permissions deny server access

Updated on March 15, 2022

Whenever I configure Apache on CentOS 7, most of the time I get “(13) Permission denied: file permissions deny server access” error as below:

[Fri Nov 12 06:29:24.901157 2021] [core:error] [pid 8287] (13)Permission denied: [client 192.168.10.12:15979] AH00132: file permissions deny server access: /var/www/html/admin/images/logo.png

How to fix file permissions deny server access in Apache

Step 1: Check for the below Apache configuration which will block access to all files and URLs.

<Directory />
     Order deny,allow
     Deny from all
 </Directory>

Instead, it should be like:

<Directory />
     Order allow,deny
     Allow from all
 </Directory>

Step 2: Check Read/Write Permissions of your website’s root folder and files required by Apache. To provide permissions for Apache to read/write to the files/folders, run the below command:

# chmod -R 755 /var/www/html
-R option in the above command

will recursively update the user permissions of all files & folders in your webite’s root location.

Step 3: Check for the website’s root folder/file ownership. The ownership should be of Apache(www-data or apache). First, find out the user used by Apache process on your system by the following command:

# egrep -iw --color=auto '^user|^group' /etc/httpd/conf/httpd.conf

or

# ps aux | egrep '([a|A]pache|[h|H]ttpd)' | awk '{ print $1}' | uniq | tail -1

Now change the ownership accordingly using the below command:

# chown -R www-data:root /var/www/html

or

# chown -R apache:root /var/www/html

Step 4: Check for SELinux (Security-Enhanced Linux). You may need to use chcon command to set the security context of your website’s root directory as below:

# chcon -R -h -t httpd_sys_content_t /var/www/html

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...