摘要: Python中的文件操作Python中文件打操作离不开两个模块 os 和 shutilos:操作文件、目录; Python os模块包含普遍的操作系统功能。如果你希望你的程序能够与平台无关的话,这个模块是尤为重要的。shutil:移动、复制目录或文件;是一种高层次的文件操作工具,类似于高级API,... 阅读全文
posted @ 2015-12-30 22:28 Bodi 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 在Python中数组中的每一项可以是不同的数据类型元组:只能读不能写的数组aTuple=(1,'abc','tmc',79.0,False)print aTuple[1:3]print type(aTuple) # tuple:元组aTuple[1]=5 #在这,如果要对元组进行修改,就会报错:'... 阅读全文
posted @ 2015-12-30 00:09 Bodi 阅读(1199) 评论(0) 推荐(0) 编辑
摘要: 先来看一个例子:class Fish: hungry=True def eat(self,food): if food is not None: self.hungry=False class User: def __in... 阅读全文
posted @ 2015-12-29 22:36 Bodi 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 一、搭建Python开发环境1、选择开发工具首先要寻找一个Python的开发工具,Python的开发工具有很多,有pyCharm 、Eclipse、Visual studio等等 ,使用最多的还是免费版的Eclipse;Eclipse下载地址:http://www.eclipse.org/downl... 阅读全文
posted @ 2015-12-27 22:02 Bodi 阅读(245) 评论(0) 推荐(0) 编辑
摘要: Linux 分层内核库: .so 共享对象,windows:dll 动态链接库应用程序Linux的基本原则:1、由目的单一的小程序组成;组合小程序完成复杂任务;2、一切皆文件;3、尽量避免捕获用户接口;4、配置文件保存为纯文本格式;Linux中的GUI就是CLIGUI: Graphic User ... 阅读全文
posted @ 2015-12-26 22:21 Bodi 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 一、配置Linux网络在安装Linux的时候,一定要保证你的物理网络的IP是手动设置的,要不然会在Linux设置IP连通网络的时候会报network is unreachable 并且怎么也找不到问题在哪!当在VMware中安装完Linux以后需要通过一些网络配置才能使Linux能够连能网络:1.首... 阅读全文
posted @ 2015-12-26 21:06 Bodi 阅读(8709) 评论(2) 推荐(4) 编辑
摘要: JavaEE 的WebService中的Date类型在Web应用中调set方法的时候,默认情况下,JAXB将xsd:date, xsd:time, 和xsd:dateTime映射为XMLGregorianCalendar; 下面是将Date转换成XMLGregorianCalendar的方法: ... 阅读全文
posted @ 2015-12-18 11:51 Bodi 阅读(978) 评论(0) 推荐(0) 编辑
摘要: 激活一个MyEclipse的步骤,大家都会,在这里就不多说了,不会的可以看:http://jingyan.baidu.com/article/3ea51489cc14d452e71bba7a.html关键来了,下面是同时激活两个MyEclipse的步骤:先激活一个MyEclipse2013,激活完成... 阅读全文
posted @ 2015-11-26 09:55 Bodi 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 1、引入SrpingMVC所使用的Java包:cglib-nodep-2.1_3.jar、commons-logging.jar、spring-aspects-4.1.7.RELEASE.jar、spring-beans-4.1.7.RELEASE.jar、spring-context-4.1.7.... 阅读全文
posted @ 2015-11-24 15:52 Bodi 阅读(16055) 评论(0) 推荐(0) 编辑
摘要: 所使用的Jar包:Hibernate:Spring(使用MyEclipse自动导入框架功能)Struts2:注解包和MySql驱动包:1、配置Hibernate和Spring: cn/raffaello/hbm/Person... 阅读全文
posted @ 2015-11-20 15:36 Bodi 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://www.yihaomen.com/article/java/466.htmHibernate4 与 spring3 集成之后, 如果在取得session 的地方使用了getCurrentSession,可能会报一个错:“No Session found for current... 阅读全文
posted @ 2015-11-19 10:44 Bodi 阅读(619) 评论(0) 推荐(0) 编辑
摘要: @Transactional可以设置以下参数:@Transactional(readOnly=false) // 指定事务是否只读的 true/false@Transactional(rollbackFor=Exception.class) //指定在什么异常情况下回滚事务,默认在运行时异常回滚... 阅读全文
posted @ 2015-11-17 17:30 Bodi 阅读(841) 评论(0) 推荐(0) 编辑
摘要: 首先引入Spring包和JDBC所使用到的包:配置beans.xml步骤:1.配置dataSource的属性2.将DataSource交给DataSourceTransactionManager管理3.开启事务开关4.配置JdbcTemplate工具类5.将jdbcTemplate注入到Person... 阅读全文
posted @ 2015-11-17 15:01 Bodi 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 新建一个AOP类:public class MyInterceptor2 { public void doAccessCheck(){ System.out.println("前置通知 "); } public void doAfterReturning(){ System.out.printl... 阅读全文
posted @ 2015-11-16 11:32 Bodi 阅读(390) 评论(0) 推荐(0) 编辑
摘要: 如何配置AOP查看:Spring、Hello AOP1.对于拦截规则@Pointcut的介绍: @Pointcut("execution (* cn.raffaello.service..*.*(..))") private void anyMethod(){} // 声名一个切入点,声名方式比较奇... 阅读全文
posted @ 2015-11-12 16:54 Bodi 阅读(296) 评论(0) 推荐(0) 编辑
摘要: AOP 概念:http://blog.csdn.net/moreevan/article/details/11977115AOP 所使用到的jar 包:aspectjrt.jarcommon-annotations.jaraspectjweaver.jarcglib-nodep.jarcommons... 阅读全文
posted @ 2015-11-12 15:05 Bodi 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Spring2.5为我们引入了组件自动扫描机制,它可以在类路径下寻找标记了@Component、@Service、@Controller、@Repository注解的类,并把这些类纳入到spring容器中管理,它的作用和在xml中使用bean节点配置组件一样。1. 引入context命名空间(在Sp... 阅读全文
posted @ 2015-11-11 16:36 Bodi 阅读(859) 评论(0) 推荐(0) 编辑
摘要: 使用手工注解方式有两种方式@Resource、@Autowired首先,引入注解所使用的Jar包 :common-annotations.jar然后在beans.xml中加入命名空间空间xmlns:context="http://www.springframework.org/schema/cont... 阅读全文
posted @ 2015-11-10 16:59 Bodi 阅读(552) 评论(0) 推荐(0) 编辑
摘要: Spring 还可以对基本属性和集合类型属性进行注入:public interface PersonIService { public String getBaseProperty(); public Set getSets(); public List getList(); public Prop... 阅读全文
posted @ 2015-11-10 11:34 Bodi 阅读(597) 评论(0) 推荐(0) 编辑
摘要: Spring依赖注入新建PersonIDao 和PersonDao底实现Save方法:public interface PersonIDao { public void save();}public class PersonDaoImpl implements PersonIDao{ @Overr... 阅读全文
posted @ 2015-11-09 15:59 Bodi 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 1、默认情况下,在Bean容器被实例化的时候,bean对象将被创建:public class PersonServiceImpl implements PersonIService { public PersonServiceImpl(){ System.out.println("初始化!!!")... 阅读全文
posted @ 2015-11-06 16:25 Bodi 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Singleton作用域(默认) 当一个bean的作用域为singleton,那么Spring Ioc容器中只会存在一个共享的bean实例,并且所有对bean的请求,只要id与该bean定义相匹配,则只会返回bean的同一实例。也就是说,当把一个bean定义设置为singleton作用域时,S... 阅读全文
posted @ 2015-11-06 14:32 Bodi 阅读(429) 评论(0) 推荐(0) 编辑
摘要: 1、使用类构造器进行实例化测试代码:@Test public void test() { ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml"); PersonIService personIService=... 阅读全文
posted @ 2015-11-06 11:32 Bodi 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 引入dom4j jar包1、新建Person接口和PersonBeanpublic interface PersonIService { public void helloSpring();}public class PersonServiceImpl implements PersonIServi... 阅读全文
posted @ 2015-11-05 16:53 Bodi 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 1、引入Spring jar包2、新建一个Person 接口和Person Beanpublic interface PersonIService { public void helloSpring();}import cn.server.PersonIService;public class Pe... 阅读全文
posted @ 2015-11-05 15:12 Bodi 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Spring一个开源的控制反转(Inversion of Control ,Ioc)和面向切面(AOP)的容器框架。主要目的:简化开发控制反转(Inversion of Control ,Ioc)所谓控制反转就是应用本身不负责依赖对象的创建及维护,依赖对象的创建及维护由外部容器来负责。这样控制权就由... 阅读全文
posted @ 2015-11-04 17:36 Bodi 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Hibernate 批量操作数据可以使用两种方法实现1、分批更新,每一小批同步一次数据: public void saveEmployee2(){ Session s=HibernateSessionFactory.getSession(); Transaction tran=s.beg... 阅读全文
posted @ 2015-11-03 14:59 Bodi 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 地址:http://resource.ajava.org/hibernate/hibernate-3.6.7.final-manual-zh-cn/index.html 阅读全文
posted @ 2015-11-03 11:09 Bodi 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 悲观锁(Pessimistic Lock), 顾名思义,就是很悲观,每次去拿数据的时候都认为别人会修改,所以每次在拿数据的时候都会上锁,这样别人想拿这个数据就会block直到它拿到锁。传统的关系型数据库里边就用到了很多这种锁机制,比如行锁,表锁等,读锁,写锁等,都是在做操作之前先上锁。乐观锁(Opt... 阅读全文
posted @ 2015-11-02 17:41 Bodi 阅读(1768) 评论(0) 推荐(0) 编辑
摘要: 1、JQuery MiniUi http://www.miniui.com/ 阅读全文
posted @ 2015-10-30 15:57 Bodi 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 首先需要引入两个Jar包分别是:iTextAsian.jar 、itext-2.1.7.jar 可以去 http://download.csdn.net/detail/work201003/9227159下载;代码:import java.awt.Color;import java.io.Buffe... 阅读全文
posted @ 2015-10-30 15:51 Bodi 阅读(3575) 评论(1) 推荐(0) 编辑
摘要: 一个继承树一张表(subclass)一个继承树一张表是指将一个类和他下面的所有派生类的所有的属性都放在一张表中,举例有Employee这个实体,在他下面分别派生了两个类skill和sell,通过Hibernate 通过subclass将Employee和他的派生类的所有属性都存放在一张表中,使用ty... 阅读全文
posted @ 2015-10-27 17:54 Bodi 阅读(247) 评论(0) 推荐(0) 编辑
摘要: Set类型的使用: Set是最常见的在Hibernate中对集合进行映射的类型,其配置也很简单;List类型的使用: 使用List进行集合映射有一点特殊,List是按顺序进行存入所以Hibernate还需... 阅读全文
posted @ 2015-10-27 14:34 Bodi 阅读(537) 评论(0) 推荐(0) 编辑
摘要: 组件关联映射可以将一些简小的数据与主题放在一个表中,例如firstName 和LastName这两个结合在一起可以组成一个名字,但是再分别将这两个再建一个表就不太合适了,这个时候可以用到组件关联映射;hibernate.cfg.xml: org.hibernate.dialect.M... 阅读全文
posted @ 2015-10-26 17:33 Bodi 阅读(223) 评论(0) 推荐(0) 编辑
摘要: hibernate.cfg.xml: org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/spring?useUnicode=true&charact... 阅读全文
posted @ 2015-10-26 14:56 Bodi 阅读(269) 评论(0) 推荐(0) 编辑
摘要: hibernate.cfg.xml: org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/spring?useUnicode=true&charact... 阅读全文
posted @ 2015-10-23 17:49 Bodi 阅读(425) 评论(0) 推荐(0) 编辑
摘要: Hibernage.cfg.xml: org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/spring?useUnicode=true&charact... 阅读全文
posted @ 2015-10-23 15:35 Bodi 阅读(357) 评论(0) 推荐(0) 编辑
摘要: Hibernate.cfg.xml: org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/spring?useUnicode=true&charact... 阅读全文
posted @ 2015-10-22 17:17 Bodi 阅读(523) 评论(0) 推荐(0) 编辑
摘要: HQL查询:public Object query(String name){ Session s=null; try{ s=HibernateSessionFactory.getSession(); //String hql="from User where name=?"; //... 阅读全文
posted @ 2015-10-22 15:19 Bodi 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 所使用到的jar 包:1、创建实体类public class User { private Integer id; private String name; private String address; public Integer getId() { return id; } public v... 阅读全文
posted @ 2015-10-21 17:21 Bodi 阅读(186) 评论(0) 推荐(0) 编辑