Tutorial by Examples: f

[ServiceContract] public interface IBookService { [OperationContract] [WebGet] List<Book> GetBooksList(); [OperationContract] [WebGet(UriTemplate = "Book/{id}")] Book GetBookById(string id); [OperationContract] [WebInvoke(UriTemplate = &...
The .every method tests if all array elements pass a provided predicate test. To test all objects for equality, you can use the following code snippets. [1, 2, 1].every(function(item, i, list) { return item === list[0]; }); // false [1, 1, 1].every(function(item, i, list) { return item === list[0...
Object obj = new Object(); // Note the 'new' keyword Where: Object is a reference type. obj is the variable in which to store the new reference. Object() is the call to a constructor of Object. What happens: Space in memory is allocated for the object. The constructor Object() is call...
Simple Example (centering a single element) HTML <div class="aligner"> <div class="aligner-item">…</div> </div> CSS .aligner { display: flex; align-items: center; justify-content: center; } .aligner-item { max-width: 50%; /*for d...
The @if control directive evaluates a given expression and if it returns anything other than false, it processes its block of styles. Sass Example $test-variable: true !default =test-mixin @if $test-variable display: block @else display: none .test-selector +test-mixin ...
To receive a file uploaded via an HTTP Post, you need to do the following: @RequestMapping( value = "...", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE ) public Object uploadFile( @RequestPart MultipartFile file ) { String fileNam...
To receive multiple files uploaded via a single HTTP Post, you need to do the following: @RequestMapping( value = "...", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE ) public Object uploadFile( @RequestPart MultipartFile[] files ) { ...
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 matches the part name. To receive a file uploaded via an HTTP Post, you need to do the following: @RequestMapping( value = "...&quo...
The function angular.isDefined tests a value if it is defined angular.isDefined(someValue) This is the equivalent of performing value !== undefined; // will evaluate to true is value is defined Examples angular.isDefined(42) // true angular.isDefined([1, 2]) // true angular.isDefined(un...
C++11 The type std::conditional in the standard library header <type_traits> can select one type or the other, based on a compile-time boolean value: template<typename T> struct ValueOrPointer { typename std::conditional<(sizeof(T) > sizeof(void*)), T*, T>::type vop; }...
tf get /all /recursive $/ Gets and replaces all files and directories from the last version available
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...
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...
This code writes the string to a file. It is important to close the writer, so this is done in a finally block. public void writeLineToFile(String str) throws IOException { File file = new File("file.txt"); BufferedWriter bw = null; try { bw = new BufferedWriter(ne...
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 ...
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...
Meteor.call(name, [arg1, arg2...], [asyncCallback]) (1) name String (2) Name of method to invoke (3) arg1, arg2... EJSON-able Object [Optional] (4) asyncCallback Function [Optional] On one hand, you can do : (via Session variable, or via ReactiveVar) var syncCall = Meteor.call("my...
stringVar="Apple Orange Banana Mango" arrayVar=(${stringVar// / }) Each space in the string denotes a new item in the resulting array. echo ${arrayVar[0]} # will print Apple echo ${arrayVar[3]} # will print Mango Similarly, other characters can be used for the delimiter. stringVa...
As per the Mongoid Documentation, there are 16 valid field types: Array BigDecimal Boolean Date DateTime Float Hash Integer BSON::ObjectId BSON::Binary Range Regexp String Symbol Time TimeWithZone To add a field (let's call it name and have it be a String), add this to your mode...

Page 128 of 457