Java convert object xml example

There are many ways to convert object to xml. In this post I will show you how to use XStream to convert object to xml. In order to use XStream add maven dependency like following.

Linux find command examples

find is a very useful command when you want "find" something in Linux. In the page I will learn the basic use of this command with you. For the detail of find you can learn from manual(type man find in command line).

google 403 error your client does not have permission to get url

Today I meet this error when I use Chrome google something. I change the search word the error is still there. After restarting Chrome I try to google again it is still doesn't work. To solve this problem just clear the cache of Chrome like following.

JQuery add remove tr in table

In this page I will show you how to use JQuery remove and add tr element in table. Copy the code following and click remove or add button. If you do not want remove the first tr element or add after last tr element just change the JQuery selector.

Spring Boot http status code

It is easy to custom your own 404 or 500 page in SpringMVC(I use Spring Boot to make an example). It is not friendly for browser and search engine to return an error page without http status code. There are several ways to return page with http status code. I will show you the easiest way in this blog.

GitHub markdown code highlight identifier

You can use code block in markdown to make code read easily. GitHub support different language identifier to highlight the keywords. The list of identifiers are here. Click highlight.js demo page for detail.

Solve OutOfMemoryError UncaughtExceptionHandler

In this page I will show you how to solve Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread. This error means there is not enough memory to run your application. What you need to do is increasing memory. The key question is there are a lot of arguments for java which is right?

Generate OutOfMemoryError java heap space

OutOfMemoryError means the memory is not enough for your program. After this error Java virtual machine will tell you the detail. When you want solve this problem, you should first of all get to understand it. In this page I will show you how to generate OutOfMemoryError: Java heap space programatically.

Catch exception in MyBatis

I generate mapper interface and xml file in my application. There is no exception in method signature. But when the sql execute failed MyBatis will throw an exception. I found the exception thrown from MyBatis is always PersistenceException. After reading the source code, I seemed to understand.

Add border in table CSS example

In this page I will show you how to add border CSS in table. It is better add border in table before adjusting width and height. Example is here

Difference between text() html() and val() in JQuery

Do not know which to use when you want set or change the content of selector in JQuery? I will show you the difference between text(), html() and val() in this page. Example is here, copy it and save as html file. Click different button will change different selector's content.

Javascript switch case example

switch...case is useful and easy to use in Javascript. I will show you how to use switch...case in Javascript. Examples are here.

JQuery loop array example

In this page I will show you how to loop an array by using JQuery and Javascript. I recommend using JQuery to loop an array. Examples are here.

Change character set in MySQL

Recently I met Chinese garbled(中文乱码) problem in MySQL. Solve this problem by changing the character. In this page I will show you how to change character in MySQL. Before changing it we need to know the support character sets in MySQL.

Update null or not exist field in MongoDB

Use db.collection.update to update the document. Do not know how to update document you can click Update document in MongoDB. In this page I will show you how to update document which field is null or not exists.