Tutorial by Examples

As to pass list into a subroutine, you specify the subroutine's name and then supply the list to it: test_subroutine( 'item1', 'item2' ); test_subroutine 'item1', 'item2'; # same Internally Perl makes aliases to those arguments and put them into the array @_ which is available within the s...
If you like to organize your project by keeping source files in different subdirectories, you should know that during a build qmake will not preserve this directory structure and it will keep all the ".o" files in a single build directory. This can be a problem if you had conflicting file ...
In views\site\form-submission.php <?php Pjax::begin(['id'=>'id-pjax']); ?> <?= Html::beginForm(['site/form-submission'], 'post', ['data-pjax' => '', 'class' => 'form-inline']); ?> <?= Html::input('text', 'string', Yii::$app->request->post('string'), ['class' =&gt...
public function actionFormSubmission() { $security = new Security(); $string = Yii::$app->request->post('string'); $stringHash = ''; if (!is_null($string)) { $stringHash = $security->generatePasswordHash($string); } return $this->render('form-submi...
When a migration is run, Django stores the name of the migration in a django_migrations table. Create and Fake initial migrations for existing schema If your app already has models and database tables, and doesn’t have migrations. First create initial migrations for you app. python manage.py mak...
public interface ISingleton : IDisposable { } public class TransientDependency { } public class Singleton : ISingleton { public void Dispose() { } } public class CompositionRoot : IDisposable, IHttpControllerActivator { private readonly ISingleton _singleton; // pass in a...

MVC

public interface ISingleton : IDisposable { } public class TransientDependency { } public class Singleton : ISingleton { public void Dispose() { } } public class CompositionRoot : IDisposable, IControllerFactory { private readonly ISingleton _singleton; // pass in any tru...
A simple Hello, World program without error checking: #include <unistd.h> /* For write() and STDOUT_FILENO */ #include <stdlib.h> /* For EXIT_SUCCESS and EXIT_FAILURE */ int main(void) { char hello[] = "Hello, World\n"; /* Attempt to write `hell...
The following example creates a unique index on the JobCandidateID column of the HumanResources.JobCandidate table of the AdventureWorks2012 sample database. The example then creates a default full-text catalog, ft. Finally, the example creates a full-text index on the Resume column, using the ft ca...
USE AdventureWorks2012; GO CREATE FULLTEXT CATALOG production_catalog; GO CREATE FULLTEXT INDEX ON Production.ProductReview ( ReviewerName Language 1033, EmailAddress Language 1033, Comments Language 1033 ) KEY INDEX PK_ProductR...
USE AdventureWorks2012; GO CREATE FULLTEXT INDEX ON Production.Document ( Title Language 1033, DocumentSummary Language 1033, Document TYPE COLUMN FileExtension Language 1033 ) KEY INDEX PK_Document_DocumentID ...
SELECT product_id FROM products WHERE CONTAINS(product_description, ”Snap Happy 100EZ” OR FORMSOF(THESAURUS,’Snap Happy’) OR ‘100EZ’) AND product_cost < 200 ; SELECT candidate_name,SSN FROM candidates WHERE CONTAINS(candidate_resume,”SQL Server”) AND candidate_division ...
Postmodern is a library to interface the relational database PostgreSQL. It offers several levels of access to PostgreSQL, from the execution of SQL queries represented as strings, or as lists, to an object-relational mapping. The database used in the following examples can be created with these SQ...
This example shows you a minimal way to create a Hello World page in Django. This will help you realize that the django-admin startproject example command basically creates a bunch of folders and files and that you don't necessarily need that structure to run your project. Create a file called ...
Download installation files from Phalcon dedicated download page, as well as finding manuals on making Phalcon work with popular platforms. Windows Put the actual DLL files in a directory proper to extend PHP functionality. For XAMPP use xampp\php\ext\ - and for WAMP use wamp\bin\php\php*\ext\ de...
Steps to Reproduce (Turbo Forms, CRM 2015.1, --> CRM 2016.2) Form (with or without other required fields) has one field that is empty and required. Lose focus on the empty field ("title" in this example), this triggers the Field Notification Icon: Wire up onChange Handler for emp...
Your code can, and often should, throw an exception when something unusual has happened. public void WalkInto(Destination destination) { if (destination.Name == "Mordor") { throw new InvalidOperationException("One does not simply walk into Mordor."); } ...
Any value in Clojure is considered truthy unless it is false or nil. You can find the truthiness of a value with (boolean value). You can find the truthiness of a list of values using (or), which returns true if any arguments are truthy, or (and) which returns true if all arguments are truthy. =&gt...
pcall stands for "protected call". It is used to add error handling to functions. pcall works similar as try-catch in other languages. The advantage of pcall is that the whole execution of the script is not being interrupted if errors occur in functions called with pcall. If an error insid...
Given items as (value, weight) we need to place them in a knapsack (container) of a capacity k. Note! We can break items to maximize value! Example input: values[] = [1, 4, 5, 2, 10] weights[] = [3, 2, 1, 2, 4] k = 8 Expected output: maximumValueOfItemsInK = 20; Algorithm: 1) Sort values...

Page 618 of 1336