Bash

#!/bin/sh

################################################################################
##  FUNCTIONS                                                                 ##
################################################################################

##
## ARRANGE $PWD AND STORE IT IN $NEW_PWD
## * The home directory (HOME) is replaced with a ~
## * The last pwdmaxlen characters of the PWD are displayed
## * Leading partial directory names are striped off
##  /home/me/stuff -> ~/stuff (if USER=me)
##  /usr/share/big_dir_name -> ../share/big_dir_name (if pwdmaxlen=20)
##
## Original source: WOLFMAN'S color bash promt
## https://wiki.chakralinux.org/index.php?title=Color_Bash_Prompt#Wolfman.27s
##
bash_prompt_command() {
 # How many characters of the $PWD should be kept
 local pwdmaxlen=25

 # Indicate that there has been dir truncation
 local trunc_symbol=".."

 # Store local dir
 local dir=${PWD##*/}

 # Which length to use
 pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))

 NEW_PWD=${PWD/#$HOME/\~}
 
 local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))

 # Generate name
 if [ ${pwdoffset} -gt "0" ]
 then
  NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
  NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
 fi
}

##
## GENERATE A FORMAT SEQUENCE
##
format_font()
{
 ## FIRST ARGUMENT TO RETURN FORMAT STRING
 local output=$1


 case $# in
 2)
  eval $output="'\[\033[0;${2}m\]'"
  ;;
 3)
  eval $output="'\[\033[0;${2};${3}m\]'"
  ;;
 4)
  eval $output="'\[\033[0;${2};${3};${4}m\]'"
  ;;
 *)
  eval $output="'\[\033[0m\]'"
  ;;
 esac
}



