How to install AWS and Azure CLI with Homebrew

Homebrew

Installing

Run the following code to install Homebrew if you don't have in your machine.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Verifying

Run the following code to verify Homebrew is installed

$ brew --version

Homebrew 3.2.6
Homebrew/homebrew-core (git revision c4d5aac8ec; last commit 2021-08-07)
Homebrew/homebrew-cask (git revision 1169dcb641; last commit 2021-08-07)

AWS

AWS CLI

Installing

brew update && brew install awscli

Verifying

$ aws --version

aws-cli/2.2.27 Python/3.9.6 Darwin/20.6.0 source/x86_64 prompt/off

Upgrading

brew upgrade awscli

Uninstalling

brew uninstall awscli

AWS SAM CLI

Installing

brew tap aws/tap
brew install aws-sam-cli

Verifying

$ sam --version

SAM CLI, version 1.27.2

Upgrading

brew upgrade aws-sam-cli

Uninstalling

brew uninstall aws-sam-cli

Azure

Demo repository is in the following link.

https://github.com/nodejs-projects-kenanhancer/serverless-azure-functions-typescript-demo

Azure CLI

Installing

brew update && brew install azure-cli

Verifying

$ az --version

azure-cli                         2.26.1 *

core                              2.26.1 *
telemetry                          1.0.6

Python location '/usr/local/Cellar/azure-cli/2.26.1/libexec/bin/python'
Extensions directory '/Users/kenanhancer/.azure/cliextensions'

Python (Darwin) 3.8.11 (default, Jun 29 2021, 03:08:07) 
[Clang 12.0.5 (clang-1205.0.22.9)]

Legal docs and information: aka.ms/AzureCliLegal


You have 2 updates available. Consider updating your CLI installation with 'az upgrade'

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

Upgrading

brew update && brew upgrade azure-cli

# OR

az upgrade

Uninstalling

brew uninstall azure-cli

Azure Functions Core Tools

Installing

brew tap azure/functions
brew install azure-functions-core-tools@3

# if upgrading on a machine that has 2.x installed
brew link --overwrite azure-functions-core-tools@3

Verifying

$ func --version

3.0.3477

Upgrading

brew upgrade azure-functions-core-tools@3

Uninstalling

brew uninstall azure-functions-core-tools@3

How to create and run C# project

This post is just a reminder for me. So in order to find more details about dotnet CLI, follow the below link

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet

Creating a C# Project

Creating a Console Project

dotnet new console -o console-demo1

Creating a WebApi Project

dotnet new webapi -o webapi-todo-demo1

1. Creating a C# Console Project

-o or –output is location to place for new generated project.

dotnet new console -o enum_demo4
Folder Structure
Generated Project
Continue reading

How to compile and run Java Projects with java and javac commands

Compiling

-d is output directory for new generated class files.

How to compile single Java source file

javac -d ./target/classes src/main/java/com/extuni/enum_demo4/App.java

How to compile multiple Java source files

javac -d ./target/classes 
./src/main/java/com/extuni/enum_demo4/App.java 
./src/main/java/com/extuni/enum_demo4/Greeting.java 
./src/main/java/com/extuni/enum_demo4/Helper.java

How to compile multiple Java source files using wildcard

javac -d ./target/classes ./src/main/**/*.java

How to specify dependency jar file when compiling

Trying to compile ./src folder completely will throw exception due to junit.jar file dependency. So, it should be specified using -cp option which means –classpath as below.

javac -d ./target/classes -cp /Users/kenanhancer/.m2/repository/junit/junit/4.11/junit-4.11.jar ./src/**/*.java
Continue reading

How to create and run Java project with Maven

You can find more details in https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

1. Creating a Java Project with Maven

mvn archetype:generate 
    -DgroupId={project-package-name}
    -DartifactId={project-name}
    -DarchetypeArtifactId={maven-template-name}
    -DinteractiveMode=false
    -DarchetypeVersion=1.4
for example
mvn archetype:generate 
    -DgroupId=com.extuni.enum_demo4 
    -DartifactId=enum_demo4 
    -DarchetypeArtifactId=maven-archetype-quickstart 
    -DinteractiveMode=false 
    -DarchetypeVersion=1.4
Maven Directory Layout
Continue reading