Tutorial by Examples: sin

You can also put custom variables in the front matter. These can be reused in the page layout. For example, if your front matter looks like this: --- layout: post title: "Using Custom Variables!" date: 2016-07-25 chicken: "I like Chicken." --- You can use the chicken va...
public void MoveToStateAndExecuteActions(Item item, ID workflowStateId) { Sitecore.Workflows.IWorkflowProvider workflowProvider = Item.Database.WorkflowProvider; Sitecore.Workflows.IWorkflow workflow = workflowProvider.GetWorkflow(item); // if item is in any workflow if (workf...
An HTTP POST request is sent to a URL of the format: "https://api.twilio.com/2xxx-xx-xx/Accounts/[AccountSid]/Messages.json The example below uses a alphanumeric string as the sender. At the time of writing a sender ID can only be added through a service request Twlio. Example Request: To=&q...
from __future__ import print_function import multiprocessing def countdown(count): while count > 0: print("Count value", count) count -= 1 return if __name__ == "__main__": p1 = multiprocessing.Process(target=countdown, args=(10,)) ...
The first thing you need to do is create a connection to the database using the connect method. After that, you will need a cursor that will operate with that connection. Use the execute method of the cursor to interact with the database, and every once in a while, commit the changes using the comm...
.gitignore and .git/info/exclude work only for untracked files. To set ignore flag on a tracked file, use the command update-index: git update-index --skip-worktree myfile.c To revert this, use: git update-index --no-skip-worktree myfile.c You can add this snippet to your global git config ...
cURL is the name of the project which depicts: 'Client for URLs' and also be called as Client URL Request Library it combines two separate packages: curl and libcurl. curl is a command line tool used to get documents/files from or send documents to a server, using any of the supported protocol...
A stream is closed by sending a closing </stream> tag. After the closing stream tag is sent, no more data should be sent on the stream (even in response to data received from the other party). Before closing the connection, the sending entity should wait for a response </stream> tag to g...
The WHILE loop can be used as an alternative to CURSORS. The following example will print numbers from 0 to 99. DECLARE @i int = 0; WHILE(@i < 100) BEGIN PRINT @i; SET @i = @i+1 END
Methods are inherited class A def boo; p 'boo' end end class B < A; end b = B.new b.boo # => 'boo' Class methods are inherited class A def self.boo; p 'boo' end end class B < A; end p B.boo # => 'boo' Constants are inherited class A WOO = 1 end class ...
F# uses the type keyword to create different kind of types. Type aliases Discriminated union types Record types Interface types Class types Struct types Examples with equivalent C# code where possible: // Equivalent C#: // using IntAliasType = System.Int32; type IntAliasType = int // ...
Using Derived column we can prepare the input. We will provide yyyy-MM-dd to the final conversion: Year: (DT_STR,4,1252)(DataDate / 10000) Month: (DT_STR,2,1252)(DataDate / 100 % 100) Day: (DT_STR,2,1252)(DataDate % 100) All together: (DT_DBDATE)((DT_STR,4,1252)(DataDate / 10000) + "-&q...
Using c# or vb.net code the conversion is even more simple. An output column is needed because we type can not be changed on the fly, alternative is adding an input column on forehand make it ReadWrite. Next code will fill the new column. public override void Input0_ProcessInputRow(Input0Buffer ...
int sumArrayRecursive(int * arr, int index, int arraySize) { if (index == (arraySize - 1)) { return arr[index]; } return arr[index] + sumArrayRecursive(arr, index + 1, arraySize); }
var arr = [1, 2, 3, 4, 5]; var sum = arr.reduce((prev, curr) => prev + curr); console.log(sum); // Output: 15 You can also specify an initial value var arr = [1, 2, 3, 4, 5]; var sum = arr.reduce(function (previousValue, currentValue, currentIndex, array) { return previousValue + cur...
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Float digits 8 range 0.0 .. 10.0; X : Some_Float := 2.71; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 2.71000E+00
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Integer is range -42 .. 42; X : Some_Integer := 17; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 17
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (X'Image); Ada.Text_IO.Put_Line (Pear'Image); end Main; Result ORANGE PEAR
You can use a class to mimic the switch/case structure. The following is using introspection of a class (using the getattr() function that resolves a string into a bound method on an instance) to resolve the "case" part. Then that introspecting method is aliased to the __call__ method to ...
Another way, which is very readable and elegant, but far less efficient than a if/else structure, is to build a class such as follows, that will read and store the value to compare with, expose itself within the context as a callable that will return true if it matches the stored value: class Switc...

Page 68 of 161