##
## COLORIZE BASH PROMT
##
bash_prompt() {

 ############################################################################
 ## COLOR CODES                                                            ##
 ## These can be used in the configuration below                           ##
 ############################################################################
 
 ## FONT EFFECT
 local      NONE='0'
 local      BOLD='1'
 local       DIM='2'
 local UNDERLINE='4'
 local     BLINK='5'
 local    INVERT='7'
 local    HIDDEN='8'
 
 
 ## COLORS
 local   DEFAULT='9'
 local     BLACK='0'
 local       RED='1'
 local     GREEN='2'
 local    YELLOW='3'
 local      BLUE='4'
 local   MAGENTA='5'
 local      CYAN='6'
 local    L_GRAY='7'
 local    D_GRAY='60'
 local     L_RED='61'
 local   L_GREEN='62'
 local  L_YELLOW='63'
 local    L_BLUE='64'
 local L_MAGENTA='65'
 local    L_CYAN='66'
 local     WHITE='67'
 
 ## TYPE
 local     RESET='0'
 local    EFFECT='0'
 local     COLOR='30'
 local        BG='40'
 
 ## 256 COLOR CODES
 local NO_FORMAT="\[\033[0m\]"
 local ORANGE_BOLD="\[\033[1;38;5;208m\]"
 local TOXIC_GREEN_BOLD="\[\033[1;38;5;118m\]"
 local RED_BOLD="\[\033[1;38;5;1m\]"
 local CYAN_BOLD="\[\033[1;38;5;87m\]"
 local BLACK_BOLD="\[\033[1;38;5;0m\]"
 local WHITE_BOLD="\[\033[1;38;5;15m\]"
 local GRAY_BOLD="\[\033[1;90m\]"
 local BLUE_BOLD="\[\033[1;38;5;74m\]"
 
 ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  
   ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
 ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ## 

 ##                          CONFIGURE HERE                                ##

 ############################################################################
 ## CONFIGURATION                                                          ##
 ## Choose your color combination here                                     ##
 ############################################################################
 local FONT_COLOR_1=$WHITE
 local BACKGROUND_1=$BLUE
 local TEXTEFFECT_1=$BOLD
 
 local FONT_COLOR_2=$WHITE
 local BACKGROUND_2=$L_BLUE
 local TEXTEFFECT_2=$BOLD
 
 local FONT_COLOR_3=$D_GRAY
 local BACKGROUND_3=$WHITE
 local TEXTEFFECT_3=$BOLD
 
 local PROMT_FORMAT=$BLUE_BOLD

 
 ############################################################################
 ## EXAMPLE CONFIGURATIONS                                                 ##
 ## I use them for different hosts. Test them out 😉                       ##
 ############################################################################
 
 ## CONFIGURATION: BLUE-WHITE
 if [ "$HOSTNAME" = dell ]; then
  FONT_COLOR_1=$WHITE; BACKGROUND_1=$BLUE; TEXTEFFECT_1=$BOLD
  FONT_COLOR_2=$WHITE; BACKGROUND_2=$L_BLUE; TEXTEFFECT_2=$BOLD 
  FONT_COLOR_3=$D_GRAY; BACKGROUND_3=$WHITE; TEXTEFFECT_3=$BOLD 
  PROMT_FORMAT=$CYAN_BOLD
 fi
 
 ## CONFIGURATION: BLACK-RED
 if [ "$HOSTNAME" = giraff6 ]; then
  FONT_COLOR_1=$WHITE; BACKGROUND_1=$BLACK; TEXTEFFECT_1=$BOLD
  FONT_COLOR_2=$WHITE; BACKGROUND_2=$D_GRAY; TEXTEFFECT_2=$BOLD
  FONT_COLOR_3=$WHITE; BACKGROUND_3=$RED; TEXTEFFECT_3=$BOLD
  PROMT_FORMAT=$RED_BOLD
 fi
 
 ## CONFIGURATION: RED-BLACK
 #FONT_COLOR_1=$WHITE; BACKGROUND_1=$RED; TEXTEFFECT_1=$BOLD
 #FONT_COLOR_2=$WHITE; BACKGROUND_2=$D_GRAY; TEXTEFFECT_2=$BOLD
 #FONT_COLOR_3=$WHITE; BACKGROUND_3=$BLACK; TEXTEFFECT_3=$BOLD
 #PROMT_FORMAT=$RED_BOLD

 ## CONFIGURATION: CYAN-BLUE
 if [ "$HOSTNAME" = sharkoon ]; then
  FONT_COLOR_1=$BLACK; BACKGROUND_1=$L_CYAN; TEXTEFFECT_1=$BOLD
  FONT_COLOR_2=$WHITE; BACKGROUND_2=$L_BLUE; TEXTEFFECT_2=$BOLD
  FONT_COLOR_3=$WHITE; BACKGROUND_3=$BLUE; TEXTEFFECT_3=$BOLD
  PROMT_FORMAT=$CYAN_BOLD
 fi
 
 ## CONFIGURATION: GRAY-SCALE
 if [ "$HOSTNAME" = giraff ]; then
  FONT_COLOR_1=$WHITE; BACKGROUND_1=$BLACK; TEXTEFFECT_1=$BOLD
  FONT_COLOR_2=$WHITE; BACKGROUND_2=$D_GRAY; TEXTEFFECT_2=$BOLD
  FONT_COLOR_3=$WHITE; BACKGROUND_3=$L_GRAY; TEXTEFFECT_3=$BOLD
  PROMT_FORMAT=$BLACK_BOLD
 fi
 
 ## CONFIGURATION: GRAY-CYAN
 if [ "$HOSTNAME" = light ]; then
  FONT_COLOR_1=$WHITE; BACKGROUND_1=$BLACK; TEXTEFFECT_1=$BOLD
  FONT_COLOR_2=$WHITE; BACKGROUND_2=$D_GRAY; TEXTEFFECT_2=$BOLD
  FONT_COLOR_3=$BLACK; BACKGROUND_3=$L_CYAN; TEXTEFFECT_3=$BOLD
  PROMT_FORMAT=$CYAN_BOLD
 fi
 
 
 ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  
   ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
 ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  

 ############################################################################
 ## TEXT FORMATING                                                         ##
 ## Generate the text formating according to configuration                 ##
 ############################################################################
 
 ## CONVERT CODES: add offset
 FC1=$(($FONT_COLOR_1+$COLOR))
 BG1=$(($BACKGROUND_1+$BG))
 FE1=$(($TEXTEFFECT_1+$EFFECT))
 
 FC2=$(($FONT_COLOR_2+$COLOR))
 BG2=$(($BACKGROUND_2+$BG))
 FE2=$(($TEXTEFFECT_2+$EFFECT))
 
 FC3=$(($FONT_COLOR_3+$COLOR))
 BG3=$(($BACKGROUND_3+$BG))
 FE3=$(($TEXTEFFECT_3+$EFFECT))
 
 FC4=$(($FONT_COLOR_4+$COLOR))
 BG4=$(($BACKGROUND_4+$BG))
 FE4=$(($TEXTEFFECT_4+$EFFECT))
 

 ## CALL FORMATING HELPER FUNCTION: effect + font color + BG color
 local TEXT_FORMAT_1
 local TEXT_FORMAT_2
 local TEXT_FORMAT_3
 local TEXT_FORMAT_4 
 format_font TEXT_FORMAT_1 $FE1 $FC1 $BG1
 format_font TEXT_FORMAT_2 $FE2 $FC2 $BG2
 format_font TEXT_FORMAT_3 $FC3 $FE3 $BG3
 format_font TEXT_FORMAT_4 $FC4 $FE4 $BG4
 
 
 # GENERATE PROMT SECTIONS
 local PROMT_USER=$"$TEXT_FORMAT_1 \u "
 local PROMT_HOST=$"$TEXT_FORMAT_2 \h "
 local PROMT_PWD=$"$TEXT_FORMAT_3 \${NEW_PWD} "
 local PROMT_INPUT=$"$PROMT_FORMAT "


 ############################################################################
 ## SEPARATOR FORMATING                                                    ##
 ## Generate the separators between sections                               ##
 ## Uses background colors of the sections                                 ##
 ############################################################################
 
 ## CONVERT CODES
 TSFC1=$(($BACKGROUND_1+$COLOR))
 TSBG1=$(($BACKGROUND_2+$BG))
 
 TSFC2=$(($BACKGROUND_2+$COLOR))
 TSBG2=$(($BACKGROUND_3+$BG))
 
 TSFC3=$(($BACKGROUND_3+$COLOR))
 TSBG3=$(($DEFAULT+$BG))
 
 ## CALL FORMATING HELPER FUNCTION: effect + font color + BG color
 local SEPARATOR_FORMAT_1
 local SEPARATOR_FORMAT_2
 local SEPARATOR_FORMAT_3
 format_font SEPARATOR_FORMAT_1 $TSFC1 $TSBG1
 format_font SEPARATOR_FORMAT_2 $TSFC2 $TSBG2
 format_font SEPARATOR_FORMAT_3 $TSFC3 $TSBG3
 
 # GENERATE SEPARATORS WITH FANCY TRIANGLE
 local TRIANGLE=$'\uE0B0' 
 local SEPARATOR_1=$SEPARATOR_FORMAT_1$TRIANGLE
 local SEPARATOR_2=$SEPARATOR_FORMAT_2$TRIANGLE
 local SEPARATOR_3=$SEPARATOR_FORMAT_3$TRIANGLE

 ############################################################################
 ## WINDOW TITLE                                                           ##
 ## Prevent messed up terminal-window titles                               ##
 ############################################################################
 case $TERM in
 xterm*|rxvt*)
  local TITLEBAR='\[\033]0;\u:${NEW_PWD}\007\]'
  ;;
 *)
  local TITLEBAR=""
  ;;
 esac

 ############################################################################
 ## BASH PROMT                                                             ##
 ## Generate promt and remove format from the rest                         ##
 ############################################################################
 PS1="$TITLEBAR\n${PROMT_USER}${SEPARATOR_1}${PROMT_HOST}${SEPARATOR_2}${PROMT_PWD}${SEPARATOR_3}${PROMT_INPUT}"

 ## For terminal line coloring, leaving the rest standard
 none="$(tput sgr0)"
 trap 'echo -ne "${none}"' DEBUG
}


