Tutorial by Examples

LINQ queries do not execute immediately. When you are building the query you are simply storing the query for future execution. Only when you actually request to iterate the query is the query executed (e.g. in a for loop, when calling ToList, Count, Max, Average, First, etc.) This is considered de...
--- 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 more complex MIDI THRU. This version uses a queue. Queues are important because some // MIDI messages can be interrupted for real time events. If you are generating your own messages, // you may need to stop your message to let a "real time" message through and then resum...
// 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...
You can use Scan or TryScan methods to look for specific messages in the queue and process them regardless of how many messages are before them. Both methods look at the messages in the queue in the order they arrived and will look for a specified message (up until optional timeout). In case there i...
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 =...
The root process scatters the contents in sendbuf to all processes (including itself) using the MPI_Scatter operation. int rank; int size; int sendcount = 1; int recvcount = sendcount; int sendbuf[3]; int recvbuf; int root = 0; MPI_Comm_size (MPI_COMM_WORLD, &size); if (size != 3) ...
#!/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...
Starting from a sequence of static images (for example called frame01.jpg, frame02.jpg and so on) an animated gif can be created using the following command: magick -delay 10 -loop 0 frame*.jpg animation.gif -delay 10 sets the interval between the frames to 0.1 seconds -loop 0 creates a...
So let's say again that you have the following model: public class Person { public int PersonId { get; set; } public string Name { get; set; } } public class Car { public int CarId { get; set; } public string LicensePlate { get; set; } } public class MyDemoContext : DbContext ...
Mapping one-to-one (when both sides are required) is also a tricky thing. Let's imagine how this could be represented with foreign keys. Again, a CarId in People that refers to CarId in Car, and a PersonId in Car that refers to the PersonId in People. Now what happens if you want to insert a car r...

Page 1183 of 1336