Posts by Tag

Book

Digest of Advanced R (亟待更新)

150 minute read

P.S. It was 2015 when the 1st edition of this book came out and I wrote this post. Now Hadley Wickham is working on the 2nd edition where a lot contents chan...

Digest of Test Driven Development

less than 1 minute read

这本书 的副标题是 “By Example”,所以整书适合一口气读完,也不用每个例子都敲一遍,顺着作者思路走完一遍就可以了。

Back to Top ↑

Math-Statistics

Alias Sampling

less than 1 minute read

Two brilliant posts on this sampling technique:

Parametric vs. non-parametric models

less than 1 minute read

在查 non-parametric tests 时,Wikipedia 上提到了 Non-parametric models,于是干脆就记录一下。参考 Wikipedia: Parametric model。

McNemar Test

7 minute read

看 wikipedia 什么的都不好使,还是得看书 Handbook of Parametric and Nonparametric Statistical Procedures,写得非常清楚。

Conditional Probability

4 minute read

总结自 Coursera lecture Statistical Inference section 03 Conditional probability。

Probability

4 minute read

总结自 Coursera lecture Statistical Inference section 02 Probability。

Back to Top ↑

C++11

C++: noexcept

1 minute read

整理自 C++ Primer, 5th Edition

C++: override

less than 1 minute read

基本就是 java @Override 的作用:

C++: final

less than 1 minute read

整理自 C++ Primer, 5th Edition

C++: Null Pointer

less than 1 minute read

整理自 C++ Primer, 5th Edition

C++: enum

1 minute read

整理自 Thinking in C++。没啥特别好说的。

Back to Top ↑

Experience

Locate Bugs by Replaying

less than 1 minute read

线上机的 exception log 可能被吞(日志量很大的时候,exception log 根本就打不出来),此时可以用测试机 debug。如果测试机没问题,说明是线上环境问题(网络不好、依赖的外部接口挂了之类的)。如果测试机一样挂,那么直接在测试机上找问题就好了

a weird problem caused by encoding

less than 1 minute read

copy 一段代码到 jsp,tomcat 的 catalina.err 总说:org.apache.jasper.JasperException: /WEB-INF/jsp/admin/lottery/add.jsp(425,32) equal symbol expected。

有关设计的一些事后诸葛亮

less than 1 minute read

