[Microsoft Word] - Tips

December 23, 2021 |

 




I. Không thể Zoom Tài Liệu



Nguyên nhân: Bạn đang dùng chế độ view Side By Side
Cách khắc phục:
Menu > View > Chọn Vertical



II. Cách đánh số thứ tự cho từng trang trong word

Cách 1: Đánh số thứ tự cho toàn bộ văn bản
- Chọn Insert > Page Number


Top of page: Chèn phía trên trang
Bottom of page: Chèn phía dưới trang
- Click vào là chọn nơi bạn cần đánh dấu

Cách 2: Đánh số trang cho vị trí bất kì
- Để dánh số trang bất kì, bạn cần chia word thành nhiều Section khác nhau để đánh số. Ví dụ bạn muốn đánh dấu trang số 2 từ 1 đến cuối trang, trang bìa thì bạn bỏ không đánh dấu.
- Bạn chia trang bìa là section 1, và trang thứ 2 trở đi là section 2.
Bạn làm như sau:
- Trỏ chuột vào trang thứ 2 hoặc bất kì trang nào bạn muốn để bắt đầu section #2.
- Bạn vào Layout > Break > Continous


- Lúc này tài liệu bạn đã chia thành 2 section.
- Vào Insert > Page Number > Format Page Number > Chọn Start at: 1

- Sau đó bạn vào trang bìa > Double Click vào Footer > xóa số tự của trang đi.






Read more…

[Oracle] - Oracle Database 21

November 24, 2021 |

 

I. Install Oracle DB 21c In CentOS 8

Ref:
1. Oracle 21c : https://www.oracle.com/database/technologies/oracle21c-windows-downloads.html
2. CentOS v8 : https://www.centos.org/download/

Step 1: Set hostname
$hostnamectl set-hostname oracle.unixcop.local
Step 2: Install Oracle Database preinstall packages.
$dnf install oracle-database-preinstall-21c -y

# If above is cannot install, download rpm in url: 
# https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/index.html
$dnf localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm

Step 3: Update packages.
$ dnf update -y

Step 4: Create the user
$ useradd oracle
$ passwd oracle


Step 5: Disabled SELinux
$ cat /etc/selinux/config
$ vi /etc/selinux/config

Step 6: Disable Firewall
$ systemctl status firewalld
$ systemctl disable firewalld
Step 7: Make environments
$ mkdir -p /u01/app/oracle
$ mkdir -p /u01/app/oracle/product/21.0.0/dbhome_1
$ mkdir -p /u01/app/oraInventory
$ mkdir -p /u02/oradata
$ chown -R oracle:oinstall /u01 /u02
$ chown -R oracle:oinstall /u01/app/oraInventory
$ chmod -R 775 /u01 /u02
$ mkdir /home/oracle/scripts
$ cat > /home/oracle/scripts/setEnv.sh <<EOF
> # Oracle Settings
> export TMP=/tmp
> export TMPDIR=\$TMP
>
> export ORACLE_HOSTNAME=oracle.unixcop.local
> export ORACLE_UNQNAME=cdb1
> export ORACLE_BASE=/u01/app/oracle
> export ORACLE_HOME=\$ORACLE_BASE/product/21.0.0/dbhome_1
> export ORA_INVENTORY=/u01/app/oraInventory
> export ORACLE_SID=cdb1
> export PBD_NAME=pdb1
> export DATA_DIR=/u02/oradata
>
> export PATH=/usr/sbin:/usr/local/bin:\$PATH
> export PATH=\$ORACLE_HOME/bin:\$PATH
>
> export LB_LIBRRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
> export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
> EOF

$ echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Step 8: Create start/stop oracle db:
$ cat > /home/oracle/scripts/start_all.sh <<EOF
> #!/bin/bash
> . /home/oracle/scripts/setEnv.sh
>
> export ORAENV_ASK=NO
> . oraenv
> export ORAENV_ASK=YES
>
> dbstart \$ORACLE_HOME
> EOF