################################################################################
##  MAIN                                                                      ##
################################################################################

## Bash provides an environment variable called PROMPT_COMMAND. 
## The contents of this variable are executed as a regular Bash command 
## just before Bash displays a prompt. 
## We want it to call our own command to truncate PWD and store it in NEW_PWD
PROMPT_COMMAND=bash_prompt_command

## Call bash_promnt only once, then unset it (not needed any more)
## It will set $PS1 with colors and relative to $NEW_PWD, 
## which gets updated by $PROMT_COMMAND on behalf of the terminal
bash_prompt
unset bash_prompt

# EOF

You can find the latest iteration of this script in my GIT repository, among many other useful bash scripts. Before you use this script, remember to to install the package fonts-powerline.

This script updates your “PS1” environment variable to display colors. additionally, it also shortens the name of your current part to maximum 25 characters, which is quite useful when working in deeply nested folders.

To install it, simply copy the following text into your user’s .bashrc file, or if you prefer to keep things tidy, paste it into a new .fancy-bash-promt.sh, and simply run this command:  

echo “source ~/.fancy-bash-promt.sh” >> ~/.bashrc

Source: https://yalneb.blogspot.com/2018/01/fancy-bash-promt.html

Hits: 0

How to use a search operator in Gmail


  1. Go to Gmail.
  2. In the search box, type the search operator.

Search operators you can use

Tip: Once you do a search using search operators, you can use the results to set up a filter for these messages.

What you can search bySearch operator & example
Specify the sender from: Example: from:amy
Specify a recipient to: Example: to:david
Words in the subject line subject: Example: subject:dinner
Messages that match multiple terms OR or { } Example: from:amy OR from:david Example: {from:amy from:david}
Remove messages from your results - Example: dinner -movie
Find messages with words near each other. Use the number to say how many words apart the words can be  Add quotes to find messages in which the word you put first stays first. AROUND Example: dinner AROUND 5 friday Example: "secret AROUND 25 birthday"
Messages that have a certain label label: Example: label:friends
Messages that have an attachment has:attachment Example: has:attachment
Messages that have a Google Drive, Docs, Sheets, or Slides attachment or link has:drive has:document has:spreadsheet has:presentation Example: has:drive 
Messages that have a YouTube video has:youtube Example: has:youtube
Messages from a mailing list list: Example: list:info@example.com
Attachments with a certain name or file type filename: Example: filename:pdf Example: filename:homework.txt
Search for an exact word or phrase " " Example: "dinner and movie tonight"
Group multiple search terms together ( ) Example: subject:(dinner movie)
Messages in any folder, including Spam and Trash in:anywhere Example: in:anywhere movie
Search for messages that are marked as important is:important label:important Example: is:important   
Starred, snoozed, unread, or read messages is:starred is:snoozed is:unread is:read Example: is:read is:starred
Messages that include an icon of a certain color has:yellow-star has:blue-info Example: has:purple-star
Recipients in the cc or bcc field cc: bcc: Example: cc:david Note: You can’t find messages that you received on bcc.
Search for messages sent during a certain time period after: before: older: newer: Example: after:2004/04/16 Example: before:2004/04/18
Search for messages older or newer than a time period using d (day), m (month), and y (year) older_than: newer_than: Example: newer_than:2d
Chat messages is:chat Example: is:chat movie
Search by email for delivered messages deliveredto: Example: deliveredto:username@gmail.com
Messages in a certain category category: Example: category:updates
Messages larger than a certain size in bytes size: Example: size:1000000
Messages larger or smaller than a certain size in bytes larger: smaller: Example: larger:10M
Results that match a word exactly + Example: +unicorn
Messages with a certain message-id header Rfc822msgid: Example: rfc822msgid:200503292@example.com 
Messages that have or don’t have a label has:userlabels has:nouserlabels Example: has:nouserlabels  Note: Labels are only added to a message, and not an entire conversation.

Note: When using numbers as part of your query, a space or a dash (-) will separate a number while a dot (.) will be a decimal. For example, 01.2047-100 is considered 2 numbers: 01.2047 and 100.

Hits: 90

Materialized Views

REFRESH FAST Categories

There are three ways to categorize a materialized view’s ability to be fast refreshed.

  1. It can never be fast refreshed.
  2. It can always be fast refreshed.
  3. It can be fast refreshed after certain kinds of changes to the base table but not others.

For the first case Oracle will raise an error if you try to create such a materialized view with its refresh method defaulted to REFRESH FAST. In the example below table T does not have a materialized view log on it. Materialized views based on T cannot therefore be fast refreshed. If we attempt to create such a materialized view we get an error.

create materialized view MV REFRESH FAST as select * from t2 ; as select * from t2 * ERROR at line 3: ORA-23413: table "SCOTT"."T2" does not have a materialized view log

Source: Materialized Views: REFRESH FAST Categories

Hits: 42

Learn REACT with node.js

How to learn JS? For me best way it is practice programing… just write the code like some examples below.

But first some preliminary tasks.

Tools stack

Instal

Install express.js and nodemon

$ npm install express --save
$ npm install nodemon --save

Code

First example is about REST with express.js

Create directory rest and init git repozitory. To add a remote, just do

cd "path to your repo"
git init
git add . # if you want to commit everything. Otherwise use .gitconfig files
git commit -m "initial commit" # If you change anything, you can add and commit again...
var stack = [];
stack.push(2);       // stack is now [2]
stack.push(5);       // stack is now [2, 5]
var i = stack.pop(); // stack is now [2]
alert(i);            // displays 5

var queue = [];
queue.push(2);         // queue is now [2]
queue.push(5);         // queue is now [2, 5]
var i = queue.shift(); // queue is now [5]
alert(i); 

Event emitter

Event logger class

const EventEmitter = require('events');

class Logger extends EventEmitter {
    constructor() {
        super();
        this.messageStore = [];
    }

