Tutorial by Examples: c

Type Families are not necessarily injective. Therefore, we cannot infer the parameter from an application. For example, in servant, given a type Server a we cannot infer the type a. To solve this problem, we can use Proxy. For example, in servant, the serve function has type ... Proxy a -> Server...
In this example, User Table will have a column that references the Agency table. CREATE TABLE agencies ( -- first create the agency table id SERIAL PRIMARY KEY, name TEXT NOT NULL ) CREATE TABLE users ( id SERIAL PRIMARY KEY, agency_id NOT NULL INTEGER REFERENCES agencies(id) DEFERR...
In a data declaration, prefixing a type with a bang (!) makes the field a strict field. When the data constructor is applied, those fields will be evaluated to weak head normal form, so the data in the fields is guaranteed to always be in weak head normal form. Strict fields can be used in both rec...
wire d = 1'bx; // say from previous block. Will be 1 or 0 in hardware if (d == 1'b) // false in simulation. May be true of false in hardware
Simple Hello World Application: using System; namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); } } } Equivalent IL Code (which will be JIT compiled) // Microsoft (R) ...
It is possible to use integer variables with latex. To create a new variable we need the \newcounter{name} command, where name is the name of the new counter. The name must contain only letters. This command creates a new one with name \thename. With this command we can print name variable onto the ...
Completion can be used to match words used in a document. When typing a word, Ctrlp or Ctrln will match previous or next similar words in the document. This can even be combined with Ctrl-X mode to complete entire lines. For instance type something like: This is an example sentence. then go to ...
C++17 The if constexpr statement can be used to conditionally compile code. The condition must be a constant expression. The branch not selected is discarded. A discarded statement inside a template is not instantiated. For example: template<class T, class ... Rest> void g(T &&p, Re...
One good reason to use Filters is for logging. Using this technique a REST call can be logged and timed easily. public class RestLogger implements ClientRequestFilter, ClientResponseFilter { private static final Logger log = LoggerFactory.getLogger(RestLogger.class); // Used for timing...
package com.test.ws.example; import javax.xml.soap.MessageFactory; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnve...
This example shows how to use mathematical operations with counters. It may be useful for loops in latex. Addition: \addtocounter{num}{n} this command adds n to num, where num is a counter and n is a positive integer. Subtraction: \addtocounter{num}{-n} this command subtracts n from num, where n...
There are certain principles that apply to optimization in any computer language, and Python is no exception. Don't optimize as you go: Write your program without regard to possible optimizations, concentrating instead on making sure that the code is clean, correct, and understandable. If it's too...
Nested for loops may be used to iterate over a number of unique iterables. result = [] for a = iterable_a for b = iterable_b push!(result, expression) end end Similarly, multiple iteration specifications may be supplied to an array comprehension. [expression for a = iterabl...
Generator comprehensions follow a similar format to array comprehensions, but use parentheses () instead of square brackets []. (expression for element = iterable) Such an expression returns a Generator object. julia> (x^2 for x = 1:5) Base.Generator{UnitRange{Int64},##1#2}(#1,1:5) Fun...
&& chains two commands. The second one runs only if the first one exits with success. || chains two commands. But second one runs only if first one exits with failure. [ a = b ] && echo "yes" || echo "no" # if you want to run more commands within a logical c...
A semicolon separates just two commands. echo "i am first" ; echo "i am second" ; echo " i am third"
The | takes the output of the left command and pipes it as input the right command. Mind, that this is done in a subshell. Hence you cannot set values of vars of the calling process wihtin a pipe. find . -type f -a -iname '*.mp3' | \ while read filename; do mute --noise &quot...
This Example using Standard EXE Project With addition of a Module File. Create New "Standard EXE" Project. So here, a Form will get added to the Project by default. Add a Module File to the Project Place a Command Button on the Form Create Command Button Click Event. Module code...
Adding a video that will autoplay on a loop and has no controls or sound. Perfect for a video header or background. <video width="1280" height="720" autoplay muted loop poster="video.jpg" id="videobg"> <source src="video.mp4" type="...
Glyphicons can be used in text, buttons, toolbars, navigation, forms, etc (Source: W3Schools). Glyphicons are basically icon forms that can be used to style any of the aforementioned. These examples outline the usage of glyphicons inside two types of buttons by simply using a span inside the buttons...

Page 720 of 826