We would be creating mongodb as a replica set having 3 instances. One instance would be primary and the other 2 instances would be secondary.
For simplicity, I am going to have a replica set with 3 instances of mongodb running on the same server and thus to achieve this, all three mongodb instances...
Given a file Sample called movieslist.
Troy
Gladiator
Robin Hood
King Arthur
BraveHeart
The Last Samurai
Normal grep returns
grep "Gladiator" movieslist
Gladiator
Now,using grep to print the below or above lines of the file.
To print the below line
grep -A 1 Gladiator movie...
In Scala you can define your own operators:
class Team {
def +(member: Person) = ...
}
With the above defines you can use it like:
ITTeam + Jack
or
ITTeam.+(Jack)
To define unary operators you can prefix it with unary_. E.g. unary_!
class MyBigInt {
def unary_! = ...
}
var ...
CategoryOperatorAssociativityPostfix() []Left to rightUnary! ~Right to leftMultiplicative* / %Left to rightAdditive+ -Left to rightShift>> >>> <<Left to rightRelational> >= < <=Left to rightEquality== !=Left to rightBitwise and&Left to rightBitwise xor^Left to ri...
[TestCase(0, 0, 0)]
[TestCase(34, 25, 59)]
[TestCase(-1250, 10000, 8750)]
public void AddNumbersTest(int a, int b, int expected)
{
// Act
int result = a + b;
// Assert
Assert.That(result, Is.EqualTo(expected));
}
!!! Container should be positioned relatively or absolutely
$direction - top, bottom, left, right
$margin - margin by the edge in $direction. For top and bottom direction - it's from left to right. For left and right - it's from top to bottom.
$colors - first is a border color, second - is a back...
//define a short alias to avoid chubby method signatures
using AppFunc = Func<IDictionary<string, object>, Task>;
class RequestTimeMiddleware
{
private AppFunc _next;
public RequestTimeMiddleware(AppFunc next)
{
_next = next;
}
public async Task...
Groups can be added and nested within a report to organize the data in a hierarchy of sorted lists. Outer groups supersede any groups within. This directly affects which records are affected by the Previous keyword.
Select Insert, Group from the menu bar.
Select the field to group the data by fr...
A thing to look out for when using the toString method in Kotlin is the handling of null in combination with the String?.
For example you want to get text from an EditText in Android.
You would have a piece of code like:
// Incorrect:
val text = view.textField?.text.toString() ?: ""
...
You can use the following instructions to install Theano and configure the GPU (assume a freshly installed Ubuntu 14.04):
# Install Theano
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
# Install Nvidia drivers, ...
You can run Theano on multiple CPU cores with the OMP_NUM_THREADS=[number_of_cpu_cores] flag.
Example:
OMP_NUM_THREADS=4 python gpu_test.py
The script theano/misc/check_blas.py outputs information regarding which BLAS is used:
cd [theano_git_directory]
OMP_NUM_THREADS=4 python theano/misc/ch...
Define a sequence of Targets (Target1, then Target2) that must execute before Target3. Note that an execution request for Target3 is required to cause Target1 and Target2 to be executed.
<Target Name="Target3" DependsOnTargets="Target1;Target2">
</Target>
<Tar...
Define a Target (Target1) for which an execution request will cause Target2 to be executed afterward.
<Target Name="Target2" AfterTargets="Target1">
</Target>
<Target Name="Target1">
</Target>
Define a Target (Target2) for which an execution request will cause Target1 to be executed beforehand.
<Target Name="Target2">
</Target>
<Target Name="Target1" BeforeTargets="Target2">
</Target>
We now know how to create a modal. But what if we want to pass some data from modal to our home page. To do so, let us look into an example with modal as Register page passing parameters to parent page.
Register.html
<ion-header>
<ion-toolbar>
<ion-title>
Login
...
Passing parameters to a modal is similar to how we pass values to a NavController. To do so, we are altering our list in home.html to open a modal when clicking a list item and passing the required parameters as a second argument to the create method.
Home.html
<ion-list>
<ion-item ...
class my_model(models.Model):
_name = "my.model"
name = fields.Char('Name')
@api.multi
def foo_manipulate_records_1(self):
""" function returns list of tuples (id,name) """
return [(i.id,i.name) for i in self]
@...
Examples below demonstrate how to call Python function from JavaScript in Odoo 8. In the examples we call methods of my_model described early on this page.
We assume that in the following examples "list_of_ids" variable contains list(array) of ids of existing records of "my.model&quo...