Tutorial by Examples: sin

This example shows how to retrieve items from the server as well as get deeper properties of each list item. By default, the server will only return the minimum amount of data to represent the object. It is up to the caller to request additional information from the server. ClientContext clientCont...
ClientContext clientContext = new ClientContext(siteUrl); ListCollection collList = clientContext.Web.Lists; clientContext.Load( collList, lists => lists.Where( list => list.Hidden == false).Include( list => list.Title, list => list.Items.Take(10)...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements"); ListItemCollectionPosition itemPosition = null; while (true) { CamlQuery camlQuery = new CamlQuery(); camlQuery.ListItemCollectionPosition = it...
ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"); GroupCollection collGroup = clientContext.Web.SiteGroups; clientContext.Load(collGroup); clientContext.Load(collGroup, groups => groups.Include( group => group.Users)); ...
Groovy has access to all java classes, in fact Groovy classes ARE Java classes and can be run by the JVM directly. If you are working on a Java project, using Groovy as a simple scripting language to interact with your java code is a no-brainer. To make things even better, nearly any Java class ca...
(This pitfall applies equally to all primitive wrapper types, but we will illustrate it for Integer and int.) When working with Integer objects, it is tempting to use == to compare values, because that is what you would do with int values. And in some cases this will seem to work: Integer int1_1 =...
public class Singleton { private static class InstanceHolder { static final Singleton INSTANCE = new Singleton(); } public static Singleton getInstance() { return InstanceHolder.INSTANCE; } private Singleton() {} } This initializes the INSTANCE vari...
generate sample DF In [39]: df = pd.DataFrame(np.random.randint(0, 10, size=(5, 6)), columns=['a10','a20','a25','b','c','d']) In [40]: df Out[40]: a10 a20 a25 b c d 0 2 3 7 5 4 7 1 3 1 5 7 2 6 2 7 4 9 0 8 7 3 5 8 8 9 6 8 4 8 1 ...
You can iterate on the object returned by groupby(). The iterator contains (Category, DataFrame) tuples. # Same example data as in the previous example. import numpy as np import pandas as pd np.random.seed(0) df = pd.DataFrame({'Age': np.random.randint(20, 70, 100), 'Sex':...
This example shows a simple image cropping function that takes an image and cropping coordinates and returns the cropped image. function cropImage(image, croppingCoords) { var cc = croppingCoords; var workCan = document.createElement("canvas"); // create a canvas workCan.wi...
Let's say we need to add a button for each piece of loadedData array (for instance, each button should be a slider showing the data; for the sake of simplicity, we'll just alert a message). One may try something like this: for(var i = 0; i < loadedData.length; i++) jQuery("#container&q...
Bad Example: var location = dbContext.Location .Where(l => l.Location.ID == location_ID) .SingleOrDefault(); return location; Since the above code is simply returning an entity without modifying or adding it, we can avoid tracking cost. Good Ex...
Erlang modules are available as atoms. For example, the Erlang math module is available as :math: iex> :math.pi 3.141592653589793
class Vector { double x double y } def points = [ new Vector(x: 10, y: -5), new Vector(x: -17.5, y: 3), new Vector(x: -3.3, y: -1) ] assert points*.x == [10, -17.5, -3.3] Note: The * is optional. We could also write the above statement as in the below line and Groov...
We use this model from the first example: class Person(models.Model): name = models.CharField(max_length=50) description = models.TextField() class Club(models.Model): name = models.CharField(max_length=50) members = models.ManyToManyField(Person) Add Tom and Bill to the N...
Polymer prodives a lot of well built elements for you to use in your app. Browse them in their Element Catalog. Let's go through the workflow of using an element by including paper-input (Documentation) Download the Element To Download an element there are two ways: Bower The convinient way is...
The following example is an introduction to: Template compilation using underscore Accessing variables in a template Creating a view Rendering a view Showing a view <html> <head> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> ...
From JavaDoc The Theories runner allows to test a certain functionality against a subset of an infinite set of data points. Running theories import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; @RunWith(Theories...
Although modules are ideal, if the library you are using is referenced by a global variable (like $ or _), because it was loaded by a script tag, you can create an ambient declaration in order to refer to it: declare const _: any;
First, ensure you have imported sessions from flask from flask import session To use session, a Flask application needs a defined SECRET_KEY. app = Flask(__name__) app.secret_key = 'app secret key' Sessions are implemented by default using a cookie signed with the secret key. This ensures t...

Page 40 of 161