Tutorial by Examples

Steps#1-5 below allow any image or path-shape to be both moved anywhere on the canvas and rotated to any angle without changing any of the image/path-shape's original point coordinates. Move the canvas [0,0] origin to the shape's center point context.translate( shapeCenterX, shapeCenterY ); ...
The Compare attribute compares two properties of a model. The error message can be specified using property ErrorMessage, or using resource files. To use Compare attribute include using for the following namespace: using System.ComponentModel.DataAnnotations; Then you can use the attribute in ...
Canvas apps often rely heavily on user interaction with the mouse, but when the window is resized, the mouse event coordinates that canvas relies on are likely changed because resizing causes the canvas to be offset in a different position relative to the window. Thus, responsive design requires tha...
ps aux | grep <search-term> shows processes matching search-term Example: root@server7:~# ps aux | grep nginx root 315 0.0 0.3 144392 1020 ? Ss May28 0:00 nginx: master process /usr/sbin/nginx www-data 5647 0.0 1.1 145124 3048 ? S Jul18 2:53 nginx: worke...
core.async is about making processes that take values from and put values into channels. (require [clojure.core.async :as a]) Creating channels with chan You create a channel using the chan function: (def chan-0 (a/chan)) ;; unbuffered channel: acts as a rendez-vous point. (def chan-1 (a/chan...
/** * @var \Vendor\Module\Helper\Data */ protected $customHelper; /** * Constructor call * @param \Vendor\Module\Helper\Data $customHelper */ public function __construct( \Vendor\Module\Helper\Data $customHelper ) { $this->customHelper = $customHelper; parent::__co...
You can improve the security for data transit or storing by implementing encrypting techniques. Basically there are two approaches when using System.Security.Cryptography: symmetric and asymmetric. Symmetric Encryption This method uses a private key in order to perform the data transformation. ...
One of the core benefits of Typescript is that it enforces data types of values that you are passing around your code to help prevent mistakes. Let's say you're making a pet dating application. You have this simple function that checks if two pets are compatible with each other... checkCompatible...
Code class Program { static void Main(string[] args) { int a = 20; Console.WriteLine("Inside Main - Before Callee: a = {0}", a); Callee(a); Console.WriteLine("Inside Main - After Callee: a = {0}", a); Console.WriteLine(); ...
This very simple snippet of XQuery can be executed in QueryConsole using the built-in "Documents" database as a sandbox. Each piece of the snippet has a comment to explain what the following line of code means. xquery version "1.0-ml"; (: Let's first insert a simple document to...
If we know the desired URI of the document we are looking for: fn:doc("/stuff/mysimpledocument.xml") Returns the full document from the database, using the URI to locate it. Since this is XQuery, we can use XPath to find the document when we know about the structure, but not the URI: ...
We will now add some additional XML nodes to the "my-document" element and update the document. The snippet again contains comments to explain what is happening. xquery version "1.0-ml"; (: We are preserving the same URI as we used originally :) let $uri := "/stuff/mysimp...
MarkLogic is first and foremost a search engine, so let's use two different methods to search for this document. Using search:search() This gives a peek into using search:search() to develop search applications. This library provides Google-like search results and will likely speed up your develop...
To round out simple examples of CRUD operations, we present the following examples. Always use great care in deleting documents. (: When we know the URI, we can delete it very easily :) let $uri := "/stuff/mysimpledocument.xml" return xdmp:document-delete($uri) or simplified: xdmp:d...
Many modern Prolog systems are in continuous development and have added new features to address classic shortcomings of the language. Unfortunately, many Prolog textbooks and even teaching courses still introduce only the outdated prolog. This topic is intended to illustrate how modern Prolog has ov...
Traditionally Prolog performed arithmetic using the is and =:= operators. However, several current Prologs offer CLP(FD) (Constraint Logic Programming over Finite Domains) as a cleaner alternative for integer arithmetic. CLP(FD) is based on storing the constraints that apply to an integer value and ...
Some "classic" Prolog textbooks still use the confusing and error-prone failure-driven loop syntax where a fail construct is used to force backtracking to apply a goal to every value of a generator. For example, to print all numbers up to a given limit: fdl(X) :- between(1,X,Y), print(Y),...
Traditionally in Prolog, "functions" (with one output and bound inputs) were written as regular predicates: mangle(X,Y) :- Y is (X*5)+2. This can create the difficulty that if a function-style predicate is called multiple times, it is necessary to "daisy chain" temporary vari...
The dependencies for your projects are specified in a single text file called a Podfile. CocoaPods will resolve dependencies between libraries, fetch the resulting source code, then link it together in an Xcode workspace to build your project. Create a podfile # Next line contains target platf...
Try to run your code from the tool bar as shown below : In your code, if you have more than one function then, before running it you should mention the function you want to run with. For example : Alternatively, you can press ctrl + r from your keyboard to run the code. It will save the code f...

Page 767 of 1336