Tutorial by Examples: e

Jumping out of nested loops would usually require use of a boolean variable with a check for this variable in the loops. Supposing we are iterating over i and j, it could look like this size_t i,j; for (i = 0; i < myValue && !breakout_condition; ++i) { for (j = 0; j < mySecondVa...
A lot of people who are new to multi-threading think that using threads automatically make an application go faster. In fact, it is a lot more complicated than that. But one thing that we can state with certainty is that for any computer there is a limit on the number of threads that can be run at ...
Returning a value One commonly used case: returning from main() #include <stdlib.h> /* for EXIT_xxx macros */ int main(int argc, char ** argv) { if (2 < argc) { return EXIT_FAILURE; /* The code expects one argument: leave immediately skipping t...
When programming in Prolog it is not always possible, or desirable, to create predicates which unify for every possible combination of parameters. For example, the predicate between(X,Y,Z) which expresses that Z is numerically between X and Y. It is easily implemented in the cases where X, Y, and Z ...
Immediately continue reading on invalid input or break on user request or end-of-file: #include <stdlib.h> /* for EXIT_xxx macros */ #include <stdio.h> /* for printf() and getchar() */ #include <ctype.h> /* for isdigit() */ void flush_input_stream(FILE * fp); int main(v...
You can take a look at the full code in this working Plunker. In this example I use a shared service to handle the communication between the pages inside the tab (child pages) and the tab container (the component that holds the tabs). Even though you probably could do it with Events I like the shar...
Given: x <- as.matrix(mtcars) One can use heatmap.2 - a more recent optimized version of heatmap, by loading the following library: require(gplots) heatmap.2(x) To add a title, x- or y-label to your heatmap, you need to set the main, xlab and ylab: heatmap.2(x, main = "My main t...
In Gloss, one can use the display function to create very simple static graphics. To use this one needs to first import Graphics.Gloss. Then in the code there should the following: main :: IO () main = display window background drawing window is of type Display which can be constructed in two ...
Sometimes, programmers who are new to Java make the mistake of defining a class with a name that is the same as a widely used class. For example: package com.example; /** * My string utilities */ public class String { .... } Then they wonder why they get unexpected errors. For ex...
Render a white rectangle over an image with the composite operation ctx.globalCompositeOperation = 'difference'; The amount of the effect can be controled with the alpha setting // Render the image ctx.globalCompositeOperation='source-atop'; ctx.drawImage(image, 0, 0); // set the composite...
Remove color from an image via ctx.globalCompositeOperation = 'color'; The amount of the effect can be controled with the alpha setting // Render the image ctx.globalCompositeOperation='source-atop'; ctx.drawImage(image, 0, 0); // set the composite operation ctx.globalCompositeOperation='...
Increase the saturation level of an image with ctx.globalCompositeOperation = 'saturation'; The amount of the effect can be controled with the alpha setting or the amount of saturation in the fill overlay // Render the image ctx.globalCompositeOperation='source-atop'; ctx.drawImage(image, 0, ...
Create a colored sepia FX with ctx.globalCompositeOperation = 'luminosity'; In this case the sepia colour is rendered first the the image. The amount of the effect can be controled with the alpha setting or the amount of saturation in the fill overlay // Render the image ctx.globalCompositeOp...
Simple pull When you are working on a remote repository (say, GitHub) with someone else, you will at some point want to share your changes with them. Once they have pushed their changes to a remote repository, you can retrieve those changes by pulling from this repository. git pull Will do it, ...
Detailed instructions on getting wordpress-theming set up or installed. Wordpress is opensource.You can find large set of theme for use free or premium themes.All theme are provide a documentation for install and use. What you have to understand while choose a theme? Wordpress version you are ...
You can use a filter to log only messages "lower" than e.g. ERROR level. But the filter is not supported by PropertyConfigurator. So you must change to XML config to use it. See log4j-Wiki about filters. Example "specific level" <appender name="info-out" class=&quo...
In order to prevent a button from firing multiple times within a short period of time (let's say 2 clicks within 1 second, which may cause serious problems if the flow is not controlled), one can implement a custom SingleClickListener. This ClickListener sets a specific time interval as threshold (...
Html5 Canvas gives you the ability to fetch and change the color of any pixel on the canvas. You can use Canvas's pixel manipulation to: Create a color-picker for an image or select a color on a color-wheel. Create complex image filters like blurring and edge detection. Recolor any part of an ...
GRANT SELECT, UPDATE ON Employees TO User1, User2; Grant User1 and User2 permission to perform SELECT and UPDATE operations on table Employees. REVOKE SELECT, UPDATE ON Employees FROM User1, User2; Revoke from User1 and User2 the permission to perform SELECT and UPDATE operations on tab...
From the Apple documentation: A UIStoryboardSegue object is responsible for performing the visual transition between two view controllers. In addition, segue objects are used to prepare for the transition from one view controller to another. Segue objects contain information about the view contro...

Page 687 of 1191