The EntityDamage event is thrown when an Entity is damaged.
EntityDamageEvent
@EventHandler
public void onEntityDamage(EntityDamageEvent e) {
DamageCause cause = e.getCause(); //Get the event DamageCause
double rawDamage = e.getDamage(); //Returns the damage before any calculation...
std::array being a STL container, can use range-based for loop similar to other containers like vector
int main() {
std::array<int, 3> arr = { 1, 2, 3 };
for (auto i : arr)
cout << i << '\n';
}
To configure robolectric add @Config annotation to test class or method.
Run with custom Application class
@RunWith(RobolectricTestRunner.class)
@Config(application = MyApplication.class)
public final class MyTest {
}
Set target SDK
@RunWith(RobolectricTestRunner.class)
@Config(sdk = Build...
SWIFT:
Step 1:
In your Info.plist add the following attribute:
View controller-based status bar appearance
and set its value to
NO
as described in the image below:
Step 2:
In your AppDelegate.swift file, in didFinishLaunchingWithOptions method, add this code:
UIApplication.shared.st...
Sometimes it is useful to print a current binding directly from markup. A neat trick which allows that is to use an additional DOM element with a non-existing binding (KO < 3.0), custom binding or a binding that is not relevant such as uniqueName.
Consider this example:
<tbody data-bind=&quo...
Once it's done, you can find your archive in the Xcode organizer. This is where all your previous versions and archive builds are saved and organized in case you do not delete them. You will immediately notice a large blue button saying "Upload to App Store..." however in 9/10 cases this w...
Once the IPA file is generated, open Xcode, navigate to developer tools and open Application Loader.
If you have multiple accounts in your Xcode, you will be asked to choose. Naturally pick the one you used for code signing in the first step. Pick "Deliver your app" and upload the code....
//create a new ExcelPackage
using (ExcelPackage excelPackage = new ExcelPackage())
{
//create 2 WorkSheets. One for the source data and one for the Pivot table
ExcelWorksheet worksheetPivot = excelPackage.Workbook.Worksheets.Add("Pivot");
ExcelWorksheet worksheetData = exc...
One to Many
Lets say that each Post may have one or many comments and each comment belongs to just a single Post.
so the comments table will be having post_id. In this case the relationships will be as follows.
Post Model
public function comments()
{
return $this->belongsTo(Post::class...
if and else:
it used to check whether the given expression returns true or false and acts as such:
if (condition) statement
the condition can be any valid C++ expression that returns something that be checked against truth/falsehood for example:
if (true) { /* code here */ } // evaluate that ...
The break instruction:
Using break we can leave a loop even if the condition for its end is not fulfilled. It can be used to end an infinite loop, or to force it to end before its natural end
The syntax is
break;
Example:
we often use break in switch cases,ie once a case i switch is satisfied...
I'll start with a really short explanation what is and why use Model-View-ViewModel (MVVM) design pattern in your iOS apps.
When iOS first appeared, Apple suggested to use MVC (Model-View-Controller) as a design pattern. They showed it in all of their examples and all first developers were happy us...
Environment Setup:
Download android sdk of API level 17 or more
Node.js (https://nodejs.org/)
Appium software (http://appium.io/)
Selenium jars (http://www.seleniumhq.org/download/)
Appium jar (https://search.maven.org/#search%7Cga%7C1%7Cg%3Aio.appium%20a%3Ajava-client)
.apk file of the appl...
A Reference in C++ is just an Alias or another name of a variable. Just like most of us can be referred using our passport name and nick name.
References doesn't exist literally and they don't occupy any memory. If we print the address of reference variable it will print the same address as that of...
SELECT E.LAST_NAME|| ' reports to ' ||
PRIOR E.LAST_NAME "Walk Top Down"
FROM HR.EMPLOYEES E
START WITH E.MANAGER_ID IS NULL
CONNECT BY PRIOR E.EMPLOYEE_ID = E.MANAGER_ID;
Concept
AsyncTask is a class that allows running operations in the background, with the results being published on the UI thread. The main purpose is to eliminate all the boilerplate code for starting/running a thread by eliminating the handlers and all the stuff that are needed for manipulating t...
Another variation from the code above gives you more performance when you want to get hash codes of all files from a root folder including all sub folders.
Example of Worksheet:
Code
Option Explicit
Private Const HashTypeMD5 As String = "MD5" ' https://msdn.microsoft.com/en-us/libr...
We can create Singleton class in such a way that developers are forced to used the shared instance (singleton object) instead of creating their own instances.
@implementation MySingletonClass
+ (instancetype)sharedInstance
{
static MySingletonClass *_sharedInstance = nil;
static dispa...