交互稿没画边界情况的话后患无穷,态度一定要强硬,直接拒收! 至少在部署前要询问是否有统计需求,产品不会提醒你加统计日志的,都是事后才说。 中途换技术方案是很坑爹的。涉及第三方或自己不可控的控件,提前考虑是否有压力隐患,压力测试越早做越好(越早做越先发现问题,修改的成本越小,如:Magick,lp 项...

关于表字段数量与对象字段数量的思考

less than 1 minute read

mc_lottery 是一个大表(28个字段),对应 Lottery 也是个大对象。如果一个页面只用展示 Lottery 对象的3个字段,那么,SQL 层的传输就很浪费。 如果把 mc_lottery 拆成多个小表,Lottery 对象也要拆成多个小对象的话,你就需要处理事务问题,也很烦。 由于小表...

2 most important questions when an old project is assigned to you

less than 1 minute read

最简单也最容易忽视的一点:最终的操作是什么?要输出什么?要写什么值?是写 DB 还是写 UD 还是写 MD?输入往往很清楚,但输出有时候很恍惚(比如:aupg 项目) 搞清楚:接口给谁用?(比如:aupg 项目,两个接口给用户,一个接口给 SA)

Back to Top ↑

const

C++: Const Pointer

3 minute read

在 2010-09-26 原作基础上修改。日期改到 2015-03-26 使本文进入 C++ 文章群落,方便查阅。

Back to Top ↑

Math-Algebra

PCA: my interpretation

2 minute read

$$ \newcommand{\icol}[1]{ \bigl[ \begin{smallmatrix} #1 \end{smallmatrix} \bigr] }

Gradient Field

2 minute read

[\newcommand{\icol}[1]{ \bigl[ \begin{smallmatrix} #1 \end{smallmatrix} \bigr] }]

Gradient and Directional Derivative

2 minute read

Original post is The Gradient and Directional Derivative from Mathematics School, Oregon State University. Here I thank the author(s) sincerely.

Derivative and Partial Derivative

1 minute read

感谢 良田围 网友在 偏导数有什么用 问题上的精彩回复,以下全文摘抄,仅加音标并稍微排版。

Back to Top ↑

copy-constructor

Back to Top ↑

Java-InnerClass

Java: 对内部类的继承

1 minute read

首先我们明确下 “enclose” 这个单词的逻辑关系:OuterClass encloses InnerClass,所以外部类就是 enclosing class,内部类是 enclosed class。

Java: 局部内部类 (local inner class)

less than 1 minute read

如果把 {...} 这么一段称为 “域”,那么方法 body 明显是一个域,方法 body 中的 if {} 或是 for {} 之类的也是域。在方法 body 或是方法 body 中其他域里定义的类就是局部内部类。

Java: 匿名内部类 (anonymous inner class):简化形式及自动向上转型

less than 1 minute read

内部类的一个重要作用是隐藏继承或是对接口的实现,典型的形式是:内部类来继承或是实现接口,由外部类提供代理 constructor 方法。这些代理 constructor 方法一般都利用的向上转型,即不返回内部类对象,而是返回内部类继承的父类对象或是实现的接口对象。如:

Back to Top ↑

Java-DesignPattern

Middleman Patterns: Adapter / Proxy / Decorator

1 minute read

我觉得用 Java 学 design pattern 有个问题就是:总是要有 interface / abstract class 介入,搞得整个 class hierarchy 非常复杂。其实我用 duck typing 的思路来看,Adapter、Proxy、Decorator 这三个模式的基本结构是一样的,...

Visitor Pattern Revisited

2 minute read

我们在 PPP 里其实有讲 visitor pattern,但最近在读的 Crafting Interpreters 提供了一个绝妙的解读,虽然只能适用于 vanilla 的 visitor pattern,但还是值得记录下。

Service Locator Pattern

less than 1 minute read

Martin Fowler 的 Inversion of Control Containers and the Dependency Injection pattern 中提到的。

Back to Top ↑

Java-Exception

Java: throw 的屏蔽作用

less than 1 minute read

在其所在的块内 (如方法 body、if () {...} 等),throw 语句可以屏蔽其后的语句,即在块内,该 throw 语句后面不能再写其他语句;但在块之外,还是可以写其他的语句的。如:

Java: 涉及继承的异常声明及捕捉

2 minute read

当有继承发生时,会伴随着重载、覆写 (包括接口方法的实现)、构造器的重写等行为。此时,如果基类或是接口的方法存在异常声明,那么导出类或是接口的实现类的对应方法该如何声明异常?同时对这些方法的调用该如何捕捉异常?下面就这 2 个问题进行探讨,你会看到,针对覆写和构造器的重写是 2 种完全不同的处理方式 (针对重载则...

Java: first catch

less than 1 minute read

try 块里有异常抛出时,程序会进入 第一个 异常类型匹配的 catch 块执行,其他的 catch 块不执行。

Back to Top ↑

Java-Concurrency

Java 多线程:synchronized

1 minute read

首先明确一点,同步方法本质上也是一个同步控制块(仅针对于锁定 this 的情况,如果同步控制块锁定的不是 this,那么它是不能直接改写为同步方法的),区别在于同步方法的粒度是整个方法,而同步控制块的粒度可以是方法的一部分。

Java 多线程:终止线程的方法

1 minute read

虽说 Thread 类提供了 stop() 和 suspend() 方法,但这两种方法过于粗暴,如果线程占用了一些资源(如打开了一个文件,建立了一个数据库连接什么的),直接 stop() 或是 suspend() 是会产生问题的。

Back to Top ↑

SVM

WD kernel with shifts

4 minute read

原文 RASE: recognition of alternatively spliced exons in C.elegans.

Lagrange duality

6 minute read

总结自 section note 5: Convex Optimization Overview, Part II

Back to Top ↑

pointer

C++: Null Pointer

less than 1 minute read

整理自 C++ Primer, 5th Edition

C++: Const Pointer

3 minute read

在 2010-09-26 原作基础上修改。日期改到 2015-03-26 使本文进入 C++ 文章群落,方便查阅。

Back to Top ↑

Java-AOP

Spring AOP 学习(四):简单 XML 配置

less than 1 minute read

紧接着 Spring AOP 学习(三):例子与基本概念 中的例子。其实 Spring AOP 注解的概念理解了后,看 XML 配置就是件很简单的事情了。

Spring AOP 学习(二):动态代理

1 minute read

如果系统中有 500 个类,每个类都要添加日志功能,此时无论是直接修改源代码、继承还是组合,都是十分巨大的工作量。此时 AOP 可以帮我们解决这个问题。

Java: the proxy parameter of the invoke() method

1 minute read

关于动态代理,一般的代码结构为:一个业务接口、一个业务接口的实现、一个自定义的 InvocationHandler 实现和 main 类,如下:

Back to Top ↑

Paper

The MEME algorithm

2 minute read

接上一篇 EM method for identifying motifs in unaligned biopolymer sequences,我们接着介绍 Unsupervised Learning of Multiple Motifs in Biopolymers Using Expectation Maxi...

Expectation-Maximization Algorithm

6 minute read

原文 A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models。

WD kernel with shifts

4 minute read

原文 RASE: recognition of alternatively spliced exons in C.elegans.

Back to Top ↑

Proxy

Spring AOP 学习(二):动态代理

1 minute read

如果系统中有 500 个类,每个类都要添加日志功能,此时无论是直接修改源代码、继承还是组合,都是十分巨大的工作量。此时 AOP 可以帮我们解决这个问题。

Java: the proxy parameter of the invoke() method

1 minute read

关于动态代理,一般的代码结构为:一个业务接口、一个业务接口的实现、一个自定义的 InvocationHandler 实现和 main 类,如下:

Back to Top ↑

PCA

PCA: my interpretation

2 minute read

$$ \newcommand{\icol}[1]{ \bigl[ \begin{smallmatrix} #1 \end{smallmatrix} \bigr] }

Back to Top ↑

template

C++: Template Trait

less than 1 minute read

具体见 Traits: a new and useful template technique。这里只说下感想:

Back to Top ↑

Rcpp

Digest of Advanced R (亟待更新)

150 minute read

P.S. It was 2015 when the 1st edition of this book came out and I wrote this post. Now Hadley Wickham is working on the 2nd edition where a lot contents chan...

Back to Top ↑

JVM

Java Class Loading: an example

1 minute read

class loading 是一个比较复杂的过程。一般说来,类是在其 static member 被访问时被加载的。在加载时会做的一件事是:初始化 static member 和 static 代码段 (static block, i.e. static {......}),当然,static 是只会被执行 on...

Back to Top ↑

动态代理

Spring AOP 学习(二):动态代理

1 minute read

如果系统中有 500 个类,每个类都要添加日志功能,此时无论是直接修改源代码、继承还是组合,都是十分巨大的工作量。此时 AOP 可以帮我们解决这个问题。

Java: the proxy parameter of the invoke() method

1 minute read

关于动态代理,一般的代码结构为:一个业务接口、一个业务接口的实现、一个自定义的 InvocationHandler 实现和 main 类,如下:

Back to Top ↑

Article

Service Locator Pattern

less than 1 minute read

Martin Fowler 的 Inversion of Control Containers and the Dependency Injection pattern 中提到的。

Back to Top ↑

escape

Python: play with backslashes

3 minute read

最近研究 regular expression 顺便补了下 escape 的课 (参 Escape Character / Control Character / Python Raw Strings / Python Bytes Literals),然后我今天就发现了 python 光一个 escape cha...

Back to Top ↑

MathJax

MathJax 血泪史

1 minute read

Github Pages 升级到了 Jekyll 3.0,而且将使用 kramdown 解析引擎。我紧跟大部队,local build 环境也升级了,但是发现了 MathJax 有超级多的问题,特来写下血泪史……

Back to Top ↑

entropy

Cross Entropy vs Cross Entropy Loss

less than 1 minute read

这俩是有区别的,我一直没有注意直到我发现公式上的区别。我没有注意的原因应该是 regression 没有显式使用 cross entropy loss,而 classification 的 cross entropy loss 是对原生 cross entropy 的扩展。

Back to Top ↑

Topology

Back to Top ↑

Delegate

Java: a simple delegation example

less than 1 minute read

public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { doGet(req, resp); }

Back to Top ↑

Post Formats

Post: Link Permalink

less than 1 minute read

This theme supports link posts, made famous by John Gruber. To use, just add link: http://url-you-want-linked to the post’s YAML front matter and you’re done.

Post: Notice

1 minute read

A notice displays information that explains nearby content. Often used to call attention to a particular detail.

Back to Top ↑

Servlet

Back to Top ↑

IE

never fake a <input type=file>

less than 1 minute read

不管这篇 自定义input type=”file”的样式以及引出的相关技术问题 描绘得有多么好,永远不要妄想用 <span> 来代替 <input type="file"> (即自定义样式的 file 控件),浏览器兼容性问题 is watching you! 我们可是连 IE6 都要测的...

Back to Top ↑

Java-TDD

Digest of Test Driven Development

less than 1 minute read

这本书 的副标题是 “By Example”,所以整书适合一口气读完,也不用每个例子都敲一遍,顺着作者思路走完一遍就可以了。

Back to Top ↑

JSON

Is JSON a string?

less than 1 minute read

我写这篇的起因来自于这个灵魂拷问 Is JSON a string? 我觉得这又是个老外瞎用词导致的误解。

JSON conversion

less than 1 minute read

1. Java Object <-> JSONObject

Back to Top ↑

Closure

Back to Top ↑

Java-DistributedSystem

Back to Top ↑

LDA

ISL: Classification

16 minute read

总结自 Chapter 4, An Introduction to Statistical Learning.

Back to Top ↑

Bootstrap

ISL: Resampling Methods

9 minute read

总结自 Chapter 5, An Introduction to Statistical Learning.

Back to Top ↑

Bayes

Naive Bayes classifier

1 minute read

首先感谢 张洋 先生的这篇 算法杂货铺——分类算法之朴素贝叶斯分类(Naive Bayesian classification),写的非常清楚明白。本文以此为基础做些总结。

Back to Top ↑

Bagging

Back to Top ↑

Boosting

Back to Top ↑

EM

Expectation-Maximization Algorithm

6 minute read

原文 A Gentle Tutorial of the EM Algorithm and its Application to Parameter Estimation for Gaussian Mixture and Hidden Markov Models。

Back to Top ↑

Graph

Laplacian Matrix

7 minute read

[\newcommand{\icol}[1]{ \bigl[ \begin{smallmatrix} #1 \end{smallmatrix} \bigr] }]

Back to Top ↑

ggplot

Back to Top ↑

cross-validation

Back to Top ↑

ROC

Back to Top ↑

PRC

Back to Top ↑

socket

Python: Socket Programming 101

5 minute read

参考 Socket Programming in Python (Guide) 的前半部分,代码有改动。另外我觉得这个例子用两个 ipython 来玩更方便理解。

Back to Top ↑

port

Back to Top ↑

regexp

MySQL REGEXP

less than 1 minute read

  参考 Regular Expressions - User Guide

Back to Top ↑

notice

Post: Notice

1 minute read

A notice displays information that explains nearby content. Often used to call attention to a particular detail.

Back to Top ↑

utf8

Back to Top ↑

UML

Back to Top ↑

ajax

Back to Top ↑

JavaDoc

Back to Top ↑

XSS

Back to Top ↑

CSRF

Back to Top ↑

SOA

Back to Top ↑

Java-Collection

Back to Top ↑

Spline

Back to Top ↑

GAM

Back to Top ↑

Cluster

Back to Top ↑

NLP

Back to Top ↑

Math-Geometry

Simplex

less than 1 minute read

概念挺简单,主要是生单词太多了,mark 一下。

Back to Top ↑

HMM

Back to Top ↑

pandas

Back to Top ↑

numpy

Back to Top ↑

MySQL-client

Back to Top ↑

Markov

Back to Top ↑

Entropy

Back to Top ↑

CPU

CPU bound vs IO bound

less than 1 minute read

From stackoverflow: What do the terms “CPU bound” and “I/O bound” mean?:

Back to Top ↑

IO

CPU bound vs IO bound

less than 1 minute read

From stackoverflow: What do the terms “CPU bound” and “I/O bound” mean?:

Back to Top ↑

Bioconductor

Back to Top ↑

apply

Back to Top ↑

Autocommit

Back to Top ↑

np.unique

Back to Top ↑

pdist

scipy: pdist indexing

1 minute read

scipy.spatial.distance.pdist(X) gives the pair-wise distances of X, $\operatorname{dist}(X[i], X[i])$ not included. The distances are stored in a dense matri...

Back to Top ↑

dense-matrix

scipy: pdist indexing

1 minute read

scipy.spatial.distance.pdist(X) gives the pair-wise distances of X, $\operatorname{dist}(X[i], X[i])$ not included. The distances are stored in a dense matri...

Back to Top ↑

pip

Back to Top ↑

sudo

Back to Top ↑

virtualenv

Back to Top ↑

generative

Generative Models

3 minute read

参考自 Introduction to Semi-Supervised Learning。

Back to Top ↑

convex

Back to Top ↑

SNAP

Back to Top ↑

node2vec

Back to Top ↑

Pivot

Back to Top ↑

context-free

What does context-free mean in CFLs?

less than 1 minute read

这真的是困扰了我很多年的问题,而且我发现这还不是中文教材的锅,老外的很多教材也是上来就 CFL,也不告诉你这个 context 到底是啥 context,这个 free 是怎么个 free 法。我就纳闷了,多讲这么几句怎么就这么难呢……

Back to Top ↑

Chomsky

What does context-free mean in CFLs?

less than 1 minute read

这真的是困扰了我很多年的问题,而且我发现这还不是中文教材的锅,老外的很多教材也是上来就 CFL,也不告诉你这个 context 到底是啥 context,这个 free 是怎么个 free 法。我就纳闷了,多讲这么几句怎么就这么难呢……

Back to Top ↑

URL

Back to Top ↑