[Microsoft Word] - Tips
December 23, 2021 |
II. Cách đánh số thứ tự cho từng trang trong word
Cách 2: Đánh số trang cho vị trí bất kì
$hostnamectl set-hostname oracle.unixcop.local
$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
$ dnf update -y
$ useradd oracle $ passwd oracle
$ cat /etc/selinux/config $ vi /etc/selinux/config
$ systemctl status firewalld $ systemctl disable firewalld
$ 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
$ 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
$ ./runInstaller
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
# 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 :
Run Java App as a Service in Cent OS
References:
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
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
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....
AWS Cloud Practitioner Essentials
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
Share With YouSoftware Engineer Email: hoquoctri@live.com Skype: hoquoctri.it.tdt |