Tutorial by Examples: c

It's a good practice to scope patches using Refinements, but sometimes it's nice to load it globally (for example in development, or testing). Say for example you want to start a console, require your library, and then have the patched methods available in the global scope. You couldn't do this wit...
Refinements have special limitations. refine can only be used in a module scope, but can be programmed using send :refine. using is more limited. It can only be called in a class/module definition. Still, it can accept a variable pointing to a module, and can be invoked in a loop. An example show...
struct Mathematics { internal func performOperation(inputArray: [Int], operation: (Int)-> Int)-> [Int] { var processedArray = [Int]() for item in inputArray { processedArray.append(operation(item)) } retur...
func multiply2(item: Int)-> Int { return (item + 2) } let multiply2ToMe = multiply2 // passing the function directly to the function as param print(math.performOperation(inputArray: arrayToBeProcessed, operation: multiply2ToMe)) Output: [3, 5, 7, 9, 11, 13, 10, 8, 6, 4, 102] ...
// function as return type print(math.performComplexOperation(valueOne: 4)(5)) Output: 9
The following will produce a PNG image in the current directory of the loaded page. chrome --headless --screenshot https://stackoverflow.com
Using the --remote-debugging-port to expose a debugger accessible over HTTP is one way appliances can connect and interact with the document using the Chrome Debugging Protocol. chrome --headless --remote-debugging-port=9222 https://stackoverflow.com You can then navigate to http://localhost:9222 ...
Using srcset with sizes <img sizes="(min-width: 1200px) 580px, (min-width: 640px) 48vw, 98vw" srcset="img/hello-300.jpg 300w, img/hello-600.jpg 600w, img/hello-900.jpg 900w, img/hello-1200.jpg 1200w" src="img/hello-900.jpg&quo...
The query string is the part of a request following the URL, preceded by a ? mark. Example: https://encrypted.google.com/search?hl=en&q=stack%20overflow For this example, we are making a simple echo webserver that echos back everything submitted to it via the echo field in GET requests. Examp...
Flask also allows access to a CombinedMultiDict that gives access to both the request.form and request.args attributes under one variable. This example pulls data from a form field name submitted along with the echo field in the query string. Flask Example: from flask import Flask, request app...
You can access the form data submitted via a POST or PUT request in Flask via the request.form attribute. from flask import Flask, request app = Flask(import_name=__name__) @app.route("/echo", methods=["POST"]) def echo(): name = request.form.get("name"...
In Swift 1 and 2, closure parameters were escaping by default. If you knew your closure wouldn’t escape the function body, you could mark the parameter with the @noescape attribute. In Swift 3, it’s the other way around: closure parameters are non-escaping by default. If you intend for it to escape...
From Swift Documentarion @escaping Apply this attribute to a parameter’s type in a method or function declaration to indicate that the parameter’s value can be stored for later execution. This means that the value is allowed to outlive the lifetime of the call. Function type parameters wi...
You can't improve something you can't measure. To improve the performance of React components, you should be able to measure it. ReactJS provides with addon tools to measure performance. Import the react-addons-perf module to measure the performance import Perf from 'react-addons-perf' // ES6 var ...
Here are the steps required to install Gradle plugin in Eclipse: Open Eclipse and go to Help -> Eclipse Marketplace In the search bar, enter buildship and hit enter Select "Buildship Gradle Integration 1.0" and click Install In the next window, click Confirm Then, accept the term...
$username = "[email protected]" $pwdTxt = Get-Content "C:\temp\Stored_Password.txt" $securePwd = $pwdTxt | ConvertTo-SecureString $credObject = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $securePwd # Now, $credObject is having the credential...
Module Module1 Sub Main() Debug.WriteLine("This line will be shown in the Visual Studio output console") Console.WriteLine("Press a key to exit") Console.ReadKey() Debug.WriteLine("End of application") End Sub End Modul...
On 32-bit systems, integers greater than 0x7FFFFFFF cannot be stored primitively, while integers between 0x0000000080000000 and 0x7FFFFFFFFFFFFFFF can be stored primitively on 64-bit systems but not 32-bit systems (signed long long). However, since 64-bit systems and many other languages support sto...
with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; with Ada.Text_IO; procedure Producer_Consumer_V1 is type Work_Item is range 1 .. 100; package Work_Item_Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces ...
Once you have your UWP application ready for tests you should add test application to your solution. To do it "right" click on the solution and choose "Unit Test App (Universal Windows)": Once you add it to the solution there are few more steps required to configure it. You w...

Page 674 of 826