Two months of Java internship end, continue to work

Source: Internet
Author: User
Tags exception handling image processing library local time rar
Objective

Only a bald head can become stronger.

August 30, 2018, I resigned today. On June 25, there are now two months to get into the job.

Feel:

    • The first day is expected: the first time to pull the project to look at the local time, code a lot, there are very many modules, the module has dao/service/controller/form/bean , dazzling. Connected to the test library, also found that there are more than 100 tables. ~ ~ down some modules to see down, found that the technology is not difficult, before the basic have been contacted, are can be understood.
    • The first week was anxiety: The next day sent me a document, there are several small tasks in the document (one, write the interface to export data to Excel, two, improve a function).
      • The second function of the SQL statement for a long time did not write it out, did not write it out for two reasons: my weak SQL and the relationship between the business table is not familiar (now think of it, I wrote the most troublesome SQL in two months). It took nearly two weeks to complete the function, and my ability to write SQL was improved.
    • Most of the time is idle: Many times the task is based on the original to add some features, change bugs and so on, also done a small module development. Overall: The technical difficulty is not big, mainly is the understanding of the business .

These two months have been very happy, delicious good live, is to grow fat

Also worth saying is: don't think I wrote so many blog is very powerful, very good, in fact, I have a batch of slag ! School recruit Algorithm Pen questions basically no AC, in the interview, the Knowledge Point said forget forget. I write a blog is mainly a record of their own growth, forgotten technology can be looked over, with everyone to exchange, and common progress ~

Friend Spit Groove I write articles like elementary school students composition, I am not good at the feeling of such ... So, take a look at the point. ~

Here are the main records of the new technology encountered in the internship, as well as some of the previously written notes have been put up.

I. New technologies learned during internships 1.1swagger document framework

When looking at the company code, I found that controller has a few notes I don't know: @Api , @ApiOperation ..

To check it out, it was the document frame of the interface .

For more in-depth understanding:

    • 77622977
1.2Lombok makes Java code more concise

When I saw JavaBean, I found the new continent: annotations@Data

There is no method in JavaBean set/get , but it is magical to use the set/get method outside.

Went to find a bit of information, the original thing called:Lombok.

    • Simply put: eliminate boilerplate code with annotations (from set/get there), JavaBean will be very concise !

Note that the plugin needs to be installed on the IDE (idea if the Lombok plugin is not installed, the compilation will be wrong, a lot of red!)

Lombok Use and Introduction:

    • yq.aliyun.com/articles/59972
    • www.zhihu.com/question/42348457
    • 68065775
1.3postman use

The company is separated from front to back, and back end returns JSON data to the front end parsing. I got the code is completely no front page, boss let me install a postman to debug.

Because before all is personal development, want how to play on how to play (so have not used postman ...).

Found a good postman tutorial (if not used classmate, read should be able to quickly get started!) :

    • 80428216
1.4JSON Web Token (authentication authorization)

What is a JSON Web Token (JWT)?

As an open standard (RFC 7519), WT defines a concise, self-contained method for communicating information between two communication parties in the form of a JSON object. Because of a particular digital signature, the information of these communications can be verified and trusted. JWT can be signed using the HMAC algorithm or RSA's public key pair.

When should I use the JSON Web Tokens?

    • Certification authentication (authentication)
    • Data exchange (Information exchange)

It seems that our company is very simple with a JWT for authentication, I briefly summed up the process :

    1. Log in as normal
    2. Stitching user information into parameters
    3. Use this parameter to generate a token value for the JWT.
    4. This token value holds the corresponding permission, expiration date, encryption method
    5. Tokens are returned to the browser and stored using session storage.
    6. When you visit again, take this token value with you (either through the header or Post/url stitching). Asked the front-end brother, they use angular, encapsulated a bit, each request will be written on the header.
    7. If the token does not expire, parse the token value and return the corresponding user object (identity)
    8. If this token expires, re-enable the user to log in

Learn more about viewing documents (Chinese):

    • Http://jwtio.com/introduction.html

Related Posts and discussions:

    • Http://www.liriansu.com/jwt
    • www.zhihu.com/question/41248303
    • Www.cnblogs.com/cjsblog/p/9277677.html
1.5SQL Writing Ideas

Before you write the SQL is quite simple, nothing more than to connect two tables to query out the corresponding data.

