Tutorial by Examples: di

The easiest way to connect via curl to a different server is to alter the hosts file on your machine. On Linux and Unix systems, the hosts file is located in /etc/hosts, while on Windows systems it will be located in c:\windows\system32\drivers\etc\hosts. Once you open the file with a text editor ...
The most effective way to resolve curl to a different server is to use the --resolve option. This option will insert the address into curl's DNS cache, so it will effectively make curl believe that's the address it got when it resolved the name. Like so: curl --resolve eaxmple.com:80:1.2.3.4 http:...
I wrote a simple C code foo.c int main() { int i = 0; int j = 0; for (i = 0; i < 5; i++) { j = i + 1; } return 0; } When compiled with -O0 i.e. by disabling all compiler optimizations $ gcc -o foo.S foo.c -O0 -S I got this: .file "foo.c&...
Option Explicit #If Win64 Then 'Win64 = True, Win32 = False, Win16 = False Private Declare PtrSafe Sub apiCopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long) Private Declare PtrSafe Sub apiExitProcess Lib "Kern...
#ElseIf Win32 Then 'Win32 = True, Win16 = False Private Declare Sub apiCopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (MyDest As Any, MySource As Any, ByVal MySize As Long) Private Declare Sub apiExitProcess Lib "Kernel32" Alias "ExitProcess" (ByVa...
<View style={[(this.props.isTrue) ? styles.bgcolorBlack : styles.bgColorWhite]}> If the value of isTrue is true then it will have black background color otherwise white.
<Image style={[this.props.imageStyle]} source={this.props.imagePath ? this.props.imagePath : require('../theme/images/resource.png')} /> If the path is available in imagePath then it will be assigned to source else the default image path will be assigned.
Installation pip install Flask-SQLAlchemy Simple Model class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80)) email = db.Column(db.String(120), unique=True) The code example above shows a simple Flask-SQLAlchemy model, we can add an ...
In this example, we will plot a sine curve and a hyperbolic sine curve in the same plot with a common x-axis having different y-axis. This is accomplished by the use of twinx() command. # Plotting tutorials in Python # Adding Multiple plots by twin x axis # Good for plots having different y axis ...
In this example, a plot with curves having common y-axis but different x-axis is demonstrated using twiny() method. Also, some additional features such as the title, legend, labels, grids, axis ticks and colours are added to the plot. # Plotting tutorials in Python # Adding Multiple plots by twin ...
Numeric literals of more than a few digits are hard to read. Pronounce 7237498123. Compare 237498123 with 237499123 for equality. Decide whether 237499123 or 20249472 is larger. C++14 define Simple Quotation Mark ' as a digit separator, in numbers and user-defined literals. This can make it ...
You can show cart items by loop through cart or you can display single item from cart. $cartContents = $this->cart->contents(); This will return an array of cart items so you can loop through this array using foreach loop. foreach ($cartContents as $items){ echo "ID : ". ...
import networkx as nx # importing networkx package import matplotlib.pyplot as plt # importing matplotlib package and pyplot is for displaying the graph on canvas b=nx.Graph() b.add_node('helloworld') b.add_node(1) b.add_node(2) '''Node can be called by any python-hashable obj like string,nu...
/** * Apply a radial mask (vignette, i.e. fading to black at the borders) to a bitmap * @param imageToApplyMaskTo Bitmap to modify */ public static void radialMask(final Bitmap imageToApplyMaskTo) { Canvas canvas = new Canvas(imageToApplyMaskTo); final float centerX = imageToApply...
The example below is taken from the full docs, available here (GitHub) or here (NPM). Installation npm install --save activedirectory Usage // Initialize var ActiveDirectory = require('activedirectory'); var config = { url: 'ldap://dc.domain.com', baseDN: 'dc=domain,dc=com' }; va...
Request:"http://example.com" GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: UTF-8, iso-8859-1 Accept-Language: en-US,en;q=0.5 Accept-Encoding: g...
Request:"http://example.com" GET / HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: * Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate C...
from chempy import ReactionSystem # The rate constants below are arbitrary rsys = ReactionSystem.from_string("""2 Fe+2 + H2O2 -> 2 Fe+3 + 2 OH-; 42 2 Fe+3 + H2O2 -> 2 Fe+2 + O2 + 2 H+; 17 H+ + OH- -> H2O; 1e10 H2O -> H+ + OH-; 1e-4 Fe+3 + 2 H2O -...
Authorize yourself, you will be navigated to Google Sign In page. $ gcloud auth login Initialize or reinitialize the gcloud, you can set your configurations here. $ gcloud init Display information about the current gcloud environment. $ gcloud info Display the list of active SDK configur...
"""PyAudio Example: Play a wave file (callback version).""" import pyaudio import wave import time import sys if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.arg...

Page 159 of 164