Friday, 28 October 2016

Install Java (JRE or JDK) on Ubuntu 16.04

Introduction



If you had the option to choose between a base model car or a fully loaded model, which one will you choose?
Both cars will take you from point A to point B, but with the fully loaded car you have additional features that can make rush hour a chill hour.
Well, that’s the same concept when we take a closer look at Java. There are two standard types of installations, JRE (Java Runtime Environment) and JDK (Java Development Kit). Like the base model car, JRE enables the ability to create Java Applications for different types of deployments using minimal core tools to accomplish the task. JDK is a fully loaded Development Kit that has everything that JRE has plus additional resources to create/secure Applications and Applets.

Prerequisites

You need a Ubuntu server that is configured with a static IP address.  If you do not have a server already, why not spin up a robust and reliable Cloud Server in under 30 seconds.

Installing Java on Ubuntu 16.04

Before we begin, let make sure that the server is fully updated with the following command:
  • sudo apt update
After your server has been fully updated, you will need to know what version of Java is currently installed or if it is not installed, with the following command:
  • java -version

Install Java Open JRE or JDK on Ubuntu 16.04

Once you have verified if Java is installed or not, choose the type of Java installation that you want with one the following:
  • sudo apt install default-jdk
  • sudo apt install default-jre
One alternative Java install is with Open JRE 7 and JDK 7 and can be installed with one of the following:
  • sudo apt install openjdk-7-jre
  • sudo apt install openjdk-7-jdk

Install Java Oracle JRE or JDK on Ubuntu 16.04

Another alternative Java install is with Oracle JRE and JDK. However, we would need to install additional repositories for a proper installation.
  • sudo apt install python-software-properties
  • sudo add-apt-repository ppa:webupd8team/java
Then, you will need to fully update the system with the following command:
  • sudo apt update
You can also install previous and newer versions of Java by using one of the following commands:
  • sudo apt install oracle-java6-installer
  • sudo apt install oracle-java7-installer
  • sudo apt install oracle-java8-installer
If you have multiple versions of Java installed on your server, then you have the ability to select a default version. Check your alternatives with the following command:
  • sudo update-alternatives --config java
This is the output after running the Java Alternative script on Ubuntu 16.04
This is the output after running the Java Alternative script on Ubuntu 16.04


Once you have viewed your alternatives, choose the version that you want by selecting the assigned number, and then hit enter.

Setup JAVA_HOME on Ubuntu 16.04

Since many programs now days need a JAVA_HOME environment variable to work properly. We will need to find the appropriate path to make these changes. With the following command, you can view your installs and their path:
  • sudo update-alternatives --config java
To edit the environment file use your text editor and edit the following file:
  • sudo nano /etc/profile
Now that you are in the user profile file, add the following code, along with the Path of your installation from the previous step, to the bottom. ( Example: JAVA_HOME=”YOUR_PATH”)
  • export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.el7_1.x86_64"
Reload the file so all your changes could take effect with the following command:
  • source /etc/profile
Verify that your implementations are correct with the following command. Confirm :

  • echo $JAVA_HOME

An IDE For PHP: Install PhpStorm on Ubuntu 15.10/16.04





For those of you who don’t know, PhpStorm is a cool, lightning-smart IDE for PHP developers. It’s a commercial and cross-platform product from Jetbrains and can run on Linux, Mac OS and Windows. This tutorial will explain how to install Phpstorm on Ubuntu15.10/16.04.
Install Oracle Java 8 on Ubuntu 15.10/16.04
Because phpstorm is a Java program, so first we need to install Oracle Java on Ubuntu and the latest stable version is Oracle Java 8. We’ll install it via a PPA.
Remove OpenJDK
sudo apt-get remove openjdk*
Add the PPA and install Oracle Java 8 with following 3 commands.
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install java-common oracle-java8-installer
During the installation process you will need to accept the Oracle License agreement. Once installed we need to set Java environment variables such as JAVA_HOME on Ubuntu 15.10/16.04.
sudo apt-get install oracle-java8-set-default

source /etc/profile
The above two commands will set the correct Java environment variables.
Install phpstorm on Ubuntu 15.10/16.04
First go the official website and download the tar archive. If you like command line, you can use wget to download. The latest version is 2016.1.2 at the time of this writing. You may need to change the version number if you are reading this at a later time.
wget https://download-cf.jetbrains.com/webide/PhpStorm-2016.1.2.tar.gz
Once downloaded, open a terminal window and change your working directory to the download directory, then extract the .tar.gz file with this command:
tar xvf PhpStorm-2016.1.2.tar.gz
A new folder called PhpStorm-145.1616.3 will be created within the current working directory. It’s better to move this PhpStorm-145.1616.3 directory to /opt.
sudo mv PhpStorm-145.1616.3/ /opt/phpstorm/
Create a symlink
sudo ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
Now type phpstorm in the terminal to launch the application.
phpstorm
If you are new to PhpStorm, select the second option and hit the OK button.

