This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct elev { | |
char nume[20]; | |
float medie; | |
struct elev *urm; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CMMDC scris in C | |
#include<stdlib.h> | |
#include<stdio.h> | |
int main() { | |
int a, b, r; | |
scanf("%d", &a); | |
scanf("%d", &b); | |
printf("%d %d", a, b); | |
r = a % b; | |
while (r) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Person { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
@NotEmpty | |
@Size(min = 5) | |
private String fullName; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-validation</artifactId> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository | |
public interface PersonRepository extends JpaRepository<Person, Long> { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GetMapping("/add") | |
public String showAddPersonForm(Person person) { | |
return "add-person"; | |
} | |
@PostMapping("/add") | |
public String addPerson(@Valid Person person, BindingResult result, Model model) { | |
if (result.hasErrors()) { | |
return "add-person"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="alert alert-warning" th:if="${#fields.hasErrors('age')}" th:errors="*{age}"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NotEmpty(message = "The Full Name can't be null") | |
@Size(min = 5, message = "{Size.Person.FullName}") | |
private String fullName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate-validator</artifactId> | |
<version>6.0.10.Final</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Documented | |
@Constraint(validatedBy = CustomGoogleEmailValidator.class) | |
@Target({ ElementType.METHOD, ElementType.FIELD }) | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface CustomGoogleEmailConstraint { | |
String message() default "The email must have \"@gmail.com\" extension"; | |
Class[] groups() default {}; | |
Class[] payload() default {}; | |
} |
OlderNewer