本文均来自PythonCookbook,本博文励志将Cookbook中的string部位,文件,面向对象编程部分完成,本系列博文陆续还会介绍flask框架,每篇博文都以一个个小例子展示。#-*-coding:utf-8-*-
‘‘‘
文件相关的操作:
read()
open()
两个参数:
第一个:文件路径
第二个:打开文件的模式
常..
分类:
编程语言 时间:
2014-05-03 02:00:18
阅读次数:
417
BufferGo标准库Buffer是一个可变大小的字节缓冲区,可以用Wirte和Read方法操作它,在Go标准库中,定义了如下关于Buffer的数据结构。typeBufferstruct{
buf[]byte//contentsarethebytesbuf[off:len(buf)]
offint//readat&buf[off],writeat&buf[len(buf)]
runeBytes[utf8...
分类:
其他好文 时间:
2014-05-03 01:30:02
阅读次数:
539
64位系统中,安装freetype时,出现这个问题。后来发现,此问题进出现在64位系统中。
修复方法:
cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure //使用64位元的方法进行编译
make
make install
然后,进入freetyp...
分类:
其他好文 时间:
2014-05-02 23:50:23
阅读次数:
397
Artificial Intelligence?
Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and underst...
分类:
其他好文 时间:
2014-05-02 23:39:35
阅读次数:
485
Lease 的机制:hdfs支持write-once-read-many,也就是说不支持并行写,那么对读写的互斥同步就是靠Lease实现的。Lease说白了就是一个有时间约束的锁。客户端写文件时需要先申请一个Lease,对应到namenode中的LeaseManager,客户端的client name就作为一个lease的holder,即租约持有者。LeaseManager起什么作用呢?
读写过程的容错是怎么做的?数据块是如何复制的?数据块的恢复机制?本文都有涉及。...
分类:
其他好文 时间:
2014-05-02 23:22:14
阅读次数:
450
安装libpng,出现“configure: error: ZLib not
installed”。
解决方法:
1. 进入ZLib的安装包,不必加--prefix参数命令:
./configure
make && make install
2. 进入libpng解压缩包中,输入:
./configure --prefix=/...
分类:
其他好文 时间:
2014-05-02 22:38:51
阅读次数:
289
1. 自定义验证--成功提示
1) 添加选项
errorClass: "unchecked",
validClass: "checked",
errorElement: "span",
errorPlacement: function (error, element) {
if (element.parent().find("span[for=""" + element.attr("id...
分类:
Web程序 时间:
2014-05-02 18:38:21
阅读次数:
467
今天,所谓的劳动节,其实只是给予大部分行业的人,但是对于技术类或者是服务行业,都是没有所谓的休息假期。因为每次放假,反而是一个商机。
早上,刚整理完店面摆设,没多久就来了一位客户需要重装电脑。说电脑中毒,一开机检测, disk error, 问是否需要保存资料,得到的是“...
分类:
其他好文 时间:
2014-05-02 12:47:30
阅读次数:
354
编译Lua时,出现这样的错误:
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o lua.o lua.clua.c:67:31: error:
查阅了一下,centOS上需要安装readline-devel ncurses-devel
yum install readline-devel ncurses-devel
...
分类:
系统相关 时间:
2014-05-02 07:03:00
阅读次数:
455
usingSystem;
usingSystem.Collections.Generic;
usingSystem.IO;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespace读文件案例
{
classProgram
{
staticvoidMain(string[]args)
{
Console.WriteLine("请输入文件名");
stringfileName=Console.Read..
分类:
其他好文 时间:
2014-05-02 04:00:58
阅读次数:
289