11 2016 档案
摘要:在win7下安装了Python后,想安装python-MySQL,使用pip安装出现如下问题: >pip install MySQL-python _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
阅读全文
摘要:# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import re import os import urllib2 import urllib def download_img(urls,k): #urls = "http://tieba.baidu.com/p/4807867791" page = urllib2...
阅读全文
摘要:本文实例讲述了python实现从URL地址提取文件名的方法。分享给大家供大家参考。具体分析如下: 如:地址为 http://www.jb51.net/images/logo.gif 要想从该地址提取logo.gif,只需要一句代码就可以搞定 import osurl = 'http://www.jb
阅读全文
摘要:# -*- coding: utf-8 -*- import re import urllib import os.path def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getImg(html,p): reg = r'<img src="(htt...
阅读全文
摘要:#coding:utf8 import urllib2 __author__ = 'wang' class HtmlDownloader(object): def download(self, url): if url is None: return None response = urllib2.urlopen(url) ...
阅读全文
摘要:#coding:utf8 __author__ = 'wang' class HtmlOutputer(object): def __init__(self): self.datas = []; def collect_data(self, data): if data is None: return ...
阅读全文
摘要:#coding:utf8 import urlparse from bs4 import BeautifulSoup import re __author__ = 'wang' class HtmlParser(object): def parse(self, page_url, html_cont): if page_url is None or html_con...
阅读全文
摘要:#coding:utf8 class UrlManager(object): def __init__(self): self.new_urls = set() self.old_urls = set() def add_new_url(self, url): if url is None: return...
阅读全文
摘要:import re from bs4 import BeautifulSoup html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title"><b>The Dormouse'
阅读全文
摘要:python scripts下 pip install beautifulsoup4
阅读全文
摘要:# -*- coding: utf-8 -*- import cookielib import urllib2 url = "http://www.baidu.com" print "第一种方法" response1 = urllib2.urlopen(url) print response1.getcode() print len(response1.read()) print "第二种方...
阅读全文
摘要:sz /etc/sysconfig/network-scripts/ifcfg-eth1
阅读全文
摘要:ci重定向 对于/index.php/abc这种url,Apache和lighttpd会按"index.php?abc"来解释,而nginx会认为是请求名字是“index.php”的目录下的abc文件的内容。所以CI在nginx下不配置rewrite是无法运行的,而在Apache和lighttpd则
阅读全文
摘要:表 配置文件csft.conf php代码 ./indexer delta --rotate
阅读全文
摘要:配置文件 数据库数据 php代码 效果图片:
阅读全文
摘要:【转】sphinx服务器安装及配置详解 安装PHP sphinx扩展 【转】sphinx服务器安装及配置详解 安装PHP sphinx扩展 1、架构:ip192.168.0.200 redhat5.4(64位)2、安装 #cd /usr/local/src #yum -y install mysql
阅读全文
摘要:表现: /home/sphinx-1.1.0/sphinx.c: In function ‘php_sphinx_client_read_property’:/home/sphinx-1.1.0/sphinx.c:105:2: error: too few arguments to function
阅读全文
摘要:sphinx的配置文件是在配置的时候最容易出错的了: 我们先要明白几个概念: source:数据源,数据是从什么地方来的。 index:索引,当有数据源之后,从数据源处构建索引。索引实际上就是相当于一个字典检索。有了整本字典内容以后,才会有字典检索。 searchd:提供搜索查询服务。它一般是以de
阅读全文
摘要:sphinx :undefined reference to `libiconv' 报错解决办法 2013-11-30 21:45:39 安装sphinx时不停报错。。。郁闷在make时报错,错误内容:r local src sphinx sphinx-0 9 8-rc2 src tokenizer
阅读全文
摘要:一、关于/etc/init.d 如果你使用过Linux系统,那么你一定听说过init.d目录。这个目录到底是干嘛的呢?它归根结底只做了一件事情,但这件事情非同小可,是为整个系统做的,因此它非常重要。init.d目录包含许多系统各种服务的启动和停止脚本。它控制着所有从acpid到x11-common的
阅读全文
摘要:进入C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp。鼠标右键选中粘贴,将软件快捷方式粘贴到启动目录 进入文件夹时路径可能是C:\ProgramData\Microsoft\Windows\开始菜单\程序\启动
阅读全文
摘要:centos'的yum安装php的memcache扩展 博客分类: linux centos'的yum安装php的memcache扩展 linux 让php能使用memcached服务的扩展有两种:memcache 和 memcached 1. 先安装libmemcached扩展 yum -y in
阅读全文
摘要:百度了半天找到别人的解决办法 记录下 摘要: file not found. nginx php 这个问题是你配置文件的问题: 查看就是了不要管 nginx 如何开启解析 PHP 的功能? # 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the P
阅读全文
摘要:1:查看环境: 1 2 [root@10-4-14-168 html]# cat /etc/redhat-release CentOS release 6.5 (Final) 2:关掉防火墙 1 [root@10-4-14-168 html]# chkconfig iptables off 3:配置
阅读全文
摘要:# locale -a # source /etc/sysconfig/i18n
阅读全文
摘要:锁是计算机协调多个进程或线程并发访问某一资源的机制。在数据库中,除传统的计算资源(如CPU、RAM、I/O等)的争用以外,数据也是一种供许多用户共享的资源。如何保证数据并发访问的一致性、有效性是所有数据库必须解决的一个问题,锁冲突也是影响数据库并发访问性能的一个重要因素。从这个角度来说,锁对数据库而
阅读全文
摘要:1.锁 为什么需要锁?因为数据库要解决并发控制问题。在同一时刻,可能会有多个客户端对表中同一行记录进行操作,比如有的在读取该行数据,其他的尝试去删除它。为了保证数据的一致性,数据库就要对这种并发操作进行控制,因此就有了锁的概念。 1.1锁的分类 从对数据操作的类型(读\写)分 读锁(共享锁):针对同
阅读全文
摘要:mysql服务器的主从配置,这样可以实现读写分离,也可以在主库挂掉后从备用库中恢复。需要两台机器,安装mysql,两台机器要在相通的局域网内,可以分布在不同的服务器上,也可以在一台服务器上启动多个服务。 主机A: 192.168.1.100从机B:192.168.1.101可以有多台从机1、先登录主
阅读全文
摘要:MyISAM 和InnoDB 讲解 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定。基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持。MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,但是不
阅读全文
摘要:#coding=utf8 import bs4 import re from bs4 import BeautifulSoup html_doc = """ The Dormouse's story The Dormouse's story Once upon a time there were three little sisters; and their names were Els...
阅读全文
摘要:#coding:utf8 __author__ = 'wang' import urllib2 import cookielib url = "http://www.baidu.com"; response = urllib2.urlopen(url) print(len(response.read())); request = urllib2.Request(url) request....
阅读全文
摘要:一,安装mysql 如果是windows 用户,mysql 的安装非常简单,直接下载安装文件,双击安装文件一步一步进行操作即可。 Linux 下的安装可能会更加简单,除了下载安装包进行安装外,一般的linux 仓库中都会有mysql ,我们只需要通过一个命令就可以下载安装: Ubuntu\deepi
阅读全文
摘要:import reimport urllib def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getImg(html): reg = r'height="\d{3,}" src="(.+?
阅读全文
摘要:原创文章,转载请注明出处:http://www.cnblogs.com/hongfei/archive/2012/07/07/2580776.html 简单工厂模式:①抽象基类:类中定义抽象一些方法,用以在子类中实现②继承自抽象基类的子类:实现基类中的抽象方法③工厂类:用以实例化对象 看完文章再回头
阅读全文
摘要:策略模式(Strategy Pattern) 策略模式是对象的行为模式,用意是对一组算法的封装。动态的选择需要的算法并使用。 策略模式指的是程序中涉及决策控制的一种模式。策略模式功能非常强大,因为这个设计模式本身的核心思想就是面向对象编程的多形性思想。 策略模式的三个角色: 1.抽象策略角色 2.具
阅读全文
摘要:ubuntu server设置时区和更新时间 ubuntu server设置时区和更新时间 今天测试时,发现时间不对,查了一下时区: data -R 结果时区是:+0000 我需要的是东八区,这儿显示不是,所以需要设置一个时区 一、运行tzselect sudo tzselect 在这里我们选择亚洲
阅读全文
摘要:ubuntu 重启 nginx 失败,* Restarting nginx nginx ...fail! ubuntu 重启 nginx 失败,* Restarting nginx nginx ...fail! 执行 nginx 重启服务时,提示失败如下: $ sudo service nginx
阅读全文