$ cat > /home/oracle/scripts/stop_all.sh <<EOF
> #!/bin/bash
> . /home/oracle/scripts/setEnv.sh
>
> export ORAENV_ASK=NO
> . oraenv
> export ORAENV_ASK=YES
>
> dbshut \$ORACLE_HOME
> EOF
$ chown -R oracle:oinstall /home/oracle/scripts
$ chmod u+x /home/oracle/scripts/*.sh
Step 9: Upload unzip Oracle DB installter to server follow the path:
/u01/app/oracle/product/21.0.0/dbhome_1

$ ./runInstaller

Note: Switch to user "oracle" in GUI and run this scripts.


* Running RPM packages to Install Oracle Database:
























Read more…

[Aruba] - Setting Aruba IAP 225

September 27, 2021 |

 

1. Access console of Aruba

Step 1: Open putty

Step 2: Type IP of Aruba 

Step 3: Enter Admin/Password of Admin (same on GUI Login)


2. CLI Command line

Ref: https://www.arubanetworks.com/techdocs/Instant_84_WebHelp/Content/instant-cli/clock-set.htm?Highlight=clock%20set

# show clock
$show clock

#set clock
$ clock set yyyy mm dd hh mm ss

#set NTP server
$ config  (go to config mode )
$ ntp-server <hostname>
$ end (exit config mode)
$commit apply  (apply config)

#check NTP status|
$ show ntp status

#Show NTP debug
$ show ntp debug

#Show time-range
$ show time-range

3. Turn off Broadcast filtering

If all clients cannot broadcast together, we can turn off that:

1. Network > Select Network > Advance Setting > Broadcase filtering : Disable


4. Resolve NTP Time Not Sync in Mikrotik

Description:

In some areas, the home network infrastructure is still limited, applying policies to each of their Internet users, especially in rural areas and remote areas. Many places block/change NTP ports, specifically UDP port 123.

At that time, your Mikrotik Router will not be able to update and synchronize the time, no matter which NTP Server you set, the status is still in the waiting state as shown above, detecting other unexpected errors. Maybe at this time you think that the Mikrotik device is faulty, you will update, downgrade the firmware for the device, even Re-Install RouterOS for the device but still cannot solve the problem.

Ip > Firewall :






Read more…

[Java] - Run Java App as a Service in Cent OS

July 30, 2021 |

 


Run Java App as a Service in Cent OS

References:

  1. https://dzone.com/articles/run-your-java-application-as-a-service-on-ubuntu

Step 1: Create user

  • You should create a user for your service.

Ex:

$ groupadd group1

$ useradd user1 -M -s /bin/nologin -g gtest


Step 2: Create a service

$ vi /etc/systemd/system/your-service.service


Copy/past:

#!/bin/bash

[Unit]

Description=VCS Netty Service

[Service]

User=user1

# The configuration file application.properties should be here:


#change this to your workspace

WorkingDirectory=/home/user1


#path to executable.

#executable is a bash script which calls jar file

ExecStart=/home/user1/run-service


SuccessExitStatus=143

TimeoutStopSec=10

Restart=on-failure

RestartSec=5


[Install]

WantedBy=multi-user.target


Step 3: Create a Bash Script to Call Your Service

$ cd /home/user1

$ vi run-service.sh


#!/usr/bin/bash

/usr/bin/java -jar NETTY_SERVER-0.0.1-SNAPSHOT.jar


$ chmod u+x run-service.sh


Step 4: Start the Service

$ systemctl daemon-reload

$ systemctl enable your-service.service

$ systemctl start your-service

$ systemctl status your-service


Step 4: Check log

$ journalctl -f -u your-service


Read more…

[React Native] - Realm Database

June 07, 2021 |

 

REACT NATIVE - REALM DATABASE

Ref:
1. https://docs.mongodb.com/realm-legacy/docs/javascript/latest.html#examples
2. To do list example: https://hellokoding.com/todo-app-with-react-native-realm/

1. Open Realms

//Schema
const PersonSchema = {
  name: 'Person',
  properties: {
    realName:    'string', // required property
    displayName: 'string?', // optional property
    birthday:    {type: 'date', optional: true}, // optional property
  }
};
// Get the default Realm with support for our objects
Realm.open({schema: [Car, Person]})
  .then(realm => {
    // ...use the realm instance here
  })
  .catch(error => {
    // Handle the error here if something went wrong
  });
// Open a realm at another path
Realm.open({
  path: 'anotherRealm.realm',
  schema: [CarSchema]
}).then(/* ... */);


2. Get the current schema version

// Update to to the new schema
Realm.open({schema: [UpdatedPersonSchema], schemaVersion: 1});
//Get current version
const currentVersion = Realm.schemaVersion(Realm.defaultPath);


2. List of properties

realm.write(() => {
  let charlie = realm.create('Person', {
    name: 'Charlie',
    testScores: [100.0]
  });

  // Charlie had an excused absense for the second test and was allowed to skip it
  charlie.testScores.push(null);

  // And then he didn't do so well on the third test
  charlie.testScores.push(70.0);
});


