Tuesday, January 18, 2022

EFTPS Individual Payment Phone Number

I wanted to let anyone that may stumble upon this blog that if you're trying to pay your federal estimated taxes through the EFTPS phone system and you do not yet have your PIN to call 1-800-316-6541.  This number is not published on the EFTPS website, but I found it in an old irs.gov newsletter and is the "individual payment line / individual customer service" number (one of the wonderful operators told me that's the label it's listed as.  It's also listed as the number to call if you have a question on a transaction with the pamphlet that comes in the mail when you get your PIN.



I used to have a working EFTPS account but haven't logged into it for close to two years; apparently, EFTPS had a system password update in September of 2019.  Passwords expire about every 13 months, and any inactive account is purged at 18 months.  The safe rule of thumb to keep your account active is to log in yearly and change your password.

Two helpful numbers:

  • Listed as individual payment line / individual customer service: 1-800-316-6541
  • Bypass automated number and contact operator directly (I haven't tried this personally): 1-800-991-2245

Helpful Article:

https://tscpafederal.typepad.com/blog/2019/08/eftps-system-password-update-.html


Wednesday, December 29, 2021

JS separate out / remove attributes from an Object

I needed to separate out attributes to save for query parameters, and other settings separately.  So instead of looping through filters twice to remove what I needed to populate query parameters and other settings, do it once:

const filters = [
  {
    type: "type1",
    ids: [22,33,44,55],
    other1: { testdata: "hi" },
    other2: true,
    other3: false,
    other4: ["you"],
  },
  {
    type: "type2",
    ids: [66,77,88],
    other1: { testdata: "howdy" },
    other2: false,
    other3: true,
    other4: ["there"],
  }
];
const otherSettings = [];
const queryParams = [];
filters.forEach(filter => {
  const { ids, type, ...otherSetting } = filter;
  const queryParam = {
    ids,
    type
  };
  otherSettings.push(otherSetting);
  queryParams.push(queryParam);
});
console.log(`queryParams:${JSON.stringify(queryParams)}, otherSettings:${JSON.stringify(otherSettings)}`);

Output

queryParams: [{
        "ids": [22, 33, 44, 55],
        "type": "type1"
    }, {
        "ids": [66, 77, 88],
        "type": "type2"
    }
], otherSettings: [{
        "other1": {
            "testdata": "hi"
        },
        "other2": true,
        "other3": false,
        "other4": ["you"]
    }, {
        "other1": {
            "testdata": "howdy"
        },
        "other2": false,
        "other3": true,
        "other4": ["there"]
    }
]

Monday, November 29, 2021

Save redis key value to file

Some of my redis key values are very large so it's easier for me to query for one key's value and view it in a file.

Environment:
CentOS Linux release 7.3.1611 (Core)
redis server 3.2.12
redis-cli 3.2.12

If I have a key named "CST_9527d72b05eb713c20465d6bc5022775bbe3a4ffb99b261a8231e967fe1585ce" enter in either command to save the key's value to cst.txt

redis-cli --scan --pattern "CST_9527d72b05eb713c20465d6bc5022775bbe3a4ffb99b261a8231e967fe1585ce" | xargs redis-cli mget > cst.txt
echo 'GET CST_9527d72b05eb713c20465d6bc5022775bbe3a4ffb99b261a8231e967fe1585ce' | redis-cli > cst.txt

Helpful Article:

https://stackoverflow.com/questions/44826691/how-to-get-value-by-redis-cli-keys

Saturday, October 30, 2021

How to fix Node.js PayloadTooLargeError: request entity too large

Displaying results on a visualization when there were many areas that needed to be displayed on a map caused a HTTP 413 PayloadTooLarge error.  The HTTP request in question had 20,000+ areas defined that made a request payload of 150+ kb.

Things fixed:

The first problem was that Node's HTTP request body parser default request payload limit is 100kb. I increased it to 1mb, as I don't want to arbitrarily make it any bigger. NOTE: nginx didn't have any request payload limits configured.

The second thing was that since Node express version 4.16.0, no longer needed a separate body-parser library, I could use express's internal one.

OLD for Node 8.11.3

const express = require("express");
const bodyParser = require("body-parser");

const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

NEW for Node 14.17.1

const express = require("express");

const app = express();
// The default express max request limit is 100kb, increase it
const maxRequestBodySize = '1mb';
app.use(express.json({limit: maxRequestBodySize}));
app.use(express.urlencoded({limit: maxRequestBodySize}));

Helpful Articles:

https://stackoverflow.com/questions/19917401/error-request-entity-too-large

https://stackoverflow.com/questions/31967138/node-js-express-js-bodyparser-post-limit











Thursday, September 30, 2021

Installing ESLint extension for VSCode

My project has ESLint configured on both the client and server code, the code is separated under to folders in the same git repository.  Command line linting worked great.  Below are quick notes on how to get the linter configured and recognized by VSCode.

  • Install the ESLint extension for Visual Studio Code.  
  • .vscode/settings.json configuration - multiple useful settings so far:
    • Because there are multiple working directories under the root project folder, must set "eslint.workingDirectories". 
      • Without setting "eslint.workingDirectories" it was only formatting one of my folders ("server").  It wasn't until "eslint.workingDirectories" was specified did it recognize other folders as well.
    • "editor.tabSize: my project uses spaces instead of tabs and two spaces by default
    • "editor.rulers":  visually see how many characters can fit on a line
    • "files.eol": CRLF or LF
    • "editor.autoIndent":  when pressing enter, auto-indent or not
    • "editor.defaultFormatter":  specify the ESLint extension installed
    • "editor.formatOnPaste"/"editor.formatOnSave"/"editor.format.enable": must be enabled to format and format on paste/save

{

  "eslint.workingDirectories":[
    "./client",
    "./server"
  ],
  "editor.tabSize":2,
  "editor.rulers":[
    120
  ],
  "files.eol":"\n",
  "editor.autoIndent":"keep",
  "[javascript]":{
    "editor.defaultFormatter":"dbaeumer.vscode-eslint"
  },
  "editor.formatOnPaste":true,
  "editor.formatOnSave":true,
  "eslint.format.enable":true
}

Warnings:

  • Before I had the VSCode settings configured properly, I kept getting "Extension 'ESlint' cannot format <file>" errors during saving. 
    • These settings were key: "eslint.format.enable", "eslint.formatOnSave", and "eslint.workingDirectories"
  • Any files/patterns that are listed in the .eslintignore files will not be able to be formatted by the IDE!!!  I had *.test.js files ignored since I wanted to fix those eslint errors/warnings later.  But then I realized I had to fix them and remove them from the ignore files if I wanted to have them fixed during save.

Helpful articles:

https://stackoverflow.com/questions/45093510/eslint-not-working-in-vs-code

https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint




Saturday, August 28, 2021

JS get variable name as string

I needed to get the variable name as a string recently, some notes to remember:

// getting variable name as string
// regular string, array, int, object
const cherryshoeTypes1 = "hi";
const cherryshoeTypes2 = ["cherry", "shoe"];
const cherryshoeTypes3 = 9;
const cherryshoeTypes4 = {name:"cherry"};

const dynamicVarName1 = Object.keys({cherryshoeTypes1})[0];
const dynamicVarName2 = Object.keys({cherryshoeTypes2})[0];
const dynamicVarName3 = Object.keys({cherryshoeTypes3})[0];
const dynamicVarName4 = Object.keys({cherryshoeTypes4})[0];

console.log(dynamicVarName1);
console.log(dynamicVarName2);
console.log(dynamicVarName3);
console.log(dynamicVarName4);

An article that was helpful:

https://stackoverflow.com/questions/4602141/variable-name-as-a-string-in-javascript

Saturday, July 31, 2021

Upgrade Nginx on CentOS/RHEL 7 from 1.16.1/1.15.2 to 1.20.1, install with Ansible

The upgrade of Nginx on CentOS/RHEL 7 from 1.16.1/1.15.2 to 1.20.1 involved a complete manual removal and ansible installation.  Complete removal and installation were used vs upgrading the version because upgrading requires Nginx modules to be upgraded separately, where an installation takes care of everything.

NOTES:

  • In my case, there were no breaking changes with the nginx.conf and cherryshoe.conf files used from the old to new versions.
  • I installed with yum several times, and on occasion the /etc/nginx/conf.d and /etc/nginx/default.d folders were not created.  You may have to add the ansible task to create these for you prior to copying over the configuration files.
Environment:
ansible 2.9.9
CentOS/RHEL 7
nginx 1.16.1/1.15.2 to 1.20.1

Uninstall existing Nginx

  1. change to the appropriate user that has access to sudo
  2. note the old version, should be 1.16.1/1.15.2
    • nginx -v
  3. stop nginx and verify it's down
    • sudo systemctl stop nginx
    • sudo systemctl status nginx
  4. remove nginx
    • sudo yum remove nginx
    • Confirm y
    • Should see something like the following:
      Loaded plugins: fastestmirror
      Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
      Resolving Dependencies
      --> Running transaction check
      ---> Package nginx.x86_64 1:1.16.1-1.el7 will be erased
      --> Processing Dependency: nginx for package: 1:nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64
      --> Processing Dependency: nginx for package: 1:nginx-mod-http-perl-1.16.1-1.el7.x86_64
      --> Processing Dependency: nginx for package: 1:nginx-mod-stream-1.16.1-1.el7.x86_64
      --> Processing Dependency: nginx for package: 1:nginx-mod-mail-1.16.1-1.el7.x86_64
      --> Processing Dependency: nginx for package: 1:nginx-mod-http-image-filter-1.16.1-1.el7.x86_64
      --> Running transaction check
      ---> Package nginx-mod-http-image-filter.x86_64 1:1.16.1-1.el7 will be erased
      --> Processing Dependency: nginx-mod-http-image-filter = 1:1.16.1-1.el7 for package: 1:nginx-all-modules-1.16.1-1.el7.noarch
      ---> Package nginx-mod-http-perl.x86_64 1:1.16.1-1.el7 will be erased
      ---> Package nginx-mod-http-xslt-filter.x86_64 1:1.16.1-1.el7 will be erased
      ---> Package nginx-mod-mail.x86_64 1:1.16.1-1.el7 will be erased
      ---> Package nginx-mod-stream.x86_64 1:1.16.1-1.el7 will be erased
      --> Running transaction check
      ---> Package nginx-all-modules.noarch 1:1.16.1-1.el7 will be erased
      --> Finished Dependency Resolution
      Dependencies Resolved
      ==========================================================================================
      Package                            Arch          Version               Repository    Size
      ===========================================================================================
      Removing:
       nginx                              x86_64        1:1.16.1-1.el7        @epel        1.6 M
      Removing for dependencies:
       nginx-all-modules                  noarch        1:1.16.1-1.el7        @epel        0.0
       nginx-mod-http-image-filter        x86_64        1:1.16.1-1.el7        @epel         24 k
       nginx-mod-http-perl                x86_64        1:1.16.1-1.el7        @epel         54 k
       nginx-mod-http-xslt-filter         x86_64        1:1.16.1-1.el7        @epel         24 k
       nginx-mod-mail                     x86_64        1:1.16.1-1.el7        @epel         99 k
       nginx-mod-stream                   x86_64        1:1.16.1-1.el7        @epel        171 k
      Transaction Summary
      ===========================================================================================
      Remove  1 Package (+6 Dependent packages)
       Installed size: 2.0 M
      Is this ok [y/N]:
      
  5. delete nginx configuration and log folders
    • sudo rm -R /etc/nginx
    • sudo rm -R /var/log/nginx

Install Nginx

The ansible deploy will install nginx-1.20.1, task looks like:

The upgrade of Nginx on CentOS/RHEL 7 from 1.16.1/1.15.2 to 1.20.1 involved a complete manual removal and ansible installation.  Complete removal and installation were used vs upgrading the version because upgrading requires Nginx modules to be upgraded separately, where an installation takes care of everything.

NOTES:

  • In my case, there were no breaking changes with the nginx.conf and cherryshoe.conf files used from the old to new versions.
  • I installed with yum several times, and on occasion the /etc/nginx/conf.d and /etc/nginx/default.d folders were not created.  You may have to add the ansible task to create these for you prior to copying over the configuration files.

Uninstall existing Nginx

  1. change to the appropriate user that has access to sudo
  2. note the old version, should be 1.16.1/1.15.2
    • nginx -v
  3. stop nginx and verify it's down
    • sudo systemctl stop nginx
    • sudo systemctl status nginx
  4. remove nginx
    • sudo yum remove nginx
    • Confirm y
    • Should see something like the following:
  5. delete nginx configuration and log folders
    • sudo rm -R /etc/nginx
    • sudo rm -R /var/log/nginx

Install Nginx

The ansible deploy will install nginx-1.20.1, task looks like:

- name: install system dependencies
  yum:
    name:
      - nginx-1.20.1
    state: present
    update_cache: yes

- block:
    - name: set up nginx site conf
      template:
        src: "{{ item.src }}"
        dest: "{{ item.dest }}"
      with_items:
        - { src: "cherryshoe.conf.j2", dest: "/etc/nginx/conf.d/cherryshoe.conf" }
        - { src: "nginx.conf.j2", dest: "/etc/nginx/nginx.conf" }
    - name: restart nginx
      systemd: enabled=yes state=reloaded name=nginx

Verification

  1. verify new version
    • nginx -v
  2. verify nginx configuration and log folders created
    • sudo ls -la /etc/nginx
    • sudo ls -la /var/log/nginx
  3. verify application works