    log(eventArg) {
        console.log('[Logger.log(message)]:', eventArg.id, eventArg.url);
        this.emit('messageLogged', eventArg);
        this.messageStore.push(eventArg.url);
        //console.log(this.messageStore.pop());

        var propValue;
        for (var propName in this.messageStore) {
            propValue = this.messageStore[propName];
            console.log('>', propName, propValue);
        }
    }
}
module.exports = Logger;

Starting with release 4.16.0, a new express.json() middleware is available.

var express = require('express');
var app = express();

app.use(express.json());

app.post('/', function(request, response){
  console.log(request.body);      // your JSON
   response.send(request.body);    // echo the result back
});

app.listen(3000);

So our program will looks like this:

const express = require('express');
var bodyParser = require('body-parser');
var multer = require('multer'); // v1.0.5
var upload = multer(); // for parsing multipart/form-data

var app = express();
app.use(express.json());

var courses = [{
    id: 1,
    name: 'course1'
}, {
    id: 2,
    name: 'course2'
}, {
    id: 3,
    name: 'course3'
}, {
    id: 4,
    name: 'course4'
}, {
    id: 5,
    name: 'course5'
}, {
    id: 6,
    name: 'course6'
}];



app.get('/api/courses/:id', function (request, response) {
    var course = courses.find(c => c.id === parseInt(request.params.id));
    if (!course) response.status(404).send(`The course with the given ID ${request.params.id} not exist in courses`);
    response.send(course);
});

app.get('/api/courses', function (request, response) {
    if (courses.length < 1) response.status(404).send('The courses not exist');
    response.send(courses);
});

app.post('/api/courses', upload.array(), (request, response, next) => {
    console.log("Got response: " + response.statusCode);
    console.log('Request body: ', request.body);
    // console.log('request =' + JSON.stringify(request.body))
    if (!request.body.name || request.body.length < 3) {
        response.status(400).send('Name is required and should be sent to in JSON');
        return;
    }
    const course = {
        id: courses.length + 1,
        name: request.params.name
    };

    courses.push(course);
    response.json(request.body);
    response.send(course);
});

app.get('/', function (request, res) {
    res.send('Hello World!');
});

const port = process.env.PORT || 3000;
app.listen(3000, () => console.log(`Listen on port ${port}...`));

Hits: 0

Using WSL and MobaXterm to Create a Linux Dev Environment on Windows — Nick Janetakis

For the last 5 years or so I’ve been using VMware’s Unity mode to seamlessly run Linux applications on Windows without having to dual boot.

Overall, it was a pretty solid set up but it had a few annoying issues. It got to the point where I woke up one day and backed up my source code and then rage uninstalled VMware followed by deleting the 100GB VM image.

There was no going back. I had to find a new solution.

Spoiler alert: This new set up is the best way I’ve come across to run both Linux and Windows together. If you’re on Windows and want to also run Linux tools (even graphical apps and Docker) you’ll learn how to set everything up by reading this article.

Source: Using WSL and MobaXterm to Create a Linux Dev Environment on Windows — Nick Janetakis

Hits: 101

Local Area Network : How to fix slow LAN transfer speed of files in Windows – HowToSolutions

Recently I had to solve a problem of a very slow transfer of files between two computers on a LAN network using Ethernet cable. Both machines had Windows 7 x64 installed and the transfer speed was ridiculously slow at 10-15kb/s. Using Task Manager under Networking tab, Network Utilization was showing only around 0.25% for Local Area Connection.

I looked around the web for solutions and found quite a few suggestions how to tackle this problem. Those that I tried and the one that finally solved my problem are discussed here.

The best code editors for WordPress developers

Turning off “Remote Differential Compression”

One of the first suggestions that I came across was to turn off this Windows Feature in Windows 7.

This suggestion is common on the web but it turns out to be just a myth.

From TechNet:

This is 100% false. Neither Windows Update or file copy operations use RDC at all.

So I ignored this suggestion and continued looking.

The best code editors for WordPress developers

Disabling “TCP Auto-Tuning”

This is another common suggestion that I came across and it uses NETSH command-line utility used for displaying and modifying the network configuration. To make the necessary changes, we need to run that utility as an Administrator.

  1. Open Command Prompt as Administrator:
    • Click on Start Menu
    • Type Command in search box
    • Command Prompt will show up in results. Right-click on it to open Context Menu
    • Select Run as administrator
    • If User Account Control Window shows up asking if you want to allow the following program to make changes, select Yes
  2. Type: netsh interface tcp set global autotuning=disabled
  3. Restart the computer
  4. To verify that the auto-tuning is still disabled type in Command Prompt:
    netsh interface tcp show global

This suggestion still didn’t solve my problem, so I looked further, but before doing that I wanted to set Auto-tuning back to the default value by typing netsh interface tcp set global autotuning=normal in the Command Prompt (running as an Administrator).

The best code editors for WordPress developers

Disabling “Large Send Offload (LSO)”

Large Send Offload is a technique of improving network performance while at the same time reducing CPU overhead. Apparently it does not work very well, so it was suggested to disable it. If you would like to know about LSO, check this MSDN article from 2001.

LSO is an option located in a Device Manager under your network adapter, so this solution requires Administrator Privileges.

Follow these steps:

  1. Open Start Menu, right-click on Computer and select Properties
  2. Under Control Panel Home located on the left side of the window click on Device Manager
  3. You will get a list of all devices on your machine. Expand Network Adapters.
  4. Find your Network Card and double-click on it.
  5. Select Advanced tab. You will get a list filled with different options.
  6. Select Large Send Offload V2 (IPv4) and set the value to Disabled
  7. Do the same for Large Send Offload V2 (IPv6) if it is available
  8. Click OK

After clicking OK, I tried to send a file over the LAN network. The transfer speed started very slow, but it was gradually picking up speed. I decided to restart the computer and try to send that file again and this time it worked like a charm.

