Tutorial by Examples: er

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...
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...
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+...
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...
Nested serializers by default don't support create and update. To support this without duplicating DRF create/update logic, it is important to remove the nested data from validated_data before delegating to super: # an ordinary serializer class UserProfileSerializer(serializers.ModelSerializer): ...
If you have a stored DATE or DATETIME (in a column somewhere) it was stored with respect to some time zone, but in MySQL the time zone is not stored with the value. So, if you want to convert it to another time zone, you can, but you must know the original time zone. Using CONVERT_TZ() does the con...
An integer literal is a primary expression of the form decimal-literal It is a non-zero decimal digit (1, 2, 3, 4, 5, 6, 7, 8, 9), followed by zero or more decimal digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) int d = 42; octal-literal It is the digit zero (0) followed by zero or more octal dig...
Each server has a default global time_zone setting, configured by the owner of the server machine. You can find out the current time zone setting this way: SELECT @@time_zone Unfortunately, that usually yields the value SYSTEM, meaning the MySQL time is governed by the server OS's time zone sett...
To get a list of possible time_zone values in your MySQL server instance, use this command. SELECT mysql.time_zone_name.name Ordinarily, this shows the ZoneInfo list of time zones maintained by Paul Eggert at the Internet Assigned Numbers Authority. Worldwide there are appproximately 600 time z...
%f is the fractional precision format specifier for the DATE_FORMAT() function. SELECT DATE_FORMAT(NOW(3), '%Y-%m-%d %H:%i:%s.%f') displays a value like 2016-11-19 09:52:53.248000 with fractional microseconds. Because we used NOW(3), the final three digits in the fraction are 0.
var gulp = require('gulp'); // include plug-ins var uglify = require('gulp-uglify'), concat = require('gulp-concat'); // Minified file gulp.task('packjsMin', function() { return gulp.src('node_modules/angular/*.js') .pipe(concat('script.js')) .pipe(uglify()) .p...
You can use docker, without using docker daemon (engine), by using cloud providers. In this example, you should have a gcloud (Google Cloud util), that connected to your account docker-machine create --driver google --google-project `your-project-name` google-machine-type f1-large fm02 This exa...
grant all privileges on schema_name.* to 'new_user_name'@'%' identified by 'newpassword'; Attention: This can be used to create new root user
rename user 'user'@'%' to 'new_name`@'%'; If you create a user by mistake, you can change his name
You might receive from your peer private key in PPK format, which seems it does not work in OpenSSH (command-line ssh). The client will be asking for the passphrase, because of OpenSSH bug. $ ssh -i mykey.ppk example.com Enter passphrase for mykey.ppk: You need to convert the key to OpenSSH for...
Visual Basic.NET, like most languages, permits recursion, a process by which a function calls itself under certain conditions. Here is a basic function in Visual Basic .NET to compute Fibonacci numbers. ''' <summary> ''' Gets the n'th Fibonacci number ''' </summary> ''' <param na...
If an integer x is a power of 2, only one bit is set, whereas x-1 has all bits set after that. For example: 4 is 100 and 3 is 011 as binary number, which satisfies the aforementioned condition. Zero is not a power of 2 and has to be checked explicitly. boolean isPowerOfTwo(int x) { return (x ...
There are two kinds of persistent storage modes in Redis: AOF and RDB. To temporarily disable RDB execute the following commands on the Redis command line: config set save "" to temporarily disable AOF execute the following from the Redis command line: config set appendonly no The...

Page 323 of 417