category : 计算机那些事

Java Mail中文乱码


Nginx: 简单负载均衡

工作之前的时候,做任何web项目,我都会选择用PHP,简洁,快速,有时候很赞同PHP是世界上最好的语言,但是有些时候还是不如Java来的利索。可惜的是Java“不支持”热部署(至少在生产环境下不建议热部署), 导致每次部署都会有一段服务下线的时间(更糟糕的是用户的session也会随之丢失,最最糟糕的时候,每次部署,有时候还不得不重启一下Tomcat)。

Jackson: deserialize nested object

I am implementing a RESTful server inside my company. The workflow is very straight-forward: request and response. However, nothing is easy, the RESTful service is based on an existed project, which handles database operations, and the entities inside that project is pretty complex(a lot of interfaces and abstract classes).

Java: Test a file is image or not

There are many ways to check whether a file is image. For example, check the file extension(jpg, png, gif …). But this is not so safe, in a web environment, user may rename XXX.exe, to XXX.jpg, then s/he can succeed to upload it. In this case, it can induce security problem.

Hello World to XSLT

DefinitionXSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. (XSL = Style Sheets for XML) XSLT stands for XSL Transformations. In this tutorial you will learn how to use XSLT to transform XML documents into other formats, like XHTML. You can try a online demo here:

Design Pattern: Decorator & Proxy

I think it is better to master 23 Design Patterns as a Java developer. After I have a brief study, I find design pattern is not a new concept, and I have already used some of them in my daily projects unconsciously. Here I will describe some details about Decorator and Proxy, as I find they share something in common.