现在位置: 首页 > stretcher发表的所有文章
  • 08月
  • 09日
操作系统 ⁄ 共 3927字 评论关闭
为当前用户创建cron服务 1.  键入 crontab  -e 编辑crontab服务文件       例如 文件内容如下:      */2 * * * * /bin/sh /home/admin/jiaoben/buy/deleteFile.sh       保存文件并并退出      */2 * * * * /bin/sh /home/admin/jiaoben/buy/deleteFile.sh     */2 * * * * 通过这段字段可以设定什么时候执行脚本       /bin/sh /home/admin/jiaoben/buy/deleteFile.sh 这一字段可以设定你要执行的脚本,这里要注意一下bin/sh 是指运行  脚本的命令  后面一段时指脚本存放的路径   2. 查看该用户下的crontab服务是否创建成功, 用......
阅读全文
  • 03月
  • 04日
综合 ⁄ 共 463字 评论关闭
创建字符串的方式很多,归纳起来有三类: 其一,使用new关键字创建字符串,比如String s1 = new String("abc"); 其二,直接指定。比如String s2 = "abc"; 其三,使用串联生成新的字符串。比如String s3 = "ab" + "c"; String对象的创建 String对象的创建也很讲究,关键是要明白其原理。 原理1:当使用任何方式来创建一个字符串对象s时,Java运行时(运行中JVM)会拿着这个X在String池中找是否存在内容相同的字符串对象,如果不存在,则在池中创建一个字符串s,否则,不在池中添加。 原理2:Java中,只要使用new关键字来创建对......
阅读全文
  • 11月
  • 08日
综合 ⁄ 共 842字 评论关闭
求递归算法时间复杂度:递归树   递归算法时间复杂度的计算方程式一个递归方程:   在引入递归树之前可以考虑一个例子: T(n) = 2T(n/2) + n2   迭代2次可以得: T(n) = n2 + 2(2T(n/4) + (n/2) 2)   还可以继续迭代,将其完全展开可得: T(n) = n2 + 2((n/2) 2 + 2((n/22)2 + 2((n/23) 2 + 2((n/24) 2 +…+2((n/2i) 2 + 2T(n/2i + 1)))…))))……(1)   而当n/2i+1 == 1时,迭代结束。   将(1)式小括号展开,可得: T(n) = n2 + 2(n/2)2 + 22(n/22) 2 + … + 2i(n/2i)2 + 2i+1T(n/2i+1)   这恰好是一个树形结构,由......
阅读全文
  • 07月
  • 11日
综合 ⁄ 共 190字 评论关闭
用宏定义成员函数,VC6的类视图显示错误,实际函数可以使用。 VC7没此问题。 #define ConstGetMemFunMac2(varName,funName,retType)\  retType funName()const{return varName;}; class A { public:     ConstGetMemFunMac2(m_x,GetX,int);     int m_x; };
阅读全文
  • 07月
  • 01日
综合 ⁄ 共 823字 评论关闭
今天在做SSH框架Demo实例时,在ApplicationResources.properties文件时对<ref bean>与<ref local>感到不解,经查找资料才弄明白,如下: < bean id = "userDAOProxy"         class = "org.springframework.transaction.interceptor.TransactionProxyFactoryBean" >         < property name = "transactionManager" >             < ref bean = "transactionManager" />         </ property >         < property name = "target" >             < ref local = "UserDAO" /> ......
阅读全文
  • 05月
  • 14日
