现在位置: 首页 > viability发表的所有文章
  • 05月
  • 15日
综合 ⁄ 共 5259字 评论关闭
The Bitcoin network uses simple methods to perform peer discovery and communicate between nodes. The following section applies to both full nodes and SPV clients, with the exception that SPV’s Bloom filters take the role of block discovery. Peer Discovery Bitcoin Core maintains a list of peers to connect to on startup. When a full node is started for the first time, it must be bootstrapped to the network. This is done automatically today in Bitcoin Core by a short list of trust......
阅读全文
  • 01月
  • 04日
综合 ⁄ 共 5504字 评论关闭
1. 效果图 2. SlidingSwitch.java文件内容: <pre name="code" class="java">package com.jun.widget; import com.jun.slidingswitch.R; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; import android.view......
阅读全文
  • 05月
  • 23日
综合 ⁄ 共 13128字 评论关闭
单元测试利器 JUnit 4 本文主要介绍了如何使用 JUnit 4 提供的各种功能开展有效的单元测试,并通过一个实例演示了如何使用 Ant 执行自动化的单元测试。本文假设读者对 Eclipse 下进行 Java 开发有一定的经验,并了解 Java 5 中的注解(annotation)特性。 引言 毋庸置疑,程序员要对自己编写的代码负责,您不仅要保证它能通过编译,正常地运行,而且要满足需求和设计预期的效果。单元测试正是验证代码行为是否满足预期的有效手段之一。但不可否认,做测试是件很枯燥无趣的事情,而一遍又一遍的测试则更是让人生......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 7908字 评论关闭
摘要:Spark是发源于美国加州大学伯克利分校AMPLab的集群计算平台。它立足于内存计算,从多迭代批量处理出发,兼收并蓄数据仓库、流处理和图计算等多种计算范式,是罕见的全能选手。 Spark已正式申请加入Apache孵化器,从灵机一闪的实验室“电火花”成长为大数据技术平台中异军突起的新锐。本文主要讲述Spark的设计思想。Spark如其名,展现了大数据不常见的“电光石火”。具体特点概括为“轻、快、灵和巧”。 轻:Spark 0.6核心代码有2万行,Hadoop 1.0为9万行,2.0为22万行。一方面,感谢Scala语言的简洁和丰富表达力;另一方面,Spa......
阅读全文
  • 04月
  • 03日
综合 ⁄ 共 9276字 评论关闭
Foursquare 编辑 Foursquare是一家基于用户地理位置信息(LBS)的手机服务网站,并鼓励手机用户同他人分享自己当前所在地理位置等信息。与其他老式网站不同,Foursquare用户界面主要针对手机而设计,以方便手机用户使用。 目录 1创始人 2模式 3融资情况 4盈利模式 5分析 6应用商机 7点评 应用实例 转型之路 8在中国 商业应用 产品特色 竞争性 9联手媒体 10Android手机版 软件信息 软件介绍 软件截图 1创始人 丹尼斯·克罗利 丹尼斯·克罗利(Dennis Crowley......
阅读全文
  • 04月
  • 02日
综合 ⁄ 共 1460字 评论关闭
参考:http://brew.sh/index_zh-cn.html 以下是我的具体执行过程: zcms-iMac:~ zcm$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" ==> This script will install: /usr/local/bin/brew /usr/local/Library/... /usr/local/share/man/man1/brew.1 ==> The following directories will be made group writable: /usr/local/. /usr/local/bin ==> The following directories will have their group set to admin: /usr/local/. /usr/local/bin Press RETURN to continue or any other ke......
阅读全文
  • 01月
  • 29日
综合 ⁄ 共 364字 评论关闭
// 抓包回调 // pcap_loop方式: void pcap_handler(u_char *param, const struct pcap_pkthdr *pkt_hdr, const u_char *pkt_data) { struct tm *ltime; char strTime[16]; time_t local_tv_time; local_tv_time = pkt_hdr->ts.tv_sec; ltime=localtime(&local_tv_time); strftime(strTime,sizeof(strTime),"%H:%M:%S",ltime); printf("Time:%s,\t Second:%.6d,\tMicro Second:%.5d,\t%d\n",strTime,local_tv_time,pkt_hdr->len);......
阅读全文
  • 01月
  • 14日
综合 ⁄ 共 2518字 评论关闭
这一题要注意利用数列对称的性质,即v[1]+v[2]+..+v[i]和v[j]+v[j+1]+..+v[N]的点,两个对称点之间合并的代价只能是a[j-i+1],dp[i][j]表示将[i,j]区间内的数列合并到对称形式的最小代价,因此状态转移方程是dp[i][j]=min(dp[i][j],a[x-i+1]+a[r-j+1]+dp[i+1,j-1]),这里面[x,y]包含于[i,j]区间,即=[i,j]区间向内合并到对称点,再由对称点合并到最终状态。 我本来想写递推的,结果蒟蒻写晕了==,因为这里状态转移的方向一个index向前一个index向后==然后就写了好久没写的记忆化搜索,注意搜索时要对非法情况(l,r)越界的特判。 感......
阅读全文
  • 12月
  • 27日
综合 ⁄ 共 7383字 评论关闭
1::char和string比较 #include <iostream>#include <string>using namespace std;int main(){ string str="string类型字符串"; char ch[]="char型字符串"; cout<<str<<endl; cout<<ch<<endl; cout<<"请输入'狗'的英文单词"<<endl; cin>>str; if (str=="dog") {  cout<<"狗:"<<str<<endl;  cout<<str<<"的第1个字符是:"<<str[0]<<endl; } else {  cout<<"输入错误!"<<endl; } cout<<"请输入'猪'的英文单词"<......
阅读全文
  • 12月
  • 14日
综合 ⁄ 共 1342字 评论关闭
assert宏:    assert宏其实很重要,对于调试程序来说。   assert宏的原型定义在assert.h中   #include<assert.h>    void  assert(int exp);   assert的作用是计算表达式exp,如果其值为假(即为0),那么它先打印一条出错信息,然后通过调用abort来终止程序运行。   assert就是为了确定一个条件为真,如果不为真,则给出出错信息,并终止程序。所以assert也叫断言。 例子: #include<assert.h> #include<stdio.h>   void main() { int i=100; assert(i!=100); }   这里assert(i!=100);就是确保i不等于100,程序......
阅读全文
  • 11月
  • 20日
综合 ⁄ 共 2394字 评论关闭
传送门:【COGS】1577 [OIBH 练习赛#6]战地统计系统 题目分析:赤果果的四分树哦~,题目分析就不说了,大家看到一定都会,但是我要吐嘈一下数据= =,这题目的数据竟然有一组是错误的!x1 <= x2 没满足且0 < v也没有满足。。这样真的大丈夫? 代码如下: #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> using namespace std ; #define REP( i , a , b ) for ( int i = a ; i < b ; ++ i ) #define REV( i , a , b ) for ( int i = a ; i >= b ; -- i ) #de......
阅读全文
  • 10月
  • 30日
综合 ⁄ 共 679字 评论关闭
当一个工程很大的时候,恰当的路径设置可以将不同模块的动态链接库和工程很好的组织起来。 在VC中的设置如下: include 包含路径设置: project->setting->C/C++->Preprocessor: Additional include directories: ../../inc dll 输出路径设置: project->setting->Link->General: Output file name: ../../bin/moduld.dll pdb输出路径设置 : project->setting->Link->Customize: Program database name: ../../bin/moduld.pdblib 输出路径设置: 应该是在project->setting->Link-&......
阅读全文