Skip to content

Instantly share code, notes, and snippets.

@crazycode
crazycode / gist:3046563
Created July 4, 2012 10:21
Play1.2.4测试数据准备
@Before
public void setup() {
Fixtures.delete(Category.class);
Fixtures.delete(Brand.class);
Fixtures.delete(Area.class);
Fixtures.delete(Order.class);
Fixtures.delete(OrderItems.class);
Fixtures.delete(Goods.class);
Fixtures.delete(User.class);
Fixtures.delete(ECoupon.class);
@crazycode
crazycode / gist:3046589
Created July 4, 2012 10:26
play1.2.4 selenium测试
#{fixture delete:'all', load:'fixture/goods.yml' /}
#{selenium 'Test Home/index.html'}
open('/')
verifyTitle('一百券-网上消费券首选门户,消费券,代金券,优惠券,美食券,电子券,提货券')
verifyTextPresent('测试商品1')
verifyTextPresent('测试商品4')
#{/selenium}
@crazycode
crazycode / gist:4133390
Created November 23, 2012 00:03
playframework 1.x await
public static void syncAmazon(final String sid) {
// play status 检查平均耗时 2.5s , 开放线程时间 3s 后回掉
await(new Job<Selling>() {
@Override
public Selling doJobWithResult() throws Exception {
Selling selling = Selling.findById(sid);
selling.syncFromAmazon();
return selling;
}
@crazycode
crazycode / gist:4970741
Last active August 3, 2018 08:33
用于出现乐观锁重试的代码
package util.transaction;
import play.Logger;
import play.db.jpa.JPA;
public class TransactionRetryUtil {
private static final int MAX_TRIED_TIMES = 15;
public static <T> T run(TransactionCallback<T> callback) {
for (int i = 0; i < MAX_TRIED_TIMES; i++) {
try {
# play status --secret=aC3NL1k6Zn9XEZbvMO6
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.4, http://www.playframework.org
~
~ Status from http://localhost:9402/@status,
@crazycode
crazycode / 1.CacheCallBack.java
Last active December 24, 2015 14:09
Play Framework缓存封装,提供回调方式使用缓存;并提供批量更新缓存的实现。
package cache;
/**
* cache回调接口.
*/
public interface CacheCallBack<T> {
T loadData();
}
@crazycode
crazycode / gist:7669950
Last active December 29, 2015 12:19 — forked from AstonJ/gist:2896818
#get root access
$su -
$ cd /tmp
#Remove old Ruby
$ yum remove ruby
# Install dependencies
$ yum groupinstall "Development Tools"
$ yum install zlib zlib-devel
@crazycode
crazycode / gist:92a1f91dfb60ca231f2d
Last active August 29, 2015 14:04
Linuxx64-Oracle静默安装-zhs16gbk (安装在vagrant上,供开发使用,密码统一为OraPwd11)
---
layout: post
title: Linux.x64 Oracle安装
date: 2013-09-21 23:51:11
comments: true
categories: [error,java,bash,bi,oracle,database,centos,linux]
---
## 安装JDK
+ 1.直接执行
@crazycode
crazycode / gist:53bd7a5b8ea8bad7ec56
Last active September 20, 2019 04:25
ORACLE 11G R2静默安装配置 - UTF-8
# Start the old vagrant
$ vagrant init centos-6.4
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.