[English] - Possessive adjective, Possessive Pronoun, Possessive Case.

April 28, 2018 |
 Ref: https://elight.edu.vn/tinh-tu-so-huu
I. Overview

Pronoun
Possessive Adj
Possessive Pronoun
I
My
Mine
You
Your
Your
He
His
His
She
Her
Hers
It
Its
Its
We
Our
Ours
They
Their
Theirs





 II. Possessive Case 
 1. 's or s'
      's: cho một chủ sở hữu
      s': cho nhiều sỡ hữu.

updating...
Read more…

[Java] - Predicate Interface

April 27, 2018 |


Predicate Interface is a functional interface that represents a predicate of one argument and it is defined in java.util.function packages. That helps your code is simple.

Ref:
- https://docs.oracle.com/javase/8/docs/api/java/util/function/class-use/Predicate.html
- http://www.java2s.com/Tutorials/Java/java.util.function/Predicate/index.htm

1. Predicate example 1 

Predicate<Integer> pr = b -> (b >= 18); // Creating predicate  
System.out.println(pr.test(18));    // Calling Predicate method 

Results:
true

2. Predicate example 2 (Lambda and Method Reference)

Student.java
package com.javacore.stream;

public class Student {
 private String name;
 private int age;

 public Student(String name, int age) {
  super();
  this.name = name;
  this.age = age;
 }

 public String getName() {
  return name;
 }

 public void setName(String name) {
  this.name = name;
 }

 public int getAge() {
  return age;
 }

 public void setAge(int age) {
  this.age = age;
 }

 @Override
 public String toString() {
  // TODO Auto-generated method stub
  return "name = " + this.name + ";age= " + this.age;
 }

}

Main.java
package com.javacore.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

public class Main {

 public static void main(String[] args) {
   // create some student
  Student andy = new Student("andy", 25);
  Student susi = new Student("susi", 26);
  Student tom = new Student("tom", 24);
  Student adam = new Student("adam", 25);

  // create student list
  List<Student> studentList = Arrays.asList(andy, susi, tom, adam);
 
  //use Method Reference
  List<Student> studentOf25Age = filter(studentList, Main::isStudentAgeLessThan);
  System.out.println(studentOf25Age);
  
  //use lambda
  List<Student> studentOf26Age = filter(studentList, (Student student)  -> 26 == student.getAge());
  System.out.println(studentOf26Age);
 }

 public static boolean isStudentAgeLessThan(Student argStudent) {
  if (argStudent.getAge() < 25) {
   return true;
  }

  return false;
 }

 public static List<Student> filter(List<Student> argStudentList,
   Predicate<Student> argPredicate) {
  List<Student> studentList = new ArrayList<>();

  for (Student student : argStudentList) {
   if (argPredicate.test(student)) {
    studentList.add(student);
   }
  }

  return studentList;
 }

}


Results:
[name = tom;age= 24]
[name = susi;age= 26]

updating...



Read more…

[Node.js] - About Node.js

April 12, 2018 |

Read more…

[Microsoft Office] - Cách tạo video từ Microsoft Powerpoint 2016

April 12, 2018 |

Trong MS PowerPoint 2016 có chức năng tạo video từ các slide. Để tạo được một video các bạn làm như sau:

Bước 1: File > Export > Create a Video
Bước 2: Chọn chất lượng Video
Có 3 loại là:
+ Full HD (1080p)
+ HD (720p)
+ Standard (480p)


Bước 3: Chọn thời gian cho mỗi slide, mặc định là 5s. Các bạn có thể tuỳ chỉnh
Bước 4: Nhấn Create Video > Đặt tên file và chọn nơi lưu trữ video.
Bước 5: Chờ MS Powerpoint tạo video.

Sau khi chạy xong, các bạn sẽ có một file video với đuôi là .mp4


Read more…

[Java Design Pattern] - Creational Patterns

April 04, 2018 |
Creational Patterns

  • Deal with one of the most commonly performance taks in an OO application, the creation of object.
  • Support a uniform, simple and controlled mechanism to create objects.
  • Allow the encapsulation of the details about what classes are instantiated and how these instances are created.
  • Encourage the use of interfaces, which reduces coupling.


1. Factory Method
Description: A client object does not know which class to instantiate, you can make use of the factory method to create a instance of an appropriate class from a class hierarchy or a family of related classes.
Ref: Factory Method

2. Singleton
Description:Sometimes, there may be a need to have one and only one instance of a given class druing the lifetime of an application.
Ref: Singletone

3. Abstract Factory
Description: updating...
Ref: updating...

4. Prototype
Description: updating...
Ref: updating...

5. Builder
Description: updating...
Ref: updating...


Read more…