Tutorial by Examples

One of the most useful things that came along with sections is blocks. Blocks are basically a blueprint for something that can be created an unlimited amount of times. One of the best examples is the slides of a slider. A block is a top level item in the schema, meaning it is alongside things like n...
/* * This design have some major issues * For each new shape added the unit testing * of the GraphicEditor should be redone * When a new type of shape is added the time * for adding it will be high since the developer * who add it should understand the logic * of the Gr...
/* * For each new shape added the unit testing * of the GraphicEditor should not be redone * No need to understand the sourcecode * from GraphicEditor. * Since the drawing code is moved to the * concrete shape classes, it's a reduced risk * to affect old functionallity when new * functionall...
Area The term used in Debian Policy for the main, contrib, and non-free divisions. Architecture The type of system a piece of software is built for. Such as amd64, i386, armel, s390x, powerpc, armhf, mips, AArch64, POWER. Binary package An installable .deb file Source package A unit of upstr...
This example is based on spring boot 1.5.1.RELEASE. with the following dependencies: <!-- Spring --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency>...
First, lets overview what we need in order to setup Hibernate correctly. @EnableTransactionManagement and @EnableJpaRepositories - we want transactional management and to use spring data repositories. DataSource - main datasource for the application. using in-memory h2 for this example. LocalCo...
A simple entity: Using Lombok @Getter and @Setter annotations to generate getters and setters for us @Entity @Getter @Setter public class Message { @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid...
In order to expose Thymeleaf templates we need to define controllers. Example: @Controller @RequestMapping("/") public class MessageController { @Autowired private MessageRepository messageRepository; @GetMapping public ModelAndView index() { It...
Html.TextBox() @Html.TextBox("Name", null, new { @class = "form-control" }) output:<input class="form-control" id="Name"name="Name"type="text"value=""/> @Html.TextBox("Name", "Stack Overflow", new { ...
First, install ipset if needed. Please refer to your distribution to know how to do it. As an example, here is the command for Debian-like distributions. $ apt-get update $ apt-get install ipset Then create a configuration file to define an ipset containing the IPs for which you want to open ac...
Let's say we want to eliminate duplicated subsequence element from a string (it can be more than one). For example: 2,14,14,14,19 and convert it into: 2,14,19 Using gsub, we can achieve it: gsub("(\\d+)(,\\1)+","\\1", "2,14,14,14,19") [1] "2,14,19" ...
Gradle tasks can be written using Groovy code from inside a projects build.gradle file. These tasks can then be executed using > gradle [taskname] at the terminal or by executing the task from within an IDE such as Eclipse. To create the Hello World example in gradle we must define a task that w...
It is a common practice to name files using the date as prefix in the following format: YYYYMMDD, for example: 20170101_results.csv. A date in such string format can be verified using the following regular expression: \\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]) The above expression considers d...
iex(1)> [x, y] = ["String1", "String2"] iex(2)> "#{x} #{y}" # "String1 String2"
["String1", " ", "String2"] |> IO.iodata_to_binary # "String1 String2" This will gives some performances boosts as strings not duplicated in memory. Alternative method: iex(1)> IO.puts(["String1", " ", "String2"]) # ...
Enum.join(["String1", "String2"], " ") # "String1 String2"
The typeid keyword is a unary operator that yields run-time type information about its operand if the operand's type is a polymorphic class type. It returns an lvalue of type const std::type_info. Top-level cv-qualification are ignored. struct Base { virtual ~Base() = default; }; struct Deri...
Instead of invoking the Angular’s bootstrap code directly, wrap the bootstrap code into a function and export the function. This function can also accept parameters. import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; import { AppModule } from "./src/app&quot...

Page 1157 of 1336