Tutorial by Examples

The ternary operator (?:) Support for the extended ternary operator was added in Twig 1.12.0. {{ foo ? 'yes' : 'no' }} Evaluates: if foo echo yes else echo no {{ foo ?: 'no' }} or {{ foo ? foo : 'no' }} Evaluates: if foo echo it, else echo no {{ foo ? 'yes' }} or {{ f...
This example assume that a solution with an application named MyApp already exists. Add a new project to the solution: In the Setup project, add a new reference to MyApp from the Projects tab: In the Product.wxs file, valorize the Manufacturer attribute of the Product node with Hell...
In Kotlin, variable declarations look a bit different than Java's: val i : Int = 42 They start with either val or var, making the declaration final ("value") or variable. The type is noted after the name, separated by a : Thanks to Kotlin's type inference the explicit typ...
Kotlin does not need ; to end statements Kotlin is null-safe Kotlin is 100% Java interoperable Kotlin has no primitives (but optimizes their object counterparts for the JVM, if possible) Kotlin classes have properties, not fields Kotlin offers data classes with auto-generated equals/hashCode ...
Kotlin uses == for equality (that is, calls equals internally) and === for referential identity. JavaKotlina.equals(b);a == ba == b;a === ba != b;a !== b See: https://kotlinlang.org/docs/reference/equality.html
You can use django rest framework permission classes to check request headers and authenticate user requests Define your secret_key on project settings API_KEY_SECRET = 'secret_value' note: a good practice is to use environment variables to store this secret value. Define a permission ...
private void loadData(){ DatabaseReference dbRef = FirebaseDatabase.getInstance().getReference(); Query dataQuery = dbRef.child("chat").orderByChild("id").equalTo("user1"); dataQuery.addListenerForSingleValueEvent(new ValueEventListener() { ...
Create a UITableView cell category class. UITableViewCell+RRCell.h file #import <UIKit/UIKit.h> @interface UITableViewCell (RRCell) -(id)initWithOwner:(id)owner; @end UITableViewCell+RRCell.m file #import "UITableViewCell+RRCell.h" @implementation UITableViewCell (R...
Detailed instructions on getting windows-installer set up or installed.
Prior to iOS 7 when you want to scan a QR code, we might need to rely on third party frameworks or libraries like zBar or zXing. But Apple introduced AVCaptureMetaDataOutput from iOS 7 for reading barcodes. To read QR code using AVFoundation we need to setup/create AVCaptureSession and use captureO...
in Startup.cs // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); var controllerActivator = new CompositionRoot(); services...
One of the features in SugarCRM 7.x is being able to easily add and extend custom endpoints to accomplish what you require. In this example, we'll create a couple of custom endpoints to return some data about the request. This custom file is being placed in custom/clients/base/api/DescriptionAPI.p...
Both are used to define error handling for a website, but different software refers to different config elements. customErrors are a legacy (backwards compatable) element, used by Visual Studio Development Server (aka. VSDS or Cassini). httpErrors are the new element which is only used by IIS7. T...
A quick way to test your xpath is in your browser developer tool console. Format is $x('//insert xpath here') $ - specifies it is a selector. x - specifies it is using xpaths Example: $x("//button[text() ='Submit']") When this command is entered it will return all occurrences...
Suppose you want the user to select keywords from a menu, we can create a script similar to #!/usr/bin/env bash select os in "linux" "windows" "mac" do echo "${os}" break done Explanation: Here select keyword is used to loop through a list ...
Example of a TCA field configuration where you can select records from a table 'my_topfeatures' => array( 'label' => 'Select Topfeatures', 'config' => array( 'type' => 'group', 'internal_type' => 'db', 'size' => '4', ...
In Kotlin, if, try and others are expressions (so they do return a value) rather than (void) statements. So, for example, Kotlin does not have Java's ternary Elvis Operator, but you can write something like this: val i = if (someBoolean) 33 else 42 Even more unfamiliar, but equally expressive, ...
Create the Newsletter model: rails g model Newsletter name:string email:string subl app/models/newsletter.rb validates :name, presence: true validates :email, presence: true Create the Newsletter controller: rails g controller Newsletters create class NewslettersCont...
HTML <div class="countdown"></div> JS var duration = moment.duration({ 'minutes': 5, 'seconds': 00 }); var timestamp = new Date(0, 0, 0, 2, 10, 30); var interval = 1; var timer = setInterval(function() { timestamp = new Date(timestamp.getTi...
Templates/Text.html <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> <f:layout name="Default" /> <f:section name="Main"> <f:format.html>{data.bodytext}</f:format.html&gt...

Page 1267 of 1336