Tutorial by Examples: ch

The "Host:" header is a normal way an HTTP client tells the HTTP server which server it speaks to. By passing custom modified "Host:" header you can have the server respond with the content of the site, even if you didn't actually connect to the host name. For example, if you ha...
General-purpose stopwatch for timing how long a function takes to run: object Benchmark { fun realtime(body: () -> Unit): Duration { val start = Instant.now() try { body() } finally { val end = Instant.now() return Duration.b...
This following example is created by user Michael Dillon from this answer. Consider the following script: @set @junk=1 /* @echo off cscript //nologo //E:jscript %0 %* goto :eof */ //JScript aka Javascript here This script snippet does: Execute the cscript command which calls itsel...
My laptop is having Windows 10. Here i am giving steps that you can follow to test and learn Ansible. SOME THEORY For Ansible you need a Control Machine and a host(or hosts) to run the Playbook. Control Machine should be Linux based or MacOS(windows not allowed) and need Python (2.6 or higher v...
You can also use tee command to store the output of a command in a file and redirect the same output to another command. The following command will write current crontab entries to a file crontab-backup.txt and pass the crontab entries to sed command, which will do the substituion. After the substi...
Child Processes are the way to go when one wants to run processes independently with different initialization and concerns. Like forks in clusters, a child_process runs in its thread, but unlike forks, it has a way to communicate with its parent. The communication goes both ways, so parent and chil...
const { expect } = require('chai') describe('Suite Name', function() { describe('#method()', function() { it('should run without an error', async function() { const result = await answerToTheUltimateQuestion() expect(result).to.be.equal(42) }) }) })
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;q=0.8, *;q=0.5 Accept-Language: en-US,en;q=0.5 Acc...
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/* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive The client will accept Content...
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 Accept-Language: * Accept-Encoding: gzip, deflate Connection: keep-alive The client will accept any language.
from chempy import balance_stoichiometry # Main reaction in NASA's booster rockets: reac, prod = balance_stoichiometry({'NH4ClO4', 'Al'}, {'Al2O3', 'HCl', 'H2O', 'N2'}) from pprint import pprint pprint(reac) {'Al': 10, 'NH4ClO4': 6} pprint(prod) {'Al2O3': 5, 'H2O': 9, 'HCl': 6, 'N2': 3} ...
from chempy import Equilibrium from chempy.chemistry import Species water_autop = Equilibrium({'H2O'}, {'H+', 'OH-'}, 10**-14) # unit "molar" assumed ammonia_prot = Equilibrium({'NH4+'}, {'NH3', 'H+'}, 10**-9.24) # same here from chempy.equilibria import EqSystem substances = ...
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 -...
Searches can also be done on elasticsearch using a search DSL.The query element within the search request body allows to define a query using the Query DSL. GET /my_index/type/_search { "query" : { "term" : { "field_to_search" : "search_item" }...
It is possible to switch the language of Crystal Reports user interface. It may be useful to change the language to English before posting screenshots on StackOverflow. You can switch between languages using View | Product Locale: This menu shows all language packs that have been selected during...
When objects are created or modified they are not automatically available for IntelliSense. To make them available to IntelliSense the local cache has to be refreshed. Within an query editor window either press Ctrl + Shift + R or select Edit | IntelliSense | Refresh Local Cache from the menu. Aft...
A simple OGL 4.0 GLSL shader program that shows the use shader subroutines. The program is executed with a phyton script. To run the script, PyOpenGL and NumPy must be installed. The subroutines switch between different geometry generated in the geometry shader and change the surface representatio...
From the GitHub repo of RxJava, RxJava is a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences. It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose seq...
SQL Server 2012 Returns the item at the specified index from a list of values. If index exceeds the bounds of values then NULL is returned. Parameters: index: integer, index to item in values. 1-based. values: any type, comma separated list SELECT CHOOSE (1, 'apples', 'pears', 'oranges', 'b...

Page 104 of 109