Now that sending of files worked as it should, I also checked speed for receiving files. It turned out that it was still slow but all I had to do to fix that was to disable Large Send Offload V2 on the other computer. Once done,  the problem was solved for receiving files as well.

Conclusion

In this post we examined different ways to solve slow speed on a LAN network. One of them is just a common myth, but for other two you need to have administrator privileges. I hope you found this article useful. Consider sharing it on a social networks. Comments are also welcome.

If you solved your slow LAN speed problem in a different way, let me know how and I might add that solution to the list.

netsh interface tcp show global

Source: Local Area Network : How to fix slow LAN transfer speed of files in Windows – HowToSolutions

Hits: 103

Find files by date modified in Windows

Yes finaly i instaled Windows 10

Using datemodified: in Windows File Explorer in Windows Vista, Windows 7, and Windows 8 allows you to find any files that have been modified by a date of your choice. Using this tip can be helpful for anyone who has lost a file but know when they last modified the file. Follow the steps below to get the date or date range window shown in the picture.

  1. Open the Windows File Explorer

  2. In the search box, in the top right corner of the window type datemodified:

  3. After datemodified: has been typed the “Select a date or date range” window will appear, select the date or date range for when you believe the file was last modified.

  4. Depending on the dates this search may take a few seconds to a minute to complete.

Source: Find files by date modified in Windows

Hits: 128

Psychoterapia Gestalt – co to takiego? – Piękno umysłu

Psychoterapia Gestalt: istotne reguły

Poniżej znajduje się lista fundamentalnych zasad psychoterapii Gestalt, zaproponowana przez Claudio Naranjo:

Żyj teraz, to znaczy, przejmuj się teraźniejszością, raczej niż przeszłością lub przyszłością.
Żyj tutaj, to znaczy, połącz się z tym co jest obecne, zamiast tego co jest nieobecne.
Przestań sobie wyobrażać: przeżywaj to co jest realne.
Porzuć niepotrzebne myśli; zamiast tego, odczuwaj i obserwuj.
Wybierz wyrażanie się zamiast manipulować, wyjaśniać, usprawiedliwiać lub oceniać.
Oddaj się bólowi i nieprzyjemnościom w tym samym stopniu co przyjemnościom; nie ograniczaj swojej zdolności do bycia świadomym.
Nie akceptuj niczyich „powinieneś” lub „musisz” tylko swoje własne.
Weź całkowitą odpowiedzialność za swoje akcje, uczucia i myśli.
Zaakceptuj to kim jesteś i jaki jesteś.

Esencja psychoterapii Gestalt mieści się w tych zasadach, które generują rozległy i gruntowny proces wiodący do osobistego rozwoju.

Psychoterapia Gestalt patrzy na pacjentów, jako pełnych potencjału, wystarczająco by przezwyciężyć wszelkie przeciwności losu i poznać jej lub jego własne szczęście.

„Weź pod uwagę, że twój pacjent jest zdolną i kompletną osobą, która potrafi wykonać trudne czynności, bez twojej pomocy, która może przeciwstawić się bólowi i zawsze będzie do tego zdolna. Jak na osobę, która zbacza czasem na złą ścieżkę i uczy się na swoich błędach.

Szanuj jego odporność, szanuj jego zdolność do niezależnego zarządzania jego własnymi niepokojami i lękami, szanuj tą jego stronę, która jest zdrowa i zdolna do adaptacji, jego metody. Przyjmij jego zdolność do wsparcia samego siebie i jego ludzkiego potencjału.”

– Fritz Perls.1974-

Hits: 118

ZeverSolar + pvoutput.org integration

Hello, now i worked at connect solar panels ZeverSolar with http://pvoutput.org service. Best information I found here: https://pvoutput.org/help.html#autoupload-zevercloud

The Zevercloud auto uploader retrieves power data from your Zevercloud account and automates the data upload to PVOutput every 20 minutes. Energy data is calculated from power readings.

The Plant Key can be obtained by logging into your zevercloud account at http://solarcloud.zeversolar.com. Test your settings by open the following URL:

https://www.zevercloud.com/api/v1/getPlantOutput?period=bydays&date=2017-04-18&key=<API Key>

The App Key and App Secretis provided by Zevercloud support.

PVOutput Integration Service

The PVOutput Integration Service allows PV logging (Generation) and energy monitoring (Consumption) data to be collected and uploaded to http://pvoutput.org

The following monitoring log file formats are supported:

  • aurora
  • xantrex
  • solarlog
  • growatt
  • suntellite
  • currentcost
  • flukso
  • sunnyroo
  • ted5000
  • enphase
  • enasolar
  • csv
  • powerwall

https://bitbucket.org/pvoutput/pvoutput-integration-service/downloads/

Here is the API documentation for ZeverCloud: https://www.dropbox.com/s/kiraxlseqpq280f/Solarcloud-API-guide_En_v20141114.pdf?dl=0
Look down at example the first attempt with strings set to “1”, later one is after changing it to “2”.

Logs
2017-07-30 07:55:29: Severity 3, Configfile is: eversolar.ini
2017-07-30 07:55:29: Severity 3, Checking database
2017-07-30 07:55:29: Severity 1, Connecting to the ethernet to serial converter
2017-07-30 07:55:29: Severity 1, Connected to the ethernet to serial converter
2017-07-30 07:55:39: Severity 2, Asking all inverters to re-register
2017-07-30 08:12:21: Severity 3, Configfile is: eversolar.ini
2017-07-30 08:12:21: Severity 3, Checking database
2017-07-30 08:12:21: Severity 1, Connecting to the ethernet to serial converter
2017-07-30 08:12:21: Severity 1, Connected to the ethernet to serial converter
2017-07-30 08:12:31: Severity 2, Asking all inverters to re-register

Sending such request to inverter wget -qO- results in response as follows:

1
1
EAB96173XXXXXXX
NXVWWXSRRT7XXXXXXX
M11
16B21-663R+16B21-XXXXXX
09:28 30/07/2017
OK
1
SX000660117XXXXXXXXX
2264
2.20
OK
Error

