Tutorial by Examples: c

This linker error happens, if the linker can't find a used symbol. Most of the time, this happens if a used library is not linked against. qmake: LIBS += nameOfLib cmake: TARGET_LINK_LIBRARIES(target nameOfLib) g++ call: g++ -o main main.cpp -Llibrary/dir -lnameOfLib One might also for...
The compiler can't find a file (a source file uses #include "someFile.hpp"). qmake: INCLUDEPATH += dir/Of/File cmake: include_directories(dir/Of/File) g++ call: g++ -o main main.cpp -Idir/Of/File
An interesting but rather unknown usage of Active Patterns in F# is that they can be used to validate and transform function arguments. Consider the classic way to do argument validation: // val f : string option -> string option -> string let f v u = let v = defaultArg v "Hello&quo...
F# uses the type keyword to create different kind of types. Type aliases Discriminated union types Record types Interface types Class types Struct types Examples with equivalent C# code where possible: // Equivalent C#: // using IntAliasType = System.Int32; type IntAliasType = int // ...
A container will stop if no command is running on the foreground. Using the -t option will keep the container from stopping, even when detached with the -d option. docker run -t -d debian bash
docker stop mynginx Additionally, the container id can also be used to stop the container instead of its name. This will stop a running container by sending the SIGTERM signal and then the SIGKILL signal if necessary. Further, the kill command can be used to immediately send a SIGKILL or any ot...
eof returns true only after reading the end of file. It does NOT indicate that the next read will be the end of stream. while (!f.eof()) { // Everything is OK f >> buffer; // What if *only* now the eof / fail bit is set? /* Use `buffer` */ } You could correctly write: ...
You can specify different dependencies for each platforms: "net45": { "frameworkAssemblies": { "System.Linq": "4.1.0" } }, "netstandard1.3": { "dependencies": { "NETStandard.Library": "1.6....
Using Derived column we can prepare the input. We will provide yyyy-MM-dd to the final conversion: Year: (DT_STR,4,1252)(DataDate / 10000) Month: (DT_STR,2,1252)(DataDate / 100 % 100) Day: (DT_STR,2,1252)(DataDate % 100) All together: (DT_DBDATE)((DT_STR,4,1252)(DataDate / 10000) + "-&q...
Using c# or vb.net code the conversion is even more simple. An output column is needed because we type can not be changed on the fly, alternative is adding an input column on forehand make it ReadWrite. Next code will fill the new column. public override void Input0_ProcessInputRow(Input0Buffer ...
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int i; for(i = 0; i < 10; i++) { printf("%d\n", arr[i]); }
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int i = 0; while(i < 10) { printf("%d\n", arr[i]); i++; }
int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int i = 0; do { printf("%d\n", arr[i]); i++; } while (i < 10);
int [] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; for(int value : arr) { System.out.print(value); System.out.print("\n"); } *Note that the Java foreach is just a for loop with different syntax. Some languages do this and some such as C# use foreach.
int sumArrayRecursive(int * arr, int index, int arraySize) { if (index == (arraySize - 1)) { return arr[index]; } return arr[index] + sumArrayRecursive(arr, index + 1, arraySize); }
var numbers = [1,2,3,4,5]; var squares = numbers.map(function(x) { return x*x; }); // squares is [1,4,9,16,25]
var arr = [1, 2, 3, 4, 5]; var sum = arr.reduce((prev, curr) => prev + curr); console.log(sum); // Output: 15 You can also specify an initial value var arr = [1, 2, 3, 4, 5]; var sum = arr.reduce(function (previousValue, currentValue, currentIndex, array) { return previousValue + cur...
Install node modules npm install express npm install socket.io Node.js server const express = require('express'); const app = express(); const server = app.listen(3000,console.log("Socket.io Hello World server started!")); const io = require('socket.io')(server); io.on('connec...
Although this works only for WebKit based browsers, this is helpful: /* ----------- Non-Retina Screens ----------- */ @media screen and (min-width: 1200px) and (max-width: 1600px) and (-webkit-min-device-pixel-ratio: 1) { } /* ----------- Retina Screens ----------- */ @media scre...
When an object is exposed to the template context, its arguments-less methods are available. This is useful when these functions are "getters". But it can be hazardeous if these methods alter some data or have some side effects. Eventhough you likely trust the template writer, he may not b...

Page 357 of 826