Tutorial by Examples: c

IObserver<T> and IObservable<T> interfaces can be used to implement observer pattern in .NET IObservable<T> interface represents the class that sends notifications IObserver<T> interface represents the class that receives them public class Stock { private string Sym...
This example is a very simple Spring Boot application. Maven Dependencies At first add the following dependencies to your project. Spring Initializr is recommended when you create a new project. <parent> <groupId>org.springframework.boot</groupId> <artifactId>spr...
Code <p><?php echo esc_html( sprintf( __( 'Character set: %s', 'textdomain' ), get_option( 'blog_charset' ) ) ); ?></p> Output Character set: UTF-8
By using tools like lscpu as lscpu is an easy way to get CPU information. $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 So...
Sometimes we'd like to pause code execution to inspect the state of the application (see Debugging). When running code through the MATLAB editor, this can be done using the "Pause" button in the UI or by pressing Ctrl+c (on Windows). However, when a computation was initiated from a GUI (vi...
VideoWriter videoWriter; videoWriter = new VideoWriter(outputFile, VideoWriter.fourcc('x', '2','6','4'), fps, frameSize, isRGB); //We have stated that we will use x264 as codec with FourCC //For writing, we add the following method and it will write the image we give as parameter...
/* * Component is an interface * which all elements (files, * folders, links ...) will implement */ class Component { public: virtual int getSize() const = 0; }; /* * File class represents a file * in file system. */ class File : public Component { public: virtual int...
Including a Static Section on a page is similar to including a snippet. The only difference is instead of using the word include you use the word section. {% section 'section-file-name' %} Using this tag will "hardcode" the section into your theme at the place where you put the code an...
For sections, instead of utilizing one big JSON file (like settings_schema.json, they instead keep their schema within the file of the section that is using it. To do this {% schema %} {% endschema %} tags are used and JSON is placed between them. From there, the format is similar to settings_schema...
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...
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...
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...
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" ...
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 718 of 826