Tutorial by Examples: code

In C++ methods that differs only by const qualifier can be overloaded. Sometimes there may be a need of two versions of getter that return a reference to some member. Let Foo be a class, that has two methods that perform identical operations and returns a reference to an object of type Bar: class ...
<#@ template language="C#" #> //Language of your project <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" ...
#!/bin/bash #Print Date / Time in different Formats date1=$(date +'%d-%m-%y') date2=$(date +'%d-%m-%Y') date3=$(date +'%d-%b-%Y') date4=$(date +'%d-%B-%Y') date5=$(date +'%a %d-%b-%Y') date6=$(date +'%a %d-%b-%Y %Z') date7=$(date +'%A %d-%b-%Y') echo "Print Date in different forma...
If you are using library that contains (for example) AwesomeViewController with a wrong status bar color you can try this: let awesomeViewController = AwesomeViewController() awesomeViewController.navigationBar.barStyle = .blackTranslucent // or other style
Explanation In this example a simple Trigger has been created to change the Close Date of an Opportunity, that's about to be inserted or updated, to a date 10 days in the future. The Apex Controller custom setting's checkbox field enables the code to be disabled at the user / profile / org level. ...
using System; namespace myProject { public partial class WebForm1 : System.Web.UI.Page { public string PageSteps = string.Empty; //Raised after the start stage is complete and before the initialization stage begins. protected void Page_PreInit(object sender...
[footag foo="value of 1" attribute-2="value of 2"] In wordpress admin we use pre defined shortcodes by writing the shortcode name inside square brackets and optionally adding attributes to it separating by space.
function footag_func( $atts ) { return "foo = {$atts['foo']}"; } add_shortcode( 'footag', 'footag_func' ); In plugins we can add shortcodes using the add_shortcode function. The shortcode can be used in any Wordpress page or post just by enclosing it in square brackets. [footag...
<?php echo do_shortcode("[footag foo='Hi! I am a foo output']"); ?> To print a shortcode using php use the do_shortcode function and echo the returned value.
// application/controllers/Company_controller.php <?php if(!defined('BASEPATH')) exit('No direct script access allowed'); class Company_controller extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('companies_mo...
xcrun uses the system default Xcode version (set via xcode-select) to locate and execute command line tools from the Xcode application bundle, e.g., llvm-cov. # Generate code coverage reports via llvm-cov # /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin xc...
When creating the project You should check "Include Unit Tests" in the project creation dialog. After creating the project If you missed checking that item while creating your project, you could always add test files later. To do so: 1- Go to your project settings in Xcode 2- Go to ...
To get versionName and versionCode of current build of your application you should query Android's package manager. try { // Reference to Android's package manager PackageManager packageManager = this.getPackageManager(); // Getting package info of this application PackageInfo...
When we are working on a framework, if the constraints are not too complex, we'd better use Interface Builder or NSLayoutConstraint in code to make it smaller enough, instead of import Masonry or SnapKit. for example: Objective-C // 1. create views UIView *blueView = [[UIView alloc...
The UNICODE modifier, usually expressed as u (PHP, Python) or U (Java), makes the regex engine treat the pattern and the input string as Unicode strings and patterns, make the pattern shorthand classes like \w, \d, \s, etc. Unicode-aware. /\A\p{L}+\z/u is a PHP regex to match strings that consis...
Import the class, which contains the method to be tested. Perform the operation with dummy data. Now compare the result of operation with expected result. - (void)testReverseString{ NSString *originalString = @"hi_my_name_is_siddharth"; NSString *reversedString = [self.someObject ...
- (void)testDoSomethingThatTakesSomeTime{ XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Long method"]; [self.someObject doSomethingThatTakesSomeTimesWithCompletionBlock:^(NSString *result) { XCTAssertEqualObjects(@"result", result, @"Re...
1. For Synchronous methods : - (void)testPerformanceReverseString { NSString *originalString = @"hi_my_name_is_siddharth"; [self measureBlock:^{ [self.someObject reverseString:originalString]; }]; } 2. For Asynchronous methods : - (void)testPerformanceOfAsynch...
ImageSource result = new BitmapImage(new Uri("ms-appx:///Assets/Windows_10_Hero.png")); Use result to set the Source property of an Image control either though a Binding or code-behind
This is the image of project structure in Android studio: This is the image of project structure of nativescript project: As you see they are same. so we can write java code in nativescript as we write in android studio. We want to Add Toast to the default app of nativescript. after creating...

Page 9 of 21