Kompx.com or Compmiscellanea.com

Selecting all in mc

Operating systems : Linux

Selecting all files and folders in a directory viewed in a panel of Midnight Commander. Achieving the same effect a does Ctrl - A under Microsoft Windows or Cmd - A in Mac OS X:

Open a directory --> Ctrl - Shift - = --> Enter * [asterisk] --> Enter

A directory with files and folders

[ Image ] : mc - A directory with files and folders

Selection options prompt

[ Image ] : mc - Selection options prompt

Entering * [asterisk]

[ Image ] : mc - Entering * [asterisk]

All files and folders has been selected

[ Image ] : mc - All files and folders are selected

The keyboard shortcut of Ctrl - Shift - = is meant to type plus symbol. So just Shift - = may also happen to be enough.

The "Using shell patterns" option in selection options prompt has to be checked on in order to make asterisk to work as the symbol for "all" or "any".


Aliosque subditos et thema

 

HTTP to HTTPS redirect in .htaccess

 

Redirecting from HTTP to HTTPS, when the web server serving the pages is behind a load balancer or reverse proxy. Server configuration: Apache + nginx; SSL is enabled; SSL-certificate is purchased, approved and installed. That is, everything is up and running. So it is just the HTTP to HTTPS redirection that is left to get ready and start up. Directives for .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{HTTP:X_FORWARDED_PROTO} !https [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] HTTP to HTTPS redirect -- Enable runtime rewriting engine: RewriteEngine On -- If domain name has no www: RewriteCond %{HTTP_HOST} !^www\. [NC] -- Then replace it with domain with www: RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] -- If HTTPS is not present: RewriteCond %{HTTP:X_FORWARDED_PROTO} !https [NC] -- Then replace domain without HTTPS with domain with HTTPS: RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] Notes 1. X_FORWARDED_PROTO may instead be called X-Forwarded-Proto or even else. The point is to obtain the information from a load balancer or reverse proxy on the original request it gets. Load balancers or reverse proxies may provide the web server with this info and a header named X_FORWARDED_PROTO or X-Forwarded-Proto or else may be sent, holding the protocol string. It is most often so, but not always. So it should probably be determined by practice how to get the protocol string in a particular case. 2. The other way is just to set the environment variable (if it is suitable for the given web server): SetEnvIf X_FORWARDED_PROTO https HTTPS=on Then directives for .htaccess file are to be like this: RewriteEngine On SetEnvIf X_FORWARDED_PROTO https HTTPS=on RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{HTTP:HTTPS} !on [NV] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] 3. Apache Module mod_rewrite docs: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

JavaScript + CSS centering

 

Centering content of a web page by means of JavaScript and CSS. A block containing the content of a page is JavaScript + CSS centered horizontally and vertically. Two cases: 1. A block is centered, if screen resolution is equal to or greater than 1024x768 - [ Open demo page ] 2. A block is centered, if screen resolution is equal to or greater than 1024x768 + mouse cursor is moved over a link in an element of the page content - [ Open demo page ] JavaScript and CSS horizontal and vertical centering. The first case. Step by step. 1. A web page, the part of which is going to be the element the JavaScript + CSS horizontal and vertical centering is to be applied to: HTML / XHTML. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>JavaScript + CSS horizontal and vertical centering. The first case. Step 1</title> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <link rel="stylesheet" type="text/css" href="1.css" /> </head> <body>   </body> </html> CSS. Code: html {height: 100%; margin: 0px;} body {background-color: #fff; margin: 0px; height: 100%;} 2. A block element A (grey color) with dimensions declared explicitly, for instance 800 by 500 pixels and with relative positioning is created in the document's body. [ Open demo page ] HTML / XHTML. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>JavaScript + CSS horizontal and vertical centering. The first case. Step 2</title> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <link rel="stylesheet" type="text/css" href="2.css" /> </head> <body> <div class="element_A">&nbsp;</div> </body> </html> CSS.