Tutorial by Examples

Each instantiation and full specialization of the std::atomic template defines an atomic type. If one thread writes to an atomic object while another thread reads from it, the behavior is well-defined (see memory model for details on data races) In addition, accesses to atomic objects may establish...
\documentclass{beamer} When to use the beamer class ? For presentation slides. What are the specificities of this class ? The output is landscape-oriented. The document is separated in "frames" (slides). Simple example Following example was adapted from : sharelatex.com/learn/Beame...
1. at(pos) Returns a reference to the element at position pos with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown. The complexity is constant O(1). #include <array> int main() { std::array<int, 3> arr; ...
Its easy to get lost while debugging the hiearchy. You can use PHP's built in command debug_backtrace. Put the next snippet inside any template you want to debug and view the generated page: <!-- <?php print_r( debug_backtrace() ) ?> -->
Flower is a web based tool to monitor Celery. To install Flower, we can use pip as follows: pip install flower To run Flower for proj: celery -A proj flower Now, flower is accessible in: http://localhost:5555
There are two options to render components on server: renderToString and renderToStaticMarkup. renderToString This will render React components to HTML on server. This function will also add data-react- properties to HTML elements so React on client won't have to render elements again. import { r...
Observer Pattern's intent is to define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. The subject and observers define the one-to-many relationship. The observers are dependent on the subject such that when ...
import React from 'react'; import { Route, IndexRoute } from 'react-router'; import Index from './containers/home'; import App from './components/app'; //for single Component lazy load use this const ContactComponent = () => { return { getComponent: (location, callback)=> { ...
This document explains how to display your GitHub feeds/timeline on your website. Example: A live example is available at: https://newtonjoshua.com GitHub timeline: GitHub provides the public timeline for any user in Atom format. You can view your timeline at: https://github.com/{{GitHub...
We want to be able to compile below component and render it in our webpage Filename: src/index.jsx import React from 'react'; import ReactDOM from 'react-dom'; class ToDo extends React.Component { render() { return (<div>I am working</div>); } } ReactDOM.re...
# install react and react-dom $ npm i react react-dom --save # install webpack for bundling $ npm i webpack -g # install babel for module loading, bundling and transpiling $ npm i babel-core babel-loader --save # install babel presets for react and es6 $ npm i babel-preset-react babel-p...
Create a file webpack.config.js in the root of your working directory Filename: webpack.config.js module.exports = { entry: __dirname + "/src/index.jsx", devtool: "source-map", output: { path: __dirname + "/build", filename: "bund...
Create a file .babelrc in the root of our working directory Filename: .babelrc { "presets": ["es2015","react"] }
Setup a simple html file in the root of the project directory Filename: index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <div id="App"></div> ...
Using webpack, you can bundle your component: $ webpack This will create our output file in build directory. Open the HTML page in a browser to see component in action
Convert the interface of a class into another interface clients expect. Adapter (or Wrapper) lets classes work together that couldn't otherwise because of incompatible interfaces. Adapter pattern's motivation is that we can reuse existing software if we can modify the interface. Adapter pattern...
A gen_server is a specific finite state machine working like a server. gen_server can handle different type of event: synchronous request with handle_call asynchronous request with handle_cast other message (not defined in OTP specification) with handle_info Synchronous and asynchronous mess...
This source code create a simple key/value store service based on map Erlang datastructure. Firstly, we need to define all information concerning our gen_server: -module(cache). -behaviour(gen_server). % our API -export([start_link/0]). -export([get/1, put/2, state/0, delete/1, stop/0]). %...
Cryptography is the science of using mathematical constructs (codes) to make communication secure. The field of cryptography is a subset of the field of Information Security. There are many cryptographic operations possible; some best known examples are: Encryption : transforming a plaintext mes...
In the Garbage collection example, we implied that Java solves the problem of memory leaks. This is not actually true. A Java program can leak memory, though the causes of the leaks are rather different. Reachable objects can leak Consider the following naive stack implementation. public class ...

Page 991 of 1336