Tutorial by Examples: c

string urlWebsite = "http://MyServer/sites/SiteCollection"; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; List oList = oWebsite.Lists.GetByTitle("My List"); UserCustomActionCollection collUserCustomAction = oList.UserCustomAc...
string urlWebsite = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; UserCustomActionCollection collUserCustomAction = oWebsite.UserCustomActions; UserCustomAction oUserCustomAction = collUserCu...
Assume you've initialized a project with the following directory structure: /build app.js Then you add everything so you've created so far and commit: git init git add . git commit -m "Initial commit" Git will only track the file app.js. Assume you added a build step to your applicat...
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...
When you have a variable containing a struct, you can access its fields using the dot operator (.). However, if you have a pointer to a struct, this will not work. You have to use the arrow operator (->) to access its fields. Here's an example of a terribly simple (some might say "terribl...
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...
[HttpPost] public ActionResult ContactUs(ContactUsModel contactObject) { // This line checks to see if the Model is Valid by verifying each Property in the Model meets the data validation rules if(ModelState.IsValid) { } return View(contactObject); } The model class p...
def addNumbers = { a, b -> a + b } addNumbers(-7, 15) // returns 8
['cat', 'dog', 'fish'].collect { it.length() } it is the default name of the parameter if you have a single parameter and do not explicitly name the parameter. You can optionally declare the parameter as well. ['cat', 'dog', 'fish'].collect { animal -> animal.length() }
Build a text report showing the main classification metrics, including the precision and recall, f1-score (the harmonic mean of precision and recall) and support (the number of observations of that class in the training set). Example from sklearn docs: from sklearn.metrics import classification_re...
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...
The when-statement is an alternative to an if-statement with multiple else-if-branches: when { str.length == 0 -> print("The string is empty!") str.length > 5 -> print("The string is short!") else -> print("The string is long!") ...
When given an argument, the when-statement matches the argument against the branches in sequence. The matching is done using the == operator which performs null checks and compares the operands using the equals function. The first matching one will be executed. when (x) { "English" -...
(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 =...
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...
Custom constructors can be made for derived types by using an interface to overload the type name. This way, keyword arguments that don't correspond to components can be used when constructing an object of that type. module ball_mod implicit none ! only export the derived type, and not any ...
The .format() method can interpret a number in different formats, such as: >>> '{:c}'.format(65) # Unicode character 'A' >>> '{:d}'.format(0x0a) # base 10 '10' >>> '{:n}'.format(0x0a) # base 10 using current locale for separators '10' Format integers to d...
Properties can be set when an object is instantiated. var redCar = new Car { Wheels = 2, Year = 2016, Color = Color.Red };
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...
If you know that a value is of a specific type, you can explicitly cast it to that type in order to use it in a context where that type is needed. object value = -1; int number = (int) value; Console.WriteLine(Math.Abs(number)); If we tried passing value directly to Math.Abs(), we would get a ...

Page 209 of 826