Skip to content

Instantly share code, notes, and snippets.

@kaka2008
kaka2008 / PostJsonExample.java
Created December 2, 2014 09:23
使用httpclient调用post方式api,post时,直接传递一个json
package client;
import java.io.IOException;
import java.nio.charset.Charset;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
@kaka2008
kaka2008 / PostExample.java
Created December 2, 2014 09:21
使用httpclient 调用post方式api
package client;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@kaka2008
kaka2008 / GetExample.java
Created December 2, 2014 09:21
使用httpclient调用get方式的api
package client;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="__UP_frogName__"
directory_title="Tree Frog"
category="funandgames"
description="Add this tree frog to your page to see how he inquisitively follows your mouse or eats the flies you give it. You can change the color of the tree frog, the color of the background, the size of his belly, and add a background jpg image. "
author="Adam Bowman"
author_email="adbocode@gmail.com"
title_url="http://abowman.com/google-modules/tree-frog/"
screenshot="http://hosting.gmodules.com/ig/gadgets/file/112581010116074801021/treefrog.png"
@kaka2008
kaka2008 / StringUtil.java
Last active August 29, 2015 14:05
Java方式des-ecb加密和解密
// des-ecb方式加密解密的key
public static final String DES_ECB_KEY = "01234567";
/**
* 采用DES-ECB方式加密
*
* @param text
* @return
*/
public static String encryptText(String text) {
@kaka2008
kaka2008 / StringUtil.js
Last active April 25, 2021 08:46
javascript des-ecb加密和解密
/**
* 采用des-ecb的方式进行加密,
* @param text
*/
function encryptText(text){
var settings = {
des_ecb_key:"01234567",
des_ecb_iv:null
};
var key = settings.des_ecb_key;
@kaka2008
kaka2008 / MergeSort2
Last active August 29, 2015 14:04
分治法合并排序 ,将一个数组递归的分成两部分,然后将其合并,达到排序的目的。时间复杂度为log(2)n
/**
* 真正的插入排序<br/>
* 时间复杂度为log(2)n (2为底数)
*
* 在一个数据组中,递归的将其分成两部分,最后,将其合并
*
* @author weizhankui
*
*/
public class MergeSort{
@kaka2008
kaka2008 / MergeSort
Last active August 29, 2015 14:04
用java实现的合并排序
package first;
/**
* 合并排序,时间代价为O(n),总的计算次数是一定的,每次比较花得时间是个常量<br/>
* 但是前提是左右两个数组是排好序的
*
* @author weizhankui
* @date 2014-7-27
*
C:\Documents and Settings\weizhankui>gem install -v 2.3.5 rails
WARNING: RubyGems 1.2+ index not found for:
http://gems.rubyforge.org/
RubyGems will revert to legacy indexes degrading performance.
Bulk updating Gem source index for: http://gems.rubyforge.org/
ERROR: While executing gem ... (Gem::RemoteSourceException)
Error fetching remote gem cache: SocketError: getaddrinfo: 存储控制块被损坏
。 (http://gems.rubyforge.org/yaml)