Tutorial by Examples: c

UML is not about diagramming. It is about choosing the right words to express some (in most cases technical) context. Diagrams are a means to present the chosen text to humans since a visual perception is generally a good way to convey information. So you will be using graphical elements not in orde...
Sometimes for organizational or other reasons it makes sense to have your top level resource return a sub-resource that would look like this. (Your sub-resource does not need to be an inner class) import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("items&q...
If the size of your content is fixed, you can use absolute positioning to 50% with margin that reduces half of your content's width and height: HTML <div class="center"> Center vertically and horizontally </div> CSS .center { position: absolute; background...
.my-div { width: 300px; height: 200px; background-size: 100%; background-repeat: no-repeat; background-image: linear-gradient(to right, black 0%,white 100%), url('https://static.pexels.com/photos/54624/strawberry-fruit-red-sweet-54624-medium.jpeg'); background-blend-mod...
A common thought pattern for inexperienced Java programmers is that exceptions are "a problem" or "a burden" and the best way to deal with this is catch them all1 as soon as possible. This leads to code like this: .... try { InputStream is = new FileInputStream(fileName);...
<dom-module id="using-listeners-obj"> <template> <style> :host{ width: 220px; height: 100px; border: 1px solid black; display: block; } #inner{ width: calc(100% - 10px); height: 50px; ...
You can also fire your own events and then listen to them from either Polymer element of HTML page This Element fires the custom event <dom-module id="custom-event"> <template> <style> #inner{ width: 200px; height: 50px; bor...
Properties with notify:true also fires an event <link rel="import" href="../bower_components/paper-input/paper-input.html"> <dom-module id="property-change-event"> <template> <style></style> <paper-input id="input&quo...
To search for text foo within a {} block surrounding the cursor use the following command (<ESC> - escape key, <CR> - enter key) : vi{<ESC>/\%Vfoo<CR> now you can jump between the matches within the block by pressing n and p. If you have hlsearch option enabled this will ...
As a privileged user (root or sudo): Create scollector directory: mkdir /opt/scollector In the /opt/scollector directory, download the latest binary build from the bosun/scollector site, [http://bosun.org/scollector/][1] wget https://github.com/bosun-monitor/bosun/releases/download/"version...
The Runnable interface defines a single method, run(), meant to contain the code executed in the thread. The Runnable object is passed to the Thread constructor. And Thread's start() method is called. Example public class HelloRunnable implements Runnable { @Override public void run()...
Almost any MPI call returns an integer error code, which signifies the success of the operation. If no error occurs, the return code is MPI_SUCCESS: if (MPI_Some_op(...) != MPI_SUCCESS) { // Process error } If an error occurs, MPI calls an error handler associated with the communicator, ...
An example of a class that contains a parcelable class inside: public class Repository implements Parcelable { private String name; private Owner owner; private boolean isPrivate; public Repository(String name, Owner owner, boolean isPrivate) { this.name = name; ...
get-childitem | foreach-object { if ($_.IsReadOnly) { return } } Pipeline cmdlets (ex: ForEach-Object, Where-Object, etc) operate on closures. The return here will only move to the next item on the pipeline, not exit processing. You can use break instead of return if you want to exit processing...
Inspired by PowerShell: Function doesn't have proper return value function bar { [System.Collections.ArrayList]$MyVariable = @() $MyVariable.Add("a") | Out-Null $MyVariable.Add("b") | Out-Null $MyVariable } The Out-Null is necessary because the .NET ArrayLis...
A function is similar in look to a mixin but it doesn't add any styles, it only returns a value. Functions should be used to prevent repeated logic in your styles. Sass has some built-in functions that are called using the standard CSS function syntax. h1 { background: hsl(0, 25%, 50%); } ...
Install webpack-dev-server via npm. npm i -D webpack-dev-server Configure webpack-dev-server by adding server.js. // server.js var webpack = require("webpack"); var WebpackDevServer = require("webpack-dev-server"); var config = require("./webpack.dev.config...
To create a redistributable package (e.g. a ZIP archive or setup program), it's usually enough to simply invoke CPack using a syntax very similar to calling CMake: cpack path/to/build/directory Depending on the environment this will gather all required/installed files for the project and put the...
To create a package using a specific format, it is possible to pick the Generator to be used. Similar to CMake this may be done using the -G argument: cpack -G 7Z . Using this command line would package the built project in the current directory using the 7-Zip archive format. At the time of w...
It is easy to get confused in the C preprocessor, and treat it as part of C itself, but that is a mistake because the preprocessor is just a text substitution mechanism. For example, if you write /* WRONG */ #define MAX 100; int arr[MAX]; the code expands to int arr[100;]; which is a synta...

Page 404 of 826