Tutorial by Examples

DECLARE @VariableName INT SET @VariableName = 1 PRINT @VariableName 1 Using SET, you can only update one variable at a time.
Using SELECT, you can update multiple variables at once. DECLARE @Variable1 INT, @Variable2 VARCHAR(10) SELECT @Variable1 = 1, @Variable2 = 'Hello' PRINT @Variable1 PRINT @Variable2 1 Hello When using SELECT to update a variable from a table column, if there are multiple values, it wi...
DECLARE @Var1 INT = 5, @Var2 NVARCHAR(50) = N'Hello World', @Var3 DATETIME = GETDATE()
This is an example of what a simple Arduino sketch looks like after being imported into Atmel Studio. Atmel Studio added the auto generated sections at the top. The rest is identical to the original Arduino code. If you expand the ArduinoCore project that was created and look in the src -> cor...
You can group related assertions in deftest unit tests within a context using the testing macro: (deftest add-nums (testing "Positive cases" (is (= 2 (+ 1 1))) (is (= 4 (+ 2 2)))) (testing "Negative cases" (is (= -1 (+ 2 -3))) (is (= -4 (+ 8 -12))))) ...
deftest is a macro for defining a unit test, similar to unit tests in other languages. You can create a test as follows: (deftest add-nums (is (= 2 (+ 1 1))) (is (= 3 (+ 1 2)))) Here we are defining a test called add-nums, which tests the + function. The test has two assertions. You can ...

are

The are macro is also part of the clojure.test library. It allows you to make multiple assertions against a template. For example: (are [x y] (= x y) 4 (+ 2 2) 8 (* 2 4)) => true Here, (= x y) acts as a template which takes each argument and creates an is assertion out of it. Thi...
seq is a more flexible function than the : operator allowing to specify steps other than 1. The function creates a sequence from the start (default is 1) to the end including that number. You can supply only the end (to) parameter seq(5) # [1] 1 2 3 4 5 As well as the start seq(2, 5) # or se...
Input table data (People table) IdNameAge1John232Jane31 Query SELECT Id, Name, Age FROM People FOR JSON PATH Result [ {"Id":1,"Name":"John","Age":23}, {"Id":2,"Name":"Jane","Age":31} ]
JSON_VALUE and JSON_QUERY functions parse JSON text and return scalar values or objects/arrays on the path in JSON text. DECLARE @json NVARCHAR(100) = '{"id": 1, "user":{"name":"John"}, "skills":["C#","SQL"]}' SELECT JS...
(let [x true y true z true] (match [x y z] [_ false true] 1 [false true _ ] 2 [_ _ false] 3 [_ _ true] 4)) ;=> 4
(let [v [1 2 3]] (match [v] [[1 1 1]] :a0 [[1 _ 1]] :a1 [[1 2 _]] :a2)) ;; _ is used for wildcard matching ;=> :a2
(let [x {:a 1 :b 1}] (match [x] [{:a _ :b 2}] :a0 [{:a 1 :b _}] :a1 [{:x 3 :y _ :z 4}] :a2)) ;=> :a1
(match [['asymbol]] [['asymbol]] :success) ;=> :success
One can extract a series of consecutive elements from an Array using a Range. let words = ["Hey", "Hello", "Bonjour", "Welcome", "Hi", "Hola"] let range = 2...4 let slice = words[range] // ["Bonjour", "Welcome", &quot...
C++11 NOTE: std::auto_ptr has been deprecated in C++11 and will be removed in C++17. You should only use this if you are forced to use C++03 or earlier and are willing to be careful. It is recommended to move to unique_ptr in combination with std::move to replace std::auto_ptr behavior. Before we ...
Let's say we wish to write Euclid's gcd() as a lambda. As a function, it is: int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); } But a lambda cannot be recursive, it has no way to invoke itself. A lambda has no name and using this within the body of a lambda refers to a captured thi...
COMMON Gitter chat group IBM developerWorks wiki LinkedIn group for connections Mailing list on Midrange.com Wiki on BitBucket
int a = 6; // 0110b (0x06) int b = 10; // 1010b (0x0A) int c = a & b; // 0010b (0x02) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 6, b = 10, c = 2 Why A bit wise A...
int a = 5; // 0101b (0x05) int b = 12; // 1100b (0x0C) int c = a | b; // 1101b (0x0D) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 5, b = 12, c = 13 Why A bit wise OR o...

Page 321 of 1336