Tutorial by Examples: er

This example is written with F# in mind but the ideas are applicable in all environments The first rule when optimizing for performance is to not to rely assumption; always Measure and Verify your assumptions. As we are not writing machine code directly it is hard to predict how the compiler an...
This error happens if a unknown object is used. Variables Not compiling: #include <iostream> int main(int argc, char *argv[]) { { int i = 2; } std::cout << i << std::endl; // i is not in the scope of the main function return 0; } Fix: #i...
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...
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...
Outline is a line that goes around the element, outside of the border. In contrast to border, outlines do not take any space in the box model. So adding an outline to an element does not affect the position of the element or other elements. In addition, outlines can be non-rectangular in some brows...
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...
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]
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 working with large files, you can use the System.IO.File.ReadLines method to read all lines from a file into an IEnumerable<string>. This is similar to System.IO.File.ReadAllLines, except that it doesn't load the whole file into memory at once, making it more efficient when working with l...
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Integer is range -42 .. 42; X : Some_Integer := 17; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 17
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (X'Image); Ada.Text_IO.Put_Line (Pear'Image); end Main; Result ORANGE PEAR
Jupyter Notebooks are an interactive, browser-based development environment. They were originally developed to run computation python and as such play very well with numpy. To try numpy in a Jupyter notebook without fully installing either on one's local system Rackspace provides free temporary note...

Page 183 of 417