- 博客(170)
- 收藏
- 关注
原创 R Api
sum(x, na.rm = TRUE)na.omit() 删除不完整的观测(na jiqu)date() Sys.Date() as.Date(c("2007-06-22"), "%Y-%m-%d")today difftime(today, dob, units="weeks") strDates order(-age) 排序数据集合并 merge(A, B, by="ID" c("ID",
2014-11-27 11:39:26
947
原创 R student score
options(digits=2)Studeng <- c("John Davis", "Angela Williams", "Bullwinkle Moose", "David Jones", "Janice Markhammer", "Chery1 Cushing", "Reuven Ytzrhk", "Greg Knox", "Joel England", "Mary Rayburn")
2014-11-27 11:33:15
958
原创 python(8) shelve
import shelvefrom contextlib import closingwith closing(shelve.open('test_shelf.db')) as s: existing = s['key1']print(existing)
2014-11-21 09:50:28
666
原创 python(7) random
import randomimport itertoolsoutcomes = {'heads': 0, 'tails': 0}sides = outcomes.keys()a = []for i in sides: a.append(i)for i in range(10000): outcomes[random.choice(a)] += 1print(o
2014-11-21 09:48:28
621
原创 python(6) packle
import pickleimport osimport randomif os.path.exists("test"): print('exist') with open('test', 'rb') as f: state = pickle.load(f) random.setstate(state)else: random.seed(1
2014-11-19 16:10:42
1367
原创 python(4)date
import datetimeformat = "%a %b %d %H:%M:%S %Y"today = datetime.datetime.today()s = today.strftime(format)print(s)print(datetime.datetime.strptime(s, format).strftime(format))
2014-11-19 15:33:00
468
原创 python(3)
from itertools import *import operatorimport pprintimport functools@functools.total_orderingclass Point: def __init__(self, x, y): self.x = x self.y = y
2014-11-19 14:22:05
474
原创 python(1)
try: from io import StringIOexcept ImportError: from cStringIO import StringIOimport threadingimport queueclass Job(object): def __init__(self, priority, description): self.p
2014-11-19 13:35:55
495
原创 rack
#!/usr/bin/python #-*-coding:UTF-8 -*- import sys rack = {"172.23.155.101":"rack01",if __name__=="__main__": print "/" + rack.get(sys.argv[1],"rack00")
2014-11-06 10:21:26
555
原创 oozie部署
OOZIE配置文档一、 下载1. OOZIEgit clone https://github.com/apache/oozie.git2. 编译安装mvn -DskipTests=true -P hadoop-2 clean package assembly:singlecd oozie/distrotarget有生成的tar包o
2014-11-05 14:54:31
1315
原创 Mongid主备配置
Mongodb主从配置一、 官网下载1. 下载官网下载https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.5.tgztar zxvf mongodb-linux-x86_64-2.6.5.tgz 2. 主从和仲裁节点配置文件注:配置文件中的目录要先建立1.master.con
2014-11-05 11:12:03
615
原创 Redis主从配置
Redis主从配置一、 官网下载1. 下载官网下载http://download.redis.io/releases/redis-2.8.17.tar.gztar zxvf redis-2.8.17.tar.gz2. 编译安装cd redis-2.8.17make makePREFIX=/export/grid/01/xiale/soft
2014-11-05 10:13:20
419
原创 R笔记
1.age weight mean(weight)sd(weight)cor(age,weight)plot(age,weight)2.data() example("foo")3.getwd() setwd("") rm() savehistory("myfile") loadhistory("myfile") save.image("") save(
2014-11-05 09:39:53
646
原创 收藏网址
It will be read and overwritten. DO NOT EDIT! -->BookmarksBookmarks 书签栏 桌面支持中心 从 IE 中导入 桌面支持中心 入职
2014-11-05 09:29:27
881745
原创 Voltdb CsvLoader 源代码分析
1. CsvLoader csvloader --separator "#" -m 1000000000 --file splitfileaa.csv orders_par2.
2014-08-08 10:17:25
1179
原创 Spark1.01运行例子以及问题解决
1. 直接下载编译好的 export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoopSPARK_JAR=./assembly/target/scala-2.10/spark-assembly_2.10-0.9.1-hadoop2.2.0.jar \./bin/spark-class org.apache.spark.depl
2014-07-21 17:28:24
1203
原创 SparkPageRank
1.读入参数构建sparkContext if (args.length < 1) { System.err.println("Usage: SparkPageRank ") System.exit(1) } val sparkConf = new SparkConf().setAppName("PageRank") val iters = if
2014-07-21 10:37:59
823
原创 MultiBroadcastTest
1. 能够val sparkConf = new SparkConf().setAppName("Multi-Broadcast Test") val sc = new SparkContext(sparkConf) val slices = if (args.length > 0) args(0).toInt else 2 val num = if (args.le
2014-07-16 16:27:32
473
原创 LogQuery
1. 正则表达式,匹配下面stringval apacheLogRegex = """^([\d.]+) (\S+) (\S+) \[([\w\d:/]+\s[+\-]\d{4})\] "(.+?)" (\d{3}) ([\d\-]+) "([^"]+)" "([^"]+)".*""".r
2014-07-16 16:14:57
873
原创 SparkKMeans
1. 读取每一行,按 def parseVector(line: String): Vector[Double] = { DenseVector(line.split(' ').map(_.toDouble)) }
2014-07-16 13:51:04
902
原创 LocalPi
1. 计算PI = count / total * 42. var count = 0 for (i <- 1 to 100000) { val x = random * 2 - 1 val y = random * 2 - 1 if (x*x + y*y < 1) count += 1 } println("Pi is ro
2014-07-16 10:45:36
472
原创 LocalLR
1. 生成Arraydef generateData = { def generatePoint(i: Int) = { val y = if(i % 2 == 0) -1 else 1 val x = DenseVector.fill(D){rand.nextGaussian + y * R} DataPoint(x, y) } A
2014-07-15 20:27:03
560
原创 LocalKMeans
1. 随机生成N个 def generateData = { def generatePoint(i: Int) = { DenseVector.fill(D){rand.nextDouble * R} } Array.tabulate(N)(generatePoint) }
2014-07-15 20:19:24
730
原创 scala 特质
1. 要使用特质丰满接口,只要简单地定义一个具有少量抽象方法的特质——特质接口的瘦部分——和潜在的大量具体方法,所有的都实现在抽象方法之上。然后你就可以把丰满了的特质混入到类中,实现接口的瘦部分,并最终获得具有全部胖接口内容的类。
2014-07-10 17:56:27
430
原创 全局类与变量
1. js 全局共享类 单例模式var Util = cc.Class.extend({ init:function() { return true; } });Util.getInstance = function () { cc.assert(this._sharedGame, "Havn't call setSharedGame")
2014-05-28 17:24:04
672
原创 Matlab处理blob类型数据
1. addpath(fullfile(pwd, 'src'));import edu.stanford.covert.db.MySQLDatabase;db = MySQLDatabase('172.20.22.52', 'SecuritiesCloud', 'root', 'root');db.prepareStatement('SELECT * FROM t_storage_data
2014-05-26 17:13:40
2225
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人