Tutorial by Examples: er

Common Requirements All reports, regardless of how the data is presented, take a path to the report template and a parameter map. The variables are used in all examples that follow: // Parameters passed into the report. Map<String, Object> parameters = new HashMap<>(); // Arbitrary...
When working with existing model that is quite big and is being regenerated quite often in cases where abstraction needed it might be costly to manually go around redecorating model with interfaces. In such cases one might want to add some dynamic behavior to model generation. Following example wil...
:s/foo/bar/c Marks the first instance of foo on the line and asks for confirmation for substitution with bar :%s/foo/bar/gc Marks consecutively every match of foo in the file and asks for confirmation for substitution with bar
Some ADO.NET providers (most notably: OleDB) do not support named parameters; parameters are instead specified only by position, with the ? place-holder. Dapper would not know what member to use for these, so dapper allows an alternative syntax, ?foo?; this would be the same as @foo or :foo in other...
User-defined method objects may be created when getting an attribute of a class (perhaps via an instance of that class), if that attribute is a user-defined function object, an unbound user-defined method object, or a class method object. class A(object): # func: A user-defined function object...
In C, a pointer can refer to another pointer. #include <stdio.h> #include <stdlib.h> int main(void) { int A = 42; int* pA = &A; int** ppA = &pA; int*** pppA = &ppA; printf("%d", ***pppA); /* prints 42 */ return EXIT_SUCCESS; } But, ref...
ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_bar(stat = "count", position = "dodge") it is possible to obtain an horizontal bar chart simply adding coord_flip() aesthetic to the ggplot object: ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_ba...
async.series(tasks, afterTasksCallback) will execute a set of tasks. Each task are executed after another. If a task fails, async stops immediately the execution and jump into the main callback. When tasks are finished successfully, async call the "master" callback with all errors and all...
async.waterfall(tasks, afterTasksCallback) will execute a set of tasks. Each task are executed after another, and the result of a task is passed to the next task. As async.series(), if a task fails, async stop the execution and call immediately the main callback. When tasks are finished successfull...
SELECT name, caption as title, year, pages FROM books UNION SELECT name, title, year, 0 as pages FROM movies When combining 2 record sets with different columns then emulate the missing ones with default values.
extern int var; static int var; /* Undefined behaviour */ C11, §6.2.2, 7 says: If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined. Note that if an prior declaration of an identifier is visible then it'll have the pri...
Use the yum command to manage packages in Enterprise Linux-based operating systems: yum install php This installs a minimal install of PHP including some common features. If you need additional modules, you will need to install them separately. Once again, you can use yum to search for these pac...
You can use the header() function to instruct the browser to redirect to a different URL: $url = 'https://example.org/foo/bar'; if (!headers_sent()) { // check headers - you can not send headers if they already sent header('Location: ' . $url); exit; // protects from code being executed afte...
Improper Inheritance Lets say there are 2 classes class Foo and Bar. Foo has two features Do1 and Do2. Bar needs to use Do1 from Foo, but it doesn't need Do2 or needs feature that is equivalent to Do2 but does something completely different. Bad way: make Do2() on Foo virtual then override it in B...
C# developers get a lot of null reference exceptions to deal with. F# developers don't because they have the Option type. An Option<> type (some prefer Maybe<> as a name) provides a Some and a None return type. It makes it explicit that a method may be about to return a null record. For...
The assignment operator = sets thr left hand operand's value to the value of right hand operand, and return that value: int a = 3; // assigns value 3 to variable a int b = a = 5; // first assigns value 5 to variable a, then does the same for variable b Console.WriteLine(a = 3 + 4); // prints ...
Angular js directives can be nested or be made interoperable. In this example, directive Adir exposes to directive Bdir it's controller $scope, since Bdir requires Adir. angular.module('myApp',[]).directive('Adir', function () { return { restrict: 'AE', controlle...
enum Util { /* No instances */; public static int clamp(int min, int max, int i) { return Math.min(Math.max(i, min), max); } // other utility methods... } Just as enum can be used for singletons (1 instance classes), it can be used for utility classes (0 instance...
When you wish to combine the results of multiple tables or queries with similar fields together into a single resulting data set without performing any relational joins (i.e. you want to list one dataset immediately after the other), you will use a UNION query. However, it is notable that these quer...
The http_build_query() will create a query string from an array or object. These strings can be appended to a URL to create a GET request, or used in a POST request with, for example, cURL. $parameters = array( 'parameter1' => 'foo', 'parameter2' => 'bar', ); $queryString = http_b...

Page 169 of 417