Tutorial by Examples: sin

Steps to Create component: Create a folder named components in your project root folder Create your component inside components folder e.g.: MyComponent.php namespace app\components; use Yii; use yii\base\Component; use yii\base\InvalidConfigException; class MyComponent ...
Create function in MyComponent.php namespace app\components; use Yii; use yii\base\Component; use yii\base\InvalidConfigException; use yii\helpers\Url; use yii\helpers\ArrayHelper; use app\models\User; class MyComponent extends Component ...
Using ActiveCell or ActiveSheet can be source of mistakes if (for any reason) the code is executed in the wrong place. ActiveCell.Value = "Hello" 'will place "Hello" in the cell that is currently selected Cells(1, 1).Value = "Hello" 'will always place "Hello&...
So you've uploaded your files to a folder say /backend/web/uploads/ and you want these uploads to be visible on the frontend too. The easiest option is to create a symlink in the frontend that links to the backend: ln -s /path/to/backend/web/uploads/ /path/to/frontend/web/uploads In your views y...
The <algorithm> header provides a number of useful functions for working with sorted vectors. An important prerequisite for working with sorted vectors is that the stored values are comparable with <. An unsorted vector can be sorted by using the function std::sort(): std::vector<int&...
SharedPreferences allows you to store primitive data types only (boolean, float, long, int, String, and string set). You cannot store more complex objects in SharedPreferences, and as such is really meant to be a place to store user settings or similar, it's not meant to be a database to keep user d...
The following example encrypts data by using a hybrid cryptosystem consisting of AES GCM and OAEP, using their default parameter sizes and an AES key size of 128 bits. OAEP is less vulnerable to padding oracle attacks than PKCS#1 v1.5 padding. GCM is also protected against padding oracle attacks. ...
Long-running operations must not be run on the JavaFX application thread, since this prevents JavaFX from updating the UI, resulting in a frozen UI. Furthermore any change to a Node that is part of a "live" scene graph must happen on the JavaFX application thread. Platform.runLater can be...
Worksheets in excel have three options for the Visible property. These options are represented by constants in the xlSheetVisibility enumeration and are as follows: xlVisible or xlSheetVisible value: -1 (the default for new sheets) xlHidden or xlSheetHidden value: 0 xlVeryHidden xlSheetVeryHidd...
By default you will get de codes and id's for optionsets and lookups. If you want to get the label as well, you need to add an extra header to the call. $.ajax({ url: Xrm.Page.context.getClientUrl() + '/api/data/v8.0/contacts', headers: { 'Accept': 'Application/json', ...
For performance reasons you should minimize the number of fields you are requesting from the API. You can use the select property to do so. This example fetches the name property of all accounts: $.ajax({ url: Xrm.Page.context.getClientUrl() + '/api/data/v8.0/accounts?$select=name', head...
If you fetch a single record and when that record has a lookup, you can also fetch values of the lookup value using the expand option. This reduces the number of calls you need to make to the API. The sample gets all accounts and the last name of the primary contact: $.ajax({ url: Xrm.Page.co...
You can use the filter property to retrieve a subset of values from CRM. In this example only the accounts where the company name equals CompanyName are returned. $.ajax({ url: Xrm.Page.context.getClientUrl() + '/api/data/v8.0/accounts?$filter=name eq CompanyName', headers: { 'A...
You can add an interpreter directive (shebang) to your script. Create a file called hello_world.rb which contains: #!/usr/bin/env ruby puts 'Hello World!' Give the script executable permissions. Here's how to do that in Unix: $ chmod u+x hello_world.rb Now you do not need to call the Ru...
This program uses the Windows API (WinAPI) to print "Hello World" into a message box. To include a dependency (like Windows in this case), add the uses block including a comma-separated list of units ending with an semicolon. program HelloWorld; uses Windows; begin MessageBox...
A single case discriminated union is like any other discriminated union except that it only has one case. // Define single-case discriminated union type. type OrderId = OrderId of int // Construct OrderId type. let order = OrderId 123 // Deconstruct using pattern matching. // Parentheses used...
>>> variables = {'a': 6, 'b': 7} >>> eval('a * b', globals=variables) 42 As a plus, with this the code cannot accidentally refer to the names defined outside: >>> eval('variables') {'a': 6, 'b': 7} >>> eval('variables', globals=variables) Traceback (most ...
As the static keyword is used for accessing fields and methods without an instantiated class, it can be used to declare constants for use in other classes. These variables will remain constant across every instantiation of the class. By convention, static variables are always ALL_CAPS and use unders...
Static gives a method or variable storage that is not allocated for each instance of the class. Rather, the static variable is shared among all class members. Incidentally, trying to treat the static variable like a member of the class instance will result in a warning: public class Apple { pu...
This example show how you can check if a service already exists (i.e., is installed on the machine) or not. This code requires only the lowest privileges necessary, so each process can perform the check, no matter what level of security it is running at. #define UNICODE #define _UNICODE #include ...

Page 32 of 161