Tutorial by Examples

Lifecycle Monitoring in Akka is usually referred to as DeathWatch. Monitoring is thus used to tie one actor to another so that it may react to the other actor’s termination, in contrast to supervision which reacts to failure. Monitoring Monitoring is particularly useful if a supervisor ...
PHP lacks a build-in function to encrypt and decrypt large files. openssl_encrypt can be used to encrypt strings, but loading a huge file into memory is a bad idea. So we have to write a userland function doing that. This example uses the symmetric AES-128-CBC algorithm to encrypt smaller chunks of...
Suppose you have two views ViewA and ViewB Instance of ViewB is created inside ViewA, so ViewA can send message to ViewB's instance, but for the reverse to happen we need to implement delegation (so that using delegate ViewB's instance could send message to ViewA) Follow these steps to implement t...
Move to the SQL Server Management Studio menu bar (ALT) Activate the menu for a tool component (ALT+ HYPHEN) Display the context menu (SHIFT+F) Display the New File dialog box to create a file (CTRL+N) Display the Open Project dialog box to open an existing project (CTRL+SHIFT+0) Display the ...
The ClassLoader needs to provide a ProtectionDomain identifying the source of the code: public class PluginClassLoader extends ClassLoader { private final ClassProvider provider; private final ProtectionDomain pd; public PluginClassLoader(ClassProvider provider) { this...
Applications running in non-development environments often require database updates. After using the Add-Migration command to create your database patches there's the need to run the updates on other environments, and then the test environment as well. Challenges commonly faced are: no Visual S...
To get random data from certain collection refer to $sample aggregation. db.emplyees.aggregate({ $sample: { size:1 } }) where size stands for number of items to select.
Using React.createClass will automatically bind this context (values) correctly, but that is not the case when using ES6 classes. React.createClass Note the onClick declaration with the this.handleClick method bound. When this method gets called React will apply the right execution context to the ...
In order to get the total number of commits that each developer or contributor has made on a repository, you can simply use the git shortlog: git shortlog -s which provides the author names and number of commits by each one. Additionally, if you want to have the results calculated on all branch...
In spark-shell: sc.version Generally in a program: SparkContext.version Using spark-submit: spark-submit --version
Let say you want to build your API to comply jsonapi.org specification and the result should look like: { "article": { "id": "305", "type": "articles", "attributes": { "title": "Asking Alexandria&q...
from pymongo import MongoClient uri = "mongodb://localhost:27017/" client = MongoClient(uri) db = client['test_db'] # or # db = client.test_db # collection = db['test_collection'] # or collection = db.test_collection collection.save({"hello":"world"...
Introduces a while loop. int i = 0; // print 10 asterisks while (i < 10) { putchar('*'); i++; }
import cv2 import numpy as np import urllib stream=urllib.urlopen('http://96.10.1.168/mjpg/video.mjpg') bytes='' while True: bytes+=stream.read(1024) a = bytes.find('\xff\xd8') # JPEG start b = bytes.find('\xff\xd9') # JPEG end if a!=-1 and b!=-1: jpg = bytes[a:b+...
"Fat Model, Skinny Controller" is a very good first step, but it doesn't scale well once your codebase starts to grow. Let's think on the Single Responsibility of models. What is the single responsibility of models? Is it to hold business logic? Is it to hold non-response-related logic? ...
First you have to generate public and private keys using OpenSSL(tutorial). var express = require("express"); var http =require ("http"); var https=require ("https"); var fs=require("fs"); var app=express(); var httpsKeys={ key:fs.readFileSync("&l...
In your Maven project, add the following to your pom.xml file. The following versions are for Cassandra 3.x. <dependency> <groupId>com.datastax.cassandra</groupId> <artifactId>cassandra-driver-core</artifactId> <version>3.1.0</ve...
Connecting to Cassandra is very similar to connecting to other datasources. With Cassandra, credentials are not required. String cassandraIPAddress = "127.0.0.1"; String cassandraKeyspace = "myKeyspace"; String username = "foo"; String password = "bar"; ...
public enum Cassandra { DB; private Session session; private Cluster cluster; private static final Logger LOGGER = LoggerFactory.getLogger(Cassandra.class); /** * Connect to the cassandra database based on the connection configuration provided. * Multiple c...

Page 1024 of 1336