Tutorial by Examples: c

The simplest way to wrap and access a piece of state is Agent. The module allows one to spawn a process that keeps an arbitrary data structure and allows one to send messages to read and update that structure. Thanks to this the access to the structure is automatically serialized, as the process onl...
To install openshift follow installation steps on https://install.openshift.com
import pygame pygame.init() WIDTH = 300 HEIGHT = 200 SCREEN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption('My Game') WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 255) SCREEN.fill(R...
Here is the corresponding Java configuration: Add this annotation to an @Configuration class to have the Spring Security configuration defined in any WebSecurityConfigurer or more likely by extending the WebSecurityConfigurerAdapter base class and overriding individual methods: @Configuration @En...
This example uses SqlConnection, but any IDbConnection is supported. Also any IDbTransaction is supported from the related IDbConnection. public void UpdateWidgetQuantity(int widgetId, int quantity) { using(var conn = new SqlConnection("{connection string}")) { conn.Open()...
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...
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...
vagrant ssh-config >> ~/.ssh/config ssh default
FirebaseUI is just an open-source library by Google that provides easy UI bindings for Firebase Auth and Firebase Database. To begin adding FirebaseUI to your app, add these dependencies in your app's build.gradle file: android { // ... } dependencies { // Required for FirebaseUI Dat...
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...

Page 560 of 826