- v3
http://news-at.zhihu.com/api/3/stories/latest 获取今日日报
http://news-at.zhihu.com/api/3/news/latest 获取今日日报
http://news-at.zhihu.com/api/3/news/before/20140618 获取某个日期之前的日报
import java.math.BigInteger; | |
class PrimeCompare implements ICompare { | |
@Override | |
public boolean compare(String longString, String shortString) { | |
BigInteger product = new BigInteger("1"); | |
for (int i = 0; i < longString.length(); i++) { | |
int index = longString.charAt(i) - 'A'; |
http://121.40.186.170/shipin/test1.php | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | |
.detectDiskReads().detectDiskWrites().detectNetwork() | |
.penaltyLog().build()); | |
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() | |
.detectLeakedSqlLiteObjects().detectLeakedClosableObjects() | |
.penaltyLog().penaltyDeath().build()); |
XmlPullParser xmlPullParser = null; | |
try { | |
InputStream is = util.getInput("http://121.40.186.170/shipin/test1.php"); | |
XmlPullParserFactory pullFactory = XmlPullParserFactory.newInstance(); | |
xmlPullParser = pullFactory.newPullParser(); | |
xmlPullParser.setInput(is, "UTF-8"); | |
} catch (Exception e) { | |
Log.v("TAG", e.toString()); | |
} | |
ArrayList<Object> arrarys = util.ParseXml(xmlPullParser); |
imageView = (ImageView) findViewById(R.id.myImageview); | |
small_imageView = (ImageView) findViewById(R.id.small_image); | |
imageView.setBackgroundResource(R.anim.m_anim); | |
animationDrawable = (AnimationDrawable) imageView.getBackground(); | |
public void start(View view) { //A button click | |
if (!animationDrawable.isRunning()) { | |
animationDrawable.start(); | |
controlFrame = new Thread(new Runnable() { | |
@Override |
BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; // Don't allocated memory | |
BitmapFactory.decodeResource(getResources(), R.id.myimage, options); | |
int imageHeight = options.outHeight; | |
int imageWidth = options.outWidth; | |
String imageType = options.outMimeType; |
##科学上网之实践篇 ####1. HOSTS
hosts翻墙是我最厌恶的一种方式,原因如下
但是在某些情况下,hosts 可以作为应急方案,还是给出若干 hosts 提供方网址
/** | |
* Qucik sort 54,12,9,89,3,19,29,1 (1)选择54作为中轴 并定义tmp=54 1,12,9,89,3,19,29,1 | |
* (2) 定义一个队尾游标,从后向前扫描,选择小于54的第一个元素,并把它复制到54这个位置 1,12,9,89,3,19,29,89 | |
* (3)定义一个队首游标,从前向后扫描,扫描到大于54的第一个元素,并把它复制到1这个位置 1,12,9,29,3,19,29,89 | |
* (4)继续步骤2的扫描,扫描小于54的第一个元素,并把它复制到89这个位置 1,12,9,29,3,19,54,89 | |
* (5)继续步骤3的扫描,当扫描游标触碰到队尾游标时还未发现大于54的元素,则把tmp复制到队尾游标所指向的位置 | |
* (1,12,9,29,3,19)54(89) (6)分别对54左右两个数组执行步骤1 | |
* | |
* @param str | |
* @return |
public String[] allSort1(String str) { | |
int len = str.length(); | |
if (len == 0) { | |
return null; | |
} | |
int count = 0, n = 1; | |
for (int i = 1; i <= len; i++) { | |
n *= i; | |
} | |
String[] strings = new String[n]; |
import java.security.MessageDigest; | |
public class HashTest { | |
public static String HashTest(String message, String type) { | |
StringBuilder sBuilder = null; | |
try { | |
MessageDigest messageDigest = MessageDigest.getInstance(type); | |
messageDigest.update(message.getBytes()); | |
sBuilder = new StringBuilder(); |