综合 ⁄ 共 1540字 评论关闭
问: (1)一次插入多条数据时: CREATE TABLE tb(ID int, 名称 NVARCHAR(30), 备注 NVARCHAR(1000)) INSERT tb   SELECT 1,'DDD',1 UNION ALL        SELECT 1,'5100','D' UNION ALL        SELECT 1,'5200','E'   也可以这样: CREATE TABLE tb1(ID int, 名称 NVARCHAR(30), 备注 NVARCHAR(1000)) INSERT TB1 (ID,名称,备注)VALUES(1,'DDD',1) INSERT TB1 (ID,名称,备注)VALUES(1,'5100','D') INSERT TB1 (ID,名称,备注)VALUES(1,'5200','E') _________________________________ 上面两种方法,哪种方法效率高? 答: 第1种好一些, 但......
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 304字 评论关闭
package Servlets; import java.text.DecimalFormat; public class Untitled1 {    public Untitled1() {    }    public static void main(String[] args) {        double   value   =   22.363834;  DecimalFormat   df   =   new   DecimalFormat("0.000");  //四舍五入  value   =   Double.parseDouble(df.format(value));  System.out.println(value);    }}  
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 750字 评论关闭
一、基本语法 1.US概念:C++和Java的杂交语言,以C的风格来创建它(EPIC的人都是人才啊,这都能想出来) 2.具有标识符和关键字,标识符和C、C++风格一样,重点:所有修饰符大小写不敏感(C++用习惯了,改不了了) 3.具有表达式和操作符 4.注释风格和C++一样 // A line comment /* A block comment */ (=。=官方人员还真的是简略,几句话就介绍完基本语法,上边是我的精简版,学过C++的基本一下都懂) 二、实例 1.环境配置 注意:Start with specified game 中选项一定记得要把自己创建的文件名添加到前面 2.代码 说明:创建实......
阅读全文
  • 04月
  • 22日
综合 ⁄ 共 2080字 评论关闭
//这里创建一个圆角矩形的按钮UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 能够定义的button类型有以下6种, // typedef enum { // UIButtonTypeCustom = 0, 自定义风格 // UIButtonTypeRoundedRect, 圆角矩形 // UIButtonTypeDetailDisclosure, 蓝色小箭头按钮,主要做详细说明用 // UIButtonTypeInfoLight, 亮色感叹号 // UIButtonTypeInfoDark, 暗色感叹号 // UIButtonTypeContactAdd, 十字加号按钮 // } UIButtonType; //给定button在view上的位置button1.frame = CGRectMake(20, 20, 280, 40)......
阅读全文
  • 04月
  • 07日
综合 ⁄ 共 887字 评论关闭
ClientDataSet 的动态排序可以通过以下代码实现1.单一字段的升序和降序 with cds dobegin  IndexDefs.Update;  if IndexDefs.IndexOf('index1') >= 0 then  DeleteIndex('index1');  AddIndex('index1', SortFieldName, [], '');  IndexName := 'index1';  First;end; with cds dobegin  IndexDefs.Update;  if IndexDefs.IndexOf('index1') >= 0 then  DeleteIndex('index1');  AddIndex('index1', SortFieldName, [], SortFieldName);  IndexName := 'index1';  First;end; 2.复合字段的升序和降序 with cds dobegin  I......
阅读全文
  • 03月
  • 31日
综合 ⁄ 共 3489字 评论关闭
    准备一张名为picture的图片。       布局文件main.xml不用编写             在MyMultitouchDemo.java中:   package com.li.multitouch;   import android.app.Activity; 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.os.Bundle; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; impo......
阅读全文
  • 02月
  • 20日
综合 ⁄ 共 4084字 评论关闭
1、删除output路径所在的文件 HadoopUtil.delete(conf, output); 2、获取HDFS上某一路径下的所有文件 2.1 方法1 FileSystem hdfs = null;try {//hdfs = FileSystem.get(URI.create("hdfs://localhost:9000/"),conf);hdfs = FileSystem.get(conf);} catch (Exception e) {// TODO Auto-generated catch blocklog.info("Create HDFS File System failed.");e.printStackTrace();}//Path path = hdfs.getHomeDirectory();FileStatus[] srcFileStatus = null;try {srcFileStatus = hdfs.listStatus(new Path(clusteredPointsPath));} c......
阅读全文