CSS
div {
height: 200px;
width: 200px;
background: url(http://lorempixel.com/200/200/nature/1);
mask-image: linear-gradient(to right, white, transparent);
}
HTML
<div></div>
In the above example there is an element with an image as its background. The mask that is a...
NSAttributedString (and its mutable sibling NSMutableAttributedString) allows you to create strings that are complex in their appearance to the user.
A common application is to use this to display a string and adding custom kerning / letter-spacing.
This would be achieved as follows (where label ...
If you know the format of the string you are converting (parsing) you should use DateTime.ParseExact
Dim dateString As String = "12.07.2003"
Dim dateFormat As String = "dd.MM.yyyy"
Dim dateValue As Date
dateValue = DateTime.ParseExact(dateString, dateFormat, Globalization.C...
set myVariable [expr { $myVariable * 17 }]
This shows how you can use a simple expression to update a variable. The expr command does not update the variable for you; you need to take its result and write it to the variable with set.
Note that newlines are not important in the little language un...
When inheriting from any base class, only one partial class needs to have the base class specified.
// PartialClass1.cs
public partial class PartialClass : BaseClass {}
// PartialClass2.cs
public partial class PartialClass {}
You can specify the same base class in more than one partial clas...
The command set is used to assign values in Tcl. When it is called with two arguments in the following manner,
% set tempVar "This is a string."
This is a string.
it places the second argument ("This is a string.") in the memory space referenced by the first argument (tempVa...
Firstly the classes from the jar need to be loaded. We'll use three methods for this process:
loadClasses(File)
readJar(JarFile, JarEntry, Map)
getNode(byte[])
Map<String, ClassNode> loadClasses(File jarFile) throws IOException {
Map<String, ClassNode> classes = new HashMap&...
Suppose you have a hot observable for which you would love to keep the count of. It could be the IObservable<StockTick> and you want to keep count of the average trade volume. You can use Scan for that.
var tradeVolume = stockTicks.Select(e => e.Price)
.Scan(0.0m, (aggregated, newtick...
Sometimes we need to fetch and print the value of a TensorFlow variable to guarantee our program is correct.
For example, if we have the following program:
import tensorflow as tf
import numpy as np
a = tf.Variable(tf.random_normal([2,3])) # declare a tensorflow variable
b = tf.random_normal([2...
Consider the following three equations:
x0 + 2 * x1 + x2 = 4
x1 + x2 = 3
x0 + x2 = 5
We can express this system as a matrix equation A * x = b with:
A = np.array([[1, 2, 1],
[0, 1, 1],
[1, 0, 1]])
b = np.array([4, 3, 5])
Then, use np.linalg....
In Tcl itself, a string consisting of a single word does not need to be quoted. In the language of expression strings that expr evaluates, all operands must have an identifiable type.
Numeric operands are written without any decoration:
expr {455682 / 1.96e4}
So are boolean constants:
expr {tr...
The angular.copy function takes an object, array or a value and creates a deep copy of it.
angular.copy()
Example:
Objects:
let obj = {name: "vespa", occupation: "princess"};
let cpy = angular.copy(obj);
cpy.name = "yogurt"
// obj = {name: "vespa", ...
Navigation controller can be embed in each tabs using storyboard it self. It can be like in the screenshot added.
To add a Navigation Controller to a View Controller connecting from Tab Bar Controller, here are the flow
Select the view controller for which we need to add navigation controller. H...
In order to print the value of a variable such as,
set tempVar "This is a string."
The argument in the puts statement is preceded by a $ sign, which tells Tcl to use the value of the variable.
% set tempVar "This is a string."
This is a string.
% puts $tempVar
This is a s...
The tr method returns a copy of a string where the characters of the first argument are replaced by the characters of the second argument.
"string".tr('r', 'l') # => "stling"
To replace only the first occurrence of a pattern with with another expression use the sub method
...
Any project that targets netstandard1.X can be packed into a NuGet package by running:
dotnet pack
The resulting package can be uploaded to NuGet, MyGet, or hosted in a local package source.
Below code showcases multiple Producer/Consumer program. Both Producer and Consumer threads share same global queue.
import java.util.concurrent.*;
import java.util.Random;
public class ProducerConsumerWithES {
public static void main(String args[]) {
BlockingQueue<Integer> ...