Read and agree the privacy policy. You won’t sign you life away.

If you are not ready to purchase a license to use PhpStorm, you can select the 30 day free trial option.

Accept the license agreement.

In the next window, select a theme, color, font and hit OK button.

Next, you need to enter your password to create a launch script and desktop entry.
After that’s done, you can start a new project in PhpStorm.

Next time, you can start PhpStorm from Unity Dash.

If for any reason you want to remove PhpStorm, simply delete /opt/phpstorm/ directory and all subdirectories and files in it.
sudo rm /opt/phpstorm/ -R
I hope this article helped you to install PhpStorm on Ubuntu 15.10/16.04. Comments, questions or suggestions are always welcome. If you found this post useful, ? please share it with your friends on social media! Stay tuned for more Linux tutorials.
Rate this tutorial

Saturday, 8 October 2016

Ngày tháng trong tiếng anh


1/- Ngày trong tuần (Days of week)
  • Monday: thứ 2
  • Tuesday: thứ 3
  • Wednesday: thứ 4
  • Thursday: thứ 5
  • Friday: thứ 6
  • Saturday: thứ 7
  • Sunday: chủ nhật
Chúng ta dùng giới từ "On" trước ngày trong tuần
Ex: on Monday, on Tuesday...



2/- Ngày trong tháng (Dates)


3/- Tháng trong năm (months of a year)
  • January: tháng 1
  • February: tháng 2
  • March: tháng 3
  • April: tháng 4
  • May: tháng 5
  • June: tháng 6
  • July: tháng 7
  • August: tháng 8
  • September: tháng 9
  • October: tháng 10
  • November: tháng 11
  • December: tháng 12
Chúng ta dùng giới từ "In" trước các tháng. Nếu có cả ngày và tháng chúng ta dùng giới từ "On"

Ex: in January, in February... on December 3rd...

2/- Cách viết và đọc ngày tháng
a. Cách viết: Thứ, tháng + ngày (số thứ tự), năm (A.E)
Ex: Wednesday, December 3rd, 2008
Thứ, ngày (số thứ tự) + tháng, năm (B.E)
Ex: Wednesday, 3rd December, 2008
Đôi lúc chúng ta thấy người Anh, Mỹ viết ngày tháng như sau:
Wednesday, December 3, 2008 (A.E)
Wednesday, 3 December, 2008 (B.E)

b. Cách đọc: Thứ + tháng + ngày (số thứ tự) + năm 
hoặc Thứ + ngày (số thứ tự) + of + tháng + năm.

Ex: 
Wednesday, December 3rd, 2008: Wednesday, December the third, two thousand and eight. hoặc Wednesday, the third of December, two thousand and eight.


Trong tiếng Anh, cách đọc và viết ngày tháng rất đa dạng và được áp dụng theo 2 văn phong: Anh-Anh hoặc Anh-Mỹ. Dưới đây là các quy tắc chung nhất về cách đọc và viết. Hãy thực hành thật nhiều để không bị lúng túng mỗi khi viết hay đọc ngày, tháng, năm bằng tiếng Anh bạn nhé.

1. Cách đọc viết ngày tháng theo Anh-Anh.
- Ngày luôn viết trước tháng và bạn có thể thêm số thứ tự vào phía sau (ví dụ: st, th...), đồng thời bỏ đi giới từ of ở vị trí trước tháng (month). Dấu phẩy có thể được sử dụng trước năm (year), tuy nhiên cách dùng này không phổ biến.
Ví dụ:
o 6(th) (of) January(,) 2009 (Ngày mùng 6 tháng 1 năm 2009)
o 1(st) (of) June(,) 2007 (Ngày mùng 1 tháng 5 năm 2007)

- Khi đọc ngày tháng theo văn phong Anh – Anh, bạn sử dụng mạo từ xác định trước ngày

Ví dụ:
March 2, 2009 - March the second, two thousand and nine

2. Cách đọc và viết theo Anh-Mỹ- Nếu như viết ngày tháng theo văn phong Anh-Mỹ, tháng luôn viết trước ngày và có mạo từ đằng trước nó. Dấu phẩy thường được sử dụng trước năm
Ví dụ:
o August (the) 9(th), 2007 (Ngày mùng 9 tháng 8 năm 2007)
- Bạn cũng có thể viết ngày, tháng, năm bằng các con số và đây cũng là cách thông dụng nhất.
Ví dụ:
o 9/8/07 hoặc 9-8-07

