Bounded type parameters allow you to set restrictions on generic type arguments:
class SomeClass {
}
class Demo<T extends SomeClass> {
}
But a type parameter can only bind to a single class type.
An interface type can be bound to a type that already had a binding. This is achieve...
Create a Java class which extends org.apache.hadoop.hive.ql.exec.hive.UDAF
Create an inner class which implements UDAFEvaluator
Implement five methods
init() – This method initializes the evaluator and resets its internal state. We are using new Column() in the code below to indicate th...
The modifier that allows using whitespace inside some parts of the pattern to format it for better readability and to allow comments starting with #:
/(?x)^ # start of string
(?=\D*\d) # the string should contain at least 1 digit
(?!\d+$) # the string cannot consist of digi...
With the bind command it is possible to define custom key bindings.
The next example bind an Alt + w to >/dev/null 2>&1:
bind '"\ew"':"\" >/dev/null 2>&1\""
If you want to execute the line immediately add \C-m (Enter) to it:
bind '"\ew&quo...
Information about the database connections
SELECT
a.mon$attachment_id as Attachment_ID,
a.mon$server_pid as Server_PID,
case a.mon$state
when 1 then 'active'
when 0 then 'idle'
end as State,
a.mon$attachment_name as Database_Name,
...
Partial classes provide a clean way to separate core logic of your scripts from platform specific methods.
Partial classes and methods are marked with the keyword partial. This signals the compiler to leave the class "open" and look in other files for the rest of the implementation.
// E...
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 ...
public static async Task<WriteableBitmap> RenderUIElement(UIElement element)
{
var bitmap = new RenderTargetBitmap();
await bitmap.RenderAsync(element);
var pixelBuffer = await bitmap.GetPixelsAsync();
var pixels = pixelBuffer.ToArray();
var writeableBitmap = new W...
In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. Wikipedia reference
protocol SenderProtocol
{
func send(packa...
Writing with roxygen2
roxygen2 is a package created by Hadley Wickham to facilitate documentation.
It allows to include the documentation inside the R script, in lines starting by #'. The different parameters passed to the documentation start with an @, for example the creator of a package will by...
ngMessages is used to enhanced the style for displaying validation messages in the view.
Traditional approach
Before ngMessages, we normally display the validation messages using Angular pre-defined directives ng-class.This approach was litter and a repetitive task.
Now, by using ngMessages we ca...
These are URL schemes supported by native apps on iOS, OS X, and watchOS 2 and later.
Opening link in Safari:
Objective-C
NSString *stringURL = @"http://stackoverflow.com/";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Swift:
let s...
To open an app with defined URL scheme todolist://:
Objective-C
NSURL *myURL = [NSURL URLWithString:@"todolist://there/is/something/to/do"];
[[UIApplication sharedApplication] openURL:myURL];
Swift
let stringURL = "todolist://there/is/something/to/do"
if let url = NSURL(s...
A document can be created by using the CreateDocumentAsync method of the DocumentClient class. Documents are user defined (arbitrary) JSON content.
async Task CreateFamilyDocumentIfNotExists(DocumentClient client, string databaseName, string collectionName, Family family)
{
try
{
...
DocumentDB supports rich queries against JSON documents stored in each collection.
With a LINQ query
IQueryable<Family> familyQuery = this.client.CreateDocumentQuery<Family>(
UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), queryOptions)
.Where(f => f....