Sunday, September 27, 2020

Online Tool to Convert Text to HTML with Pre-defined Tags And Selectors

>PROBLEM


You want to copy a code snippet and paste into an HTML page that has its own CSS selectors.

For example, you are working on Eclipse, VSCode, Atom, Sublime, etc. and you wish to copy and paste the snippet below to your post in HTML.

server {
	server_name marketing.example.com marketing.example.org marketing.
	example.net;
	rewrite ^ http://www.example.com/marketing/application.do permanent;
}
server {
	server_name communication.example.com communication.example.org
	communication.example.net;
	rewrite ^ http://www.example.com/comms/index.cgi permanent;
}
server {
	server_name www.example.org www.example.net;
	rewrite ^ http://www.example.com$request_uri permanent;
}


>SOLUTION


You need a Text to HTML converter that enables to use your CSS selector.

You may try ultering.com/it4us/converter, a free online tool, that offers fast shortcuts. For instance, paste the text in the box and try CTRL+.







Saturday, September 26, 2020

nginx install: debian: Job for nginx.service failed because the control process exited with error code

 

>PROBLEM

Installing nginx:

apt install nginx

Returns:

  

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-09-26 22:49:18 UTC; 7ms ago
     Docs: man:nginx(8)
  Process: 21405 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 21404 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Sep 26 22:49:17 mind4y.com nginx[21405]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Sep 26 22:49:17 mind4y.com nginx[21405]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Sep 26 22:49:17 mind4y.com nginx[21405]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Sep 26 22:49:18 mind4y.com nginx[21405]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Sep 26 22:49:18 mind4y.com nginx[21405]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Sep 26 22:49:18 mind4y.com nginx[21405]: nginx: [emerg] still could not bind()
Sep 26 22:49:18 mind4y.com systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 26 22:49:18 mind4y.com systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Sep 26 22:49:18 mind4y.com systemd[1]: nginx.service: Unit entered failed state.
Sep 26 22:49:18 mind4y.com systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-full (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-full (<< 1.10.3-1+deb9u4.1~) | nginx-light (<< 1.10.3-1+deb9u4.1~) | nginx-extras (<< 1.10.3-1+deb9u4.1~); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-full (>= 1.10.3-1+deb9u4) | nginx-light (>= 1.10.3-1+deb9u4) | nginx-extras (>= 1.10.3-1+deb9u4); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 nginx-full
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)


>SOLUTION


The issue is caused by port collision. In this case Apache is already using port 80.

The tip is given by the log at line:
nginx[21405]: nginx: [emerg] listen() to 0.0.0.0:80

Switch Nginx or Apache to another port.
In this case, Nginx is switched to port 81.

1. Edit:

/etc/nginx/sites-enabled/default


Switch from:

server {
listen 80 default_server;
listen [::]:80 default_server;

To:

server {
listen 81 default_server;
listen [::]:81 default_server;

 

2. Start nginx

systemctl start nginx


3. Test:

nginx -t


>EXTRA


If desired to reinstall Nginx, uninstall first:

apt update
apt purge nginx
apt autoremove

- verifying dependencies:
apt -f install


>ENV


debian 9


Sunday, September 6, 2020

Clients fail to Connect Debian on VMWare Virtual Machine


>PROBLEM

VMWare has ping to host but host has not ping to the VMWare running Debian.


>SOLUTION

There are three things to observe.


First, you must make sure that the VMWare network interface configuration is correct.
Summarizing: it is required two interfaces at least.
One for the Internet that it is mapped to NAT, and a second to access a local network, for instance, that shall be mapped to the local interface on your host. If Windows, you may access the network interfaces using the command: ncpa.cpl.

Map in the network interfaces using the same order.
For instance, if the guest is a Debian and has eth0 (Internet) and eth1(local), map the network adapters in VMWare's settings using the same order. 








Second, check the network icon to make sure it active and not "unmanaged".



If it is deactivated (unmanaged), do:

sudo vim /etc/NetworkManager/NetworkManager.conf

Set false to true:



Update, restarting service:

service network-manager restart


More detailed information, you get in this video.


Third, restart the virtual machine without using Ctrl+E. Use its shutdown button.
Try to ping your VM:
ping 10.0.0.XX

If it fails, restart Windows. 


IMPORTANT NOTE

Remember two extra concerns:

- Firewall configuration (host and guest/VM)

- VPN 
Sometimes the VPN impedes the access.
Test disconnecting the VPN.


>ENV

Windows 10
VMWare 8 running Debian 7 or 10
VMWare 15.5 running Debian 7 or 10





eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...