Most of the programs we have seen so far are transient in the sense that they run for a short time and produce some output, but when they end, their data disappears. If you run the program again, it starts with a clean state.

Other programs are persistent: they run for a long time (or all the time); they keep at least some of their data in non-volatile storage (a hard drive, for example); and if they shut down and restart, they pick up where they left off.

Examples of persistent programs are operating systems, which run pretty much whenever a computer is on, and web servers, which run all the time, waiting for requests to come in on the network.

One of the simplest ways for programs to maintain their data is by reading and writing text files. We have already seen programs that read text files; in this chapter we will see programs that write them.

An alternative is to store the state of the program in a database. In this chapter I will present a simple database and a module, pickle, that makes it easy to store program data.

from Thinking in Python

Persistence的更多相关文章

  1. [EF2]Sneak Preview: Persistence Ignorance and POCO in Entity Framework 4.0

    http://blogs.msdn.com/b/adonet/archive/2009/05/11/sneak-preview-persistence-ignorance-and-poco-in-en ...

  2. persistence.xml文件的妙处

    在上家公司,经常要做的一个很麻烦的事就是写sql脚本, 修改了表结构,比如增加一个新字段的时候,都必须要写sql并放入指定目录中, 目的就是为了便于当我们把代码迁移到其他数据库中的时候,再来执行这些s ...

  3. Caused by: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode

    进行 spring mvc jpa整合时.Junit方法测试时. 异常: org.springframework.beans.factory.BeanCreationException: Error ...

  4. JPA persistence

    Play provides a set of very useful helpers to simplify the management of your JPA entities. Note tha ...

  5. [转]用jpa创建web项目,报错:No persistence units parsed from {classpath*:META-INF/persistence.xml}

    原文地址:http://blog.sina.com.cn/s/blog_6826662b01015opk.html 最近做一个web项目用到了Spring+JPA,由于没有正确配置persistenc ...

  6. hibernate之persistence错误

    错误码: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityM ...

  7. 使用javax.persistence注解配置PO对象

    JPA注解持久化类很方便,需要jar包:ejb3-persistence.jar下载 import java.io.Serializable; import javax.persistence.Col ...

  8. javax.persistence.PersistenceException: No Persistence provider for EntityManager named ...

    控制台下输出信息 原因:persistence.xml必须放在src下META-INF里面. 若误放在其他路径,就会迷路.

  9. JPA 不在 persistence.xml 文件中配置每个Entity实体类的2种解决办法

    在Spring 集成 Hibernate 的JPA方式中,需要在persistence配置文件中定义每一个实体类,这样非常地不方便,远哥目前找到了2种方法.   这2种方式都可以实现不用persist ...

  10. HoloLens开发手记 - Unity之Persistence 场景保持

    Persistence 场景保持是HoloLens全息体验的一个关键特性,当用户离开原场景中时,原场景中全息对象会保持在特定位置,当用户回到原场景时,能够准确还原原场景的全息内容.WorldAncho ...

随机推荐

  1. BCB使用线程删除目录中的图片

    BCB新建线程DeleteImgThread类.其会默认继承Thread类,然后在Execute函数中编写代码, void __fastcall DeleteImgThread::Execute() ...

  2. hdu 4521 小明系列问题——小明序列(线段树+DP或扩展成经典的LIS)

    小明系列问题--小明序列 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Tot ...

  3. hdoj 4548 美素数 【打表】

    另类打表:将从1到n的满足美素数条件的数目赋值给prime[n],这样最后仅仅须要用prime[L]减去prime[R-1]就可以: 美素数 Time Limit: 3000/1000 MS (Jav ...

  4. 公布自己的pods到CocoaPods trunk 及问题记录

    这两天准备把之前写的一些小玩意加入到pods库中去,參考了一些资料后进行操作,实际中也遇到了一些问题,记录下来.问题及解决方案在后面. 參考内容转载例如以下: 首先更新了用trunk之后,CocoaP ...

  5. 【LeetCode-面试算法经典-Java实现】【058-Length of Last Word (最后一个单词的长度)】

    [058-Length of Last Word (最后一个单词的长度)] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 原题 Given a string s consis ...

  6. [jzoj NOIP2018模拟10.29]

    OI生涯的最高分,来了纪中这么多天,在经历了这么多场“NOIP难度”的模拟赛之后,终于看到了真正的NOIP 今天考场上效率很高,很快码完了全部的题目,留下了足够的时间对拍和...发呆.不得不说看着电脑 ...

  7. 关于Tomcat的启动

    1.Tomcat分为安装版和解压版. 2.在Tomcat的解压版的bin路径下启动startup.bat的时候,如果没有启动成功,请检查是否设置了JAVA_HOME 3.建议不要在环境变量里面设置CA ...

  8. Linux基础01

    ** 一些老生常谈的问题 一提起Linux,行业内无人不知<鸟哥私房菜>,就是放在胸口可以防弹的那种书,虽说经典.全面,但对于初学者而言,确实过于厚重,而且容易学着后边忘了前边,毕竟实际操 ...

  9. AOP为Aspect Oriented Programming的缩写,意为:面向切面编程

    在软件业,AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是OOP的延续,是软件开发中的 ...

  10. <ItemTemp>里写判断语句

    <%@ Language="C#" %> <html> <head></head> <body> <%=DateT ...