Tutorial by Examples: bye

object HelloWorld extends App { println("Hello, world!") } Live demo By extending the App trait, you can avoid defining an explicit main method. The entire body of the HelloWorld object is treated as "the main method". 2.11.0 Delayed Initialization Per the official d...
Use this option if your project requires an Application subclass. Specify this Application subclass using the android:name property in the manifest file inside the application tag. In the Application subclass, add the attachBaseContext() method override, and in that method call MultiDex.install():...
Let's say that we want to have an alternative greeting that is accessible through a different URL. We might create a new function or even a new controller for that, but a best practice is to optimize what we already have, to make it work at it's best! To do this, we'll keep the same view as in the ...
Error handling is extremely important, we can define functions to be triggered when an execution error happens in one of your triggered functions: //Fires when 10 errors occur in the last 30 minutes (sliding) public static void ErrorMonitor([ErrorTrigger("0:30:00", 10)] TraceFilter filte...
It might be easier if you think of GROUP BY as "for each" for the sake of explanation. The query below: SELECT EmpID, SUM (MonthlySalary) FROM Employee GROUP BY EmpID is saying: "Give me the sum of MonthlySalary's for each EmpID" So if your table looked like this: +----...
The most straightforward approach to optimizing is by executing less code. This approach usually gives a fixed speed-up without changing the time complexity of the code. Even though this approach gives you a clear speedup, this will only give noticable improvements when the code is called a lot. R...
Its possible to change *.vmoptions and idea.properties files without editing them in the PhpStorm installation folder. Follow the steps below: Step 1: Run Help - Edit Custom VM Options... Step 2: Confirm the creation of the configuration file, if prompted Step 3: Add following lines if yo...
This is very similar to using an Application subclass and overriding the attachBaseContext() method. However, using this method, you don't need to override attachBaseContext() as this is already done in the MultiDexApplication superclass. Extend MultiDexApplication instead of Application: package...
A conversion that involves calling an explicit constructor or conversion function can't be done implicitly. We can request that the conversion be done explicitly using static_cast. The meaning is the same as that of a direct initialization, except that the result is a temporary. class C { std:...
Description This is a self-contained running example including/showcasing: minimum dependencies needed, Java Configuration, Bean declaration by annotation and Java Configuration, Dependency Injection by Constructor and by Property, and Pre/Post hooks. Dependencies These dependencies are needed in...
AWK is string manipulation language, used largely in UNIX systems. The idea behind AWK was to create a versatile language to use when working on files, which wasn't too complex to understand. AWK has some other variants, but the main concept is the same, just with additional features. These other v...
First, you need to install pry-byebug gem. Run this command: $ gem install pry-byebug Add this line at the top of your .rb file: require 'pry-byebug' Then insert this line wherever you want a breakpoint: binding.pry A hello.rb example: require 'pry-byebug' def hello_world puts &qu...
To retrieve a list of nearby entities of an entity, one can use List<Entity> nearby = entity.getNearbyEntities(double x, double y, double z); Bukkit will then calculate a bounding box centered around entity, having as parameters: x: 1/2 the size of the box along x axis y: 1/2 the size ...
In this example we are creating a new xs:complexType (EmployeeType) based on an existing xs:complexType (PersonType). The construction of this is slightly more complicated. Because the base xs:complexType (PersonType) is considered to be complex (more about this below) we add the <xs:complexCon...
JUnit has an abstract implementation of @TestRule that lets you write a rule in a more simpler way. This is called ExternalResource and provides two protected methods that can be extended like this: public class AwesomeTestRule extends ExternalResource { @Override protected void befor...
WarehosueEntity findWarehouseById(@Param("id") Long id); List<WarehouseEntity> findWarehouseByIdIn(@Param("idList") List<Long> warehouseIdList);
Using Line Numbers ... and documenting them in case of error ("The importance of seeing Erl") Detecting which line raises an error is a substantial part of any debugging and narrows the search for the cause. To document identified error lines with a short description completes a successf...

Page 1 of 1