How can two components communicate with each other?
In Angular, components can communicate with each other by any of the following means:
- Input parameters
- Output parameters
- Service methods
- Subject and Observables
In Angular, components can communicate with each other by any of the following means:
To enable a class to be used under a using() block, the class must implement the IDisposable interface with its own implementation of the Dispose() method.
public class MyClass : IDisposable {
public void Dispose() {
// implementation of Dispose method
}
}
// in some other method
using(var myclass = new MyClass()) {
// myclass instance is alive inside
// this block only
}
Dispose is never called by the .NET Framework; you must call it manually - preferably by wrapping its creation in a using() block.
We can make use of the built-in UseExceptionHandler() middleware for catching Global Errors in ASP.NET Core.
app.UseExceptionHandler(err =>
{
err.Run(async ctx =>
{
context.Response.StatusCode = 500;
context.Response.ContentType = "application/json";
// gets error detail
var ex = context.Features.Get<IExceptionHandlerPathFeature>();
var error = new MyResponseModel() { Content = ex.Error.Message };
await context.Response.WriteAsync(JsonConvert.SerializeObject(error));
});
});
We can use raiseError to throw custom exceptions in an P-SQL block.
Example:
RAISERROR (N'Error Raised: %s %d.', -- Message text.
10, -- Severity,
1, -- State,
N'number', -- First argument from the
5); -- Second argument.
Returns Error Message: Error Raised: number 5.
For a given string return a compressed string which replaces all the repetitions of the characters with their counts. If the compressed string is not smaller than the initial string return the original string as it is. For example, if the input string is "aabbbbbcccdddeef", then the resultant string should be "a2b5c3d3e2f1", whereas if the input string is "abcdef" then the output should be "abcdef".
Imagine you are given a number n. You need to find out all possible sets of numbers that fit into a,b,c,d such that a3+b3=c3+d3. There is no restriction that the numbers a,b,c,d need to be distinct.