01 2014 档案
摘要:Flask-LoginFlask-Login provides user session management for Flask. It handles the common tasks of logging in, logging out, and remembering your users’ sessions over extended periods of time.It will:Store the active user’s ID in the session, and let you log them in and out easily.Let you restrict vie
阅读全文
摘要:一、cookie机制和session机制的区别具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案。同时我们也看到,由于才服务器端保持状态的方案在客户端也需要保存一个标识,所以session机制可能需要借助于cookie机制来达到保存标识的目的,但实际上还有其他选择二、会话cookie和持久cookie的区别如果不设置过期时间,则表示这个cookie生命周期为浏览器会话期间,只要关闭浏览器窗口,cookie就消失了。这种生命期为浏览会话期的cookie被称为会话cookie。会话cookie一般不保存在硬盘上而是保存在内存里。如果设置了过
阅读全文
摘要:http://www.cnblogs.com/xd502djj/archive/2010/08/08/1795263.html随着时间的飞逝,随着岁月的流失。从世界上第一台计算机ENIAC诞生至今,已经有将近半个世纪了。经过这半个世纪的语言发展,我们所接触的语言基本上都是高级语言了。这篇文章主要对现在比较主流的WEB开发语言,做一个简单的对比。JAVA简介: Java是由Sun Microsystems公司于1995年5月推出的Java程序设计语言(以下简称Java语言)和Java平台的总称。用Java实现的HotJava浏览器(支持Java applet)显示了Java的魅力:跨平台、动态的
阅读全文
摘要:API¶This part of the documentation covers all the interfaces of Flask. For parts where Flask depends on external libraries, we document the most important right here and provide links to the canonical documentation.Application Object¶class flask.Flask(import_name, static_path=None, static_
阅读全文
摘要:http://blog.csdn.net/yanxiaoqing/article/details/7029451sqlite3 新建数据库 django创建项目后需要修改配置文件 修改数据库配置 使用sqlite3 数据库是最简单的了 其他数据库还要安装驱动什么的 本着快速体验到django的原创 先用sqlite3作为数据库 其实django支持许多数据库 可以无缝切换 到时候修改一下数据库配置就好了 不需要在开始的时候就在这个上面浪费很多时间 博主就是 使用sqlite3做数据库 对应的配置是这样的 settings.py DATABASES = { 'default':
阅读全文
摘要:http://www.tutorialspoint.com/sqlite/sqlite_installation.htmThe SQLite is famous for its great feature zero-configuration, which means no complex setup or administration is needed. This chapter will take you through the process of setting up SQLite on Windows, Linux and Mac OS X.Install SQLite On Wi
阅读全文
摘要:Python第三方模块中一般会自带setup.py文件,在Windows环境下,我们只需要使用命令cd c:\Temp\foopython setup.py install两个命令就可以完成第三方模块的安装了。第一个cd命令将当前目前切换到待安装的第三方模块的目录下(这里假设第三方模块解压后的目录为c:\Temp\foo),第二个命令就执行安装了。安装的过程中可能会出现“ImportError: No module named setuptools”的错误提示,这是新手很常遇见的错误提示。不用担心,这是因为Windows环境下Python默认是没有安装setuptools这个模块的,这也是一个
阅读全文
摘要:Deterministic Finite AutomataA Deterministic Finite Automaton is used to perform lexical analysis for the parser.As the name implies, deterministic finite automata are deterministic. This means that from any given state there is only one path for any given input. In other words, there is no ambiguit
阅读全文
摘要:http://blog.csdn.net/money_bear/article/details/11730729在stackoverflow上面看到一个关于Python中装饰器问题的回复,瞬间觉得作者简直是神人啊。原文地址:http://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python这么好的一段东西,实在是忍不住拿过来翻译一下,有删改:Python's functions are objects函数是一个对象To understand decorator
阅读全文
摘要:Python标准库13 循环器 (itertools)作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!在循环对象和函数对象中,我们了解了循环器(iterator)的功能。循环器是对象的容器,包含有多个对象。通过调用循环器的next()方法 (__next__()方法,在Python 3.x中),循环器将依次返回一个对象。直到所有的对象遍历穷尽,循环器将举出StopIteration错误。在for i in iterator结构中,循环器每次返回的对象将赋予给i,直到循环结束。使用iter()内置函数,我们可以将诸如表、字典等容
阅读全文
摘要:Python深入06 Python的内存管理作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!语言的内存管理是语言设计的一个重要方面。它是决定语言性能的重要因素。无论是C语言的手工管理,还是Java的垃圾回收,都成为语言最重要的特征。这里以Python语言为例子,说明一门动态类型的、面向对象的语言的内存管理方式。对象的内存使用赋值语句是语言最常见的功能了。但即使是最简单的赋值语句,也可以很有内涵。Python的赋值语句就很值得研究。a = 1整数1为一个对象。而a是一个引用。利用赋值语句,引用a指向对象1。Python是动态类型
阅读全文
摘要:Linux文本流作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!文件用于数据的存储,相当于一个个存储数据的房子。我们之前说,所谓的数据是0或者1的序列,但严格来说,Linux以字节(byte)来作为数据的单位,也就是说这个序列每八位(bit)为一个单位(八位二进制对应的十进制范围为0到255)。使用ASCII编码,可以将这样一个字节转换成为字符。所以,在Linux中,我们所说的数据,完全可以用字符表达出来,也就是说文本(text)的形式。实际上,如果以bit为单位处理字符的话,机器会更容易读懂和传输,效率会更高。但为什么Lin
阅读全文
摘要:Skew heapFrom Wikipedia, the free encyclopediaAskew heap(orself-adjusting heap) is aheapdata structureimplemented as abinary tree. Skew heaps are advantageous because of their ability to merge more quickly than binary heaps. In contrast withbinary heaps, there are no structural constraints, so there
阅读全文
摘要:Python标准库04 文件管理 (部分os包,shutil包)作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!我们可以通过操作系统的命令来管理文件,如同我们在linux文件管理相关命令中看到的那样。另一方面,python标准库则允许我们在python内部管理文件。相同的目的,我们就有了两条不同的途径实现。在python内部实现的优势在于你可以同时利用python语言,并配合其他python工具,比如正则表达式工具。但操作系统同样可以通过shell编程,来整合linux文件管理命令,shell也拥有自己的正则表达式工具。pyt
阅读全文
摘要:Python标准库05 存储对象 (pickle包,cPickle包)作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!谢谢reverland纠错在之前对Python对象的介绍中 (面向对象的基本概念,面向对象的进一步拓展),我提到过Python“一切皆对象”的哲学,在Python中,无论是变量还是函数,都是一个对象。当Python运行时,对象存储在内存中,随时等待系统的调用。然而,内存里的数据会随着计算机关机和消失,如何将对象保存到文件,并储存在硬盘上呢?计算机的内存中存储的是二进制的序列 (当然,在Linux眼中,是文本流)
阅读全文
摘要:http://en.wikipedia.org/wiki/Leftist_treeLeftist treeFrom Wikipedia, the free encyclopediaIncomputer science, aleftist treeorleftist heapis apriority queueimplemented with a variant of abinary heap. Every node has ans-valuewhich is the distance to the nearestleaf. In contrast to abinary heap, a left
阅读全文
摘要:Advanced Bash-Scripting Guide:PrevNextChapter 2. Starting Off With a Sha-BangShell programming is a 1950s juke box . . .--Larry WallTable of Contents2.1.Invoking the script2.2.Preliminary ExercisesIn the simplest case, a script is nothing more than a list of system commands stored in a file. At the
阅读全文
摘要:A working knowledge of shell scripting is essential to anyone wishing to become reasonably proficient at system administration, even if they do not anticipate ever having to actually write a script. Consider that as a Linux machine boots up, it executes the shell scripts in/etc/rc.dto restore the sy
阅读全文
摘要:The shell is a command interpreter. More than just the insulating layer between the operating system kernel and the user, it's also a fairly powerful programming language. A shell program, called ascript, is an easy-to-use tool for building applications by"gluing together"system calls,
阅读全文

浙公网安备 33010602011771号