- 浏览: 286967 次
- 性别:
- 来自: 上海
-
最新评论
-
zhengalways:
samwalt 写道zhengalways 写道samwalt ...
“程序包com.sun.image.codec.jpeg不存在”问题解决 -
samwalt:
zhengalways 写道samwalt 写道zhengal ...
“程序包com.sun.image.codec.jpeg不存在”问题解决 -
zhengalways:
samwalt 写道zhengalways 写道博主你好,刚用 ...
“程序包com.sun.image.codec.jpeg不存在”问题解决 -
samwalt:
zhengalways 写道博主你好,刚用idea,切换成jr ...
“程序包com.sun.image.codec.jpeg不存在”问题解决 -
zhengalways:
博主你好,刚用idea,切换成jre也不行啊,崩溃
“程序包com.sun.image.codec.jpeg不存在”问题解决
文章列表
删除目录中的隐藏文件夹
- 博客分类:
- ruby
#encoding: utf-8
#清除隐藏文件夹
require 'monitor'
puts ARGV[0] + '不是目录' if not File.directory?(ARGV[0])
q = Queue.new
q << ARGV[0]
while q.size > 0
it = q.pop
puts it
file_and_dir = Dir.entries(it)
Dir.chdir(it)
file_and_dir.each do |item|
next if item.eql?('.') or item. ...
Hibernate错误解决
- 博客分类:
- java
抛异常:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
原因:
有一个对象A,关联了对象B ,关联关系可以是 ManyToOne,OneToOne等,如果在数据库中清除了B对象,但是B对象还在A表中存在外键,Hibernate检查这个关系的时候,会抛出这个异常。但是A与B在数据库范围内不能耦合过紧,只能在pojo中建立关联关系,此时要注意,清除A表中的外键,可以解决此问题,一般的垃圾数据会造成业务系统不能正常运转。
hive本身的配置还是很简单的,关键在于需要一些前提条件。
1)hadoop必须配置成伪分布模式或者集群模式
2)必须启动hadoop
hive的数据仓库路径不是本机文件系统路径,而是hdfs的路径
<property>
<name>hive.metastore.warehouse.d ...
除了
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=“http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
还要配置:
xmlns:aop="http://www.springframework.org/schema/aop"
http:// ...
1、git恢复删除的文件(删除动作未commit)
git checkout 删除的文件名
或者
git checkout .
2、git查看提交涉及到的文件
git log --stat
查看某文件的所有提交
git log --pretty=oneline 文件名
3、创建分支
git branch 分支名
4、查看分支
git branch
5、切换分支
git checkout 分支名
6、develop分支的内容合并到master分支
git checkout master
git merge --no-ff develop
7、develop分支的部分提交 ...
指定java程序运行的所有依赖包
- 博客分类:
- java
假如所有依赖包都放在dependency目录中,
java -Djava.ext.dirs=dependency -jar Test.jar
用maven把依赖的jar包复制到target目录的dependency目录
mvn dependency:copy-dependencies
1、用mvn compile编译代码,出现错误:[ERROR] error: error reading 。。。error in opening zip file
原因及解决办法:由于maven下载了空的或者不完全的jar包在仓库中,删除之后让maven重新下载
2、把依赖的jar包复制到target目录的dependency子目录
mvn dependency:copy-dependencies
见http://tianya23.blog.51cto.com/1081650/289363
3、maven打包自动添加main class
在pom.xml文件中添加如下内容:
< ...
javax.servlet.http
Interface HttpSessionListener
void sessionCreated(HttpSessionEvent se)
Receives notification that a session has been created.
void sessionDestroyed(HttpSessionEvent se)
Receives notification that a session is about to be invalidated.
...
1、获取数据库当前时间
select to_char(sysdate, 'yyyyMMddHH24miss') from table_name
2、数据库时间月份加1
add_months(date_date, 1)
3、日期转字符串
to_char(date_date, 'yyyymm')
4、字符串转日期
to_date(date_string, 'yyyymm')
5、
-- 修改字段名
alter table 表名 rename column 旧的字段名 to 新的字段名;
-- 修改字段类型
ALTER TABLE 表名 modify(字段名 字段类型);
XMLbeans使用教程
- 博客分类:
- java
Hibernate已经成为目前流行的面向Java环境的对象/关系数据库映射工具.在Hibernate等对象/关系数据库映射工具出现之前,对数 据库的操作是通过JDBC来实现的,对数据库的任何操作,开发人员都要自己写SQL语句来实现. 对象/关系数据库映射工具出现后,对数据库的操作转成对 JavaBean的操作,极大方便了数据库开发. 所以如果有一个类似的工具能够实现将对XML的读写转成对JavaBean的操作,将会简化XML的读写,即使对XML不熟悉的开发人员也能方便地读写 XML. 这个工具就是XMLBean.
准备一个XML文档(customers.xml),
在本文的例子里 ...
/sbin/service crond start //启动服务
/sbin/service crond stop //关闭服务
/sbin/service crond restart //重启服务
/sbin/service crond reload //重新载入配置
cron 是linux的内置服务,但不随系统启动。redhat可用此方法让cron随系统启动,
在/etc/rc ...
ruby设置user-agent
- 博客分类:
- ruby
require 'net/http'
require 'uri'
require 'nokogiri'
uri = URI.parse('http://www.baidu.com')
http = Net::HTTP.new(uri.host, uri.port)
visit_url = "http://www.baidu.com/more/"
# 设置user-agent为ie7, windows vista
request = Net::HTTP::Get.new(visit_url, {'User-Agent' => 'Mozilla/4.0 ...
用nokogiri解析网页
- 博客分类:
- ruby
#解析rubyer.me的首页所有文章的标题
require 'nokogiri'
require 'open-uri'
website_url = "http://www.rubyer.me"
STDERR.puts "processing #{website_url}..."
doc = Nokogiri::HTML(open(website_url))
path = "/html/body/div/div/div/article/header/h1/a"
topics = doc.xpath(path)
...
set guifont=Monaco:h10 " 适合Ruby开发的字体 && 字号
set tabstop=4 " 设置tab键的宽度
set shiftwidth=4 " 换行时行间交错使用4个空格
set autoindent " 自动对齐
set backspace=2 " 设置退格键可用
set cindent shiftwidth=4 " 自动缩进4空格
s ...
获取cookie和保存cookie
- 博客分类:
- java
1、获取cookie
根据请求获取cookie数组,然后遍历数组,根据cookie名找到相应的cookie。
// request是HttpServletRequest类型的对象
Cookie[] cookies = request.getCookies();
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie;
}
}
2、保存cookie
Cookie cookie = new Cookie(name, value);
cookie.set ...