It's different when it comes to demand, and it's a lot more complicated (so I haven't written it for one weeks ...)

The task of the requirements is simple: to count the data for each field, and to display the specific contents of each field

    • To put it bluntly, it is to stitch together multiple rows of data to make a line ~

The final idea:

    • Use concat functions to stitch together their corresponding fields
    • The fields are then grouped, using group_concat functions to stitch together the above
    • Finally get stitching to a row of results, put in the program to parse

Anyway sql this thing to write more ... (It took me one weeks to think that this feature is not possible.)

In the completion of the requirements have also thought of a number of ways to solve, find ideas, and also found some of the more good SQL blog:

    • Case when used: www.cnblogs.com/qlqwjy/p/7476533.html
    • exists keyword use: zhuanlan.zhihu.com/p/20005249

Non-Correlated sub-query:

Related sub-query:

Nothing is a select can not solve, if there is, then set a layer of---"3y"

Tips: When you are querying a table, think about whether you need to get the results in the first place (maybe sometimes: when a query condition is necessary , you have to connect to the table)

1.6 Database foreign key

In the company, look at the database table design is not the foreign key .

Foreign key constraints are often used when learning a database. When viewing discussions in a forum, most people often say that foreign keys are seldom used. Because we can handle the relationship between the tables in the business (program control and transactions) entirely. General Internet Applications do not need to use foreign keys, foreign keys will bring a series of bad effects:

    • 1. The database needs to maintain the internal management of foreign keys;
    • 2. Foreign key is equal to the data consistency transaction implementation, all to the database server to complete;
    • 3. With the foreign key, as some of the foreign key fields involved in the increase, delete, update operation, the need to trigger the relevant operation to check, and have to consume resources;
    • 4. The foreign key will also be prone to deadlock situations because of the need to request a lock inside other tables;

Resources:

    • www.zhihu.com/question/19600081
Two, before some notes the difference between 2.1Timer and quartz

Both the timer and the quartz are the Task Scheduler Framework , which simply means that the program can execute the code you want to execute at a certain moment.

Previously in the project, the simple use of quartz, in the beginner's time also touched the timer API call. Before simply recording the difference between them, now go back and tidy up ~

    • 1. Different origins: The timer is provided directly by the JDK, the invocation is simple and rude, and no additional jar support is required. Quartz is not a JDK, it needs to introduce the appropriate jar package
    • 2. Ability difference: mainly in the control of time . A timer can be easily handled at a specific time, such as every Sunday morning at eight to remind the function of doing something needs to be quartz, so quartz control of time is much stronger than the timer, perfect
    • 3. exception handling differs :Quartz throws an exception during the execution of a task, does not affect the execution of the next task, the timer will perform the task again when next execution time arrives, and TimerTask is different, once a task throws an exception during execution, the entire timer life cycle ends and the timer task is never executed again .
    • 4. different for concurrent support : The timer walks the background thread to perform a timed task (single thread), quartz can use more than one thread to perform timed tasks
    • 5.Quartz each execution of a task creates a new task class object, while TimerTask uses the same task class object each time

Resources:

    • 1190000009542398
    • 1190000009972187
    • TimerTask and quartz comparison: 72965451

Quartz Demo Source:

    • Img.mukewang.com/down/5950cae200010ca100000000.rar
2.2Java generate two-dimensional code

We are now inseparable from the two-dimensional code.

QR Code is developed by one-dimensional code, the most typical one-dimensional code is that we usually go to the mall to see the product packaging Barcode , this is a typical one-dimensional code.

The data storage information of two-dimensional code is much larger than one-dimensional code, and it has a good function of correcting (even if some of the information in the QR code is incomplete, the data of the QR code can be parsed)

Using the Java language to generate the QR code has the following methods:

    • Zxing API
    • QRCode
    • Juqeryqrcode

Of course, it must be jquery's way to generate QR codes is relatively simple. But if you want to customize the style and shape of the two-dimensional code . It is more flexible to use Java as a way to build. (Example: Put a logo in the middle of the QR code)

Download the resource jar package that generates the QR code: Img.mukewang.com/down/5799a5440001040300000000.rar

Using jquery to generate a two-dimensional Code blog post: http://suflow.iteye.com/blog/1687396

Using zxing to generate a QR code blog: http://guopengli.cn/index.php/2017/10/05/53.html

Resources:

    • 1190000009909177
2.3Java image watermark, thumbnail image

Sometimes when we upload images, do not want to show the size of the image and upload the same size of the image, we need to compress the image to a certain pixel . Example of thumbnail Image:

Image watermarks are also often seen:

Whether it is a watermark or thumbnail, in fact, through the class library to achieve, generally we will use the Java Image Processing library thumbnailator.

Resources:

    • 1190000010302289
    • Generate watermark Source: Github.com/hongzhilin/watermark
    • Thumbnail blog: http://blog.csdn.net/qq_31179919/article/details/53336293
    • Thumbnail Source: github.com/amant-huangqi/thumbnails
At last

People who can see my blog explain that they have the habit of reading technical articles. Have the habit of reading technical articles, the description is Love technology/learning people. People who love technology/learning are generally not bad at technology. So the students who can see this article are the big guys----"3y"

If you want to see more original technical articles, you are welcome to pay attention to my public number: Java3y. Java Technology Group discussion : 742919422. The public number also has a huge amount of video resources Oh, attention can be collected free of charge.

Links that may be of interest:

    • Article directory navigation (public terminal) : Zhongfucheng.bitcron.com/post/shou-ji/wen-zhang-dao-hang
    • Article directory navigation (PC side) : Http://www.zhongfucheng.bitcron.com/post/shou-ji/pcduan-wen-zhang-dao-hang
    • massive and beautiful brain graph: Http://www.zhongfucheng.bitcron.com/post/shou-ji/nao-tu-da-quan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.