Tutorial by Examples: sin

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] ...
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...
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"...
$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...
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 ...
Plugins can be configured by annotating fields with @Parameter. The MOJO is then injected with the configuration. @Mojo(name = "greet") public final class GreetMojo extends AbstractMojo { @Parameter(required = true) public String name; public void execute() throws Mojo...
The plugin can, among others, access information about the current Maven project being built. @Mojo(name = "project") public final class ProjectNameMojo extends AbstractMojo { @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenPro...
A synchronous producer-consumer solution ensures that the consumer reads every data item written by the producer exactly one time. Asynchronous solutions allow the consumer to sample the output of the producer. Either the consumer consumes the data faster than it is produced, or the consumer consume...
Some applications may want to create so-called "Fire & Forget" tasks which can be periodically triggered and do not need to return any type of value returned upon completion of the assigned task (for example, purging old temp files, rotating logs, autosaving state). In this example, w...
It is often necessary to execute a long-running task and use the result of that task once it has completed. In this example, we will create two classes: One which implements the Callable<T> interface (where T is the type we wish to return), and one which contains a main() method. AsyncValueT...
The S in S.O.L.I.D stands for Single responsibility principle(SRP). Responsibility means in this context reasons to change, so the principle states that a class should only have one reason to change. Robert C. Martin stated it (during his lecture at Yale shool of management in 10 Sep 2014) as foll...
2009 3rd March : The project was named as "node" 1st October : First very early preview of npm, the Node package manager 8th November : Ryan Dahl's (Creator of Node.js) Original Node.js Talk at JSConf 2009 2010 Express: A Node.js web development framework Socket.io initial...
private final String COLLECTION_NAME = "myCollection"; private final String ZOOKEPER_CLIENT_TIMEOUT_MS = "1000000" private Map<String, String> getShardLeaders(CloudSolrServer cloudSolrServer) throws InterruptedException, KeeperException { Map<String, Stri...
If we have a schema looking like: <field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="name" type="string" indexed="true" stored="true" /> the solrj co...
public String getHighlightedText(final QueryResponse queryResponse, final String fieldName, final String docId) { String highlightedText = ""; Map<String, Map<String, List<String>>> highlights = queryResponse.getHighlighting(); if (highlights!=null &&am...
While good software design often maximizes code reusability, sometimes it can be useful to define asynchronous tasks inline in your code via Lambda expressions to maximize code readability. In this example, we will create a single class which contains a main() method. Inside this method, we will us...
import com.couchbase.client.core.endpoint.SSLEngineFactory import com.couchbase.client.java.env.DefaultCouchbaseEnvironment import com.couchbase.client.java.CouchbaseCluster object CouchbaseConnection extends App { //Create default environment object. //Set the keystone file path(downlo...
While using Image/Colour as an background in a CardView, You might end up with slight white paddings (If default Card colour is white) on the edges. This occurs due to the default rounded corners in the Card View. Here is how to avoid those margins in Pre-lollipop devices. We need to use an attribu...

Page 132 of 161