Prework #3

String welcomingMessage = "Hi everybody, today I started learn Java!"
System.out.println(welcomingMessage);

 

How excited it is.
So today I learned basics about variables and methods.

I will tell You what I know now!

Variables

Variables for me is variable == some data, some value – this is not the end of the truth but I understand it that way.

In Java there are couple types of variables:

  • int – integer number eg. 10, 5, 4, 198273 etc.
  • double – floating numbers  eg. 10.5, 1.25, 45.4, etc.
  • stringtext variable eg. “this is my blog welcome” String is class represent character string
  • boolean – this variable has only two value true or false

So if You want to declare variable You should think about it type. I didn’t write all types in Java here. But I will later.

For e.g. my age – age is a number, it is not float number is integer – so You have to write it like this:

 int myAge = 36;

In this declaration I do one additional thing. I declared variable as integer with name variable myAge (first thing), but second I initialized it to the value 36. I do this by equal sign “=”.

Variables can be local variables or class variables. But this is history for another time.

Methods

Method is a function which You can execute, induce. You declare method because You want to do sth, count sth or show sth. I understand method as doing sth.

static void doSthAsIWant(){ // do something with variables, count sth, }

Ok, basic example. You want to say hello to a stranger girl!

static void sayHelloToStrangerGirl(){

System.out.println("Hi Stranger Girl, How are You?!");

}

To execute this method You write only:

sayHelloToStrangerGirl();

To understand look at this code:

public class Methods {

    public static void main(String[] args) {

        sayHelloToStrangerGirl(); // this is execute of method
    }

    static void sayHelloToStrangerGirl() { //this is Your method
        System.out.println("Hi Stranger Girl, How are You?!");

    }
    
}

to be continued…

Prework #2

Git is git!

Yes I know. Old joke. But in polish git colloquially means – cool.

In this lesson I will show basic comments in git.

But first is first. What is git?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

source https://git-scm.com

So first off all there are two types of repository. Local and remote.

Local is placed on Your computer and and it is not linked to remote repo.

All commands and operation I will show based on terminal. I user iTerm on Mac. Powerfull app.

To create local repo You have to:

mkdir name_folder - create folder

cd name_folder - open folder 

git init - initialization folder for git - name of folder is name of Your folder

touch name_file.htmlcreate some file - html, txt whatever e.g

git add name_file.html - add file to repository

git commit -m "comment" - commit Your repo with comment

git status - checking git status

example 1. Creating local repo:

That`s it You create new repo in git. But You can create some branches in Your repo!

Branches are something that tree has. You have root (master) then tree is growing has one two, “n” branches. To create branch use:

git branch name_branch - how can be more simple?

git checkout name_branch - switch to you new branch

git checkout -b name_new_branch - this is combine of this two first command creating a branch and switching to it.

You can check difference with branches. Just compare two of them:

git diff master name_branch

git diff name_new_branch name_branch

Combine two branches? Simple:

gif marge name_branch name_new_branch

You have to remember. To merge two brenches You schould checkout to master. Or if You want to merge branch with master You should do the same.

Prework #1

So it`s time to do prework #1. I got instructions to install some programs before
I start course #SDA.

Programs are:

  1. Slack Communicator
  2. Java JDK8
  3. Intellij IDEA
  4. Git
  5. Maven (sic!!!) – it was very difficult – about this installation a few lines below.
  6. MySQL
  7. MongoDB
  8. Apache Tomcat
  9. Wildfly
  10. Wireshark
  11. MidnightCommander (MC) – they said – write in terminal brew install mc – yes sure mhm – it didn’t work but there is solution so scroll down to see what You have to do to installed it!

Ok, so the tough stuff to install are Maven and MC.  Rest of this program are easy to install so I will not write how to install it.

To install Maven You should install Java SDK8. You should set JAVA_HOME. This is priority. When You do this it’s not enough to work Java properIy. I have to say I did some research to complete this task. I found two sites about installing Maven.

This sites helps me to install this Maven “headake”.

You should remember that instruction on official site is very poor and its not explain everything.  You can look at here: https://maven.apache.org/install.html   For beginers who don’t now what is bash or what is terminal, vim etc it will be a nightmare. I cant imagine people who haven’t learn some basic bash or they haven’t have any contact with computer science and they install it as simple as Maven site says.

So this is install method which I used.

Set JAVA_HOME, MAVEN_HOME and M2_HOME using vim. In terminal:

vim .profile

And write this one (in vim click es and the i to insert):

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
export JAVA_HOME
export MAVEN_HOME="/Users/your_name_profile/your path to extract files apache maven/apache-maven-3.5.4"    
export MAVEN_HOME=$M2_HOME
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export M2_HOME=/Users/your_name_profile/your path to extract files apache maven/apache-maven-3.5.4
export PATH=$PATH:$M2_HOME/bin

After copying it write :wq (write and quit) from vim. Then write source .profile in terminal enter.

Test Your installation: In terminal write java -version then mvn -version. You should have something like this:

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
users-MacBook-Pro:~ you_profile_name$
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: /Users/your_name_profile/your path to extract files apache maven/apache-maven-3.5.4
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: pl_PL, platform encoding: UTF-8
OS name: "mac os x", version: "10.14", arch: "x86_64", family: "mac"

End of story Maven!

So time for:

  • Midnight Commander

In PDF file from SDA there was sth like this:

In terminal enter: brew install mc – It didnt work. Why? Beacouse You didn’t install Homebrew. This was let`s say – tricky. Please go to: https://brew.sh/index  and follow instructions. Read documentation. Then come back to terminal and install Midnight Commander. It was nice to see old fashion commander as Norton Commander was. I remebered it. I grew up on Norton Commander.

So thats it. I hope I helped You to install this two tricky things.