Tutorial by Examples: l

--- title: "Hello World!" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) # Running the setup first allows you to set the options for how each chunk of R code # will be handled, and the options are in fact part of the first chunk. # In ...
If you want users to upload files to your server you need to do a couple of security checks before you actually move the uploaded file to your web directory. The uploaded data: This array contains user submitted data and is not information about the file itself. While usually this data is generate...
""" A [GFF parser script][1] in Python for [www.VigiLab.org][2] Description: - That performs buffered reading, and filtering (see: @filter) of .GFF input file (e.g. "[./toy.gff][3]") to keep only rows whose field (column) values are equal to "transcript...
The MIDI Thru is simple and easy to test. When working properly you will be able to install your Arduino project between two MIDI devices, MIDI IN to MIDI OUT and you will be able to verify that the two device operate together. If you have the ability to measure latency, you will see an increase d...
For example, imagine a screen with 3 sections, laid out like this: The blue box might be given a margin of 4,4,0,0. The green box might be given a margin of 4,4,4,0. The purple box margin would be 4,4,4,4. Here's the XAML: (I'm using a grid to achieve the layout; but this design principle applies...
To generalise what we've demonstrated above: individual things contain a fixed margin of "half-the-whitespace", and the container they are held in should have a padding of "half-the-whitespace". You can apply these styles in your application resource dictionary, and then you won'...
Sometimes Android's logcat is running infinitely with errors coming from some process not own by you, draining battery or just making it hard to debug your code. A convenient way to fix the problem without restarting the device is to locate and kill the process causing the problem. From Logcat 03...
// This is a MiDI clk generator. This takes a #defined BPM and // makes the appropriate clk rate. The queue is used to let other messages // through, but allows a clock to go immediately to reduce clock jitter #define QUEUE_DEPTH 128 #define BPM 121 #define MIDI_SYSRT_CLK 0xF8 // clock...
Let's first create a simple "Hello world!" MailboxProcessor which processes one type of message and prints greetings. You'll need the message type. It can be anything, but Discriminated Unions are a natural choice here as they list all the possible cases on one place and you can easily us...
Mailbox processors can be used to manage mutable state in a transparent and thread-safe way. Let's build a simple counter. // Increment or decrement by one. type CounterMessage = | Increment | Decrement let createProcessor initialState = MailboxProcessor<CounterMessage>.Sta...
You can asynchronously return a value for each processed message if you send an AsyncReplyChannel<'a> as part of the message. type MessageWithResponse = Message of InputData * AsyncReplyChannel<OutputData> Then the mailbox processor can use this channel when processing the message to...
Blocking Operation Example let loop = (i, max) => { while (i < max) i++ return i } // This operation will block Node.js // Because, it's CPU-bound // You should be careful about this kind of code loop(0, 1e+12) Non-Blocking IO Operation Example let i = 0 const step = max =...
#!/bin/bash deploy=false uglify=false while (( $# > 1 )); do case $1 in --deploy) deploy="$2";; --uglify) uglify="$2";; *) break; esac; shift 2 done $deploy && echo "will deploy... deploy = $deploy" $uglify && echo "will...
const http = require('http') const fs = require('fs') const zlib = require('zlib') http.createServer((request, response) => { const stream = fs.createReadStream('index.html') const acceptsEncoding = request.headers['accept-encoding'] let encoder = { hasEncoder ...
""" CannyTrackbar function allows for a better understanding of the mechanisms behind Canny Edge detection algorithm and rapid prototyping. The example includes basic use case. 2 of the trackbars allow for tuning of the Canny function and the other 2 help with understanding h...
You might want to rename the fields in the join table to be a little more friendly. You can do this by using the usual configuration methods (again, it doesn't matter which side you do the configuration from): public class CarEntityTypeConfiguration : EntityTypeConfiguration<Car> { publi...
HERE Android Premium SDK samples Now available on Github! [https://github.com/heremaps/here-android-sdk-examples][1] HERE iOS Premium SDK samples Now available on Github! [https://github.com/heremaps/here-ios-sdk-examples][1] Please refer to the README.md on how to get started. Note the samples ...
As an example we want to set all string properties of a sample class class TestClass { val readOnlyProperty: String get() = "Read only!" var readWriteString = "asd" var readWriteInt = 23 var readWriteBackedStringProperty: String = "" ...
Extra goals enable to add processing to DCG clauses, for example, conditions that the elements of the list must satisfy. The extra goals are observed between curly braces at the end of a DCG clause. % DCG clause requiring an integer int --> [X], {integer(X)}. Usage: ?- phrase(int, [3]). t...
Let's define a grammar enabling us to perform additions, multiplications with the usage of parenthesis. To add more value to this example, we are going to compute the result of the arithmetic expression. Summary of the grammar: expression → times expression → times '+' expression times → elemen...

Page 760 of 861