Skip to content

Instantly share code, notes, and snippets.

View hellokaton's full-sized avatar
:shipit:
Focusing on work

見える hellokaton

:shipit:
Focusing on work
View GitHub Profile
@hellokaton
hellokaton / mysql隔离级别及事务传播
Created February 17, 2016 10:35 — forked from JagoWang/mysql隔离级别及事务传播
mysql隔离级别及事务传播
TRANSACTION(事务隔离级别)
1. ISOLATION_DEFAULT:这是一个PlatfromTransactionManager默认的隔离级别,使用数据库默认的事务隔离级别。
每种数据库的默认隔离级别是不同的,例如SQL Server、Oracle默认Read Commited,MySQL默认Repeatable Read。
另外四个与JDBC的隔离级别相对应,不同的隔离级别采用不同的锁类型来实现,在四种隔离级别中,Serializable的
隔离级别最高,Read Uncommited的隔离级别最低。
2. ISOLATION_READ_UNCOMMITTED:读未提交数据,这是事务最低的隔离级别,在并发的事务中,它充许一个事务可以
读到另一个事务未提交的更新数据。(会出现脏读,不可重复读和幻读)
3. ISOLATION_READ_COMMITTED:读已提交数据,保证在并发的事务中,一个事务修改的数据提交后才能被另外一个事
@hellokaton
hellokaton / Emoji.java
Created April 19, 2016 10:15 — forked from Buttonwood/Emoji.java
表情字符判断
/**
* 判断一个字符是否emoji表情字符
*
* @param ch
* 待检测的字符
*/
public static boolean isEmoji(char ch) {
return !((ch == 0x0) || (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
|| ((ch >= 0x20) && (ch <= 0xD7FF))
|| ((ch >= 0xE000) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0x10FFFF)));
@hellokaton
hellokaton / reddit_hot_sortAlgorithm_analysis.md
Created April 20, 2016 14:40
Reddit 最新热度排名算法分析

#source code

cdef extern from "math.h":
    double log10(double)
    double sqrt(double)

epoch = datetime(1970, 1, 1, tzinfo = g.tz)

cpdef double epoch_seconds(date):
@hellokaton
hellokaton / Base64.java
Created April 25, 2016 06:45
java base64
import java.io.UnsupportedEncodingException;
public class Base64 {
private static char[] base64EncodeChars = new char[] { 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/' };
@hellokaton
hellokaton / DefaultCommentGenerator.java
Last active June 28, 2016 10:11
修改mybaties生成器注释代码
/*
* Copyright 2008 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hellokaton
hellokaton / donate-buttons.htm
Created September 1, 2016 14:35 — forked from solicomo/donate-buttons.htm
精简过的PayPal捐赠按钮和OKPay捐赠按钮。前者是基于“立即购买”按钮修改的,因为中国的PayPal账户不能接收捐赠。
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="soli@cbug.org">
<input type="hidden" name="item_name" value="Support cbug.org">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" style="border:0px;background:none;" name="submit" alt="PayPal - The safer, easier way to pay online">
</form>
</center>
BufferedImage image = new BufferedImage(144, 32, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setFont(new Font("Dialog", Font.PLAIN, 24));
Graphics2D graphics = (Graphics2D) g;
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
graphics.drawString("Hello World!", 6, 24);
ImageIO.write(image, "png", new File("text.png"));
for (int y = 0; y < 32; y++) {
@hellokaton
hellokaton / ASCII.java
Created September 6, 2016 03:18 — forked from shmert/ASCII.java
Convert images to ASCII text
package ascii;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
/*Copyright (c) 2011 Aravind Rao
@hellokaton
hellokaton / Spring Schema扩展.md
Created October 16, 2016 02:55 — forked from dchjmichael/Spring Schema扩展.md
Spring Schema 扩展介绍

介绍

Spring从2.0开始引入了一个新的机制用于扩展xml模式,我们就可以编写自定义的xml bean解析器然后集成到Spring IoC容器中。

xml扩展大概有以下几个步骤:

  • 编写自定义类
  • 编写xml schema来描述自定义元素
  • 编写NamespaceHandler新样式.css的实现类
  • 编写BeanDefinitionParser实现类
  • 把以上组建注册到Spring
@hellokaton
hellokaton / text3d.css
Created February 26, 2017 11:55 — forked from catouse/text3d.css
CSS3文字效果
h1 {
text-shadow: 0 1px 0 #ccc,
0 2px 0 #c9c9c9,
0 3px 0 #bbb,
0 4px 0 #b9b9b9,
0 5px 0 #aaa,
0 6px 1px rgba(0,0,0,.1),
0 0 5px rgba(0,0,0,.1),
0 1px 3px rgba(0,0,0,.3),
0 3px 5px rgba(0,0,0,.2),