where line:

 1,2 - unknown
 3 - Registry ID
 4 - Registry Key
 5 - Hardware Version
 6 - Software version
 7 - Time
 8 - Communication status with ZeverCloud
 9 - unknown
 10 - SN.
 11 - Pac(W)
 12 - E_Today(KWh)
 13 - Status
 14 - unknown

Information is refreshed every 30s.

Hits: 622

“How you spend your morning determines your success in life.”

While serving a humanitarian and ecclesiastical mission at the age of 20, I learned potentially the most important lesson of my life.

How you spend your morning determines your success in life.

How you spend your morning determines who you will become.

How you spend your morning determines whether you become world-class at something, or remain merely average.

How you spend your morning is the difference between making tens of millions of dollars and making less than 100 grand.

How you spend your morning determines how well you:

  • think
  • strategize
  • prioritize
  • spend your time
  • choose your friends
  • choose your lover
  • choose your career
  • perform in your work
  • influence the world

I didn’t understand how important my morning was at the beginning of my mission. But it quickly became very apparent.

As a missionary, the first several hours of the day are dedicated to getting ready, studying, and planning.

After a few months in “the mission field,” I noticed that most missionaries dragged themselves out of bed, and dragged themselves through their studies.

My experience was different. For the first time in my life, I experienced the power of learning. I felt the nourishment of feeding my mind and soul. To quote Oliver Wendell Holmes, Jr.:

“A mind that is stretched by a new experience can never go back to its old dimensions.”

I started waking up earlier than prescribed to read more and more. Rather than reading one hour each morning as recommended, I was reading three or four.

Within six months, it became apparent that my thinking and teaching abilities were accelerating at rocket speed. I began to stand out as a missionary.

The following quote by Jeffrey Holland became crystal clear to me:

“I frequently say to missionaries in the field, ‘You make or break your mission every morning of your life. You tell me how those morning hours go until you are on the street in your mission, whatever time it is; you tell me how those hours go, and I will tell you how your day will go, I will tell you how your month will go, I will tell you how your year will go and how your mission and your life will go.’”

 

“How you spend your morning determines your success in life.” @BenjaminPHardy https://journal.thriveglobal.com/you-make-or-break-your-life-between-5-7-am-70e2717f9e67

Hits: 134

No New New: Raw Pointers Removed from C++

Two weeks ago, the ISO C++ standard meeting took place in Jacksonville. Today I want to make a short detour and write about the revolutionary decision that was made in the Jacksonville meeting. Additionally, I refer to the Will no Longer Have Pointers by Fluent C++. The standard committee decided that pointers will be deprecated in C++20 and will with very high probability removed in C++23.

To be honest, what seems like a revolution is only the last step in a long evolution. First, let me explain the big picture.

 The evolution of pointers in C++

Pointers are part of C++ since the first beginning. We got them from C. From the first beginning there was always the tendency in C++ to make the handling with pointers more type-safe without paying the extra cost.

With C++98 we got std::auto_ptr to express exclusive ownership. But std::auto_ptr had a big issue. When you copy an std::auto_ptr the resource will be moved. What looks like a copy operation was actually a move operation. The graphic shows the surprising behaviour of an std::auto_ptr.

This was extremely bad and the reason for a lot of serious bugs; therefore, we got std::unique_ptr with C++11 and std::auto_ptr was deprecated in C++11 and finally removed in C++17. Additionally, we got std::shared_ptr and std::weak_ptr in C++11 for handling shared ownership. You can not copy but move an std::unique_ptr and if you copy or assign an std::shared_ptr, the internal reference counter will be increased. Have a look here:

The best code editors for WordPress developers

Since C++11 C++ has a multithreading library. This makes the handling with std::shared_ptr quite challenging because an std::shared_ptr is per definition shared but not thread-safe. Only the control-block is thread-safe but not the access to its resource. That means, modifying the reference counter is an atomic operation and you have the guarantee that the resource will be deleted exactly once. This is the reason we will get with C++20 atomic smart pointers: std::atomic_shared_ptr and std::atmic_weak_ptr. Read the details in the proposal: Atomic Smart Pointers.

Hits: 91

“A Guide to Becoming a Full-Stack Developer in 2017”

Being a Full-Stack Developer doesn’t mean that you have necessarily mastered everything required to work with the front-end or back-end, but it means that you are able to work on both sides and understand what is going on when building an application.

Full-Stack Web Development, according to the Stack Overflow 2016 Developer Survey, is the most popular developer occupation today. It’s no wonder then that there are dozens of online and in-person programs that will help people become Full-Stack Developers and then even assist these new developers land high-paying programming jobs.

Some popular online programs can be found on Lynda, Udacity, Coursera, Thinkful, General Assembly, and so much more. Aside from these online programs, there are also in-person coding bootcamps that are teaching people the skills required to become web developers.

In this article I won’t be discussing which websites or coding bootcamps have the best web development programs, instead I will be providing a definitive guide to what I believe are the most important skills required to become a Full-Stack Web Developer today and land a job if you’ve never coded before. I will be basing the list off of three things:

  1. A combination of what most programs in 2017 are teaching students.
  2. My own personal experiences from interviewing at companies for developer positions in the past and also interviewing potential candidates for current Full-Stack Developer positions at my current company.
  3. Stories and feedback from people on Coderbyte who have been accepted to coding bootcamps and then proceeded to get programming jobs (see below).

 

“A Guide to Becoming a Full-Stack Developer in 2017” @borowskidaniel https://medium.com/coderbyte/a-guide-to-becoming-a-full-stack-developer-in-2017-5c3c08a1600c

Hits: 23

Code Like a Pythonista: Idiomatic Python

Dictionary and Iterators

Dictionaries implement a sq_contains slot that implements the same test as the has_key() method. This means that we can write

if k in dict: ...
which is equivalent to
if dict.has_key(k): ...

Dictionaries implement a tp_iter slot that returns an efficient iterator that iterates over the keys of the dictionary. During such an iteration, the dictionary should not be modified, except that setting the value for an existing key is allowed (deletions or additions are not, nor is the update() method). This means that we can write

    for k in dict: ...