3. Relationship
* To-One Relationship

const PersonSchema = {
  name: 'Person',
  properties: {
    // The following property definitions are equivalent
    car: {type: 'Car'},
    van: 'Car',
  }
};

realm.write(() => {
  const nameString = person.car.name;
  person.car.miles = 1100;

  // create a new Car by setting the property to an object
  // with all of the required fields
  person.van = {make: 'Ford', model: 'Transit'};

  // set both properties to the same car instance
  person.car = person.van;
});

* To-Many Relationships

const PersonSchema = {
  name: 'Person',
  properties: {
    // The following property definitions are equivalent
    cars: {type: 'list', objectType: 'Car'},
    vans: 'Car[]'
  }
}

let carList = person.cars;

// Add new cars to the list
realm.write(() => {
  carList.push({make: 'Honda', model: 'Accord', miles: 100});
  carList.push({make: 'Toyota', model: 'Prius', miles: 200});
});

let secondCar = carList[1].model;  // access using an array index


4. Query

* Get max value in Collection List.
For example: you want to get max of id Person in List. you can do like that

const personList = realm ? realm.objects('Personal') : null;

let idIdx = 0;
if (personList != null && personList.length != 0) {
   idIdx = personList.max('id');
   idIdx++;
}

* Passed para to query
Each subsequent argument is used by the placeholders (e.g. $0, $1, $2, …) in the query.

let person = personList.filtered('id=$0', id);


is updating















Read more…

[English] - TOEIC

June 03, 2021 |

 


Tổng hợp ngữ pháp trong TOEIC

I. Từ vựng
1. adhered (v) /əd'hiə/ dính chặt vào, tham gia, giữ vững
2. breached (v)/bri:tʃ/ vi phạm
3. unfavorable (a) Không thuận lợi
4. come as no surpise : chẳng có gì ngạc nhiên
5. come across: tình cờ gặp
6. tobe + about + to : chuẩn bị làm gì
7. A wide variety : Rất nhiều
8. tailored (a) phù hợp


II. Ngữ pháp
1. Đứng sau danh từ
    Prior to + N ": trước đó
    Rather than + V_ing/N : thay vì
    Owning to + N
2. Since/Because + clause
3. With/toward: không đi với ngày tháng

4. Cấu trúc đảo ngữ câu điều kiện (if)

If + S1 + V (hiện tại), S2 + will/may/might/should/can… + V (infinitive)
=> Should + S1 + (not)+ V (hiện tại), S2 + will/may/might/should/can… + V (infinitive)


If + S1 + V (quá khứ), S2 + would/might/could… + V (infinitive)
=> Were + S1 + (not) + O, S2 + would/might/could… + V (infinitive)

If + S1 + had + past participle, S2 + would/might/could… + have + past participle
=> Had + S1 + (not) + past participle, S2 + would/might/could… + have + past participle


5. many/much/very/more
Many: đi với danh từ đếm được
Much: đi với danh từ không đếm được
More: dùng trong câu so sánh
Very: đứng trước tính từ

6. If so : trước dấu "." và sau dấu ","   : Nếu vậy
Ex: They think she may try to phone. If so, someone must stay here.

7. As ... as
N/Adj/Phrase/Clause + as well as + N/Adj/Phrase/Clause.
as well as + V:
ex: John can ride the motorbike as well as ride the car.

N + as well as + N:
ex: My mom as well as my dad, both expected me to graduate.

as far as : theo như
ex: as far as the latest announcement, we will be off 4 consecutive days.

as good as : gần như
ex: as well as no one is in here.

as much as: gần như là, hầu như là, dường như
ex: after studying hard, Mike as well as finished the knowledge.

as long as : miễn là
ex: as soon as I received the test results, I immediately informed my mother.

as early  as: ngay từ khi
ex: I fell in love with Anna as early as I met her.


Read more…

[Report] - Jasper Report & Oracle BI Publisher

February 04, 2021 |

 

=========================================================================
I. Jasper Report

1. Require

IReport tool: https://community.jaspersoft.com/project/ireport-designer
JDK 1.7: https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html

If your PC has already installed many JDK, we can addressed the JDK on IReport Config:
1. Go to C:\Program Files (x86)\Jaspersoft\iReport-5.6.0\etc\ireport.conf
2. Edit this file:
    jdkhome="C:/Program Files/Java/jdk1.7.0_80"


2. Ant compile Jaser Report
Ref: http://jasperreports.sourceforge.net/sample.reference/antcompile/index.html

