Tutorial by Examples: al

In PHP, there are two versions of logical AND and OR operators. OperatorTrue if$a and $bBoth $a and $b are true$a && $bBoth $a and $b are true$a or $bEither $a or $b is true$a || $bEither $a or $b is true Note that the && and || opererators have higher precedence than and and or. S...
Imagine that we have a separate Google spreadsheet, and we need to get the B2 cell value to cell D5 on your current sheet. function copyValueandPaste() { var source = SpreadsheetApp.openById('spread sheet id is here'); //Separate spreadsheet book var sourcesheet = source.getSheetByName...
We can add Kendo-UI grid in HTML5/Javascript, ASP.NET MVC, JSP and PHP project/application. Please follow below steps to add kendo-UI grid in HTML5 page. Create empty html5 page. Include kendo.common.min.css and kendo.default.min.css. Add a link tag within the head tag. Kendo-UI li...
For immutable elements (e.g. None, string literals etc.): my_list = [None] * 10 my_list = ['test'] * 10 For mutable elements, the same construct will result in all elements of the list referring to the same object, for example, for a set: >>> my_list=[{1}] * 10 >>> print(my_...
General syntax: DATEDIFF (datepart, datetime_expr1, datetime_expr2) It will return a positive number if datetime_expr is in the past relative to datetime_expr2, and a negative number otherwise. Examples DECLARE @now DATETIME2 = GETDATE(); DECLARE @oneYearAgo DATETIME2 = DATEADD(YEAR, -1, @now...
This example shows how to create a table, insert data, and select from the database using the SQLAlchemy ORM. For information re: SQLAlchemy Core, see here. First things first, we need to connect to our database, which is identical to how we would connect using SQLAlchemy Core (Core). from sqlalch...
To start using Spring data JPA, you must include the dependency in your project with the one of Spring core, all together. If you're using Maven as dependency management system (replace version-number for the version you want to use): <dependencies> <dependency> <groupI...
function onOpen() { // Add a custom menu to run the script var ss = SpreadsheetApp.getActiveSpreadsheet(); var searchMenuEntries = [ {name: "Run", functionName: "search"}]; ss.addMenu("Get Files", searchMenuEntries); } function getFiles() { // Get...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is external code chunks. External code chunks allow us to develop/test R Scripts in an R development environment and then include the results in a report. It is a powerful organizational technique....
Similar to currying, partial application is used to reduce the number of arguments passed to a function. Unlike currying, the number need not go down by one. Example: This function ... function multiplyThenAdd(a, b, c) { return a * b + c; } ... can be used to create another function that...
When you also want to expose metadata without a config file you can build on the example programmatically creating a ServiceHost: public ConsoleHost() { mHost = new ServiceHost(typeof(Example), new Uri("http://localhost:8000/Example"), new Uri("net.tcp://9000/Example")); ...
Scope guards allow executing statements at certain conditions if the current block is left. import core.stdc.stdlib; void main() { int* p = cast(int*)malloc(int.sizeof); scope(exit) free(p); }
import std.stdio; void main() { writeln("Hello World!"); } Multiple imports can either be specified in the same line, separated with a comma or in a new line. import std.stdio, std.math; import std.datetime; void main() { writeln("2^4: ", pow(2, 4)); writ...
You can also import symbols in any scope, the import will only be looked up when the scope is needed (i.e. compiled) and the imported names will only be exposed in the imported scope. Most commonly the scope for local imports are functions, structs and classes. void main() { import std.stdio:...
Using using System.Text.RegularExpressions; Code static void Main(string[] args) { string input = "Carrot Banana Apple Cherry Clementine Grape"; // Find words that start with uppercase 'C' string pattern = @"\bC\w*\b"; MatchCollection matches = Regex.M...
Assertions are used not to perform testing of input parameters, but to verify that program flow is corect -- i.e., that you can make certain assumptions about your code at a certain point in time. In other words: a test done with Debug.Assert should always assume that the value tested is true. Debu...
You can also perform this task recursively, but I have chosen in this example to use an iterative approach. This task is useful if you are inserting all of your nodes at the beginning of a linked list. Here is an example: #include <stdio.h> #include <stdlib.h> #define NUM_ITEMS 10...
Detailed instructions on getting ibm-mobilefirst set up or installed.
To install NLTK with Continuum's anaconda / conda. If you are using Anaconda, most probably nltk would be already downloaded in the root (though you may still need to download various packages manually). Using conda: conda install nltk To upgrade nltk using conda: conda update nltk With a...
In some situations, one might want to return from a function before finishing an entire loop. The return statement can be used for this. function primefactor(n) for i in 2:n if n % i == 0 return i end end @assert false # unreachable end Usage: jul...

Page 113 of 269