which is equivalent to, but much faster than

for k in dict.keys(): ...

as long as the restriction on modifications to the dictionary (either by the loop or by another thread) are not violated.

Add methods to dictionaries that return different kinds of iterators explicitly:

for key in dict.iterkeys(): ...
for value in dict.itervalues(): ...
for key, value in dict.iteritems(): ...

This means that for x in dict is shorthand for for x in dict.iterkeys().

Other mappings, if they support iterators at all, should also iterate over the keys. However, this should not be taken as an absolute rule; specific applications may have different requirements.

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.

navs = {} for (portfolio, equity, position) in data: navs.setdefault(portfolio, 0) navs[portfolio] += position * prices[equity]

Source: http://www.omahapython.org/IdiomaticPython.html

Hits: 42

Budda nie był masochistą

Siddhartha miał świeckiego ucznia, wojownika o imieniu Mandżuśri, znanego dowcipnisia i figlarza. Jednym ze współtowarzyszy Mandżuśriego był pewien bardzo sumienny i szanowany mnich, znany z „medytowania nad brzydotą” – metody zalecanej tym, których przepełnia pożądanie i namiętność. Medytacja tego rodzaju polega na wyobrażaniu sobie, że wszystkie istoty składają się z żył, chrząstek, jelit i tak dalej. Mandżuśri, wykorzystując swoje nadprzyrodzone moce, postanowił poddać sumiennego mnicha próbie. Zmienił się w piękną nimfę i pojawił przed medytującym, aby go uwieść. Przez pewien czas poczciwy mnich pozostawał niewzruszony, trwając w całkowitym bezruchu. Jednak powab Mandżuśrego okazał się nieodparty i mnich powoli zaczął ulegać. Był bardzo zaskoczony, ponieważ w ciągu wielu lat medytacji z powodzeniem opierał się najpiękniejszym kobietom w okolicy. W końcu zdruzgotany i rozczarowany sobą, umknął. Nimfa rzuciła się w pogoń i ścigała go, aż wyczerpany ucieczką padł na ziemię. Kiedy zaczęła się zbliżać, mnich pomyślał: „Już po mnie. Ta piękna dziewczyna zaraz mnie porwie w ramiona”. Zacisnął powieki i czekał, ale nic się nie wydarzyło. Gdy wreszcie otworzył oczy, urodziwa nimfa rozpadła się na kawałki, a na jej miejscu ukazał się roześmiany Mandżuśri. „Myślenie, że ktoś jest piękny, to tylko koncepcja – powiedział. – Lgnięcie do tej koncepcji ogranicza cię, krępuje, więzi. Ale jeśli myślisz, że ktoś jest brzydki, to także tylko koncepcja, która cię zniewala”.

Source: Dzongsar Kjence Rinpocze: Budda nie był masochistą – Portal Buddyjski

Hits: 82

React continues to dominate the front-end landscape

“React continues to dominate the front-end landscape, and 2017 provided one of the most anticipated releases yet with version 16. It includes the fiber architecture which enables asynchronous UI rendering. This release also makes it much easier to manage unexpected application failures by providing error boundaries along with many other features.”

@TreyHuffine https://levelup.gitconnected.com/a-recap-of-front-end-development-in-2017-7072ce99e727

Hits: 10

The best code editors for WordPress developers

Hello! Since you are reading this article, it means that you are a WordPress developer, just like me, and strive to make your work with WordPress as productive as possible.

What do we have to do when creating sites on WordPress? We do not just edit PHP files. We should be a programmer and WEB-designer, have the skills to work with HTML, CSS and JavaScript, as it is necessary for a successful WEB-programming.

And a modern IDE or text editor that wants to win the favor of users should provide support for all the necessary languages and technologies.

As a rule, to manage several projects you need a full PHP development environment, such as PhpStorm or CodeLobster. But I also use text editors too, for example if I need to quickly correct a template or modify the code of my function.

Creators of code editors are constantly working on adding new and expanding existing capabilities of their products to support CMS WordPress. Because the community of programmers understand the importance of implementing WordPress support in their software.

I had to spend a lot of time to pick up several IDEs and text editors with advanced features and convenient functionality for WordPress developers.

I suggest you to discover these wonderful programs.

SublimeText

Sublime Text is a fast text editor with a fashionable user interface. It perfectly supports HTML, CSS and JavaScript syntax without additional plug-ins.

To expand the functionality and add tools for WordPress developers, you need to install special packages.

Run the program and go to the main menu “Tools” -> “Install Package Control …”. Package Control is a package that allows you to manage other plug-ins.

After that, you can download, install and remove plug-ins. To start the Package Control, go to the main menu “Preferences” -> “Package Control”.

In order for the program to load the list of available modules, it is necessary to select from the list or enter from the keyboard the command “Install Package”.

Let’s enter “WordPress” in the search bar to filter out the plug-ins specific to this CMS.

From the list, you can immediately select the first “WordPress” package and install it by double-clicking it. This package adds a set of snippets and the ability to auto-complete the functions of WordPress.

The best code editors for WordPress developers
Sublime Text

The next plugin we select from the list is called “Search WordPress Codex”. Using it, you can search the official WordPress online help directly from the editor.

For example, right-click on the function and select “WordPress Codex” -> “Search Selection” from the context menu to view online help on it.

The best code editors for WordPress developers
Sublime Text

Also there are several popular extensions that you should pay attention to, for example:

  • WordPress snippets – provides a collection of snippets for WordPress programmers.
  • WordPress New Project Config – helps you to create and configure a new project for WordPress CMS.
  • Genesis – facilitates the work of the creators of themes for WordPress, which use the child themes of Genesis.

Atom

Atom is another text editor with a lot of advanced functions and beautiful design. It positions itself as an IDE and successfully competes with other similar programs, such as Sublim Text and Rapid PHP.

