G1 v.s. CMS

G1 also aims at "low pause", and it can work well on large heaps(over 4G) .   CMS, on the other hand, are not designed for large heaps. And CMS requires more configuration. 

Enable https for your nginx-hosted website with a CA-signed certificate

1. Exchange a Certificate Signing Request for certificate files openssl req -new -newkey rsa:2048 -nodes -keyout private.key -out my.csr Then submit my.csr file to your CA. You will then get certificate files from it.   * The private.key will be used for decryption during SSL/TLS session establishment between a server and a client. 2. Combine …

Enable https for your nginx-hosted website with a CA-signed certificate Read More »

Why I am not a fan of Hibernate

Rich Domain Model + Lazy-loading cause problems Hiberntate encourages rich domain model over table model, that is,  A.b instead of A.bId You must enable lazy-loading, otherwise there will be performance issues If you are not in a hibernate session, A.b will be invalid ("Partial Materialization" problem) To make user you are in a hibernate session, …

Why I am not a fan of Hibernate Read More »

Python: PIL generates an image too big?

You’ve tried thumbnail(), resize(), save(quality=20),  but you still get an image too big? Maybe it’s because you are generating a PNG file.  Change it to JPG and you will get a much smaller file ! It’s because PNG format is a lossless compression file format.  Without losing quality you can’t get a considerably small image …

Python: PIL generates an image too big? Read More »

Let Django’s migration run raw SQL

You’ve created a new column and you want set its value as the "id" column. What to do?  Add the following line to the generated migration file or you can create new migration file migrations.RunSQL(sql=”update some_table set new_column = id”)