Skip to content

Instantly share code, notes, and snippets.

View arganzheng's full-sized avatar

arganzheng arganzheng

View GitHub Profile
@arganzheng
arganzheng / nginx-proxy-cache.conf
Last active December 20, 2015 12:09
我本地的nginx.conf,配合proxifier可以做灰度测试。
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
events {
# use epoll;
worker_connections 1024;

Spring MVC其实提供了一些好用的util类:

import org.springframework.web.util.WebUtils;

Cookie cookie = WebUtils.getCookie(request, "SECURITY_TOKEN");
@arganzheng
arganzheng / sinatra.md
Last active December 21, 2015 02:59
sinatra arganzheng

使用Sintra开发文档系统

安装

ruby && gem

对于windows环境,最简单的方式是下载一个installer,双击运行就可以了。

sinatra

@arganzheng
arganzheng / index.html
Last active October 15, 2018 03:05
使用bootstrap进行复杂页面布局
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Blog</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
</head>
<body>
<div class="container">

import java.lang.Thread.UncaughtExceptionHandler; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory;

/**

  • @ClassName: ExceptionThread
  • @Description: TODO(这里用一句话描述这个类的作用)
  • @date 2013-10-10 下午12:04:23 */

优雅的builder模式

public class NetworkUpdatesService{

	public void getNetworkUpdatesSummary(){
		UpdateQueryCriteria query = UpdateQueryCriteria.createDefaultCriteria()
				.setMemberID(2)
				.setRequestdTypes(NetworkUpdateType.CONNECTION)

.setCutoffDate(...)

如何提高消息系统吞吐量

  1. should not block while processing a message
  2. prefer immutable message
  3. batch and piggy(捎带)
  4. avoid polling, try callback notify
  5. cache,但是要注意数据同步更新问题
@arganzheng
arganzheng / JavaNioStudy.java
Created November 22, 2013 06:51
Java NIO study Selector Channel select
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

鹏城放生组2013年12月1号(星期日)放生公告

放生时间: 2013年12月1号(星期日)上午9点30分举行放生。 集合地点:当天9点正在深圳市大鹏新区大鹏银滩大道金水湾渡假村大门口标有“金水湾”字样的指示牌处集合。 开车前往的师兄导航大鹏银滩大道金水湾渡假村;乘坐公交车的师兄可选择:一是坐E11.H92或833.818到大鹏站下车后转乘b756到鹏城挢站下车,反方向步行至红绿灯左拐入银滩大道再走10分钟到金水湾度假村;二是坐E11.H92或833.818到大鹏站下车后,再在大鹏二站坐928到金水湾度假村站下车(928公交相隔20分钟一班,上车时请吩咐驾驶员到站让下。 欢迎随喜参加,功德无量。 放生随喜帐号: 中国银行,账号6216612000005457219,户名:欧阳权