Tutorial by Examples: and

Extension methods enable you to simplify your interface definitions by only including core required functionality in the interface itself and allowing you to define convenience methods and overloads as extension methods. Interfaces with fewer methods are easier to implement in new classes. Keeping o...
Run command below to install nginx. sudo apt-get install nginx By default, Nginx automatically starts when it is installed. You can access the default Nginx landing page to confirm that the software is running properly by visiting your server's domain name or public IP address in your web browse...
wikipedia definition: Command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time UML diagram from dofactory: Basic components and workflow: Command declares an interface for abst...
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = context.Web; oWebsite.Title = "Updated Web Site"; oWebsite.Description = "This is an updated Web site."; oWebsite.Update(); clientContext.ExecuteQuery();
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; ListCreationInformation listCreationInfo = new ListCreationInformation(); listCreationInfo.Title = "My Announcements List"; listCreationInfo.TemplateType = (int)ListTemplateType.Announcements;...
ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection/MyWebSite"); Web oWebsite = clientContext.Web; GroupCreationInformation groupCreationInfo = new GroupCreationInformation(); groupCreationInfo.Title = "My New Group"; groupCreationInfo.D...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("MyList"); int itemId = 3; ListItem oListItem = oList.Items.GetById(itemId); oListItem.BreakRoleInheritance(false); User oUser = clientContext.Web.SiteUsers.GetByLoginNam...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("MyList"); int itemId = 2; ListItem oListItem = oList.Items.GetById(itemId); oListItem.BreakRoleInheritance(true); User oUser = clientContext.Web.SiteUsers.GetByLoginName...
Arrays in C can be seen as a contiguous chunk of memory. More precisely, the last dimension of the array is the contiguous part. We call this the row-major order. Understanding this and the fact that a cache fault loads a complete cache line into the cache when accessing uncached data to prevent sub...
You can give alias names to a struct: typedef struct Person { char name[32]; int age; } Person; Person person; Compared to the traditional way of declaring structs, programmers wouldn't need to have struct every time they declare an instance of that struct. Note that the name Pers...
val str = "Hello!" if (str.length == 0) { print("The string is empty!") } else if (str.length > 5) { print("The string is short!") } else { print("The string is long!") } The else-branches are optional in normal if-statements.
1. Fix your contexts: Try using the appropriate context: For example since a Toast can be seen in many activities instead of in just one, use getApplicationContext() for toasts, and since services can keep running even though an activity has ended start a service with: Intent myService = new Inten...
functions.php //Localize the AJAX URL and Nonce add_action('wp_enqueue_scripts', 'example_localize_ajax'); function example_localize_ajax(){ wp_localize_script('jquery', 'ajax', array( 'url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('example_ajax_nonc...
from datetime import datetime import pandas_datareader.data as wb stocklist = ['AAPL','GOOG','FB','AMZN','COP'] start = datetime(2016,6,8) end = datetime(2016,6,11) p = wb.DataReader(stocklist, 'yahoo',start,end) p - is a pandas panel, with which we can do funny things: let's see what...
Maps and keyword lists have different application. For instance, a map cannot have two keys with the same value and it's not ordered. Conversely, a Keyword list can be a little bit hard to use in pattern matching in some cases. Here's a few use cases for maps vs keyword lists. Use keyword lists wh...
struct FileAttributes { unsigned int ReadOnly: 1; unsigned int Hidden: 1; }; Here, each of these two fields will occupy 1 bit in memory. It is specified by : 1 expression after the variable names. Base type of bit field could be any integral type (8-bit int to 64-bit int). Using u...
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...
Django comes with a number of builtin management commands, using python manage.py [command] or, when manage.py has +x (executable) rights simply ./manage.py [command] . The following are some of the most frequently used: Get a list of all available commands ./manage.py help Run your Django ser...
The cmath module is similar to the math module, but defines functions appropriately for the complex plane. First of all, complex numbers are a numeric type that is part of the Python language itself rather than being provided by a library class. Thus we don't need to import cmath for ordinary arith...
To run a command in a shell, in which you required buffered output (i.e. it is not a stream), use child_process.exec. For example, if you wanted to run the command cat *.js file | wc -l, with no options, that would look like this: const exec = require('child_process').exec; exec('cat *.js file | w...

Page 38 of 153