Tuy nhiên nếu bạn sử dụng cách viết như trong ví dụ trên, sẽ rất dễ xảy ra nhầm lẫn bởi nếu hiểu theo văn phong Anh-Anh sẽ là ngày mồng 9 tháng 8 năm 2007 nhưng sẽ là mồng 8 tháng 9 năm 2007 theo văn phong Anh-Mỹ.

Như vậy bạn nên viết rõ ràng ngày tháng bằng chữ (October thay vì chỉ viết số 10) hoặc sử dụng cách viết tắt (Aug, Sept, Dec...) để tránh sự nhầm lẫn đáng tiếc xảy ra

- Khi đọc ngày tháng theo văn phong Anh – Mỹ, bạn có thể bỏ mạo từ xác định:

Ví dụ:

o March 2, 2009 - March second, two thousand and nine.

Lưu ý:
Nếu bạn đọc ngày trước tháng thì bạn phải sử dụng mạo từ xác định trước ngày và giới từ of trước tháng.

Ví dụ:
o 2 March 2009 - the second of March, two thousand and nine
o 4 September 2001 - the fourth of September, two thousand and one



CÁC NGÀY TRONG TUẦN

MONDAY = thứ hai , viết tắt = MON 

TUESDAY = thứ ba, viết tắt = TUE

WEDNESDAY = thứ tư, viết tắt = WED

THURSDAY = thứ năm, viết tắt = THU

FRIDAY = thứ sáu, viết tắt = FRI

SATURDAY = thứ bảy, viết tắt = SAT

SUNDAY = Chủ nhật, viết tắt = SUN

* Khi nói, vào thứ mấy, phải dùng giới từ ON đằng trước thứ.

VD: On Sunday, I stay at home. (Vào ngày chủ nhật. tôi ở nhà). 

CÁC THÁNG TRONG NĂM

» 1. January ( viết tắt = Jan ) 
» 2. February ( viết tắt = Feb)
» 3. March ( viết tắt = Mar)
» 4. April ( viết tắt = Apr)
» 5. May ( 0 viết tắt )
» 6. June ( 0 viết tắt ) 
» 7. July ( 0 viết tắt ) 
» 8. August ( viết tắt = Aug )
» 9. September ( viết tắt = Sept )
» 10. October ( viết tắt = Oct )
» 11. November ( viết tắt = Nov )
» 12. December ( viết tắt = Dec ) 

*Khi nói, vào tháng mấy, phải dùng giới từ IN đằng trước tháng

VD: IN SEPTEMBER, STUDENTS GO BACK TO SCHOOL AFTER THEIR SUMMER VACATION. (Vào tháng chín, học sinh trở lại trường sau kỳ nghỉ hè) 

NÓI NGÀY TRONG THÁNG

* Khi nói ngày trong tháng, chỉ cần dùng số thứ tự tương ứng với ngày muốn nói, nhưng phải thêm THE trước nó. 

VD: September the second = ngày 2 tháng 9. Khi viết, có thể viết September 2nd 

* Nếu muốn nói ngày âm lịch, chỉ cần thêm cụm từ ON THE LUNAR CALENDAR đằng sau. 

VD: August 15th on the Lunar Calendar is the Middle-Autumn Festival. (15 tháng 8 âm lịch là ngày tết Trung Thu)

* Khi nói vào ngày nào trong tháng, phải dùng giới từ ON trước ngày.

VD: On the 4th of July, Americans celebrate their Independence Day. (Vào ngày 4 tháng 7, người Mỹ ăn mừng ngày Quốc Khánh của họ). 

4 MÙA

SPRING = Mùa xuân

SUMMER = Mùa hè

AUTUMN = Mùa thu (Người Mỹ dùng chữ FALL thay cho AUTUMN -"fall" có nghĩa là "rơi", mà mùa thu thì lá rụng nhiều!?)

WINTER = Mùa đông 

* Khi nói vào mùa nào, ta dùng giới từ IN.

VD: IT ALWAYS SNOWS IN WINTER HERE = Ở đây luôn có tuyết rơi vào mùa đông. 

Hi vọng rằng sau khi tham khảo cách đọc và viết ngày tháng, các bạn có thể tự mình đưa ra những ví dụ để thực hành một cách nhuần nhuyễn, và tránh gặp sai lầm về sau. Chúc các bạn viết chính xác và đọc chuẩn nhé!