Tutorial by Examples

Blade provides convenient syntax for common PHP control structures. Each of the control structures begins with @[structure] and ends with @[endstructure]. Notice that within the tags, we are just typing normal HTML and including variables with the Blade syntax. Conditionals 'If' statements @if...
Any PHP expression within double curly braces {{ $variable }} will be echoed after being run through the e helper function. (So html special characters (<, >, ", ', &) are safely replaced for the corresponding html entities.) (The PHP expression must evaluate to string, otherwise an ...
With Blade, you can also include partial views (called 'partials') directly into a page like so: @include('includes.info', ['title' => 'Information Station']) The code above will include the view at 'views/includes/info.blade.php'. It will also pass in a variable $title having value 'Informat...
Subclassing UIControl gives us access to the following methods: beginTrackingWithTouch is called when the finger first touches down within the control's bounds. continueTrackingWithTouch is called repeatedly as the finger slides across the control and even outside of the control's bounds. endTr...
After setting up Xcode, it is not difficult to get your first iOS up and running. In the following example we will: Start a new project Add a label Printing message to console. Run in the simulator Starting a new project When the Xcode welcome screen comes up, choose Create a new Xcode pr...
With local image Swift let image = UIImage(named: "imageFromBundleOrAsset") Objective-C UIImage *image = [UIImage imageNamed:@"imageFromBundleOrAsset"]; Note The method imageNamed caches the image's contents to memory. Loading many large images that way can cause low...
The most "popular" way of reversing a string in JavaScript is the following code fragment, which is quite common: function reverseString(str) { return str.split('').reverse().join(''); } reverseString('string'); // "gnirts" However, this will work only so long as ...
Just add the using at the beginning and the [WebMethod] decorator to the static method to be called in the aspx page: using System.Web.Services; public partial class MyPage : System.Web.UI.Page { [WebMethod] public static int GetRandomNumberLessThan(int limit) { var r = ...
In case you have a Named Range in your Sheet, and you want to dynamically get the last row of that Dynamic Named Range. Also covers cases where the Named Range doesn't start from the first Row. Sub FindingLastRow() Dim sht As Worksheet Dim LastRow As Long Dim FirstRow As Long Set sht =...
Just like char and int, a function is a fundamental feature of C. As such, you can declare a pointer to one: which means that you can pass which function to call to another function to help it do its job. For example, if you had a graph() function that displayed a graph, you could pass which functio...
import { Http, Request, RequestOptionsArgs, Response, RequestOptions, ConnectionBackend, Headers } from '@angular/http'; import { Router } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/empty'; import 'rxjs/add/observable/throw'; import 'rxjs/a...
After extending the Http class, we need to tell angular to use this class instead of Http class. In order to do this, in our main module(or depending on the needs, just a particular module), we need to write in the providers section: export function httpServiceFactory(xhrBackend: XHRBackend, reque...
Take any list and add an identifier to the outer wrapper (ul, div) <ul id="sortable"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> In your jquery: $(function(){ $('#sortable').sortable({ ...
A simple type switch: // assuming x is an expression of type interface{} switch t := x.(type) { case nil: // x is nil // t will be type interface{} case int: // underlying type of x is int // t will be int in this case as well case string: // underlying type of x is st...
You can archive different Textsizes inside a Textview with a Span TextView textView = (TextView) findViewById(R.id.textView); Spannable span = new SpannableString(textView.getText()); span.setSpan(new RelativeSizeSpan(0.8f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(span)...
A regular expression with grouped parts can be used as an extractor: scala> val address = """(.+):(\d+)""".r address: scala.util.matching.Regex = (.+):(\d+) scala> val address(host, port) = "some.domain.org:8080" host: String = some.domain.org por...
There are several ways to create an Observable in RxJava. The most powerful way is to use the Observable.create method. But it's also the most complicated way. So you must avoid using it, as much as possible. Emitting an exiting value If you already have a value, you can use Observable.just to emi...
Create a class which extends Service class and in overridden method onBind return your local binder instance: public class LocalService extends Service { // Binder given to clients private final IBinder mBinder = new LocalBinder(); /** * Class used for the client Binder. Bec...
Describe your service access interface through .aidl file: // IRemoteService.aidl package com.example.android; // Declare any non-default types here with import statements /** Example service interface */ interface IRemoteService { /** Request the process ID of this service, to do evil...
Actually you can use ReactJS's components in Typescript as in facebook's example. Just replace 'jsx' file's extension to 'tsx': //helloMessage.tsx: var HelloMessage = React.createClass({ render: function() { return <div>Hello {this.props.name}</div>; } }); ReactDOM.rende...

Page 175 of 1336