How to get Bash version number in Mac OS
Following command can be used to know the bash version in Mac OS.
This article shows how to install Maven (3.6.3) on macOS Monterey(version 12.2.1) with M1 processor.
x apache-maven-4.0.0-alpha-3/bin/mvn.cmd x apache-maven-4.0.0-alpha-3/bin/mvn x apache-maven-4.0.0-alpha-3/README.txt x apache-maven-4.0.0-alpha-3/LICENSE x apache-maven-4.0.0-alpha-3/NOTICE x apache-maven-4.0.0-alpha-3/lib/ x apache-maven-4.0.0-alpha-3/lib/aopalliance.license x apache-maven-4.0.0-alpha-3/lib/commons-cli.license x apache-maven-4.0.0-alpha-3/lib/commons-codec.license x apache-maven-4.0.0-alpha-3/lib/commons-lang3.license x apache-maven-4.0.0-alpha-3/lib/failureaccess.license x apache-maven-4.0.0-alpha-3/lib/guava.license x apache-maven-4.0.0-alpha-3/lib/guice.license x apache-maven-4.0.0-alpha-3/lib/httpclient.license x apache-maven-4.0.0-alpha-3/lib/httpcore.license
Apache Maven 4.0.0-alpha-3 (2ccf57baa5191468f9911fe85fd99672ac3bacb9) Maven home: /Users/SiddB/DevRuntime/apache-maven-4.0.0-alpha-3 Java version: 18.0.1.1, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "12.2.1", arch: "aarch64", family: "mac"
package com.bootng.display;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
public class DisplayCustomNameTest {
@Test
public void test_if_it_will_rain() {
}
@Test
public void test_if_it_will_be_cloudy() {
}
@Test
public void test_if_it_will_be_sunny() {
}
}
package com.bootng.display;
@DisplayName("Vacation Weather Test")
public class DisplayCustNameTest {
@DisplayName("🌧")
@Test
public void test_if_it_will_rain() {
}
@DisplayName("🌨")
@Test
public void test_if_it_will_be_cloudy() {
}
@DisplayName("🌞")
@Test
public void test_if_it_will_be_sunny() {
}
}
package com.bootng.display;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@DisplayName("Weather Test DisplayExample ")
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
public class DisplayGeneratorExampleTest {
@Test
public void test_if_it_will_rain() {
}
@Test
public void test_if_it_will_be_cloudy() {
}
@Test
public void test_if_it_will_be_sunny() {
}
}
[^\x00-\x7F]
public int fib(int n) {
if (n == 0)
return 0;
else if (n == 1)
return 1;
else
return fib(n - 1) + fib(n - 2);
}
public static int fib_topdown(int n, int td[]) {
if (td[n] != 0 && n != 0)
return td[n];
else if (n == 0)
td[n] = 0;
else if (n == 1)
td[n] = 1;
else
td[n] = fib_topdown(n - 1, td) + fib_topdown(n - 2, td);
return td[n];
}
public static int fib_bottomup(int n) {
if (n < 2)
return n;
int f0 = 0;
int f1 = 1;
int f2 = 0;
for (int i = 2; i <= n; i++) {
f2 = f0 + f1;
f0 = f1;
f1 = f2;
}
return f2;
}
mvn install -DskipTests
Following article is a very good one explaining the Gaussian Mixture model along with python code.
https://towardsdatascience.com/gaussian-mixture-models-explained-6986aaf5a95
<!-- swagger ui -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.10</version>
</dependency>
http://localhost:8080/swagger-ui/index.html
{
"openapi":"3.0.1",
"info":{
"title":"OpenAPI definition",
"version":"v0"
},
"servers":[
{
"url":"http://localhost:8080",
"description":"Generated server url"
}
],
"paths":{
"/blogapi/v2/blogs":{
"get":{
"tags":[
"blog-controller-v-2"
],
"operationId":"getBlogStories",
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"type":"array",
"items":{
"$ref":"#/components/schemas/BlogStory"
}
}
}
}
}
}
},
"post":{
"tags":[
"blog-controller-v-2"
],
"operationId":"addBlogStory",
"requestBody":{
"content":{
"application/json":{
"schema":{
"$ref":"#/components/schemas/BlogStory"
}
}
},
"required":true
},
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"$ref":"#/components/schemas/BlogStory"
}
}
}
}
}
}
},
"/blogapi/v1/categories":{
"get":{
"tags":[
"category-controller"
],
"operationId":"getBlogCats",
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"type":"array",
"items":{
"$ref":"#/components/schemas/BlogCategory"
}
}
}
}
}
}
},
"post":{
"tags":[
"category-controller"
],
"operationId":"addCats",
"requestBody":{
"content":{
"application/json":{
"schema":{
"$ref":"#/components/schemas/BlogCategory"
}
}
},
"required":true
},
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"$ref":"#/components/schemas/BlogCategory"
}
}
}
}
}
}
},
"/blogapi/v2/blogs/{id}":{
"get":{
"tags":[
"blog-controller-v-2"
],
"operationId":"getBlogStory",
"parameters":[
{
"name":"id",
"in":"path",
"required":true,
"schema":{
"type":"string"
}
}
],
"responses":{
"200":{
"description":"OK",
"content":{
"application/json":{
"schema":{
"$ref":"#/components/schemas/BlogStory"
}
}
}
}
}
}
}
},
"components":{
"schemas":{
"BlogStory":{
"type":"object",
"properties":{
"id":{
"type":"string"
},
"name":{
"type":"string"
},
"summary":{
"type":"string"
},
"description":{
"type":"string"
},
"category":{
"type":"string"
}
}
},
"BlogCategory":{
"type":"object",
"properties":{
"id":{
"type":"string"
},
"name":{
"type":"string"
}
}
}
}
}
}
@Entity
@Table (name = "dish_table")
public class Dish {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "id")
private Long id;
@NotNull
@Size(min=2, message="Name should have atleast 5 characters")
@Column(name = "name")
private String name;
@Column(name = "description")
private String description;
@Column(name = "lowprice")
private Double lowPrice;
@Column(name = "highprice")
private Double highPrice;
public Dish () {}
//Getter and Setters
}
@Repository
public interface DishRepository extends JpaRepository {
public Page findByName(String name, Pageable pageable);
}
@RestController
@RequestMapping("api/v2")
public class DishControllerPaginatedV2 {
private static final int pageSize = 2;
@Autowired
DishRepository repo;
@GetMapping(value="/dishes",produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getDish3(@RequestParam (defaultValue = "0") int pageNo) throws Exception {
Sort sort = Sort.by("name");
Pageable pageReq = PageRequest.of(pageNo, pageSize, sort);
Page result = repo.findAll(pageReq);
return ResponseEntity.ok(result);
}
}
curl --request GET \
--url 'http://localhost:8080/api/v1/dishes3?pageNo=0' \
--header 'cache-control: no-cache'
{
"content": [
{
"id": 12,
"name": "Anchovies",
"description": "Anchovies",
"lowPrice": 1987,
"highPrice": 0
},
{
"id": 14,
"name": "Celery",
"description": "Celery",
"lowPrice": 2928,
"highPrice": 0
}
],
"pageable": {
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"offset": 0,
"pageNumber": 0,
"pageSize": 2,
"paged": true,
"unpaged": false
},
"last": false,
"totalPages": 7,
"totalElements": 14,
"size": 2,
"number": 0,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"numberOfElements": 2,
"first": true,
"empty": false
}