Atom is based on themes and packages, so it has a wide range of functions and is flexibly configured. It has its own package manager, which we will use to install WordPress support.

Launch Atom and go to the main menu “File” -> “Settings”. In the opened settings tab, click on “Install”.

Now, to find new packages, enter the keyword “wordpress” in the search field and press “Enter”. You can also click on the “Packages” button.

In the list that appears, let’s choose one of the popular packages, for example – Autocomplete WordPress Hooks. This extension will help the developer by providing the completion of WordPress Actions and Filters.

Find this package in the list and click the “Install” button. After a minute we will see that the package is installed.

Now check the functionality of the just added module. Start type the name of the function and press Ctrl + Space.

The best code editors for WordPress developers
Atom

After that, we can also use the hints on the parameters of the function.

The best code editors for WordPress developers
Atom

The algorithm for working with other packages is the same. Just read the description, and if the functionality is suitable, install it.

For example, you can install the following add-ons:

  • WordPress API – this add-on greatly speeds up the development process, offering useful WordPress snippets.
  • WordPress Dictionary for Atom – adds snippets for all WordPress functions, including Actions and Filters.

Rapid PHP

Rapid PHP is also a good editor with support of PHP, HTML, CSS and JavaScript. It successfully combines the functionality of the real IDE with high speed.

It is not resource-demanding, has a built-in PHP debugger, supports HTML5, CSS3 and several frameworks, including WordPress.

For higher performance, ability to work with frameworks is disabled by default. To enable WordPress support, go to the main menu “Options” -> “Frameworks”.

In the list that appears, you can select one or more libraries that you want to work with. In this case, choose WordPress and click “OK”.

In the next step, let’s create the project, for that we go to the main menu and select “Project” -> “New Project”.

Now enter the project name and path to the project files. In this example, specify the folder with WordPress installed.

When the project is created, you can view its contents in the right pane of the program using the file browser.

Rapid PHP provides the programmer with ability to use the autocompletion feature when pressing the Ctrl + Space keys.

The best code editors for WordPress developers
Rapid PHP

You can also trigger an instant prompt on WordPress functions by pressing Shift + Ctrl + Space.

The best code editors for WordPress developers
Rapid PHP

If in the process of work you need to use the online help for any PHP function, just place the cursor on its name and press the F1 key. The page with online help will be displayed in the browser installed on the system.

CodeLobster

CodeLobster is a functional IDE that provides a complete set of tools for the web developer.

It has an editor of PHP, HTML, CSS and JavaScript with suggestions and autocompletion.

CodeLobster allows you to work with databases directly from the IDE, edit PHP files on the local computer and on a remote server using FTP.

Among other things, you can use PHP debugger, contextual and dynamic help.

There is a convenient function of installing WordPress directly from the program. In addition to that the CMS is installed and configured instantly, much faster than via the WEB-interface.

For example, to create a project, go to the main menu “Project” -> “Create Project …”.

Then in the dialog box, you can specify the type of the project, which will be created using the framework or one of the popular CMS.

Select “Create Empty WordPress Site”, enter the name and specify the location of the directory for installation. Then the New WordPress Site Wizard will run.

It will take only a few steps to configure the connection to the database and at the last step specify the parameters of our blog.

After clicking the “Finish” button, the fresh WordPress distribution will be installed and a new project will be created, you can immediately start working.

If we move the mouse pointer to any function name, we get information about it in a tooltip.

The best code editors for WordPress developers
CodeLobster

For full information about this function from the official WordPress documentation, it is enough to select it and press the F1 key.

To use autocompletion, just start typing the name of the function and press Ctrl + Space.

The best code editors for WordPress developers
CodeLobster

CodeLobster includes the WordPress plugin in its professional version. That allows the developer to quickly start working with this CMS, since no additional installation is required.

PhpStorm

PhpStorm is a PHP IDE with many convenient features for the web developer. This programming environment is built on the IntelliJ IDEA platform and inherited all the capabilities of the parent platform.

For WordPress programmers, the distribution of the IDE comes with a special plug-in for integration with WordPress.

To start working, you need to register WordPress in the program. Start PhpStorm and go to the main menu “File” -> “Settings …”.

In the settings we will find the section “Languages & Frameworks” and select the “PHP” item. Then in the “Include Path” tab we press the plus button and specify the path to the installed CMS.

The directory with the installation will be indexed, this will allow us to use the WordPress source code when navigating through functions and showing dynamic help.

In addition, you can set the WordPress coding style, which for sure has already became familiar to WordPress developers.

In the program settings window, go to “Editor” -> “Code Style” -> “PHP”. Click on the link “Set from …” and select “Predefined Style” -> “WordPress” from the drop-down list.

Click “OK” to save the settings.

Now consider the process of creation of a new project. In the main menu, select “File” -> “New Project …”.

In the opened dialog, go to the “WordPress Plugin” section and specify the directory for the project and the second one – there the WordPress is installed.

Choose the location of the project in the folder with WordPress. Then click “Create” – so we create a project based on the existing source files.

You should wait a few seconds while PhpStorm scans the files. After that the project is opened and we can continue to study the functions of the program.

To use auto-completion, start entering the name of the function and press Ctrl + Space.

The best code editors for WordPress developers
PhpStorm

It is enough just to set the cursor to the function name and press Ctrl + Q to get dynamic help on this function.

The best code editors for WordPress developers
PhpStorm

IDE also supports WordPress Actions and Filters. When you press Ctrl + Space, you can quickly get a dynamic hint about the existing parameters.

This review can be completed for now. As you can see, all of the programs in this article have their advantages.

Which one to choose? A simple and lightweight text editor, such as Rapid PHP, or a complex IDE, such as PhpStorm?

I chose CodeLobster, that combines the speed of work, functionality and ease of setting up WordPress projects. I’m happy to add it to my set of web development tools.

It’s very interesting to know what your favorite editor is? Do you create sites on WordPress, or use another CMS? I suggest sharing your experience with other readers. I really look forward to your comments.

 

Hits: 30

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