Tutorial by Examples

Detailed instructions on getting push-notification set up or installed.
λ> :t 1 1 :: Num t => t λ> :t pi pi :: Floating a => a In the examples above, the type-checker infers a type-class rather than a concrete type for the two constants. In Haskell, the Num class is the most general numerical one (since it encompasses integers and reals), but pi must...
The error message in the title is a common beginner mistake. Let's see how it arises and how to fix it. Suppose we need to compute the average value of a list of numbers; the following declaration would seem to do it, but it wouldn't compile: averageOfList ll = sum ll / length ll The problem is...
What's the type of (+) ? λ> :t (+) (+) :: Num a => a -> a -> a What's the type of sqrt ? λ> :t sqrt sqrt :: Floating a => a -> a What's the type of sqrt . fromIntegral ? sqrt . fromIntegral :: (Integral a, Floating c) => a -> c
Create a file ckeditor-content.html with the following content: <!DOCTYPE html> <html> <head> <title>CKEditor Get Content Demo!</title> </head> <body> <script src="//cdn.ckeditor.com/4.6.1/basic/ckeditor.js"></script> ...
Enumerating through Keys foreach ($key in $var1.Keys) { $value = $var1[$key] # or $value = $var1.$key } Enumerating through Key-Value Pairs foreach ($keyvaluepair in $var1.GetEnumerator()) { $key1 = $_.Key1 $val1 = $_.Val1 }
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...
This can be usefull when you want to visualize incoming data in real-time. This data could, for example, come from a microcontroller that is continuously sampling an analog signal. In this example we will get our data from a named pipe (also known as a fifo). For this example, the data in the pipe ...
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 code below shows how to perform asynchronous navigation when the app is in a MasterDetailPage context. public async Task NavigateMasterDetail(Page page) { if (page == null) { return; } var masterDetail = App.Current.MainPage as Mas...
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...
Data types to string formatting Data types like int, float, double, long, boolean can be formatted to string using String.valueOf(). String.valueOf(1); //Output -> "1" String.valueOf(1.0); //Output -> "1.0" String.valueOf(1.2345); //Output -> "1.2345" Stri...
Detailed instructions on getting sharepoint-2013 set up or installed.
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...

Page 1083 of 1336