Imagine the following XML:
<root>
<element>hello</element>
<another>
hello
</another>
<example>Hello, <nested> I am an example </nested>.</example>
</root>
The following XPath expression:
//*[text() = 'hel...
Laravel allows access to a variety of classes called Services. Some services are available out of the box, but you can create them by yourself.
A service can be used in multiple files of the application, like controllers. Let's imagine a Service OurService implementing a getNumber() method returnin...
In a Service Provider register method we can bind an interface to an implementation:
public function register()
{
App::bind( UserRepositoryInterface::class, EloquentUserRepository::class );
}
From now on, everytime the app will need an instance of UserRepositoryInterface, Larave...
The Service Container is the main Application object. It can be used as a Dependency Injection Container, and a Registry for the application by defining bindings in the Service Providers
Service Providers are classes where we define the way our service classes will be created through the applicatio...
You can easily add a breakpoint to your code by clicking on the grey column to the left of the line of your VBA code where you want execution to stop. A red dot appears in the column and the breakpoint code is also highlighted in red.
You can add multiple breakpoints throughout your code and resumi...
/**
* @param year Full year as int (ex: 2000).
* @param month Month as int, zero-based (ex: 0=January, 11=December).
*/
function daysInMonth(year:int, month:int):int {
return (new Date(year, ++month, 0)).date;
}
We have to create a view which will have a image prefix to a text. text could be of variable length.We have to achieve a result where in Image + text is always in center of a parent view.
Step 1: First create a single view project and name it something of your choice and open the story board fist...
"Use DIRECT PATH method for inserting new rows".
The APPEND hint instructs the engine to use direct path load. This means that the engine will not use a conventional insert using memory structures and standard locks, but will write directly to the tablespace the data. Always creates new b...
Analog to get a collection for a Stream by collect() an array can be obtained by the Stream.toArray() method:
List<String> fruits = Arrays.asList("apple", "banana", "pear", "kiwi", "orange");
String[] filteredFruits = fruits.stream()
....
Table file with header, footer, row names, and index column:
file: table.txt
This is a header that discusses the table file
to show space in a generic table file
index name occupation
1 Alice Salesman
2 Bob Engineer
3 Charlie Janitor
This is a footer becaus...
In C, a string is a sequence of characters that is terminated by a null character ('\0').
We can create strings using string literals, which are sequences of characters surrounded by double quotation marks; for example, take the string literal "hello world". String literals are automatica...
It is usually not a good idea to mix signed and unsigned integers in arithmetic operations. For example, what will be output of following example?
#include <stdio.h>
int main(void)
{
unsigned int a = 1000;
signed int b = -1;
if (a > b) puts("a is more than b"...
Let's suppose we have a reference to the JQuery type definition and we want to extend it to have additional functions from a plugin we included and which doesn't have an official type definition. We can easily extend it by declaring functions added by plugin in a separate interface declaration with ...
Declare public variables and methods type in the interface to define how other typescript code can interact with it.
interface ISampleClassInterface {
sampleVariable: string;
sampleMethod(): void;
optionalVariable?: string;
}
Here we create a class that implements the interface.
...
Two-way Data-Binding supports the following attributes:
ElementPropertiesAbsListViewandroid:selectedItemPositionCalendarViewandroid:dateCompoundButtonandroid:checkedDatePickerandroid:yearandroid:monthandroid:dayEditTextandroid:textNumberPickerandroid:valueRadioGroupandroid:checkedButtonRatingBarand...
It is very convenient to use extension methods with interfaces as implementation can be stored outside of class and all it takes to add some functionality to class is to decorate class with interface.
public interface IInterface
{
string Do()
}
public static class ExtensionMethods{
pu...
This is an example of how to use the generic type TFood inside Eat method on the class Animal
public interface IFood
{
void EatenBy(Animal animal);
}
public class Grass: IFood
{
public void EatenBy(Animal animal)
{
Console.WriteLine("Grass was eaten by: {0}",...