<target name="compile1"> 
  <mkdir dir="./build/reports"/> 
  <jrc 
    srcdir="./reports"
    destdir="./build/reports"
    tempdir="./build/reports"
    keepjava="true"
    xmlvalidation="true">
   <classpath refid="runClasspath"/>
   <include name="**/*.jrxml"/>
  </jrc>
</target> 
<target name="compile2">
  <mkdir dir="./build/reports"/> 
  <jrc 
    destdir="./build/reports"
    tempdir="./build/reports"
    keepjava="true"
    xmlvalidation="true">
   <src>
    <fileset dir="./reports">
     <include name="**/*.jrxml"/>
    </fileset>
   </src>
   <classpath refid="runClasspath"/>
  </jrc> 
</target> 

3. Jasper Report Java Code

Export Excel Report

/**
 * Export to Excel files.
 * @param response
 * @throws IOException
 * @throws JRException
 */
 public void exportReportToExcel(HttpServletRequest request, HttpServletResponse response) throws IOException, JRException {
  JasperPrint jasperPrint = print();
  String fileName = getExportFileName(types[1]);
  
  response.setContentType("application/vnd.ms-excel; charset=" + Constant.ENCODING);
  response.setHeader("Content-Disposition","attachment;filename=" + fileName);
  
  final OutputStream outputStream = response.getOutputStream();
  
  JRXlsExporter exporter = new JRXlsExporter();
  exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
  exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream);
  exporter.exportReport();
 }

Export HTML Report

/**
 * Export to HTML files.
 * @param response
 * @throws IOException
 * @throws JRException
 */
 public void exportReportToHTML(HttpServletRequest request, HttpServletResponse response) throws IOException, JRException {
  JasperPrint jasperPrint = print();
  
  response.setContentType("text/html");
  response.setHeader("Content-disposition", "inline");
  
  PrintWriter out = response.getWriter();
  JRHtmlExporter exporter = new JRHtmlExporter();
  request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_LIST_SESSION_ATTRIBUTE, jasperPrint);
  
  exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
  exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
  exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "/resources/ireport/html_files/");
  
  exporter.exportReport();
 }

Note: With HTML to view on the web browser, you should have "px" file from IReport. You can found this file in "html_files/px" after compiling your report in IReport Tool.

Export PDF Report

 /**
 * Export to PDF files.
 * @param response
 * @throws IOException
 * @throws JRException
 */
 public void exportReportToPDF(HttpServletResponse response) throws IOException, JRException {
  String fileName = getExportFileName(types[0]);
  JasperPrint jasperPrint = print();

  response.setContentType("application/x-pdf");
  response.setHeader("Content-disposition", "inline; filename=" + fileName);

  final OutputStream outputStream = response.getOutputStream();
  JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
 }

4. Jasper Report - Javascript

Download Report by AJAX

 function downloadFile(urlToSend) { 
     var req = new XMLHttpRequest(); 
     req.open("GET", urlToSend, true); 
     req.responseType = "blob"; 
     req.onload = function (event) { 
         var blob = req.response; 
         var fileName = req.getResponseHeader("Header attribute") //if you have the fileName header available 
         var link=document.createElement('a'); 
         link.href=window.URL.createObjectURL(blob); 
         link.download=fileName; 
         link.click(); 
     }; 
 
     req.send(); 
 }


=======================================================================






is updating....

Read more…

[AWS] - FULL Amazon Web Service

January 26, 2021 |

 

AWS Cloud Practitioner Essentials
Ref: Get from AWS Training

 


I. AWS Lamda

Ref:
1. https://aws.amazon.com/lambda/getting-started/
2. https://aws.amazon.com/getting-started/hands-on/run-serverless-code/
3. https://aws.amazon.com/lambda/


Use case: "AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers, creating workload-aware cluster scaling logic, maintaining event integrations, or managing runtimes. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration. Just upload your code as a ZIP file or container image, and Lambda automatically and precisely allocates compute execution power and runs your code based on the incoming request or event, for any scale of traffic. You can set up your code to automatically trigger from 140 AWS services or call it directly from any web or mobile app. You can write Lambda functions in your favorite language (Node.js, Python, Go, Java, and more) and use both serverless and container tools, such as AWS SAM or Docker CLI, to build, test, and deploy your functions."

Use case AWS Lamda: https://www.simform.com/serverless-examples-aws-lambda-use-cases/





Real-time file processing

Real-time stream processing


Web application


IoT

Mobile backend


is updating


Read more…