- 博客(126)
- 收藏
- 关注
转载 R apply,sapply
apply函数(对一个数组按行或者按列进行计算):使用格式为:apply(X, MARGIN, FUN,...)其中X为一个数组;MARGIN为一个向量(表示要将函数FUN应用到X的行还是列),若为1表示取行,为2表示取列,为c(1,2)表示行、列都计算。示例代码:> ma > ma [,1] [,2] [,3] [,4][1,] 1 3 1
2014-09-03 14:48:33
1049
转载 install.packages的用法
如何安装R语言包详见: Linux安装R语言包 使用公共路径上的R软件,如何拥有自己的library:R中用.libPaths()函数查看lib路径,如果有多个lib,install.packages()默认是安装在第一个目录下修改.bashrc文件中R lib路径的环境变量export R_LIBS=/home/.../R/lib64/R/library,就能设定自己li
2014-08-31 21:36:57
7571
原创 C语言 图的深度 遍历
#include#include#include#define OK 1#define ERROR 0#define GVexnum 8int visited[GVexnum];//define as the global array//---------define the graphic--------------typedef struct ArcNode{ int ad
2014-08-31 15:20:46
748
原创 图的 广度优先 搜索
#include#include#include#define OK 1#define ERROR 0//--------define the queue----------------typedef struct QNode{ int data; struct QNode *next;}QNode,*QueuePtr;typedef struct{ QueuePtr f
2014-08-31 13:21:01
507
原创 C语言结构体中指针的复制问题
#include#include#includetypedef struct TNode{ int data; struct TNode * next;}TNode,*Tree;int main(){ Tree a,b,c,d; c=(Tree)malloc(sizeof(TNode)); c->data=7;c->next=NULL; d=(Tree)malloc(si
2014-08-30 20:07:56
5329
原创 先序、中序、后序遍历二叉树 算法
#include#include#define OK 1#define ERROR 0int max_min=0;typedef struct BiTNode{ int data; struct BiTNode * lchild; struct BiTNode * rchild;}BiTNode,*BiTree;int visit_output(BiTree T);int
2014-08-30 12:31:02
680
原创 堆排序(算法导论)
#include#include#define OK 1int build_max_heap(int[],int);int main(){ int A[]={4,1,3,2,16,9,10,14,8,7}; int length=10; //build_max_heap(A,length); heap_sort(A,length); int i; for(i=0;i<lengt
2014-08-29 16:53:29
467
转载 python使用sqlite3
Sqlite是一个轻量级的数据库,类似于Access.一、 安装Python 2.5开始提供了对sqlite的支持,带有sqlite3库.没有sqlite的版本需要去PySqlite主页上下载安装包.PySqlite下载地址http://code.google.com/p/pysqlite/downloads/list 二、创建数据库/打开数据库Sqlite使用文件
2014-08-28 21:39:23
561
转载 sqlite3常用命令&语法
http://blog.csdn.net/linchunhua/article/details/7184439sqlite数据库只用一个文件就ok,小巧方便,所以是一个非常不错的嵌入式数据库,SQLite大量的被用于手机,PDA,MP3播放器以及机顶盒设备。 Mozilla Firefox使用SQLite作为数据库。 Mac计算机中的包含了多份SQLite的拷贝,用
2014-08-28 21:35:24
506
转载 python OS
我们经常会与文件和目录打交道,对于这些操作python提供了一个os模块,里面包含了很多操作文件和目录的函数。想要知道有哪些方法,我们可以运行下面的语句,就可以在屏幕上输出os模块的所有信息:>>> import os>>> help(os)如果你对linux基本操作了解的话,下面的一些os方法应该会很熟悉的,因为基本和linux下的操作方法相同。下面举几个常用的:1. 获得当前路
2014-08-28 21:03:10
628
转载 inux控制台(console)字体的设置(字符界面字体设置)
以debian为例,介绍两种设置方法。1.通过console-tools设置控制台字体1.1.选用并测试合适的字体和字库文件:dell:~# ls /usr/share/consolefonts/1.2.测试选用喜爱的字库文件:dell:~# consolechars -f /usr/share/consolefonts/lat9w-16.psf.gzdell:~# con
2014-08-28 17:08:46
8293
转载 反转链表
#include#includetypedef struct LNode{ int num; struct LNode * next;}LNode,*LinkList;LinkList linkreverse(LinkList );LinkList reverse(LinkList);int main(){ LinkList a,b,c,d,head; head=(Link
2014-08-28 16:28:31
441
转载 用小白鼠鉴别有毒药水问题
http://www.cnblogs.com/mingmingruyuedlut/archive/2011/10/14/2211237.html题设:有N瓶水,其中有一瓶水有剧毒,如果小白鼠喝了会在24小时的时候死亡。问:用多少只小白鼠能够检测出哪瓶水有剧毒?要求:用的小白鼠数量少并且用时要短,并给出合理的过程与结论。我的解题思路如下:这是一个二进制开关(0/1)问
2014-08-27 20:17:34
785
转载 一道阿里巴巴笔试题
http://blog.csdn.net/hehainan_86/article/details/11826905今天看了阿里的一道笔试题:如下函数,在32bit系统foo(2^31-3)的值是:Int foo(int x){Return x&-x;}A: 0 B: 1 C:2 D:4也没想那么多,觉得需要借助计算机编程才能得到答案!事实上呢,看看下
2014-08-26 21:07:58
873
原创 快速排序
#includeint QuickSort(int*,int,int);int partition(int*,int,int);int main(){ int i; int a[]={10,8,4,3,9,6,2,7,1,5}; int length=10; QuickSort(a,0,length-1); for(i=0;i<length;i++){ printf("%
2014-08-26 17:49:03
419
原创 插入排序
#includeint * InsertSort(int *,int len);int main(){ int i; int a[]={10,8,4,3,9,6,2,7,1,5}; int *p; p=InsertSort(a,10); for(i=0;i<10;i++){ printf("%d ",*(p+i)); } return 0;}int * Insert
2014-08-26 16:12:04
373
原创 字符串的一些基本操作
#include#includechar *revstr(char *str,size_t);int strlength(const char *);int strcmpcompare(const char *,const char *);char* strconcat(const char *,const char *);int main(){// char string[]="P
2014-08-26 14:32:17
504
转载 Hadoop集群配置
在完成hadoop伪分布式配置后,就可以开始进行进行hadoop的集群配置。下面的环境都是基于伪分布式单节点配置成功的基础上进行的,即已经安装配置了SSH,安装完JDK,伪分布式单节点wordcount测试成功。SSH无密码登录配置环境:3个虚拟机,系统都为Ubuntu11.10ip说明192.168.47.129 master192
2014-08-16 01:53:54
633
转载 Hadoop2.2.0安装配置手册!完全分布式Hadoop集群搭建过程~(心血之作啊~~)
历时一周多,终于搭建好最新版本hadoop2.2集群,期间遇到各种问题,作为菜鸟真心被各种折磨,不过当wordcount给出结果的那一刻,兴奋的不得了~~(文当中若有错误之处或疑问欢迎指正,互相学习)PS:转载请注明来源:http://blog.csdn.net/licongcong_0224/article/details/12972889另外:欢迎配置过程中遇到问题的朋友留言,相互讨论
2014-08-16 01:52:16
492
转载 Linux中cp和scp命令的使用方法
Linux为我们提供了两个用于文件copy的命令,一个是cp,一个是scp,但是他们略有不同。 cp --- 主要是用于在同一台电脑上,在不同的目录之间来回copy文件 scp --- 主要是在不同的Linux系统之间来回copy文件 关于cp的具体用法: 命令基本格式: cp [OPTIONS] SOURCE DEST --- 从源路径copy文件到目的路径
2014-08-16 00:37:04
494
转载 ubuntu防火墙设置
转自 墙规则, 功能非常强大。但是由此产生的副作用便是配置过于复杂。一向以简单易用著称Ubuntu在它的发行版中,附带了一个相对iptables简单很多的防火墙配置工具:ufw。 ufw默认是没有启用的。也就是说, ubuntu中的端口默认都是开放的。使用如下命令启动ufw: $sudo ufw default deny $sudo ufw
2014-08-16 00:35:25
475
原创 hadoop2.5.0下eclipse的配置 (ubuntu14.04)
我前面转载了一篇hadoop下eclipse的配置,但是在实际应用中仍然有点缺陷,可能是因为操作系统不符吧。
2014-08-14 23:30:02
2843
转载 配置Hadoop开发环境(Eclipse)
原文地址http://blog.csdn.net/zythy/article/details/17397153通常我们可以用Eclipse作为Hadoop程序的开发平台。1) 下载Eclipse下载地址:http://www.eclipse.org/downloads/根据操作系统类型,选择合适的版本下载并安装。2) 下载并编译Hadoop的Eclipse插件网
2014-08-14 04:58:04
533
转载 ubuntu 防火墙
ubuntu 9.10默认的是UFW防火墙,已经支持界面操作了。在命令行运行ufw命令就可以看到提示的一系列可进行的操作。最简单的一个操作:sudo ufw status可检查防火墙的状态,我的返回的是:不活动 sudo ufw version防火墙版本: ufw 0.29-4ubuntu1 Copyright 2008-2009 Canonical Ltd. ubuntu 系
2014-08-14 02:23:15
456
转载 hadoop2.2.0集群测试搭建(伪分布式集群测试)
hadoop2.0已经发布了稳定版本了,增加了很多特性,比如HDFS HA、YARN等。注意:apache提供的hadoop-2.2.0的安装包是在32位操作系统编译的,因为hadoop依赖一些C++的本地库,所以如果在64位的操作上安装hadoop-2.2.0就需要重新在64操作系统上重新编译(建议第一次安装用32位的系统,我将编译好的64位的也上传到群共享里了,如果有兴趣的
2014-08-14 01:38:43
531
转载 Ubuntu下 ssh : connect to host localhost port 22:Connection refused
http://asyty.iteye.com/blog/1440141Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhost port 22:Connection refused 造成这个错误的原因可能是ssh-server未安装或者未启动。ubuntu 11.10 默认安装openssh-clie
2014-08-13 22:15:23
573
转载 httpClient的一些学习心得
http://wallimn.iteye.com/blog/540566最近忙于一个项目,了解下httpclient,在这里总结出来,和大家一起学习分享,希望各位朋友提出宝贵的意见。首先介绍一下项目的背景: 目标:把国内一家保险公司的“WEB一账通”改成“WAP一账通”。 资源:客户不提供任何的webservice接口。 本项目中用到的第三方组件是apache
2014-08-12 20:38:08
459
原创 JAVA Iterator
package test;import java.util.*;import java.io.*;import java.math.*;import java.lang.Double;public class test { public static void main(String[] args) { LinkedHashSet link=new LinkedHashSe
2014-08-07 02:24:28
573
原创 算法9.17
#include#include#define SUCCESS 1#define UNSUCCESS 0#define DUPLICATE -1#define ElemType int#define Status int#define KeyType int#define NULLKEY 0 //a=NULLKEY means that a isn't
2014-08-01 10:34:18
560
原创 算法9.13
#include#include#include#define OK 1#define Status int#define KeyType int#define Record int#define FALSE 0#define TRUE 1#define m 3 //the order of the B treetypedef struct BTNode
2014-07-31 12:02:45
463
原创 算法9.5,9.6
#include#include#define Status int#define OVERFLOW 0#define OK 1#define ERROE 0typedef struct BiTNode{ int data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;Status Search
2014-07-30 10:53:57
611
原创 算法6.6和6.7---有错误,未改正
#include#include#include#define OK 1#define OVERFLOW 0#define Status inttypedef enum PointerTag {Link,Thread}PointerTag;typedef struct BiThrNode{ char data; struct BiThrNode *l
2014-07-28 21:34:17
532
原创 严蔚敏 数据结构 算法6.5
#include#include#includetypedef enum PointerTag {Link,Thread}PointerTag;typedef struct BiThrNode{ char data; struct BiThrNode *lchild,*rchild; PointerTag LTag,RTag;}BiThrNode,*BiThr
2014-07-28 18:24:10
884
原创 算法6.4
#include#include#define OVERFLOW 0typedef struct BiTNode{ char name; struct BiTNode *lchild, *rchild;}BiTNode,*BiTree;int CreateBiTree(BiTree);int main(voi
2014-07-28 16:38:23
439
原创 算法6.3
#include#include#include//in order to include the malloc function#include //in order to include the exit function#define OVERFLOW 1#define STACK_INIT_SIZE 100#define STACKINCREMENT 10//-
2014-07-28 16:18:24
498
原创 数据结构6.2
#include#include#include//in order to include the malloc function#include //in order to include the exit function#define OVERFLOW 1#define STACK_INIT_SIZE 100#define STACKINCREMENT 10//-
2014-07-28 15:57:42
432
原创 2.3.3算法2.18 2.19
#includetypedef struct DuLNode{ int data; struct DuLNode *prior; struct DuLNode *next;}DuLNode,*DuLinkList;// it return a pointer of the ith element in the double linked listDuLin
2014-07-27 22:35:00
715
原创 HIVE Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/ql/CommandNee
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/ql/CommandNeedRetryExceptionat java.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:270)
2014-07-17 10:58:09
4388
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人