Category Archives: design

Springbatch cursor reader

Spingbatch default cursor reader reads data readily. It has below advantages over jdbctemplate: 1. Traditional jdbctemplate reader reads data in one time, which makes wait for a very long time. But cursor reader reads steadily, we don’t need to wait. 2. Jdbctemplate reads in one time, and put everything in memory. But cursor reader can avoid this… Read More »

Consistent Hashing Algorithm

I’ve been thinking this problem for a long time. HashMap brings an amortized O(1) time for insertion/lookup data. But let’s say we do rehash when we have million records already. We can’t neglect this rehash process, and say it is amortized O(1) time. This will lead a remapping disaster to whole server. So, I found… Read More »

ssh-keygen

1. In any server, we can use ssh-keygen command to generate a pair of public/private key. ssh-keygen -t rsa -b 4096 Then, we will see “id_rsa”, “id_rsa.pub”. 2. Copy “id_rsa.pub” to the “~/.ssh” folder on machineA where we want to log in. We need to rename to “authorized_keys“. 3. Copy “id_rsa” to the “~/.ssh” folder… Read More »

Google Oauth 2.0

Finally got my google oauth 2.0 worked. It took me 2 weeks researching on it. One suggestion is that we don’t use the provided google packages. I’ve been trying so many java examples, but they always has this or that problem. In the end, I turned back to the pure GET, POST, ajax to test it.… Read More »

Read json

I have following json file and folder structure. A maven dependency I need is following: <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1.1</version> </dependency> By following colde. I read the json file from it: package com.pli.project.test; import org.apache.commons.io.IOUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import java.io.*; import java.util.HashMap; /** * Created by lipeng on 2015/4/4. */ public class App… Read More »

About Github

These 2 days, I did research about github. Let me write down my learning summary. 1. What is github? It is a version control platform. It can record the changes of a project, and can help developers to collaboratively develop one project together. 2. Repository It is actually a directory. And it is the unit… Read More »

window.opener only works on server, but not on local machine

Today, I tried ckeditor function. But the window.opener.CKEDITOR.tools.callFunction always doesn’t work. I found out it works in IE, but not in chrome. It’s weird. After hours research, I put it in tomcat server, and started tomcat server, it works. So the conclustion is that window.operner only works in server, but not in local machine. editor.html: <html>… Read More »