Several Ways to Stop Goroutine in Go.
A signal channel
Typically, you pass the goroutine a (possibly separate) signal channel. That signal channel is used to push a value into when you want the goroutine to stop. The goroutine polls that channel reg...
In PHP, using the $_SERVER variable is the easiest way to get the full URL.
Using $_SERVER Variable
$_SERVER is an array containing information such as headers, paths, and script locations.
The following example should cover whatever you are trying...
In Golang, there are 2 ways to validate URL with standard package.
Using ParseRequestURI Function
url.ParseRequestURI parses a raw url into a URL structure. It assumes that url was received in an HTTP request, so the url is interpreted only as an ab...
In Golang, there are 2 ways to set timeout for http.Get requests
Using http.Client.Timeout Field
Timeout specifies a time limit for requests made by this Client. The timeout includes connection time, any redirects, and reading the response body.
S...
In Python, there are 2 ways to make a time delay.
Using time.sleep Function
This function actually suspends execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep...
In Python, there are 3 ways to check if a file exists.
Using os.path.exists Method
Return True if path refers to an existing path or an open file descriptor. Returns False for broken symbolic links. On some platforms, this function may return False ...
Fetch Internet Resources Using The urllib Package.Fetching URLs
The simplest way to use urllib.request is as follows:
#!/usr/bin/env python3
# Import datetime module
import urllib.request
with urllib.request.urlopen('https://google.com') as respon...
Reduce Bandwidth Usage by Supporting If-Modified-Since in PHP.
If-Modified-Since
The If-Modified-Since request HTTP header makes the request conditional: the server sends back the requested resource, with a 200 status, only if it has been last modif...
Reading from a url resource in Go.Fetching a URL
Go provides a collection of packages, grouped under net, that make it easy to send and receive information through the Internet. Package http provides HTTP client and server implementations.
packag...
user interface to the TELNET protocol.
Telnet is an application protocol used on the Internet or local area network to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is interspe...
search for files and directories based on their permissions, type, date, ownership, size, and more.
find is a command-line utility that locates files based on some user-specified criteria and either prints the pathname of each matched object or, if ...
command line tool and library for transferring data with URLs.
cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...
Build or rebuild services.If you change a service’s Dockerfile or the contents of its build directory, run docker-compose build to rebuild it.
Docker-Compose build will read your docker-compose.yml or docker-compose.yaml.
This step enables you to a...
Promise based HTTP client for the browser and node.js--pname-- is a client HTTP API based on the XMLHttpRequest interface provided by browsers.
--pname-- depends on a native ES6 Promise implementation to be supported. If your environment doesn't sup...