Skip to content

Instantly share code, notes, and snippets.

View logbasex's full-sized avatar
🎯
Focusing

logbasex logbasex

🎯
Focusing
View GitHub Profile
@logbasex
logbasex / mysql_cheat_sheet.md
Created October 16, 2019 02:59 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@logbasex
logbasex / project-ideas01.md
Created February 17, 2020 08:41 — forked from MWins/project-ideas01.md
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.

/**
* Youtube has many different types of URL.
* https://www.youtube.com/watch?v=DFYRQ_zQ-gk&feature=featured
* https://www.youtube.com/watch?v=DFYRQ_zQ-gk
* http://www.youtube.com/watch?v=DFYRQ_zQ-gk
* //www.youtube.com/watch?v=DFYRQ_zQ-gk
* www.youtube.com/watch?v=DFYRQ_zQ-gk
* https://youtube.com/watch?v=DFYRQ_zQ-gk
* http://youtube.com/watch?v=DFYRQ_zQ-gk
* //youtube.com/watch?v=DFYRQ_zQ-gk
private static final String IS_DATE_MONTH_YEAR_FORMAT_PATTERN = "^(?:(?:31([/\\-.])(?:0?[13578]|1[02]))\\1|" +
"(?:(?:29|30)([/\\-.])(?:0?[13-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|" +
"^(?:29([/\\-.])0?2\\3(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))$|" +
"^(?:0?[1-9]|1\\d|2[0-8])([/\\-.])(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$";
private static final String IS_MONTH_DATE_YEAR_FORMAT_PATTERN = "^(?:(?:(?:0?[13578]|1[02])([/\\-.])31)\\1|" +
"(?:(?:0?[13-9]|1[0-2])([/\\-.])(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|" +
"^(?:0?2([/\\-.])29\\3(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))$|" +
"^(?:(?:0?[1-9])|(?:1[0-2]))([/\\-.])(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$";
/**
* Appends the elements defined by the specified pattern to the builder.
* <p>
* All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters.
* The characters '#', '{' and '}' are reserved for future use.
* The characters '[' and ']' indicate optional patterns.
* The following pattern letters are defined:
* <pre>
* Symbol Meaning Presentation Examples
* ------ ------- ------------ -------
//https://www.geeksforgeeks.org/tesseract-ocr-with-java-with-examples/
//https://medium.com/@rahulvaish/simple-tesseract-ocr-java-be261e343c5b
public static void main(String[] args) {
Tesseract tesseract = new Tesseract();
try {
//not working perfectly
tesseract.setDatapath("C:\\Users\\conta\\Downloads\\Tess4J\\tessdata");
String text = tesseract.doOCR(new File("C:\\Users\\conta\\OneDrive\\Desktop\\t.png"));
System.out.print(text);
} catch (TesseractException e) {
import static java.util.Objects.*;
public static String[] getNullProperties(Object source) {
final BeanWrapper wrappedSource = new BeanWrapperImpl(source);
return Stream.of(wrappedSource.getPropertyDescriptors()).map(FeatureDescriptor::getName)
.filter(propertyName -> isNull(wrappedSource.getPropertyValue(propertyName))).toArray(String[]::new);
}
//copy propreties that ignore null field in the request
BeanUtils.copyProperties(request, object, getNullProperties(request));
## Regex: https://www.postgresql.org/docs/9.3/functions-matching.html
` select url, thumbnail from media WHERE url !~* '.jpg|.mp4|.mov|.jpeg|.png|.mp3';`

One liner to stop / remove all of Docker containers:

docker stop $(docker ps -a -q)

docker rm $(docker ps -a -q)

Usage of @AliasFor

In Spring's many annotations, it is often found that many different attributes of different annotations play the same role, such as @RequestMapping's value attribute and path attribute. In order to keep their behavior consistent, such as the value of value and the value of path can not conflict, their values should always be equal. To handle these issues uniformly, Spring created the @AliasFor tag.

The @AliasFor tag has the following usage methods.

1, explicit use within the same annotation

For example, the usage in @RequestMapping: