Tutorial by Examples: c

A Button directive which accepts an @Input() to specify a click limit until the button gets disabled. The parent component can listen to an event which will be emitted when the click limit is reached via @Output: import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component(...
If you want to convert the content of a part into a domain object (e.g. a User or Account or Address), then the process is very simple: It is possible to upload multiple parts, each with a different name. For each part name, you will need one parameter annotated with @RequestPart, whose name matche...
Creating a custom ImplicitNamingStrategy allows you to tweak how Hibernate will assign names to non-explicitly named Entity attributes, including Foreign Keys, Unique Keys, Identifier Columns, Basic Columns, and more. For example, by default, Hibernate will generate Foreign Keys which are hashed an...
The following code can be entered in a Tcl shell (tclsh), or into a script file and run through a Tcl shell: puts "Hello, world!" It gives the string argument Hello, world! to the command puts. The puts command writes its argument to standard out (your terminal in interactive mode) an...
This code makes sure that all nested containers are always the same height. This is done by assuring that all nested elements are the same height as the containing parrent div. See working example: https://jsfiddle.net/3wwh7ewp/ This effect is achieved due to the property align-items being set to...
By injecting $filter, any defined filter in your Angular module may be used in controllers, services, directives or even other filters. angular.module("app") .service("users", usersService) .controller("UsersController", UsersController); function usersService...
A custom control does not have to limit itself to trivial things like primitives; it can edit more interesting things. Here we present two types of custom controls, one for editing persons and one for editing addresses. The address control is used to edit the person's address. An example of usage wo...
Passing a context with a timeout (or with a cancel function) to a long running function can be used to cancel that functions work: ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond) for { select { case <-ctx.Done(): return ctx.Err() default: ...
The components in angularJS can be visualised as a custom directive (< html > this in an HTML directive, and something like this will be a custom directive < ANYTHING >). A component contains a view and a controller. Controller contains the business logic which is binded with an view , w...
' sample data Dim sample = {1, 2, 3, 4, 5} ' using "query syntax" Dim squares = From number In sample Select number * number ' same thing using "method syntax" Dim squares = sample.Select (Function (number) number * number) We can project multiple result at once too ...
There are four principle ways to declare a variable in JavaScript: using the var, let or const keywords, or without a keyword at all ("bare" declaration). The method used determines the resulting scope of the variable, or reassignability in the case of const. The var keyword creates a f...
3.0 let someString = " Swift Language \n" let trimmedString = someString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) // "Swift Language" Method stringByTrimmingCharactersInSet returns a new string made by removing from both ends of t...
SleekXMPP (Python) import sleekxmpp client = sleekxmpp.Client("[email protected]", "password") client.connect() client.process(blocking=False) client.send_message(mto="[email protected]", mbody=self.msg) Smack (Java / Android) XMPPTCPConnection connectio...
In addition to functional constructs such as Try, Option and Either for error handling, Scala also supports a syntax similar to Java's, using a try-catch clause (with a potential finally block as well). The catch clause is a pattern match: try { // ... might throw exception } catch { case i...
A method can be converted to a closure using the & operator. def add(def a, def b) { a + b } Closure addClosure = this.&add assert this.add(4, 5) == addClosure(4, 5)
Add a keystore using: keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000 Note: This should be at root of project. Though not a hard requirement, it eases the file referencing Add a build.json with release/dev configuration for key...
Early Bound (with a reference to Microsoft Scripting Runtime) Sub EnumerateFilesAndFolders( _ FolderPath As String, _ Optional MaxDepth As Long = -1, _ Optional CurrentDepth As Long = 0, _ Optional Indentation As Long = 2) Dim FSO As Scripting.FileSystemObject Set ...
Declaring an array is very similar to declaring a variable, except you need to declare the dimension of the Array right after its name: Dim myArray(9) As String 'Declaring an array that will contain up to 10 strings By default, Arrays in VBA are indexed from ZERO, thus, the number inside the par...
Split Function returns a zero-based, one dimensional array containing a specified number of substrings. Syntax Split(expression [, delimiter [, limit [, compare]]]) PartDescriptionexpressionRequired. String expression containing substrings and delimiters. If expression is a zero-length string(&q...
Inside parent-component.hbs {{yield (hash child=( component 'child-component' onaction=(action 'parentAction') ) )}} Inside parent-component.js export default Ember.Component.extend({ actions: { // We pass this action to the child to call at it's discretion par...

Page 243 of 826