Tutorial by Examples: c

Messages can be sent from JavaScript using the following code window.webkit.messageHandlers.{NAME}.postMessage() Here how to create a script message handler to handle the messages: class NotificationScriptMessageHandler: NSObject, WKScriptMessageHandler { func userContentController(userCon...
function createGoogleDriveFileOfMimeType() { var content,fileName,newFile;//Declare variable names fileName = "Test File " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.cre...
function createGoogleDriveTextFile() { var content,fileName,newFile;//Declare variable names fileName = "Test Doc " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.createFile...
function createGoogleDriveFileWithBlob() { var blob,character,data,fileName,i,L,max,min,newFile,randomNmbr;//Declare variable names fileName = "Test Blob " + new Date().toString().slice(0,15);//Create a new file name with date on end L = 500;//Define how many times to loo...
function processGoogleDriveFolders() { var arrayAllFolderNames,continuationToken,folders,foldersFromToken,thisFolder;//Declare variable names arrayAllFolderNames = [];//Create an empty array and assign it to this variable name folders = DriveApp.getFolders();//Get all folders from ...
function processGoogleDriveFiles() { var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names arrayAllFileNames = [];//Create an empty array and assign it to this variable name files = DriveApp.getFiles();//Get all files from Googl...
function DriveAppAddFile(child) {//Adds file to the root drive in Google Drive var body,returnedFolder;//Declare variable names if (!child) { body = "There is no file"; MailApp.sendEmail(Session.getEffectiveUser().getEmail(), "", "Error Adding File!",...
Get all Google Forms with the word "Untitled" in the file name. function mainSearchFunction(searchStr) { var fileInfo,arrayFileIDs,arrayFileNames,arrayOfIndexNumbers, allFileIDsWithStringInName,i,searchStr,thisID;//Declare variables if (!searchStr) { searchStr = &quo...
Suppose we want to select a word without surrounding white spaces, use the text object iw for inner word using visual mode: Got to normal mode by pressing ESC Type viw at the beginning of a word This will select the inner word
In simple words: A Flyweight factory that for a given, already known, key will always give the same object as response. For new keys will create the instance and return it. Using the factory: ISomeFactory<string, object> factory = new FlyweightFactory<string, object>(); var result1...
At its most basic level, Unit Testing in any language provides assertions against some known or expected output. function assert( outcome, description ) { var passFail = outcome ? 'pass' : 'fail'; console.log(passFail, ': ', description); return outcome; }; The popular assertio...
To run multiple processes e.g. an Apache web server together with an SSH daemon inside the same container you can use supervisord. Create your supervisord.conf configuration file like: [supervisord] nodaemon=true [program:sshd] command=/usr/sbin/sshd -D [program:apache2] command=/bin/bash...
uses System.Generics.Collections, { TArray } System.Generics.Defaults; { TComparer<T> } var StringArray: TArray<string>; { Also works with "array of string" } ... { Sorts the array case insensitive } TArray.Sort<string>(StringArray, TComparer<string>...
type TIntegerList = class(TList<Integer>) public function Sum: Integer; end; ... function TIntegerList.Sum: Integer; var Item: Integer; begin Result := 0; for Item in Self do Result := Result + Item; end;
Backbone models describe how data is stored using JavaScript objects. Each model is a hash of fields called attributes and the behaviour of the model including validation is described by options. A model of Todo item in a TodoApp would be var ToDo = Backbone.Model.extend({ defaults: { assi...
The easiest way to create a custom data type in Haskell is to use the data keyword: data Foo = Bar | Biz The name of the type is specified between data and =, and is called a type constructor. After = we specify all value constructors of our data type, delimited by the | sign. There is a rule in...
Value constructors are functions that return a value of a data type. Because of this, just like any other function, they can take one or more parameters: data Foo = Bar String Int | Biz String Let's check the type of the Bar value constructor. :t Bar prints Bar :: String -> Int -> Foo...
Type constructors can take one or more type parameters: data Foo a b = Bar a b | Biz a b Type parameters in Haskell must begin with a lowercase letter. Our custom data type is not a real type yet. In order to create values of our type, we must substitute all type parameters with actual types. Be...
The minification is used to reduce the size of CSS and Javascript files to speed up download times. This process is done by removing all of the unnecessary white-space, comments, and any other non-essential content from the files. This process is done automatically when using a ScriptBundle or a St...
IPv4 To match IPv4 address format, you need to check for numbers [0-9]{1,3} three times {3} separated by periods \. and ending with another number. ^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$ This regular expression is too simple - if you want to it to be accurate, you need to check that the numbers are be...

Page 338 of 826