ilovegreenrose的博客
ilovegreenrose · 共 23 篇文章
字符串处理相关的工具类
import java.util.ArrayList; import java.util.List; /** 字符串相关的工具类 @author Fsx / public class StringUtil { / * * 判断一个字符串是否为空或等于空字符串 * * @param s * 字符串 * @return 是否为空或空字符串 */ public static final boolean isEmpty(String s) { return s == null || s.trim().length() == 0; } /** * 判断一个字符串是否不为空且不等于空字符串 * * @p…
2014-11-06 16:42 · java · 评论(0)
java 进制转换 实例
import com.biiway.gmrc.protocol.util.StringUtil; import com.biiway.gmrc.protocol.util.ToStringUtil; /** 二进制字符串和字节数组的转换工具类 / public class BinaryTransformer { / * 二进制字符串转换为字节数组 / public static byte string2ByteArray(String inputString) { if (StringUtil.isEmpty(inputString)) { return new byte; } inputS…
2014-11-06 16:38 · java · 评论(0)
netty4.0学习笔记
1.初步使用netty框架创建服务端 import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.cha…
2014-11-05 15:02 · netty4.0服务端学习笔记 · 评论(0)
转java设计原则
类的设计原则 依赖倒置原则-Dependency Inversion Principle (DIP) 里氏替换原则-Liskov Substitution Principle (LSP) 接口分隔原则-Interface Segregation Principle (ISP) 单一职责原则-Single Responsibility Principle (SRP) 开闭原则-The Open-Closed Principle (OCP) 一. Dependency Inversion Principle (DIP) - 依赖倒置原则 依赖:在程序设计中,如果一个模块a使用或调用了另一个模块b…
2014-03-25 11:21 · java · 评论(0)
主流数据库的分页查询
在 这里主要讲解一下MySQL、SQLServer2000(及SQLServer2005)和ORCALE三种数据库实现分页查询的方法。可能会有人说这 些网上都有,但我的主要目的是把这些知识通过我实际的应用总结归纳一下,以方便大家查询使用。 下面就分别给大家介绍、讲解一下三种数据库实现分页查询的方法。 一、 MySQL 数据库 分页查询 MySQL数据库实现分页比较简单,提供了 LIMIT函数。一般只需要直接写到sql语句后面就行了。 LIMIT子 句可以用来限制由SELECT语句返回过来的数据数量,它有一个或两个参数,如果给出两个参数, 第一个参数指定返回的第一行在所有数据中的位置,从0开始…
2013-12-13 11:30 · 数据库sql · 评论(0)
spring定时器配置
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 添加触发器 --> <property name="triggers"> <list> <ref local="benchmarkServiceTrigger"/> </list> </property> </bean>
2013-10-23 11:03 · 定时器配置 · 评论(0)
oracle
一.查询日期信息 select to_char(sysdate,'yyyy') from dual --得到当前年日期 select to_char(extract(month from sysdate))from dual --得到当前日期的月份去掉前边的0 select to_char(extract(month from (add_months(trunc(sysdate),-1)))) from dual --得到当前月份的上个月份并且去掉0
oracle关于树形节点处理
create table automobiles( part_id number(5) constraint pk_auto_part_id primary key, parent_id number(5) constraint fk_auto_ppid_ references automobiles(part_id), part_cname varchar2(30) not null, part_ename varchar2(30) not null, mp_cost number(9,2), desribe varchar2(20) ); --插入数据 insert into autom…
oracle树形查询
create table test (ID NUMBER(18) not null, name vaechar2(50), parent_id NUMBER(18) ); --查询当前节点下的所有子节点 select * from test t start with t.id='当前节点ID' connect by prior t.id=t.parent_id; --查询当前节点的父节点或者父节点以上的节点 select * from test t start with t.id='当前节点ID' connect by t.id= prior t.parent_id;
oracle函数使用
select l.made_dept_id,replace(substr(l.made_dept_path,INSTR(l.made_dept_path,'/',1,1)+1,length(l.made_dept_path)),'/') mdeptName from lm_storage_standard l group by l.made_dept_id,l.made_dept_path 使用情况replace(x,y,z)返回值为将串X中的Y串用Z串替换后的结果字符串。若省略Z参数,则将串X中为Y串的地方删除 substr截取其中某个字符 INSTR计算具体某个字符的位置
2013-07-29 11:36 · 数据库关键函数 · 评论(0)
oracle对查询clob字段内容与转义&符号处理方式
select * from table t where not REGEXP_LIKE( t.opinion, chr(38)||'nbsp;' ); REGEXP_LIKE(a,b);正则表达式的函数 a代表你需要查询的数据。b匹配的表达式 特殊字符&符号转义用chr(38)
2013-06-19 18:12 · 数据库sql · 评论(0)
java发送邮件
今天学习了一下JavaMail,javamail发送邮件确实是一个比较麻烦的问题。为了以后使用方便,自己写了段代码,打成jar包,以方便以后使用。呵呵 以下三段代码是我的全部代码,朋友们如果想用,直接复制即可。jar包因为我不知道怎么传到javaeye上,所以朋友们回去自己打吧。 我的代码有三个类: 第一个类:MailSenderInfo.java Java代码 package com.util.mail; /** 发送邮件需要使用的基本信息 / import java.util.Properties; public class MailSenderInfo { // 发送邮件的服务器的IP…
2013-01-10 12:03 · java发送邮件 · 评论(0)
word转pdf
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.HashSet; import java.util.Set; import org.apache.log4j.Logger; import com.artofsolving.jodconverter.DocumentConverter; import com.…
2013-01-08 10:00 · java · 评论(0)
excel文档处理
package com.standard.monthreport.executeSupervise.bizc; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Calendar; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.po…
2012-10-11 10:33 · excel · 评论(0)
hibernate分页
本文介绍一种分页组件的完整代码,最后封装了一个简单的jsp自定义标签 分页效果如下: 没有加页面效果,只是意思一下。这个分页的功能比较简单,不过更复杂的分页功能,原理也是差不多的 首先是Page对象 Java代码 1.public class Page { 2. 3. private static final int DEFAULT_PAGE_SIZE = 10; 4. 5. private static final int DEFAULT_CURRENT_PAGE = 1; 6. 7. private int currentPage;// 当前页数,通常在Action层设置 8. 9. p…
2012-08-31 10:49 · hibernate分页 · 评论(0)