- 博客(55)
- 资源 (5)
- 收藏
- 关注
原创 java listener实现定时任务
使用java ServletContextListener 实现各种简单定时任务。1. 创建ServletContextListener,在3.0版本的web.xml中不再需要添加listener的声明。package com.test.listener;import java.text.ParseException;import java.text.SimpleDateFormat
2016-08-01 21:30:42
2997
原创 myeclipse不能使用默认编辑器打开导入的struts项目的struts-config.xml,Therefore the MyEclipse Struts Editor may not be u
将eclipse中的struts1项目的导入到myeclipse2014后发现struts-config.xml不能用默认的编辑器打开,报错如下:Project Struts1Test is not configured as a MyEclipse Web-Struts Project. Therefore the MyEclipse Struts Editor may not be used with struts-config.xml. The default XML Editor has been
2016-02-19 23:40:38
1972
原创 java判断是否为金额
//金额验证 public static boolean isNumber(String str) { java.util.regex.Pattern pattern=java.util.regex.Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"); // 判断小数点后2位的数字的正则表
2014-08-16 19:48:06
18822
原创 JS判断输入的是金额或者数字
My First Web Pagefunction clearNoNum(obj){ obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符 obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字而不是 obj.value = obj.value.replac
2014-08-16 19:46:59
4390
1
原创 java时间转换
String inputStr = "Dec 12, 2013 1:54:03 AM PST"; SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy K:m:s a",Locale.ENGLISH); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:s
2013-12-13 10:15:17
626
原创 简单存储过程:从表B中查询出数据插入A中
--从表B中每周一到周五查询出数据放到表A中。--创建testa,testb并在B中填充数据create table testa(id number(10),name varchar2(10),age varchar2(10), ext1 varchar2(10));create table testb(id number(10),name varchar2(10),age varchar2
2013-11-01 09:54:17
5808
原创 java 中文和unicode字符串互相转换(文件需要保存为gbk2312或者asci格式)
public class ConvertString{ public static void main(String args[]){ String aa = "\u8fd9\u662f\u4e00\u4e2a\u4e2d\u6587\u5b57\u7b26\u4e32"; String bb = ""; String cc = "这是一个中文字符串"; String dd =
2013-09-26 15:45:50
4335
原创 java unicode编码转汉字
import java.io.*;public class unicodeTest{ private static String loadConvert (char[] in, int off, int len, char[] convtBuf) { if (convtBuf.length < len) { int newLen = len * 2
2013-09-26 15:34:59
5204
转载 jQuery选择器总结
jQuery选择器总结 ?1234567891011121314151617181920212223242526272829
2013-09-15 22:39:06
443
原创 SQL 查询时去掉多个count(*)都为0的行
问题:对于同一个查询中存在多个count(*),想要将每个count(*)都为0的行去掉。select a.name ,(select count(*) from b where b.id = a.bid) countB, (select count(*) from c where c.id = a.cid) countC, (select count(*)
2013-08-27 14:37:41
5473
转载 利用正则表达式检查素数
本帖最后由 遇见sharon 于 2013-8-12 17:09 编辑一般来说,我们会使用正规表达式来做字符串匹配,今天在网上浏览的时候,看到了有人用正则表达式来检查一个数字是否为素数(质数),让我非常感兴趣,这个正则表达式如入所示: 检查素数与否的正则表达式要使用这个正规则表达式,你需要把自然数转成多个1的字符串,如:2 要写成 “11”, 3 要写成 “
2013-08-13 09:04:28
989
转载 使用 PHP 5.5 创建和验证哈希最简单的方法
转自:开源中国 http://www.oschina.net/translate/creating-and-verifying-hashes-in-php-the-easy-way 原文: http://www.jcurcio.com/posts/creating-and-verifying-hashes-in-php-the-easy-way/PHP 5.5.0 于昨天发布,并
2013-06-27 09:38:00
707
原创 PHP 输出头像到网页,按照输入的参数自动缩放图片
(转自本人百度空间)很多网站的头像或者图片可以按照输入的参数进行调整。例如新浪微博,头像有180*180和50*50两种,在URL中修改相应的参数就可以获得不同大小的头像。我的实现方式有两种。第一种是直接保存两种头像,然后根据输入的参数取得相应的头像即可。这种比较简单但是需要额外的存储开销,并且如果前端需要的头像大小比较多,还需要保存更多的图片。第二种是只保存标准头像,
2013-04-26 16:13:29
1104
原创 php 设置用户自动登录
(转自本人的百度空间)网站经常要有自动登录功能,搜索大家的代码可以发现基本上都是用cookie做的。我也仿照编码设置了userid和password,但是重新访问时,总是索取不到所设置的cookie。但是用浏览器的cookie查看器可以看到cookie中是用userid的。经过研究发现,setcookie方法的可选函数中包括了路径信息,如果不写的话默认是当前文件的路径。比如用户
2013-04-26 15:56:53
1294
原创 java实现金额数字转换为中文大写
import java.io.*;import java.lang.IllegalArgumentException;public class ConvertNum{ /** * 把金额阿拉伯数字转换为汉字表示,小数点后四舍五入保留两位 * 还有一种方法可以在转换的过程中不考虑连续0的情况,然后对最终的结果进行一次遍历合并连续的零 */ public static
2012-12-10 10:00:27
6072
原创 算法入门-快速排序-基本快速排序方法
#include #include using namespace std;int a[10]={49,38, 65, 97, 76, 13, 27 };void exchange(int p,int q){ int temp; temp = a[p]; a[p] = a[q]; a[q] = temp;}void quicksort(int
2012-09-17 14:15:00
507
原创 最长递增子序列编程之美232算法
#include #include int a[100];//存储原始序列int LIS[100];//存储以a[i]为最大元素的最长递增子序列的长度int MaxV[100];//存储长度为i的递增子序列最大元素的最小值int N;//存储原始序列的长度 int Min(int b[]){ int i; int temp=b[0]; for(i=0;i<N;i
2012-06-06 11:21:21
683
原创 KMP字符串匹配算法
#include #include #include #include int next[11];void getNext(char *p){ memset(next,0,sizeof(next)); int i=-1,j=0; next[0]=-1; int len=strlen(p); while(j<len) {
2012-05-30 09:19:03
488
原创 最长公共子序列(动态规划求解)
输入:abcfbc abfcab programming contest abcd mnp输出 4 2 0#include #include #include #define MAX_LEN 1000char sz1[MAX_LEN];char sz2[MAX_LEN];in
2012-05-24 15:21:10
581
原创 最长上升子序列
一个数的序列bi,当b1题目为求出最长上升子序列的长度。#include #include #include #define MAXLEN 1000int b[MAXLEN+10];int aMax[MAXLEN+10];int main(int argc, char *argv[]){ int N; int i,j; int temp; scanf("
2012-05-24 15:07:53
727
原创 汉诺塔的递归实现
#include #include using namespace std;int counts=0;//DEVC++中count不能被定义为全局变量 void hanoi(char fromTower,char toTower,char auxTower,int n);int main(int argc, char *argv[]){ int numDisks;
2012-05-14 10:20:46
2542
原创 二叉树的所有基本操作
#include #include #include #define STACK_INT_SIZE 100 //存储空间初始分配量#define STACKINCREMENT 10 //存储空间分配增量#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define OVERFLOW -2
2012-04-16 21:00:08
1835
原创 (1461)转换字符串为字符+字符连续出现的次数
#include #include #include using namespace std;int main(int argc, char *argv[]){ cout<<"input the numbers"<<endl; string str; getline(cin,str); char res[50]; res[0]='\0'; i
2012-03-20 17:54:12
542
原创 (1451)求一个字符串中连续出现次数最多的子串
#include #include #include #include using namespace std;pair fun(const string& str){ vector substrs;//存放所有子串 int maxcount=1,count=1; string substr; int i,len=str.length(
2012-03-20 17:26:51
1017
原创 (1452)找出字符串中出现的相同的且长度最长的字符串,输出它及其首字母的位置
#include #include #include using namespace std;/*yyabcdabjcabceg输出:abc 3*/int main(int argc, char *argv[]){ string str,tep; cout<<"请输入字符串"<<endl; cin>>str; for(int i=str.length(
2012-03-20 17:25:24
1641
原创 (1453)重写strstr()函数,返回为主串中字符子串的位置以后的所有字符
#include #include /*重写strstr()函数,返回为主串中字符子串的位置以后的所有字符*/using namespace std;const char* strstr1(const char* string,const char * strCharSet){ for(int i=0;string[i]!='\0';i++) {
2012-03-20 17:23:36
1625
原创 (1454)将一句话中的单词倒置,标点符号不倒置。
#include #include #include /*句子中单词倒置,标点不倒置*/using namespace std;void reverse(char *str){ cout<<str<<endl; char *a=str; char temp; int i=0,j=0; int begin=0,end=0; //
2012-03-20 17:22:30
2427
原创 (1423)编写函数实现字符串循环右移n位
#include #include #include #define MAXLEN 20/*编写循环函数,使一个字符串循环右移n个字符*/using namespace std;void LoopMove1(char *str,int n){ char *p=str; char temp[MAXLEN]; int len=strlen(str);
2012-03-15 22:01:39
2924
原创 (1411)实现字符串与整数的相互转换(不使用itoa和atoi)
#include #include #include using namespace std;char *inttostring(int num,char *str)//整数转成字符串 { int i=0; char temp[10]; while(num!=0) { str[i]=num%10+'0';
2012-03-15 16:41:45
804
原创 c++ 两个栈实现队列
#include #include #include /*两个栈实现队列*/using namespace std;templatestruct MyQueue{ void push(T &t) { s1.push(t); } T front() { if(s
2012-03-14 09:31:22
933
原创 循环链表实现约瑟夫环
#include #include #include #define ERROR 0using namespace std;typedef struct LNode{ int data; struct LNode *link;}LNode,*LinkList;void Josephus(int n,int k,int m){ //n
2012-03-13 22:23:31
872
原创 c++ 实现双链表基本操作
#include #include #include #include /*c++实现双链表的基本操作*/using namespace std;typedef struct student{ int data; struct student *pre; struct student *next;}dnode;//创立链表 dn
2012-03-13 21:02:57
5203
原创 c++ 单链表基本操作
#include #include #include #include #include /*c++实现简单的单链表操作*/using namespace std;typedef struct student{ int data; struct student *next;}node;//建立单链表 node *creat(){ n
2012-03-13 21:01:44
29556
原创 数据结构--非递归遍历二叉树(利用辅助栈)
#include "StdAfx.h" #include #include /*非递归方法前序遍历二叉树,利用辅助栈(指针数组实现)。由于对指针不是很熟悉,代码较为混乱,基本上实现遍历的功能。主要练习对结构体指针与链表的使用。*/ typedef struct tree{ int key; struct tree *left;
2011-12-06 14:27:57
1324
1
原创 数据结构--二叉树(链表)基本操作
#include "StdAfx.h" #include #include typedef struct tree{ int key; struct tree *left; struct tree *right; }*BiTree,Node; //循环创建二叉树 void CreateBiTree(Bi
2011-12-05 14:10:59
1021
原创 数据结构--单链表实现队列1
#include #include /*单链表实现队列,目前的实现比较麻烦,额外使用了两个节点,但是尾节点基本没用,数据入队时间为O(n),出队为O(1),需要进一步修改,破坏了队列的常规判断空与满的方式*/ int length;//记录队列当前空余位置数 typedef struct node //队列节点 { int key; struct
2011-12-02 20:18:57
2579
原创 数据结构--单链表实现栈(头部插入数据的链表)
#include #include /*链表实现栈,只需要实现insert,delete方法*/int length;//栈的元素数量 typedef struct ss{//链表节点 int key; struct ss *next;}Node;void insert(Node *head,int num)//链表头部插入数据 { if(
2011-12-02 10:47:50
1557
原创 数据结构之双向链表,头部插入数据
#include #include /*双向链表,在表头插入数据*/typedef struct node{ int key; struct node *Next; struct node *Pre;}Node;void Insert(int num,Node *head)//插入新的节点 { Node *p = NULL; p = (Node *) malloc (s
2011-11-30 17:17:08
4360
原创 数据结构之简单链表(头部插入数据,查找,删除指定数据)
#include #include /*链表,在表头插入数据,使用了一个头结点head专门记录表头位置*/typedef struct node{ int key; struct node *Next;}Node;void Insert(int num,Node *head)//插入新的节点 { Node *p = NULL; p = (Node *) malloc (s
2011-11-30 16:31:47
2199
原创 数据结构之简单链表(尾部插入数据)
#include #include typedef struct node{ int key; struct node *Next;}Node;void Insert(int num,Node *head){ Node *L = NULL; Node *p = NULL; L = head; while (L->Next != NULL) { L = L->Nex
2011-11-30 15:59:16
10271
2016-2018年软件设计师真题及答案解析.zip
2020-03-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人